diff --git a/contracts/OYfi.sol b/contracts/OYfi.sol index 8893c34..12c3b12 100644 --- a/contracts/OYfi.sol +++ b/contracts/OYfi.sol @@ -5,9 +5,18 @@ import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract OYfi is ERC20, Ownable { + mapping(address => bool) public minters; + event MinterUpdated(address minter, bool allowed); + constructor() ERC20("OYFI", "OYFI") {} - function mint(address _to, uint256 _amount) external onlyOwner { + function setMinter(address _minter, bool _allowed) external onlyOwner { + minters[_minter] = _allowed; + emit MinterUpdated(_minter, _allowed); + } + + function mint(address _to, uint256 _amount) external { + assert(minters[msg.sender]); _mint(_to, _amount); } diff --git a/tests/conftest.py b/tests/conftest.py index bcf3a1d..dceadbd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -41,8 +41,10 @@ def reward_pool(ve_yfi_and_reward_pool): @pytest.fixture(scope="session") -def o_yfi(accounts, project): - yield project.OYfi.deploy(sender=accounts[0]) +def o_yfi(gov, project): + o_yfi = project.OYfi.deploy(sender=gov) + o_yfi.setMinter(gov, True, sender=gov) + yield o_yfi @pytest.fixture(scope="session")