PinkyNFT / pinky-contracs

Smart contracts related to v1 Pinky release
0 stars 0 forks source link

1. total mint amount is upgradable. @PinkyToken #2

Closed zk1tty closed 9 months ago

zk1tty commented 9 months ago
toufique-imam commented 9 months ago

I didn't understand the purpose of it.

zk1tty commented 9 months ago

This is business requirement. We cannot determine the total amount to issue. So the owner have to be able to update later on.

toufique-imam commented 9 months ago

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

toufique-imam commented 9 months ago

If you have any example or illustration please provide

toufique-imam commented 9 months ago

@zkitty-norika check the new contract. there is two different role now. AIRDROPPER_ROLE and MINTER_ROLE (who can mint token)

zk1tty commented 9 months ago

@toufique-imam Request to update.

  1. add SUPPLY_CAP as constant valuable.
    • 1.1 add SUPPLY_CAP to constructor argument.
    • 1.2 add 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.
  2. change the _transfer() to _mint() of airDropSingle and airDropBulk function.
    • We will mint the token each time a user claims.
    • Please declare the AirDrop Event.
    • 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.
  3. add setter function of AIRDROP_CAP.
  4. 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;
    }
    }
toufique-imam commented 9 months ago

check the new contracts @zkitty-norika

zk1tty commented 9 months ago

@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.

toufique-imam commented 9 months ago
  1. Aren't these already added? Check imint function. Supply_cap = max supply
toufique-imam commented 9 months ago

check new contracts @zkitty-norika

zk1tty commented 9 months ago

@toufique-imam

https://github.com/PinkyNFT/pinky-contracs/blob/27baa106f4c97ca271982486f386d48fe206e0e2/contracts/PinkyToken.sol#L47-L49

    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);
    }
zk1tty commented 9 months ago

To declare the unit obviously, I'd suggest to update _amount to _amount_in_wei clearly.

toufique-imam commented 9 months ago

@zkitty-norika check the new contract please

zk1tty commented 9 months ago

LGTM