feat(token): add governance token and mintable test token
This commit is contained in:
1 parent
e04164cd24
commit
86d4536629
2 files changed
+51
No files matched your search
@@ -0,0 +1,34 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
pragma solidity 0.8.36;
|
||||||
|
|
||||||
|
import {Erc20} from "./Erc20.sol";
|
||||||
|
|
||||||
|
/// @title Governance and staking reward token, minted by the active gauge.
|
||||||
|
contract FluxToken is Erc20 {
|
||||||
|
address public minter;
|
||||||
|
|
||||||
|
event MinterChanged(address indexed oldMinter, address indexed newMinter);
|
||||||
|
|
||||||
|
constructor(address minterAddress) Erc20("Flux", "FLUX") {
|
||||||
|
minter = minterAddress;
|
||||||
|
emit MinterChanged(address(0), minterAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyMinter() {
|
||||||
|
require(msg.sender == minter, "FluxToken: FORBIDDEN");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMinter(address newMinter) external onlyMinter {
|
||||||
|
emit MinterChanged(minter, newMinter);
|
||||||
|
minter = newMinter;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mint(address to, uint256 value) external onlyMinter {
|
||||||
|
_mint(to, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function burn(uint256 value) external {
|
||||||
|
_burn(msg.sender, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
pragma solidity 0.8.36;
|
||||||
|
|
||||||
|
import {Erc20} from "./Erc20.sol";
|
||||||
|
|
||||||
|
/// @title Freely mintable ERC20 for tests and liquidity bootstrapping.
|
||||||
|
contract TestErc20 is Erc20 {
|
||||||
|
constructor(string memory tokenName, string memory tokenSymbol, uint256 initialSupply)
|
||||||
|
Erc20(tokenName, tokenSymbol)
|
||||||
|
{
|
||||||
|
_mint(msg.sender, initialSupply);
|
||||||
|
}
|
||||||
|
|
||||||
|
function mint(address to, uint256 value) external {
|
||||||
|
_mint(to, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user