-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
84 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,11 @@ pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
/** | ||
* @title DMCX token contract | ||
* @author [email protected] | ||
* @notice Basically a standard ERC20Burnable contract, add a few modifications to allow certain addresses to mint tokens | ||
*/ | ||
contract DMC is ERC20Burnable, Ownable { | ||
mapping (address => bool) allow_minter; | ||
|
||
|
@@ -12,6 +17,12 @@ contract DMC is ERC20Burnable, Ownable { | |
_; | ||
} | ||
|
||
/** | ||
* @dev Constructor that gives contract itself and init addresses all of tokens | ||
* @param _totalSupply Total supply of DMCX tokens, have been minted to contract itself | ||
* @param initAddress Addresses which will be minted tokens | ||
* @param initAmount The number of tokens to be minted to each address | ||
*/ | ||
constructor(uint256 _totalSupply, address[] memory initAddress, uint[] memory initAmount) ERC20("Datamall Coin", "DMCX") Ownable(msg.sender) { | ||
uint256 totalInited = 0; | ||
for (uint i = 0; i < initAddress.length; i++) { | ||
|
@@ -21,18 +32,33 @@ contract DMC is ERC20Burnable, Ownable { | |
_mint(address(this), _totalSupply - totalInited); | ||
} | ||
|
||
/** | ||
* @dev Only owner can enable addresses to "mint" tokens, usually it will be the exchange contract | ||
* @param addresses The array of addresses to be enabled as minter | ||
*/ | ||
|
||
function enableMinter(address[] calldata addresses) public onlyOwner { | ||
for (uint i = 0; i < addresses.length; i++) { | ||
allow_minter[addresses[i]] = true; | ||
} | ||
} | ||
|
||
/** | ||
* @dev Only owner can disable addresses to "mint" tokens, it may happened when the old exchange contract is replaced by a new one | ||
* @param addresses The array of addresses to be disabled as minter | ||
*/ | ||
function disableMinter(address[] calldata addresses) public onlyOwner { | ||
for (uint i = 0; i < addresses.length; i++) { | ||
allow_minter[addresses[i]] = false; | ||
} | ||
} | ||
|
||
/** | ||
* @dev It called "mint", but actually it's just transfer tokens from contract itself to the "to" address | ||
* @dev It ensures that no more token is actually minted than the total supply | ||
* @param to mint to address | ||
* @param amount mint amount | ||
*/ | ||
function mint(address to, uint256 amount) public onlyMinter { | ||
this.transfer(to, amount); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,16 @@ pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
/** | ||
* @title DMCX token contract | ||
* @author [email protected] | ||
* @notice Basically a standard ERC20Burnable contract, add a few modifications to allow certain addresses to mint tokens | ||
*/ | ||
|
||
contract GWT is ERC20, Ownable { | ||
mapping (address => bool) allow_minter; | ||
|
||
// GWT token has no supply limit, it represents the total storage space in network | ||
constructor(address[] memory initAddress, uint[] memory initAmount) ERC20("Gb storage per Week Token", "GWT") Ownable(msg.sender) { | ||
for (uint i = 0; i < initAddress.length; i++) { | ||
_mint(initAddress[i], initAmount[i]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,12 @@ pragma solidity ^0.8.0; | |
|
||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
/** | ||
* @title LuckyMint contract for DMCs | ||
* @author [email protected] | ||
* @notice this is a luckymint contract for DMCs, called by our bitcoin inscription backend server | ||
*/ | ||
|
||
contract LuckyMint is Ownable { | ||
mapping(bytes32 => uint) lucky_mint; | ||
address public dataAdmin; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.