Address Contract Partially Verified
Address
0xF33893DE6eB6aE9A67442E066aE9aBd228f5290c
Balance
0 ETH
Nonce
1
Code Size
8832 bytes
Creator
0xa24c4553...CDd9 at tx 0xe4793a1f...d1a3e1
Indexed Transactions
0
Contract Bytecode
8832 bytes
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806370a08231116100b85780638da5cb5b1161007c5780638da5cb5b1461035057806395d89b411461036e578063a457c2d71461038c578063a9059cbb146103bc578063dd62ed3e146103ec578063f2fde38b1461041c57610142565b806370a08231146102d4578063715018a614610304578063798c2c101461030e57806383e6ab041461032a578063850c72261461033457610142565b8063313ce5671161010a578063313ce567146101ff578063395093511461021d5780633d7457261461024d578063424e7b3d146102695780634a57a6b21461028557806354b762a6146102b557610142565b806306fdde0314610147578063095ea7b31461016557806311c28b591461019557806318160ddd146101b157806323b872dd146101cf575b600080fd5b61014f610438565b60405161015c9190611777565b60405180910390f35b61017f600480360381019061017a9190611832565b6104ca565b60405161018c919061188d565b60405180910390f35b6101af60048036038101906101aa91906118a8565b6104ed565b005b6101b9610588565b6040516101c6919061190a565b60405180910390f35b6101e960048036038101906101e49190611925565b610592565b6040516101f6919061188d565b60405180910390f35b6102076106ec565b6040516102149190611994565b60405180910390f35b61023760048036038101906102329190611832565b610703565b604051610244919061188d565b60405180910390f35b61026760048036038101906102629190611832565b61073a565b005b610283600480360381019061027e91906119af565b61078e565b005b61029f600480360381019061029a91906119af565b6107eb565b6040516102ac9190611a1a565b60405180910390f35b6102bd610860565b6040516102cb929190611a44565b60405180910390f35b6102ee60048036038101906102e991906119af565b610899565b6040516102fb919061190a565b60405180910390f35b61030c6108e1565b005b610328600480360381019061032391906119af565b6108f5565b005b610332610958565b005b61034e600480360381019061034991906119af565b61096a565b005b6103586109cd565b6040516103659190611a6d565b60405180910390f35b6103766109f7565b6040516103839190611777565b60405180910390f35b6103a660048036038101906103a19190611832565b610a89565b6040516103b3919061188d565b60405180910390f35b6103d660048036038101906103d19190611832565b610b00565b6040516103e3919061188d565b60405180910390f35b61040660048036038101906104019190611a88565b610c4d565b604051610413919061190a565b60405180910390f35b610436600480360381019061043191906119af565b610cd4565b005b60606003805461044790611af7565b80601f016020809104026020016040519081016040528092919081815260200182805461047390611af7565b80156104c05780601f10610495576101008083540402835291602001916104c0565b820191906000526020600020905b8154815290600101906020018083116104a357829003601f168201915b5050505050905090565b6000806104d5610d58565b90506104e2818585610d60565b600191505092915050565b6104f5610f2b565b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555081600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550505050565b6000600254905090565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610621576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061890611b75565b60405180910390fd5b600061062b610d58565b9050610638858285610fa9565b610643858585611035565b610682576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067990611be1565b60405180910390fd5b600061068d84611302565b905060008111156106d45780846106a49190611c30565b93506106d386600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611347565b5b6106df868686611347565b6001925050509392505050565b6000600560149054906101000a900460ff16905090565b60008061070e610d58565b905061072f8185856107208589610c4d565b61072a9190611c64565b610d60565b600191505092915050565b610742610f2b565b8060078190555081600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b610796610f2b565b600960008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160009055505050565b6107f36116c4565b6107fb610f2b565b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050919050565b60008061086b610f2b565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600754915091509091565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e9610f2b565b6108f360006115c8565b565b6108fd610f2b565b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610960610f2b565b6000600781905550565b610972610f2b565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610a0690611af7565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3290611af7565b8015610a7f5780601f10610a5457610100808354040283529160200191610a7f565b820191906000526020600020905b815481529060010190602001808311610a6257829003601f168201915b5050505050905090565b600080610a94610d58565b90506000610aa28286610c4d565b905083811015610ae7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ade90611d2c565b60405180910390fd5b610af48286868403610d60565b60019250505092915050565b600080610b0b610d58565b9050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9190611b75565b60405180910390fd5b610ba5818585611035565b610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90611be1565b60405180910390fd5b6000610bef84611302565b90506000811115610c36578084610c069190611c30565b9350610c3582600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611347565b5b610c41828686611347565b60019250505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610cdc610f2b565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4390611dbe565b60405180910390fd5b610d55816115c8565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610dd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dc790611e50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3790611ee2565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f1e919061190a565b60405180910390a3505050565b610f33610d58565b73ffffffffffffffffffffffffffffffffffffffff16610f516109cd565b73ffffffffffffffffffffffffffffffffffffffff1614610fa7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9e90611f4e565b60405180910390fd5b565b6000610fb58484610c4d565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461102f5781811015611021576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101890611fba565b60405180910390fd5b61102e8484848403610d60565b5b50505050565b600080600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154111580156110cc57506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411155b156110da57600190506112fb565b6000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411801561116d5750600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015482115b1561117b57600090506112fb565b6000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541180156112585750600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154426112169190611c30565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561126657600090506112fb565b6000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015411156112f65742600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600190505b9392505050565b600080600754111561133d5761133660646113286007548561168e90919063ffffffff16565b6116a490919063ffffffff16565b9050611342565b600090505b919050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ae9061204c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141e906120de565b60405180910390fd5b6114328383836116ba565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90612170565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461154b9190611c64565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516115af919061190a565b60405180910390a36115c28484846116bf565b50505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000818361169c9190612190565b905092915050565b600081836116b29190612219565b905092915050565b505050565b505050565b604051806040016040528060008152602001600081525090565b600081519050919050565b600082825260208201905092915050565b60005b838110156117185780820151818401526020810190506116fd565b83811115611727576000848401525b50505050565b6000601f19601f8301169050919050565b6000611749826116de565b61175381856116e9565b93506117638185602086016116fa565b61176c8161172d565b840191505092915050565b60006020820190508181036000830152611791818461173e565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006117c98261179e565b9050919050565b6117d9816117be565b81146117e457600080fd5b50565b6000813590506117f6816117d0565b92915050565b6000819050919050565b61180f816117fc565b811461181a57600080fd5b50565b60008135905061182c81611806565b92915050565b6000806040838503121561184957611848611799565b5b6000611857858286016117e7565b92505060206118688582860161181d565b9150509250929050565b60008115159050919050565b61188781611872565b82525050565b60006020820190506118a2600083018461187e565b92915050565b6000806000606084860312156118c1576118c0611799565b5b60006118cf868287016117e7565b93505060206118e08682870161181d565b92505060406118f18682870161181d565b9150509250925092565b611904816117fc565b82525050565b600060208201905061191f60008301846118fb565b92915050565b60008060006060848603121561193e5761193d611799565b5b600061194c868287016117e7565b935050602061195d868287016117e7565b925050604061196e8682870161181d565b9150509250925092565b600060ff82169050919050565b61198e81611978565b82525050565b60006020820190506119a96000830184611985565b92915050565b6000602082840312156119c5576119c4611799565b5b60006119d3848285016117e7565b91505092915050565b6119e5816117fc565b82525050565b604082016000820151611a0160008501826119dc565b506020820151611a1460208501826119dc565b50505050565b6000604082019050611a2f60008301846119eb565b92915050565b611a3e816117be565b82525050565b6000604082019050611a596000830185611a35565b611a6660208301846118fb565b9392505050565b6000602082019050611a826000830184611a35565b92915050565b60008060408385031215611a9f57611a9e611799565b5b6000611aad858286016117e7565b9250506020611abe858286016117e7565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611b0f57607f821691505b60208210811415611b2357611b22611ac8565b5b50919050565b7f53656e64657220696e20426c61636b204c697374000000000000000000000000600082015250565b6000611b5f6014836116e9565b9150611b6a82611b29565b602082019050919050565b60006020820190508181036000830152611b8e81611b52565b9050919050565b7f5265737472696374696f6e2028616d6f756e742f64656c617929206572726f72600082015250565b6000611bcb6020836116e9565b9150611bd682611b95565b602082019050919050565b60006020820190508181036000830152611bfa81611bbe565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c3b826117fc565b9150611c46836117fc565b925082821015611c5957611c58611c01565b5b828203905092915050565b6000611c6f826117fc565b9150611c7a836117fc565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611caf57611cae611c01565b5b828201905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611d166025836116e9565b9150611d2182611cba565b604082019050919050565b60006020820190508181036000830152611d4581611d09565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611da86026836116e9565b9150611db382611d4c565b604082019050919050565b60006020820190508181036000830152611dd781611d9b565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611e3a6024836116e9565b9150611e4582611dde565b604082019050919050565b60006020820190508181036000830152611e6981611e2d565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611ecc6022836116e9565b9150611ed782611e70565b604082019050919050565b60006020820190508181036000830152611efb81611ebf565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611f386020836116e9565b9150611f4382611f02565b602082019050919050565b60006020820190508181036000830152611f6781611f2b565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b6000611fa4601d836116e9565b9150611faf82611f6e565b602082019050919050565b60006020820190508181036000830152611fd381611f97565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006120366025836116e9565b915061204182611fda565b604082019050919050565b6000602082019050818103600083015261206581612029565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006120c86023836116e9565b91506120d38261206c565b604082019050919050565b600060208201905081810360008301526120f7816120bb565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b600061215a6026836116e9565b9150612165826120fe565b604082019050919050565b600060208201905081810360008301526121898161214d565b9050919050565b600061219b826117fc565b91506121a6836117fc565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156121df576121de611c01565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612224826117fc565b915061222f836117fc565b92508261223f5761223e6121ea565b5b82820490509291505056fea2646970667358221220965550039af5692c80ec16b46dc19b38e3fe9ba44833d5bdf15d823c0c5c681764736f6c634300080b0033
Verified Source Code Partial Match
Compiler: v0.8.11+commit.d7f03943
EVM: london
Optimization: No
main.sol 984 lines
// This contract is part of Zellic’s smart contract dataset, which is a collection of publicly available contract code gathered as of March 2023.
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// 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: @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/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @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.
*/
abstract 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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the 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), "Ownable: new owner is the zero 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);
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// 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);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
/**
* @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.7.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
/**
* @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.zeppelin.solutions/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;
}
_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;
_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;
}
_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: Token.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
contract Token is Context, ERC20, Ownable {
using SafeMath for uint256;
uint8 private _decimals = 8;
mapping (address => bool) private _isBlackList;
uint256 private _tax = 0;
address private _taxAccount;
struct Restriction{
uint256 delay;
uint256 amount;
}
mapping (address => Restriction) private _Restrictions;
mapping (address => uint256) private _UserRestrictions;
constructor(string memory name, string memory symbol, uint256 initialSupply, uint8 decimals, address owner)ERC20(name, symbol){
_decimals = decimals;
transferOwnership(owner);
_mint(owner, initialSupply);
}
function decimals() public view override returns (uint8) {
return _decimals;
}
function transferFrom(
address from,
address to,
uint256 amount
) public override returns (bool) {
require(!_isBlackList[from], "Sender in Black List");
// require(!_isBlackList[to], "Receiver in Black List");
address spender = _msgSender();
_spendAllowance(from, spender, amount);
require(checkRestriction(from, to, amount), "Restriction (amount/delay) error");
uint256 tax = calculateTaxFee(amount);
if(tax > 0){
amount = amount - tax;
_transfer(from, _taxAccount, tax);
}
_transfer(from, to, amount);
return true;
}
function transfer(address to, uint256 amount) public override returns (bool) {
address owner = _msgSender();
require(!_isBlackList[owner], "Sender in Black List");
// require(!_isBlackList[to], "Receiver in Black List");
require(checkRestriction(owner, to, amount), "Restriction (amount/delay) error");
uint256 tax = calculateTaxFee(amount);
if(tax > 0){
amount = amount - tax;
_transfer(owner, _taxAccount, tax);
}
_transfer(owner, to, amount);
return true;
}
function ExcludeFromBlackList(address account) public onlyOwner() {
_isBlackList[account] = false;
}
function IncludeInBlackList(address account) public onlyOwner() {
_isBlackList[account] = true;
}
function getRestriction(address account) public view onlyOwner() returns (Restriction memory) {
return _Restrictions[account];
}
function deleteRestriction(address account) public onlyOwner() {
delete _Restrictions[account];
}
function addRestriction(address account, uint256 delay, uint256 amount) public onlyOwner() {
_Restrictions[account].amount = amount;
_Restrictions[account].delay = delay;
}
function checkRestriction(address from, address to, uint256 amount) private returns (bool) {
if(!(_Restrictions[to].delay > 0) && !(_Restrictions[to].amount > 0))
return true;
if(_Restrictions[to].amount > 0 && amount > _Restrictions[to].amount)
return false;
if(_Restrictions[to].delay > 0 && _UserRestrictions[from] > block.timestamp - _Restrictions[to].delay)
return false;
if(_Restrictions[to].delay > 0)
_UserRestrictions[from] = block.timestamp;
return true;
}
function setTax(address account, uint256 tax) public onlyOwner() {
_tax = tax;
_taxAccount = account;
}
function getTax() public view onlyOwner() returns (address account, uint256 tax){
return (_taxAccount, _tax);
}
function deleteTax() public onlyOwner() {
_tax = 0;
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
if(_tax > 0)
return _amount.mul(_tax).div(10**2);
else
return 0;
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
getRestriction 0x4a57a6b2 → tuple
getTax 0x54b762a6 → address, uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
ExcludeFromBlackList 0x850c7226
address account
IncludeInBlackList 0x798c2c10
address account
addRestriction 0x11c28b59
address account
uint256 delay
uint256 amount
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
deleteRestriction 0x424e7b3d
address account
deleteTax 0x83e6ab04
No parameters
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
setTax 0x3d745726
address account
uint256 tax
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address