USA Node
Top Transactions
Blocks
Staking
Tokens
Broadcast TXN
CLI Interface
Developer API
Smart Contract HQ
Contact Us
Donate
Node Status
Node:
Main Net - US
Search
Token Contract Details
Contract:
0x3da3d8cde7b12cd2cbb688e2655bcacd8946399d
Name:
Replay Token
Symbol:
RPLAY
Total Supply:
657,006,830.00
Decimal:
18
Compiler Version:
v0.8.11
Published Contract:
Send Transactions
TNT-20 Transactions
TNT-721 Transactions
Contract
Contract ByteCode:
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80634dd18bf5116100de578063a457c2d711610097578063d3b2f59811610071578063d3b2f59814610359578063d5abeb0114610361578063dd62ed3e14610388578063f851a4401461039b57600080fd5b8063a457c2d714610320578063a9059cbb14610333578063ab8e786f1461034657600080fd5b80634dd18bf5146102a35780634eb03f6e146102b657806370a08231146102c9578063909d6cb4146102f257806395d89b4114610305578063a0712d681461030d57600080fd5b806323b872dd1161013057806323b872dd1461021c57806324e770d01461022f578063267822471461023757806329fb7ef61461024a578063313ce5671461025f578063395093511461029057600080fd5b806306fdde03146101785780630754617214610196578063095ea7b3146101c15780630b064976146101e457806318160ddd146101f75780632147425f14610209575b600080fd5b6101806103ae565b60405161018d9190610fbf565b60405180910390f35b6006546101a9906001600160a01b031681565b6040516001600160a01b03909116815260200161018d565b6101d46101cf366004611030565b610440565b604051901515815260200161018d565b600b546101a9906001600160a01b031681565b6002545b60405190815260200161018d565b6009546101a9906001600160a01b031681565b6101d461022a36600461105a565b61045a565b6005546101fb565b6008546101a9906001600160a01b031681565b61025d610258366004611096565b61047e565b005b60405160ff7f000000000000000000000000000000000000000000000000000000000000001216815260200161018d565b6101d461029e366004611030565b6104ec565b61025d6102b13660046110af565b61050e565b61025d6102c43660046110af565b6105ec565b6101fb6102d73660046110af565b6001600160a01b031660009081526020819052604090205490565b600a546101a9906001600160a01b031681565b6101806106c3565b61025d61031b366004611096565b6106d2565b6101d461032e366004611030565b6108b4565b6101d4610341366004611030565b61092f565b6101d4610354366004611030565b61093d565b61025d610aaf565b6101fb7f0000000000000000000000000000000000000000033b2e3c9fd0803ce800000081565b6101fb6103963660046110ca565b610b74565b6007546101a9906001600160a01b031681565b6060600380546103bd906110fd565b80601f01602080910402602001604051908101604052809291908181526020018280546103e9906110fd565b80156104365780601f1061040b57610100808354040283529160200191610436565b820191906000526020600020905b81548152906001019060200180831161041957829003601f168201915b5050505050905090565b60003361044e818585610b9f565b60019150505b92915050565b600033610468858285610cc3565b610473858585610d3d565b506001949350505050565b6007546001600160a01b031633146104b15760405162461bcd60e51b81526004016104a890611138565b60405180910390fd5b60058190556040518181527fd65d781db82f0bd55f732ea1b96f4c6565750df815c18a70962cd8405274e2439060200160405180910390a150565b60003361044e8185856104ff8383610b74565b6105099190611185565b610b9f565b6007546001600160a01b031633146105385760405162461bcd60e51b81526004016104a890611138565b6001600160a01b03811661058e5760405162461bcd60e51b815260206004820152601d60248201527f696e76616c69642070656e64696e672061646d696e206164647265737300000060448201526064016104a8565b60088054600a80546001600160a01b03199081166001600160a01b03808516918217909355918516921682179092556040519091907fed1a3b5dea5773c7660d05cc9884b43f5e8e0b581713e873f013560558890f4990600090a350565b6007546001600160a01b031633146106165760405162461bcd60e51b81526004016104a890611138565b6001600160a01b0381166106655760405162461bcd60e51b8152602060048201526016602482015275696e76616c6964206d696e746572206164647265737360501b60448201526064016104a8565b60068054600980546001600160a01b03199081166001600160a01b03808516918217909355918516921682179092556040519091907ffb80f39493422136408edd986f7ca83c10534204422dd1dfebb055de4ef0fd5390600090a350565b6060600480546103bd906110fd565b6007546001600160a01b031633146106fc5760405162461bcd60e51b81526004016104a890611138565b6007546001600160a01b0316331461074c5760405162461bcd60e51b81526020600482015260136024820152721bdb9b1e4818591b5a5b8818d85b881b5a5b9d606a1b60448201526064016104a8565b6000306001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b0919061119d565b90507f0000000000000000000000000000000000000000033b2e3c9fd0803ce80000008111156108225760405162461bcd60e51b815260206004820152601b60248201527f616c7265616479206578636565646564206d617820737570706c79000000000060448201526064016104a8565b7f0000000000000000000000000000000000000000033b2e3c9fd0803ce800000061084d8284610ee1565b1061089a5760405162461bcd60e51b815260206004820152601d60248201527f6578636565646564206d617820737570706c79206f6620746f6b656e7300000060448201526064016104a8565b6007546108b0906001600160a01b031683610ef4565b5050565b600033816108c28286610b74565b9050838110156109225760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104a8565b6104738286868403610b9f565b60003361044e818585610d3d565b6006546000906001600160a01b0316331461099a5760405162461bcd60e51b815260206004820152601e60248201527f4f6e6c79206d696e7465722063616e206d616b6520746869732063616c6c000060448201526064016104a8565b6001600160a01b0383166109b057506000610454565b6000306001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a14919061119d565b90507f0000000000000000000000000000000000000000033b2e3c9fd0803ce80000008110610a47576000915050610454565b7f0000000000000000000000000000000000000000033b2e3c9fd0803ce8000000610a728285610ee1565b1115610aa557610aa27f0000000000000000000000000000000000000000033b2e3c9fd0803ce800000082610fb3565b92505b61044e8484610ef4565b6008546001600160a01b03163314610b175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c792070656e64696e672061646d696e2063616e206d616b6520746869736044820152640818d85b1b60da1b60648201526084016104a8565b60078054600b80546001600160a01b038084166001600160a01b0319928316811790935560085416921682179092556040519091907fcd6ba6b7da89e039d53b5d981527a893755342bb9d8e5c2f61f6638f1fb5192b90600090a3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b038316610c015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104a8565b6001600160a01b038216610c625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104a8565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610ccf8484610b74565b90506000198114610d375781811015610d2a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104a8565b610d378484848403610b9f565b50505050565b6001600160a01b038316610da15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104a8565b6001600160a01b038216610e035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104a8565b6001600160a01b03831660009081526020819052604090205481811015610e7b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104a8565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610d37565b6000610eed8284611185565b9392505050565b6001600160a01b038216610f4a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104a8565b8060026000828254610f5c9190611185565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6000610eed82846111b6565b600060208083528351808285015260005b81811015610fec57858101830151858201604001528201610fd0565b81811115610ffe576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461102b57600080fd5b919050565b6000806040838503121561104357600080fd5b61104c83611014565b946020939093013593505050565b60008060006060848603121561106f57600080fd5b61107884611014565b925061108660208501611014565b9150604084013590509250925092565b6000602082840312156110a857600080fd5b5035919050565b6000602082840312156110c157600080fd5b610eed82611014565b600080604083850312156110dd57600080fd5b6110e683611014565b91506110f460208401611014565b90509250929050565b600181811c9082168061111157607f821691505b6020821081141561113257634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601d908201527f4f6e6c792061646d696e2063616e206d616b6520746869732063616c6c000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156111985761119861116f565b500190565b6000602082840312156111af57600080fd5b5051919050565b6000828210156111c8576111c861116f565b50039056fea26469706673582212209c39db8cfa5d4ca00412de57321d5fc6abce4d5a1eae27f3535c75e9711228cd64736f6c634300080b0033
Published Contract:
// File: @openzeppelin/contracts/utils/Context.sol // 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; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) /** * @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); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.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); } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.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 {} } // File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: ReplayToken.sol /** * @title ReplayToken * @notice TNT20 token for Replay subchain on theta network blockchain * @dev This token is the Governance token of Replay subchain on Theta Blockchain */ contract ReplayToken is ERC20 { using SafeMath for uint256; /** * @dev represents the decimal value of the token. Once set in constructor cannot be changes. Its set to 18 */ uint8 private immutable _decimals; /** * @dev Rewards earned by staker per block based on staked amount */ uint256 private _stakerRewardPerBlock; /** * @dev Max supply of the token */ uint256 public immutable maxSupply; /** * @dev Minter is the one who mints tokens per each block based on _stakerRewardPerBlock */ address public minter; /** * @dev Admin of the contract - can mint tokens, change pendingAdmin and _stakerRewardPerBlock */ address public admin; /** * @dev Pending admin can update the admin */ address public pendingAdmin; /** * @dev Previous Minter emitted when replaced by new minter address */ address public previousMinter; /** * @dev Previous Pending Admin emitted when replaced by new admin */ address public previousPendingAdmin; /** * @dev Previous Admin emitted when replaced by new pending admin */ address public previousAdmin; /** * @dev Event emitted when _stakerRewardPerBlock is updated by admin. * @param newStakerRewardPerBlock - this is the new _stakerRewardPerBlock value updated by admin. */ event UpdateStakerRewardPerBlock(uint256 newStakerRewardPerBlock); /** * @dev Event emitted when setPendingAdmin is updated by admin. * @param previousPendingAdmin - the previous pendingAdmin value that was updated by admin * @param newPendingAdmin - the current pendingAdmin value that was added by admin */ event SetPendingAdmin(address indexed previousPendingAdmin, address indexed newPendingAdmin); /** * @dev Event emitted when admin is updated - only pending admin can update. * @param previousAdmin - the previous admin value that was updated by pendingAdmin * @param newAdmin - the current admin value - this is usually the pendingAdmin value and only called by pendingAdmin to perform this function */ event UpdateAdmin(address indexed previousAdmin, address indexed newAdmin); /** * @dev Event emitted when minted address is updated. * @param previousMinter - the address of previous minter * @param newMinter - the address of current minter */ event UpdateMinter(address indexed previousMinter, address indexed newMinter); /** * @dev Restricts a function so it can only be executed by an admin role */ modifier adminOnly() { require(msg.sender == admin, "Only admin can make this call"); _; } /** * @dev Restricts a function so it can only be executed by a pending admin role */ modifier pendingAdminOnly() { require(msg.sender == pendingAdmin, "Only pending admin can make this call"); _; } /** * @dev Restricts a function so it can only be executed by a minter */ modifier minterOnly() { require(msg.sender == minter, "Only minter can make this call"); _; } /** * @dev Initializes the contract during deployment * @param name_ is the name of the token * @param symbol_ is the ticker symbol of the token * @param decimals_ set to 18 on deploy. * @param maxSupply_ is set to maxSupply of tokens allowed. The total supply of tokens should never exceed more than 1 billion * @param minter_ is the contract address of ValidatorStakeManager. * @param stakerRewardPerBlock_ will mint tokens based on stakerRewardPerBlock_ to reward the Subchain validator stakers. * @param initDistrWallet_ will hold the initial minted tokens * @param initMintAmount_ the initial mint tokens that will be held by initDistrWallet_ * @param admin_ is the admin of the contract */ constructor( string memory name_, string memory symbol_, uint8 decimals_, uint256 maxSupply_, address minter_, uint256 stakerRewardPerBlock_, address initDistrWallet_, uint256 initMintAmount_, address admin_ ) ERC20(name_, symbol_) { require(admin_ != address(0x0), "invalid admin address"); require(minter_ != address(0x0), "invalid minter_ address"); require(initDistrWallet_ != address(0x0), "invalid initDistrWallet_ address"); require(decimals_ != 0, "invalid decimals"); require(maxSupply_ != 0, "invalid maxSupply"); require(maxSupply_ <= 10 ** 27, "maxSupply too large"); require( initMintAmount_ < maxSupply_, "Initial supply too large" ); _decimals = decimals_; maxSupply = maxSupply_; minter = minter_; _stakerRewardPerBlock = stakerRewardPerBlock_; admin = admin_; _mint(initDistrWallet_, initMintAmount_); emit UpdateMinter(previousMinter, minter); emit UpdateAdmin(previousAdmin, admin); emit UpdateStakerRewardPerBlock(_stakerRewardPerBlock); } /** * @dev This method allows the minter (e.g. the ValidatorStakeManager contract) to mint new tokens to reward, Minter is the ValidatorStakeManager contract. * @param account - account to which the staker amount and rewards will be minted * @param amount - amount that needs to be minted by the VSM * @return bool - This returns true - if the rewards are minted and false if they are not. */ function mintStakerReward(address account, uint256 amount) external minterOnly returns (bool) { if (account == address(0x0)) { return false; } uint256 currentSupply = this.totalSupply(); if (currentSupply >= maxSupply) { return false; } if (currentSupply.add(amount) > maxSupply) { amount = maxSupply.sub(currentSupply); } _mint(account, amount); return true; } /** * @dev This function allows admin to mint additional tokens. * @param amount - amount of tokens that will be minted by admin. They are minted to admin wallet. */ function mint(uint256 amount) external adminOnly { require(msg.sender == admin, "only admin can mint"); uint256 currentSupply = this.totalSupply(); require(currentSupply <= maxSupply, "already exceeded max supply"); require(currentSupply.add(amount) < maxSupply, "exceeded max supply of tokens" ); _mint(admin, amount); } /** * @dev This function allows admin to update Staker reward per block * @notice This value will be cut in half based on the rules in per white paper. * @param stakerRewardPerBlock_ - Minter will mint tokens based on stakerRewardPerBlock_ to reward the Subchain validator stakers. */ function updateStakerRewardPerBlock(uint256 stakerRewardPerBlock_) external adminOnly { _stakerRewardPerBlock = stakerRewardPerBlock_; emit UpdateStakerRewardPerBlock(_stakerRewardPerBlock); } /** * @dev This function updates Minter and can be called by admin only. * @param minter_ - The address of the minted contract this will be VSM - Validator Stake manager. */ function updateMinter(address minter_) external adminOnly { require(minter_ != address(0x0), "invalid minter address"); previousMinter = minter; minter = minter_; emit UpdateMinter(previousMinter, minter); } /** * @dev Pending admin is an intermediate role which is only used to update an admin * @param admin_ the address of the pending admin that needs to be set */ function setPendingAdmin(address admin_) external adminOnly { require(admin_ != address(0x0), "invalid pending admin address"); previousPendingAdmin = pendingAdmin; pendingAdmin = admin_; emit SetPendingAdmin(previousPendingAdmin, pendingAdmin); } /** * @dev This function updates admin - only invoked by pending admin */ function updateAdmin() external pendingAdminOnly { previousAdmin = admin; admin = pendingAdmin; emit UpdateAdmin(previousAdmin, admin); } /** * @dev This method tells the minter - ValidatorStakeManager contract how many new tokens are minted per block for the Subchain validator stakers * @return Returns reward per block that gets minted by minter for stakers based on their staked amount. */ function stakerRewardPerBlock() external view returns (uint256) { return _stakerRewardPerBlock; } /** * @dev Read only function for returning the decimals of token. */ function decimals() public view virtual override returns (uint8) { return _decimals; } }
Contract ABI:
[]