Closed zk1tty closed 9 months ago
I didn't understand the purpose of it.
This is business requirement. We cannot determine the total amount to issue. So the owner have to be able to update later on.
Will the token be minted to user address Or transfer like now? if the answer is later, when will the token be minted into owner/Acl account
If you have any example or illustration please provide
@zkitty-norika check the new contract. there is two different role now. AIRDROPPER_ROLE and MINTER_ROLE (who can mint token)
@toufique-imam Request to update.
setSupplyCap()
setter function with onlyOwner ACL.
Please declare the value with the number above decimal point in unit Ether.
e.g. Input value is just 1000000000
in Ether, in case of supply is 1000000000 * 10 ** 18
._transfer()
to _mint()
of airDropSingle and airDropBulk function.
AIRDROP_CAP
.add a requirement to check new totalSupply won't exceed SUPPLY_CAP to all functions; airDropSingle, airDropBulk, and mint function. ---–––––––––– Let me share the sample ERC 20 contract of LooksRare.
contract LooksRareToken is ERC20, Ownable, ILooksRareToken {
uint256 private immutable _SUPPLY_CAP;
/**
* @notice Constructor
* @param _premintReceiver address that receives the premint
* @param _premintAmount amount to premint
* @param _cap supply cap (to prevent abusive mint)
*/
constructor(
address _premintReceiver,
uint256 _premintAmount,
uint256 _cap
) ERC20("LooksRare Token", "LOOKS") {
require(_cap > _premintAmount, "LOOKS: Premint amount is greater than cap");
// Transfer the sum of the premint to address
_mint(_premintReceiver, _premintAmount);
_SUPPLY_CAP = _cap;
}
/**
* @notice Mint LOOKS tokens
* @param account address to receive tokens
* @param amount amount to mint
* @return status true if mint is successful, false if not
*/
function mint(address account, uint256 amount) external override onlyOwner returns (bool status) {
if (totalSupply() + amount <= _SUPPLY_CAP) {
_mint(account, amount);
return true;
}
return false;
}
/**
* @notice View supply cap
*/
function SUPPLY_CAP() external view override returns (uint256) {
return _SUPPLY_CAP;
}
}
check the new contracts @zkitty-norika
@toufique-imam Please take a look carefully of the previous directions. no.2 - no.4 is same with the previous comment. Once you finish it, please check the box of sentence. If you don't understand, please let me know.
[x] 1. Please declare Supply in Ether, not in Wei.
AS-is:
uint256 public MAX_SUPPLY;
To-be:
uint256 public MAX_SUPPLY_IN_ETH; //argument of constructor
uint256 public MAX_SUPPLY = MAX_SUPPLY_IN_ETH * (10 ** 18);
[x] 2. Please declare the AirDrop_Cap constant value in Ether unit. add a requirement to check if the claimed amount is less than AIRDROP_CAP constant value at airDrop functions. https://github.com/PinkyNFT/pinky-contracs/blob/1fe1f7c5c951b89c216129027c3b6a90f62e86fc/contracts/PinkyToken.sol#L16-L22
[x] 3. add setter function of AIRDROP_CAP
.
[x] 4. add a requirement to check new totalSupply won't exceed SUPPLY_CAP to all functions; airDropSingle, airDropBulk, and mint function.
check new contracts @zkitty-norika
@toufique-imam
function mint(address _to, uint256 _amount) external onlyRole(MINTER_ROLE) {
//ADD REQUIRE:
require(totalSupply() + _amount <= MAX_SUPPLY_IN_WEI, "Max supply reached");
_mint(_to, _amount);
}
To declare the unit obviously, I'd suggest to update _amount
to _amount_in_wei
clearly.
function airDropSingle(address _to, uint256 _amount_in_wei){}
function airDropBulk(address[] _to, uint256[] _amount_in_wei){}
function imint(address _to, uint256 _amount_in_wei){}
function mint(address _to, uint256 _amount_in_wei) {}
@zkitty-norika check the new contract please
LGTM
Ether
). CreatesetTotalSuppyInEther()
setter function with onlyOwner ACL. setTotalSuppyInEther can change1000000000
(unit in Ether) of the actual number (1000000000 * 10 ** 18, unit is Wei).https://github.com/PinkyNFT/pinky-contracs/blob/796920a42c20d71522fa73af7f00d68abd65926a/contracts/PinkyToken.sol#L10