Update mint and initial supply

This commit is contained in:
Mubaris NK 2021-03-27 23:43:20 +05:30
parent 04ec109c71
commit f3585454fe
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561
3 changed files with 9 additions and 5 deletions

View File

@ -28,11 +28,14 @@ contract TokenDelegate is TokenDelegateStorageV1, TokenEvents {
* @param mintingAllowedAfter_ Timestamp of the next allowed minting
* @param transferPaused_ Flag to make the token non-transferable
*/
function initialize(address account, uint mintingAllowedAfter_, bool transferPaused_) public {
function initialize(address account, uint initialSupply_, uint mintingAllowedAfter_, bool transferPaused_) public {
require(mintingAllowedAfter == 0, "Token::initialize: can only initialize once");
require(totalSupply == 0, "Token::initialize: can only initialize once");
require(mintingAllowedAfter_ >= block.timestamp, "Token::constructor: minting can only begin after deployment");
require(account != address(0), "Token::initialize: invalid address");
require(initialSupply_ > 0, "Token::initialize: invalid initial supply");
totalSupply = initialSupply_;
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
@ -198,8 +201,7 @@ contract TokenDelegate is TokenDelegateStorageV1, TokenEvents {
* @param dst The address of the destination account
* @param rawAmount The number of tokens to be minted
*/
function mint(address dst, uint rawAmount) external {
require(msg.sender == minter, "Tkn::mint: only the minter can mint");
function mint(address dst, uint rawAmount) external isMaster {
require(block.timestamp >= mintingAllowedAfter, "Uni::mint: minting not allowed yet");
require(dst != address(0), "Tkn::mint: cannot transfer to the zero address");

View File

@ -7,6 +7,7 @@ contract TokenDelegator is TokenDelegatorStorage, TokenEvents {
constructor(
address account,
address implementation_,
uint initialSupply_,
uint mintingAllowedAfter_,
uint changeImplementationAfter_,
bool transferPaused_
@ -14,8 +15,9 @@ contract TokenDelegator is TokenDelegatorStorage, TokenEvents {
delegateTo(
implementation_,
abi.encodeWithSignature(
"initialize(address,uint256,bool)",
"initialize(address,uint256,uint256,bool)",
account,
initialSupply_,
mintingAllowedAfter_,
transferPaused_
)

View File

@ -54,7 +54,7 @@ contract TokenDelegatorStorage {
string public symbol = "<TKN>"; // TODO - Replace it
/// @notice Total number of tokens in circulation
uint public totalSupply = 10000000e18; // TODO - Replace it
uint public totalSupply;
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;