Skip to content

Commit

Permalink
feat: add oYFI minter operator
Browse files Browse the repository at this point in the history
  • Loading branch information
pandadefi committed Feb 12, 2023
1 parent 9f0ec1f commit 02b5239
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion contracts/OYfi.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 02b5239

Please sign in to comment.