Skip to content

Commit

Permalink
Update dmc token contract
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiushi committed May 6, 2024
1 parent 7070d04 commit d4b557e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions contracts/dmc2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@ import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract DMC2 is ERC20Burnable, Ownable {
uint256 unReleaseSupply;
mapping (address => bool) allow_minter;

modifier onlyMinter() {
require(allow_minter[msg.sender], "mint not allowed");
_;
}

constructor(uint256 _unReleaseSupply, address[] memory initAddress, uint[] memory initAmount) ERC20("Datamall Chain Token", "DMC") Ownable(msg.sender) {

uint256 _totalSupply = _unReleaseSupply;
constructor(uint256 _totalSupply, address[] memory initAddress, uint[] memory initAmount) ERC20("Datamall Chain Token", "DMC") Ownable(msg.sender) {
uint256 totalInited = 0;
for (uint i = 0; i < initAddress.length; i++) {
_mint(initAddress[i], initAmount[i]);
_totalSupply -= initAmount[i];
totalInited += initAmount[i];
}

unReleaseSupply = _totalSupply;
_mint(address(this), _totalSupply - totalInited);
}

function enableMinter(address[] calldata addresses) public onlyOwner {
Expand All @@ -37,8 +34,6 @@ contract DMC2 is ERC20Burnable, Ownable {
}

function mint(address to, uint256 amount) public onlyMinter {
require(unReleaseSupply >= amount, "max supply exceeded");
_mint(to, amount);
unReleaseSupply -= amount;
this.transfer(to, amount);
}
}

0 comments on commit d4b557e

Please sign in to comment.