Address Contract Verified
Address
0x7787D10F8F277bC509fb79c68BFC508d69dd41dC
Balance
0 ETH
Nonce
1
Code Size
6263 bytes
Creator
0x4Aba481E...03Aa at tx 0x26d97f67...ea20bb
Indexed Transactions
0
Contract Bytecode
6263 bytes
0x608060405234801561001057600080fd5b50600436106101805760003560e01c806306fdde03146101855780630713251b146101a3578063095ea7b3146101d15780631267f79b146101f457806318160ddd146102095780631c3101d31461021157806323b872dd1461022457806326430e511461023757806328dae6e31461027757806329e1ab2d1461028b5780633092afd51461029f578063313ce567146102b257806339509351146102c457806340c10f19146102d757806342966c68146102ea57806370a08231146102fd578063715018a61461032657806371e2a6571461032e57806379cc679014610341578063828a096b146103545780638da5cb5b1461036157806395d89b4114610376578063a457c2d71461037e578063a9059cbb14610391578063aa5dcecc146103a4578063bf83f2a2146103b7578063d3d84920146103ca578063dd62ed3e146103d2578063e6f6266a146103e5578063f2fde38b146103ee578063f46eccc414610401578063f5ec017214610421575b600080fd5b61018d610429565b60405161019a91906113e7565b60405180910390f35b6101c36101b1366004611458565b600b6020526000908152604090205481565b60405190815260200161019a565b6101e46101df36600461147a565b6104bb565b604051901515815260200161019a565b6102076102023660046114fb565b6104d3565b005b6002546101c3565b61020761021f366004611458565b610659565b6101e46102323660046115a9565b6106cd565b6102656102453660046115e5565b600760209081526000928352604080842090915290825290205460ff1681565b60405160ff909116815260200161019a565b6005546101e490600160a81b900460ff1681565b6006546101e490600160a01b900460ff1681565b6102076102ad366004611458565b61072b565b600554600160a01b900460ff16610265565b6101e46102d236600461147a565b6107bf565b6102076102e536600461147a565b6107e1565b6102076102f8366004611618565b610884565b6101c361030b366004611458565b6001600160a01b031660009081526020819052604090205490565b610207610891565b61020761033c366004611631565b6108cc565b61020761034f36600461147a565b6109c8565b600a546101e49060ff1681565b6103696109dd565b60405161019a91906116dd565b61018d6109ec565b6101e461038c36600461147a565b6109fb565b6101e461039f36600461147a565b610a81565b600654610369906001600160a01b031681565b6102076103c5366004611458565b610add565b610207610b62565b6101c36103e03660046116f1565b610bcf565b6101c360095481565b6102076103fc366004611458565b610bfa565b6101c361040f366004611458565b60086020526000908152604090205481565b610207610c7a565b6060600380546104389061171b565b80601f01602080910402602001604051908101604052809291908181526020018280546104649061171b565b80156104b15780601f10610486576101008083540402835291602001916104b1565b820191906000526020600020905b81548152906001019060200180831161049457829003601f168201915b5050505050905090565b6000336104c9818585610cb5565b5060019392505050565b600654600160a01b900460ff16156105265760405162461bcd60e51b81526020600482015260116024820152701153915491d3d38e88111254d050931151607a1b60448201526064015b60405180910390fd5b33600090815260076020908152604080832060ff8086168552925290912054161561058d5760405162461bcd60e51b81526020600482015260176024820152761153915491d3d38e8814d251d7d393d390d157d554d151604a1b604482015260640161051d565b6006546105a6906001600160a01b031633858486610dda565b6105e55760405162461bcd60e51b815260206004820152601060248201526f454e4552474f4e3a204241445f53494760801b604482015260640161051d565b33600081815260076020908152604080832060ff861684529091529020805460ff191660011790556106179084610eaf565b6040805184815260ff8316602082015233917f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a910160405180910390a2505050565b336106626109dd565b6001600160a01b0316146106885760405162461bcd60e51b815260040161051d90611755565b6001600160a01b0381166000818152600b602052604080822060019055517f1907df59796147a46dfbe422632b56ccd6d1109ee14f3a26d9209199a14378359190a250565b600a54600090839060ff1615806106fb57506001600160a01b0381166000908152600b602052604090205415155b6107175760405162461bcd60e51b815260040161051d90611781565b610722858585610f5c565b95945050505050565b336107346109dd565b6001600160a01b03161461075a5760405162461bcd60e51b815260040161051d90611755565b6001600160a01b03811660009081526008602052604081208190556009805491610783836117c3565b90915550506040516001600160a01b038216907fc93cfdd5d8f442c448a02ed11ccff64355643272c9f2be94b723f2181af1a89690600090a250565b6000336104c98185856107d28383610bcf565b6107dc91906117da565b610cb5565b336000908152600860205260409020546108335760405162461bcd60e51b815260206004820152601360248201527222a722a923a7a71d102727aa2fa6a4a72a22a960691b604482015260640161051d565b61083d8282610eaf565b816001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161087891815260200190565b60405180910390a25050565b61088e3382610f75565b50565b3361089a6109dd565b6001600160a01b0316146108c05760405162461bcd60e51b815260040161051d90611755565b6108ca600061108d565b565b336108d56109dd565b6001600160a01b0316146108fb5760405162461bcd60e51b815260040161051d90611755565b60005b81518110156109c45760016008600084848151811061091f5761091f6117f2565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055506009600081548092919061095e90611808565b9190505550818181518110610975576109756117f2565b60200260200101516001600160a01b03167f887003b0d91467e681b2ba1437748e2d1b6e9b0b1cb8be6541e6cdfc1b50eabc60405160405180910390a2806109bc81611808565b9150506108fe565b5050565b6109d38233836110df565b6109c48282610f75565b6005546001600160a01b031690565b6060600480546104389061171b565b60003381610a098286610bcf565b905083811015610a695760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161051d565b610a768286868403610cb5565b506001949350505050565b600a54600090839060ff161580610aaf57506001600160a01b0381166000908152600b602052604090205415155b610acb5760405162461bcd60e51b815260040161051d90611781565b610ad58484611159565b949350505050565b33610ae66109dd565b6001600160a01b031614610b0c5760405162461bcd60e51b815260040161051d90611755565b600680546001600160a01b0319166001600160a01b0383161790556040517feee660812302c23eae4cc6a6123f49f3d358631a4e7a39c767bbc2c1bd84fd6b90610b579083906116dd565b60405180910390a150565b33610b6b6109dd565b6001600160a01b031614610b915760405162461bcd60e51b815260040161051d90611755565b6006805460ff60a01b1916600160a01b1790556040517f04332882315d65c93bab7c92b1476bc28b2cf602864681e68acefdd4a8fdc79c90600090a1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b33610c036109dd565b6001600160a01b031614610c295760405162461bcd60e51b815260040161051d90611755565b6001600160a01b038116610c715760405162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4144445245535360881b604482015260640161051d565b61088e8161108d565b33610c836109dd565b6001600160a01b031614610ca95760405162461bcd60e51b815260040161051d90611755565b600a805460ff19169055565b6001600160a01b038316610d175760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161051d565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161051d565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b60006001600160a01b0386168103610df457506000610722565b604080516001600160601b0319606088901b16602080830191909152603482018790526001600160f81b031960f887901b166054830152825180830360350181526055830184528051908201207b0ca2ba3432b932bab69029b4b3b732b21026b2b9b9b0b3b29d05199960211b607584015260918084018290528451808503909101815260b19093019093528151910120876001600160a01b0316610e998286611167565b6001600160a01b03161498975050505050505050565b6001600160a01b038216610f055760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161051d565b8060026000828254610f1791906117da565b90915550506001600160a01b03821660008181526020818152604080832080548601905551848152600080516020611822833981519152910160405180910390a35050565b600033610f6a8582856110df565b610a768585856111e6565b6001600160a01b038216610fd55760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161051d565b6001600160a01b038216600090815260208190526040902054818110156110495760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161051d565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192916000805160206118228339815191529101610dcd565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006110eb8484610bcf565b9050600019811461115357818110156111465760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161051d565b6111538484848403610cb5565b50505050565b6000336104c98185856111e6565b60008060008061117685611378565b6040805160008152602081018083528b905260ff8316918101919091526060810184905260808101839052929550909350915060019060a0016020604051602081039080840390855afa1580156111d1573d6000803e3d6000fd5b5050604051601f190151979650505050505050565b6001600160a01b03831661124a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161051d565b6001600160a01b0382166112ac5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161051d565b6001600160a01b038316600090815260208190526040902054818110156113245760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161051d565b6001600160a01b0384811660008181526020818152604080832087870390559387168083529184902080548701905592518581529092600080516020611822833981519152910160405180910390a3611153565b600080600083516041146113c95760405162461bcd60e51b81526020600482015260186024820152770d2dcecc2d8d2c840e6d2cedcc2e8eae4ca40d8cadccee8d60431b604482015260640161051d565b50505060208101516040820151606090920151909260009190911a90565b600060208083528351808285015260005b81811015611414578581018301518582016040015282016113f8565b81811115611426576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461145357600080fd5b919050565b60006020828403121561146a57600080fd5b6114738261143c565b9392505050565b6000806040838503121561148d57600080fd5b6114968361143c565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156114e2576114e26114a4565b604052919050565b803560ff8116811461145357600080fd5b60008060006060848603121561151057600080fd5b833592506020808501356001600160401b038082111561152f57600080fd5b818701915087601f83011261154357600080fd5b813581811115611555576115556114a4565b611567601f8201601f191685016114ba565b9150808252888482850101111561157d57600080fd5b80848401858401376000848284010152508094505050506115a0604085016114ea565b90509250925092565b6000806000606084860312156115be57600080fd5b6115c78461143c565b92506115d56020850161143c565b9150604084013590509250925092565b600080604083850312156115f857600080fd5b6116018361143c565b915061160f602084016114ea565b90509250929050565b60006020828403121561162a57600080fd5b5035919050565b6000602080838503121561164457600080fd5b82356001600160401b038082111561165b57600080fd5b818501915085601f83011261166f57600080fd5b813581811115611681576116816114a4565b8060051b91506116928483016114ba565b81815291830184019184810190888411156116ac57600080fd5b938501935b838510156116d1576116c28561143c565b825293850193908501906116b1565b98975050505050505050565b6001600160a01b0391909116815260200190565b6000806040838503121561170457600080fd5b61170d8361143c565b915061160f6020840161143c565b600181811c9082168061172f57607f821691505b60208210810361174f57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526012908201527127aba720a126229d102727aa2fa7aba722a960711b604082015260600190565b6020808252601290820152711153915491d3d38e881393d7d4115493525560721b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816117d2576117d26117ad565b506000190190565b600082198211156117ed576117ed6117ad565b500190565b634e487b7160e01b600052603260045260246000fd5b60006001820161181a5761181a6117ad565b506001019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220d59374790e80230dca2c167475008b9d8e583455a7627fea67a191f4649abffe64736f6c634300080d0033
Verified Source Code Full Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (1 runs)
ERC20.sol 389 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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].
*
* 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}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* 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 value {ERC20} uses, unless this function is
* 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 {}
}
ERC20Burnable.sol 39 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
}
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);
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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;
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "OWNABLE: NOT_OWNER");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "INVALID_ADDRESS");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ENERGON.sol 188 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "../common/Ownable.sol";
contract ENERGON is ERC20, ERC20Burnable, Ownable {
uint8 _tokenDecimals;
bool public enableClaim;
address public allocator;
bool public allocDisabled;
mapping(address => mapping(uint8 => uint8)) public usedNonce;
mapping(address => uint256) public minters;
uint256 public numMinters;
bool public recipientsBlocked;
mapping(address => uint256) public recipientsAllowlist;
event UpdatedAllocator(address addr);
event AllocationDisabled();
event Claimed(address indexed addr, uint256 amount, uint256 nonce);
event AddedMinter(address indexed minter);
event RemovedMinter(address indexed minter);
event Minted(address indexed account, uint256 amount);
event AddRecipient(address indexed addr);
/// @dev Initialize contract
/// @param _name The name of the token
/// @param _symbol The token symbol
/// @param _initialSupply The initial supply
/// @param _decimals The token's decimals
constructor(
string memory _name,
string memory _symbol,
uint256 _initialSupply,
uint8 _decimals
) ERC20(_name, _symbol) {
_tokenDecimals = _decimals;
_mint(msg.sender, _initialSupply);
recipientsBlocked = true;
}
/// @dev Modifier to check if sender is a minter
modifier isMinter() {
require(minters[msg.sender] > 0, "ENERGON: NOT_MINTER");
_;
}
/// @dev Modifier to check if an address can receiver tokens
modifier canReceive(address addr) {
require(!recipientsBlocked || recipientsAllowlist[addr] > 0, "ENERGON: NO_PERMIT");
_;
}
function decimals() public view override returns (uint8) {
return _tokenDecimals;
}
/// @notice Set allocator
/// @param addr The address of the allocator
function setAllocator(address addr) public onlyOwner {
allocator = addr;
emit UpdatedAllocator(addr);
}
/// @notice Disable allocation via signature.
function disableAllocation() public onlyOwner {
allocDisabled = true;
emit AllocationDisabled();
}
/// @dev Add minters
/// @param addrs The address of the minters
function addMinters(address[] memory addrs) public onlyOwner {
for (uint256 i = 0; i < addrs.length; i++) {
minters[addrs[i]] = 1;
numMinters++;
emit AddedMinter(addrs[i]);
}
}
/// @dev Remove a minter
/// @param addr The address of the minter
function removeMinter(address addr) public onlyOwner {
delete minters[addr];
numMinters--;
emit RemovedMinter(addr);
}
/// @dev Disable recipient blocking
function disableRecipientBlock() public onlyOwner {
recipientsBlocked = false;
}
/// @dev Add an address that can receive tokens
/// @param addr The target address
function addRecipient(address addr) public onlyOwner {
recipientsAllowlist[addr] = 1;
emit AddRecipient(addr);
}
/// @dev Mint amount for an address.
/// @param to The account that will receive the minted tokens.
/// @param amount The amount of tokens to be minted.
function mint(address to, uint256 amount) public isMinter {
_mint(to, amount);
emit Minted(to, amount);
}
/// @notice Claim energon with a signature
/// @param _amount The amount to claim
/// @param _signature The claim signature created by the allocator
/// @param _sigNonce The unique signature nonce
function claim(
uint256 _amount,
bytes memory _signature,
uint8 _sigNonce
) public {
require(!allocDisabled, "ENERGON: DISABLED");
require(usedNonce[msg.sender][_sigNonce] == 0, "ENERGON: SIG_NONCE_USED");
require(verifySig(allocator, msg.sender, _amount, _sigNonce, _signature), "ENERGON: BAD_SIG");
usedNonce[msg.sender][_sigNonce] = 1;
_mint(msg.sender, _amount);
emit Claimed(msg.sender, _amount, _sigNonce);
}
function transfer(address recipient, uint256 amount) public virtual override canReceive(recipient) returns (bool) {
return ERC20.transfer(recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override canReceive(recipient) returns (bool) {
return ERC20.transferFrom(sender, recipient, amount);
}
/// @dev Construct mint message hash
function getMessageHash(
address addr,
uint256 _amount,
uint8 nonce
) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(addr, _amount, nonce));
}
/// @dev Construct a signed message hash
function getEthSignedMessageHash(bytes32 _messageHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
}
/// @dev Recover the signer
function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature) internal pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);
return ecrecover(_ethSignedMessageHash, v, r, s);
}
/// @dev Verify mint signature
function verifySig(
address _signer,
address _addr,
uint256 _amount,
uint8 _nonce,
bytes memory signature
) internal pure returns (bool) {
if (address(0) == _signer) return false;
bytes32 messageHash = getMessageHash(_addr, _amount, _nonce);
bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);
return recoverSigner(ethSignedMessageHash, signature) == _signer;
}
function splitSignature(bytes memory sig)
internal
pure
returns (
bytes32 r,
bytes32 s,
uint8 v
)
{
require(sig.length == 65, "invalid signature length");
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
}
}
Read Contract
allocDisabled 0x29e1ab2d → bool
allocator 0xaa5dcecc → address
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
enableClaim 0x28dae6e3 → bool
minters 0xf46eccc4 → uint256
name 0x06fdde03 → string
numMinters 0xe6f6266a → uint256
owner 0x8da5cb5b → address
recipientsAllowlist 0x0713251b → uint256
recipientsBlocked 0x828a096b → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
usedNonce 0x26430e51 → uint8
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
addMinters 0x71e2a657
address[] addrs
addRecipient 0x1c3101d3
address addr
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
claim 0x1267f79b
uint256 _amount
bytes _signature
uint8 _sigNonce
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
disableAllocation 0xd3d84920
No parameters
disableRecipientBlock 0xf5ec0172
No parameters
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address to
uint256 amount
removeMinter 0x3092afd5
address addr
renounceOwnership 0x715018a6
No parameters
setAllocator 0xbf83f2a2
address addr
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address