Address Contract Verified
Address
0x15Dac05C93e1c5F31a29547340997BA9f6ec4F87
Balance
0 ETH
Nonce
1
Code Size
6190 bytes
Creator
0xDb951423...559C at tx 0x9bfe3491...1cc662
Indexed Transactions
0
Contract Bytecode
6190 bytes
0x608060405234801561001057600080fd5b50600436106101a35760003560e01c806364ef6dd4116100ee578063a457c2d711610097578063cb626ae211610071578063cb626ae214610375578063dd62ed3e1461037d578063f851a440146103c3578063fca3b5aa146103e357600080fd5b8063a457c2d71461033c578063a9059cbb1461034f578063c3b03fa81461036257600080fd5b80637ecc2b56116100c85780637ecc2b561461032457806395d89b411461032c578063a228bced1461033457600080fd5b806364ef6dd4146102b9578063704b6c02146102d957806370a08231146102ee57600080fd5b8063277dbafb11610150578063395093511161012a578063395093511461028057806340c10f191461029357806342966c68146102a657600080fd5b8063277dbafb146102605780632c4e722e14610268578063313ce5671461027157600080fd5b80631814a5b1116101815780631814a5b11461022e57806318160ddd1461024557806323b872dd1461024d57600080fd5b806306fdde03146101a857806307546172146101c6578063095ea7b31461020b575b600080fd5b6101b06103f6565b6040516101bd919061152a565b60405180910390f35b6005546101e69073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101bd565b61021e6102193660046115ba565b610488565b60405190151581526020016101bd565b61023760085481565b6040519081526020016101bd565b600254610237565b61021e61025b3660046115e4565b6104a2565b6102376104c6565b61023760095481565b604051601281526020016101bd565b61021e61028e3660046115ba565b61050e565b61021e6102a13660046115ba565b61055a565b61021e6102b4366004611620565b6106ef565b6007546102c690600f0b81565b604051600f9190910b81526020016101bd565b6102ec6102e7366004611639565b610703565b005b6102376102fc366004611639565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6102376107e4565b6101b06107f3565b610237610802565b61021e61034a3660046115ba565b610831565b61021e61035d3660046115ba565b6108e8565b61023761037036600461165b565b6108f6565b6102ec610b41565b61023761038b36600461167d565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6006546101e69073ffffffffffffffffffffffffffffffffffffffff1681565b6102ec6103f1366004611639565b610bac565b606060038054610405906116b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610431906116b0565b801561047e5780601f106104535761010080835404028352916020019161047e565b820191906000526020600020905b81548152906001019060200180831161046157829003601f168201915b5050505050905090565b600033610496818585610d12565b60019150505b92915050565b6000336104b0858285610e92565b6104bb858585610f4f565b506001949350505050565b6008546000906104da6301e1338082611732565b4210610500576104e8611170565b6301e133806008546104fa9190611732565b91505090565b6104fa6301e1338082611732565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104969082908690610555908790611732565b610d12565b60055460009073ffffffffffffffffffffffffffffffffffffffff1633146105c95760405162461bcd60e51b815260206004820152601060248201527f6465763a206d696e746572206f6e6c790000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831661062c5760405162461bcd60e51b815260206004820152601160248201527f6465763a207a65726f206164647265737300000000000000000000000000000060448201526064016105c0565b6301e1338060085461063e9190611732565b421061064c5761064c611170565b61065461129f565b8261065e60025490565b6106689190611732565b11156106dc5760405162461bcd60e51b815260206004820152602260248201527f6465763a206578636565647320616c6c6f7761626c65206d696e7420616d6f7560448201527f6e7400000000000000000000000000000000000000000000000000000000000060648201526084016105c0565b6106e683836112c9565b50600192915050565b60006106fb33836113a2565b506001919050565b60065473ffffffffffffffffffffffffffffffffffffffff16331461076a5760405162461bcd60e51b815260206004820152600f60248201527f6465763a2061646d696e206f6e6c79000000000000000000000000000000000060448201526064016105c0565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a1906020015b60405180910390a150565b60006107ee61129f565b905090565b606060048054610405906116b0565b6008546000906108166301e1338082611732565b421061082c57610824611170565b505060085490565b919050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156108db5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016105c0565b6104bb8286868403610d12565b600033610496818585610f4f565b6000818311156109485760405162461bcd60e51b815260206004820152601060248201527f6465763a207374617274203e20656e640000000000000000000000000000000060448201526064016105c0565b600854600954600091906109606301e1338083611732565b85111561099f576109756301e1338083611732565b9150670f6b75ab2bc471c7610992670de0b6b3a764000083611745565b61099c919061175c565b90505b6109ad6301e1338083611732565b8511156109fc5760405162461bcd60e51b815260206004820152601660248201527f6465763a20746f6f2066617220696e206675747572650000000000000000000060448201526064016105c0565b60005b6103e7811015610b3657828610610a8f5785610a1f6301e1338085611732565b811115610a3757610a346301e1338085611732565b90505b87610a466301e1338086611732565b8110610a53575050610b36565b84811015610a5e5750835b610a688183611797565b610a729085611745565b610a7c9087611732565b9550848910610a8c575050610b36565b50505b610a9d6301e1338084611797565b9250670de0b6b3a7640000610aba670f6b75ab2bc471c784611745565b610ac4919061175c565b9150610adf6301e133806a2d7eb3f96e070d9700000061175c565b821115610b2e5760405162461bcd60e51b815260206004820152601860248201527f546869732073686f756c64206e657665722068617070656e000000000000000060448201526064016105c0565b6001016109ff565b509195945050505050565b6301e13380600854610b539190611732565b421015610ba25760405162461bcd60e51b815260206004820152600e60248201527f6465763a20746f6f20736f6f6e2100000000000000000000000000000000000060448201526064016105c0565b610baa611170565b565b60065473ffffffffffffffffffffffffffffffffffffffff163314610c135760405162461bcd60e51b815260206004820152600f60248201527f6465763a2061646d696e206f6e6c79000000000000000000000000000000000060448201526064016105c0565b60055473ffffffffffffffffffffffffffffffffffffffff1615610c9f5760405162461bcd60e51b815260206004820152602e60248201527f6465763a2063616e2073657420746865206d696e746572206f6e6c79206f6e6360448201527f652c206174206372656174696f6e00000000000000000000000000000000000060648201526084016105c0565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fcec52196e972044edde8689a1b608e459c5946b7f3e5c8cd3d6d8e126d422e1c906020016107d9565b73ffffffffffffffffffffffffffffffffffffffff8316610d9a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff8216610e235760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610f495781811015610f3c5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105c0565b610f498484848403610d12565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610fd85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff82166110615760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156110fd5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610f49565b600954600a54600880546301e13380919060009061118f908490611732565b909155505060078054600191906000906111ad908490600f0b6117aa565b92506101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff1602179055508160000361120e576112076301e133806a2d7eb3f96e070d9700000061175c565b9150611255565b61121c6301e1338083611745565b6112269082611732565b600a8190559050670f6b75ab2bc471c7611248670de0b6b3a764000084611745565b611252919061175c565b91505b600982905560408051428152602081018490529081018290527f27e46362a1e6129b6dd539c984ce739291a97128dfcaeca1255e8ac83abd94419060600160405180910390a15050565b6000600954600854426112b29190611797565b6112bc9190611745565b600a546107ee9190611732565b73ffffffffffffffffffffffffffffffffffffffff821661132c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105c0565b806002600082825461133e9190611732565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff821661142b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260208190526040902054818110156114c75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016105c0565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610e85565b600060208083528351808285015260005b818110156115575785810183015185820160400152820161153b565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461082c57600080fd5b600080604083850312156115cd57600080fd5b6115d683611596565b946020939093013593505050565b6000806000606084860312156115f957600080fd5b61160284611596565b925061161060208501611596565b9150604084013590509250925092565b60006020828403121561163257600080fd5b5035919050565b60006020828403121561164b57600080fd5b61165482611596565b9392505050565b6000806040838503121561166e57600080fd5b50508035926020909101359150565b6000806040838503121561169057600080fd5b61169983611596565b91506116a760208401611596565b90509250929050565b600181811c908216806116c457607f821691505b6020821081036116fd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561049c5761049c611703565b808202811582820484141761049c5761049c611703565b600082611792577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8181038181111561049c5761049c611703565b600f81810b9083900b016f7fffffffffffffffffffffffffffffff81137fffffffffffffffffffffffffffffffff800000000000000000000000000000008212171561049c5761049c61170356fea264697066735822122045aeeef9a8da60a9af08a85d79bbf8299f47ee488331668616223f4489e2201164736f6c63430008120033
Verified Source Code Full Match
Compiler: v0.8.18+commit.87f61d96
EVM: paris
Optimization: Yes (10000 runs)
YMWK.sol 234 lines
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
/// @title Yamawake DAO Token
/// @author DeFiGeek Community Japan
/// @notice ERC20 with piecewise-linear mining supply.
contract YMWK is ERC20 {
event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply);
event SetMinter(address minter);
event SetAdmin(address admin);
address public minter;
address public admin;
// General constants
uint256 constant YEAR = 365 days;
// Supply parameters
uint256 constant INITIAL_SUPPLY = 450_000_000;
uint256 constant INITIAL_RATE = (55_000_000 * 10 ** 18) / YEAR; // leading to 45% premine
uint256 constant RATE_REDUCTION_TIME = YEAR;
uint256 constant RATE_REDUCTION_COEFFICIENT = 1_111_111_111_111_111_111; // 10 * 1e18 / 9
uint256 constant RATE_DENOMINATOR = 10 ** 18;
uint256 constant INFLATION_DELAY = YEAR;
// Supply variables
int128 public miningEpoch;
uint256 public startEpochTime;
uint256 public rate;
uint256 startEpochSupply;
constructor() ERC20("Yamawake DAO Token", "YMWK") {
uint256 _initSupply = INITIAL_SUPPLY * 10 ** decimals();
_mint(msg.sender, _initSupply);
admin = msg.sender;
startEpochTime =
block.timestamp +
INFLATION_DELAY -
RATE_REDUCTION_TIME;
miningEpoch = -1;
rate = 0;
startEpochSupply = _initSupply;
}
// @dev Update mining rate and supply at the start of the epoch
// Any modifying mining call must also call this
function _updateMiningParameters() internal {
uint256 _rate = rate;
uint256 _startEpochSupply = startEpochSupply;
startEpochTime += RATE_REDUCTION_TIME;
miningEpoch += 1;
if (_rate == 0) {
_rate = INITIAL_RATE;
} else {
_startEpochSupply += _rate * RATE_REDUCTION_TIME;
startEpochSupply = _startEpochSupply;
_rate = (_rate * RATE_DENOMINATOR) / RATE_REDUCTION_COEFFICIENT;
}
rate = _rate;
emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply);
}
// @notice Update mining rate and supply at the start of the epoch
// @dev Callable by any address, but only once per epoch
// Total supply becomes slightly larger if(this function is called late
function updateMiningParameters() external {
require(
block.timestamp >= startEpochTime + RATE_REDUCTION_TIME,
"dev: too soon!"
);
_updateMiningParameters();
}
// @notice Get timestamp of the current mining epoch start
// while simultaneously updating mining parameters
// @return Timestamp of the epoch
function startEpochTimeWrite() external returns (uint256) {
uint256 _startEpochTime = startEpochTime;
if (block.timestamp >= _startEpochTime + RATE_REDUCTION_TIME) {
_updateMiningParameters();
return startEpochTime;
} else {
return _startEpochTime;
}
}
// @notice Get timestamp of the next mining epoch start
// while simultaneously updating mining parameters
// @return Timestamp of the next epoch
function futureEpochTimeWrite() external returns (uint256) {
uint256 _startEpochTime = startEpochTime;
if (block.timestamp >= _startEpochTime + RATE_REDUCTION_TIME) {
_updateMiningParameters();
return startEpochTime + RATE_REDUCTION_TIME;
} else {
return _startEpochTime + RATE_REDUCTION_TIME;
}
}
function _availableSupply() internal view returns (uint256) {
return startEpochSupply + (block.timestamp - startEpochTime) * rate;
}
// @notice Current number of tokens in existence (claimed or unclaimed)
function availableSupply() external view returns (uint256) {
return _availableSupply();
}
// @notice How much supply is mintable from start timestamp till end timestamp
// @param start Start of the time interval (timestamp)
// @param end End of the time interval (timestamp)
// @return Tokens mintable from `start` till `end`
function mintableInTimeframe(
uint256 start,
uint256 end
) external view returns (uint256) {
require(start <= end, "dev: start > end");
uint256 _toMint = 0;
uint256 _currentEpochTime = startEpochTime;
uint256 _currentRate = rate;
// Special case if(end is in future (not yet minted) epoch
if (end > _currentEpochTime + RATE_REDUCTION_TIME) {
_currentEpochTime += RATE_REDUCTION_TIME;
_currentRate =
(_currentRate * RATE_DENOMINATOR) /
RATE_REDUCTION_COEFFICIENT;
}
require(
end <= _currentEpochTime + RATE_REDUCTION_TIME,
"dev: too far in future"
);
// Yamawake will not work in 1000 years. Darn!
for (uint i; i < 999; ) {
if (end >= _currentEpochTime) {
uint256 current_end = end;
if (current_end > _currentEpochTime + RATE_REDUCTION_TIME) {
current_end = _currentEpochTime + RATE_REDUCTION_TIME;
}
uint256 current_start = start;
if (current_start >= _currentEpochTime + RATE_REDUCTION_TIME) {
break; // We should never get here but what if...
} else if (current_start < _currentEpochTime) {
current_start = _currentEpochTime;
}
_toMint += _currentRate * (current_end - current_start);
if (start >= _currentEpochTime) {
break;
}
}
_currentEpochTime -= RATE_REDUCTION_TIME;
_currentRate =
(_currentRate * RATE_REDUCTION_COEFFICIENT) /
RATE_DENOMINATOR; // double-division with rounding made rate a bit less => good
require(_currentRate <= INITIAL_RATE, "This should never happen");
unchecked {
i++;
}
}
return _toMint;
}
// @notice Set the minter address
// @dev Only callable once, when minter has not yet been set
// @param _minter Address of the minter
function setMinter(address _minter) external onlyAdmin {
require(
minter == address(0),
"dev: can set the minter only once, at creation"
);
minter = _minter;
emit SetMinter(_minter);
}
// @notice Set the new admin.
// @dev After all is set up, admin only can change the token name
// @param _admin New admin address
function setAdmin(address _admin) external onlyAdmin {
admin = _admin;
emit SetAdmin(_admin);
}
// @notice Mint `_value` tokens and assign them to `_to`
// @dev Emits a Transfer event originating from 0x00
// @param _to The account that will receive the created tokens
// @param _value The amount that will be created
// @return bool success
function mint(address _to, uint256 _value) external returns (bool) {
require(msg.sender == minter, "dev: minter only");
require(_to != address(0), "dev: zero address");
if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) {
_updateMiningParameters();
}
require(
totalSupply() + _value <= _availableSupply(),
"dev: exceeds allowable mint amount"
);
_mint(_to, _value);
return true;
}
// @notice Burn `_value` tokens belonging to `msg.sender`
// @dev Emits a Transfer event with a destination of 0x00
// @param _value The amount that will be burned
// @return bool success
function burn(uint256 _value) external returns (bool) {
_burn(msg.sender, _value);
return true;
}
modifier onlyAdmin() {
require(admin == msg.sender, "dev: admin only");
_;
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
ERC20.sol 365 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
Read Contract
admin 0xf851a440 → address
allowance 0xdd62ed3e → uint256
availableSupply 0x7ecc2b56 → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
miningEpoch 0x64ef6dd4 → int128
mintableInTimeframe 0xc3b03fa8 → uint256
minter 0x07546172 → address
name 0x06fdde03 → string
rate 0x2c4e722e → uint256
startEpochTime 0x1814a5b1 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 _value
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
futureEpochTimeWrite 0x277dbafb
No parameters
returns: uint256
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address _to
uint256 _value
returns: bool
setAdmin 0x704b6c02
address _admin
setMinter 0xfca3b5aa
address _minter
startEpochTimeWrite 0xa228bced
No parameters
returns: uint256
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
updateMiningParameters 0xcb626ae2
No parameters
Recent Transactions
No transactions found for this address