OpenZeppelin / openzeppelin-contracts-upgradeable

Upgradeable variant of OpenZeppelin Contracts, meant for use in upgradeable contracts.
https://openzeppelin.com/contracts
MIT License
1k stars 436 forks source link

interface IERC20Mintable and IERC20Burnable is needed #169

Closed guotie closed 2 years ago

guotie commented 2 years ago

🧐 Motivation

I think interface IERC20Mintable and IERC20Burnable is needed.

📝 Details

for example, if I inherit the ERC20PresetMinterPauserUpgradeable as following:

contract MyToken is
    Initializable,
    UUPSUpgradeable,
    ERC20PresetMinterPauserUpgradeable,
    OwnableUpgradeable {
}

If I want call the MyToken method mint, then I need define an interface like this:

interface IMyToken {
    function mint(address to, uint256 amount) external;
}

contract MyToken is
    Initializable,
    UUPSUpgradeable,
    ERC20PresetMinterPauserUpgradeable,
    IMyToken,
    OwnableUpgradeable {
}

then, compile error:

Derived contract must override function "mint". Two or more base classes define function with same name and parameter types.
guotie commented 2 years ago

solidity version is ^0.8.0

frangio commented 2 years ago

If I want call the MyToken method mint, then I need define an interface like this:

You don't need to define an interface. You can just use MyToken.

If you need further assistance post on the OpenZeppelin Forum.