Address Contract Partially Verified
Address
0x70d5F3614f7EDFbF5c0E5612196de7E0fc6Ea644
Balance
0 ETH
Nonce
1
Code Size
9057 bytes
Creator
0x26F3103b...679e at tx 0x47165003...2a3478
Indexed Transactions
0
Contract Bytecode
9057 bytes
0x6080604052600436106101b75760003560e01c80636c0360eb116100ec578063ad8f0aa61161008a578063c668286211610064578063c6682862146104d0578063c87b56dd146104e5578063e985e9c514610505578063f2fde38b1461054e57600080fd5b8063ad8f0aa614610488578063b3fd919d14610490578063b88d4fde146104b057600080fd5b80638da5cb5b116100c65780638da5cb5b1461041f57806395d89b411461043d578063a22cb46514610452578063a2309ff81461047257600080fd5b80636c0360eb146103d557806370a08231146103ea578063715018a61461040a57600080fd5b806342842e0e116101595780634bd9d7b7116101335780634bd9d7b7146103525780634f1416281461038257806355f804b3146103955780636352211e146103b557600080fd5b806342842e0e146102e5578063438b630014610305578063443323fe1461033257600080fd5b8063095ea7b311610195578063095ea7b31461024b578063150b7a021461026d57806318160ddd146102a657806323b872dd146102c557600080fd5b806301ffc9a7146101bc57806306fdde03146101f1578063081812fc14610213575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004611e8d565b61056e565b60405190151581526020015b60405180910390f35b3480156101fd57600080fd5b506102066105c0565b6040516101e891906120b3565b34801561021f57600080fd5b5061023361022e366004611f10565b610652565b6040516001600160a01b0390911681526020016101e8565b34801561025757600080fd5b5061026b610266366004611db4565b6106ec565b005b34801561027957600080fd5b5061028d610288366004611d01565b610802565b6040516001600160e01b031990911681526020016101e8565b3480156102b257600080fd5b50600a545b6040519081526020016101e8565b3480156102d157600080fd5b5061026b6102e0366004611cc0565b610813565b3480156102f157600080fd5b5061026b610300366004611cc0565b610844565b34801561031157600080fd5b50610325610320366004611c4d565b61085f565b6040516101e8919061206f565b34801561033e57600080fd5b5061032561034d366004611c4d565b6109a3565b34801561035e57600080fd5b506101dc61036d366004611f10565b600c6020526000908152604090205460ff1681565b61026b610390366004611de0565b610bce565b3480156103a157600080fd5b5061026b6103b0366004611ec7565b610dd5565b3480156103c157600080fd5b506102336103d0366004611f10565b610e16565b3480156103e157600080fd5b50610206610e8d565b3480156103f657600080fd5b506102b7610405366004611c4d565b610f1b565b34801561041657600080fd5b5061026b610fa2565b34801561042b57600080fd5b506006546001600160a01b0316610233565b34801561044957600080fd5b50610206610fd8565b34801561045e57600080fd5b5061026b61046d366004611d81565b610fe7565b34801561047e57600080fd5b506102b7600a5481565b61026b610ff2565b34801561049c57600080fd5b5061026b6104ab366004611de0565b611134565b3480156104bc57600080fd5b5061026b6104cb366004611d01565b6111f1565b3480156104dc57600080fd5b50610206611229565b3480156104f157600080fd5b50610206610500366004611f10565b611236565b34801561051157600080fd5b506101dc610520366004611c87565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561055a57600080fd5b5061026b610569366004611c4d565b611314565b60006001600160e01b031982166380ac58cd60e01b148061059f57506001600160e01b03198216635b5e139f60e01b145b806105ba57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546105cf9061223e565b80601f01602080910402602001604051908101604052809291908181526020018280546105fb9061223e565b80156106485780601f1061061d57610100808354040283529160200191610648565b820191906000526020600020905b81548152906001019060200180831161062b57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166106d05760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006106f782610e16565b9050806001600160a01b0316836001600160a01b031614156107655760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106c7565b336001600160a01b038216148061078157506107818133610520565b6107f35760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106c7565b6107fd83836113af565b505050565b630a85bd0160e11b5b949350505050565b61081d338261141d565b6108395760405162461bcd60e51b81526004016106c79061214d565b6107fd838383611513565b6107fd838383604051806020016040528060008152506111f1565b6060600061086c83610f1b565b905060008167ffffffffffffffff811115610889576108896122ea565b6040519080825280602002602001820160405280156108b2578160200160208202803683370190505b5090506000806108c1600a5490565b905060005b81811015610998576000818152600260205260409020546001600160a01b03161580159061094157876001600160a01b031661090183610e16565b6001600160a01b0316141561093c5781858581518110610923576109236122d4565b60209081029190910101528361093881612279565b9450505b610985565b801580156109725750846109566001886121fb565b81518110610966576109666122d4565b60200260200101516000145b15610985578261098181612279565b9350505b508061099081612279565b9150506108c6565b509195945050505050565b600b546040516370a0823160e01b81526001600160a01b0383811660048301526060926000929116906370a082319060240160206040518083038186803b1580156109ed57600080fd5b505afa158015610a01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a259190611f29565b905060008167ffffffffffffffff811115610a4257610a426122ea565b604051908082528060200260200182016040528015610a6b578160200160208202803683370190505b509050600080600b60009054906101000a90046001600160a01b03166001600160a01b031663626be5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610abf57600080fd5b505afa158015610ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af79190611f29565b905060015b81811161099857600b546040516331a9108f60e11b8152600481018390526001600160a01b03898116921690636352211e9060240160206040518083038186803b158015610b4957600080fd5b505afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b819190611c6a565b6001600160a01b03161415610bbc5780848481518110610ba357610ba36122d4565b602090810291909101015282610bb881612279565b9350505b80610bc681612279565b915050610afc565b60026007541415610c215760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106c7565b6002600755333214610c3257600080fd5b60005b8151811015610dcc57600b5482516001600160a01b0390911690636352211e90849084908110610c6757610c676122d4565b60200260200101516040518263ffffffff1660e01b8152600401610c8d91815260200190565b60206040518083038186803b158015610ca557600080fd5b505afa158015610cb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdd9190611c6a565b6001600160a01b0316336001600160a01b031614610cfa57600080fd5b600c6000838381518110610d1057610d106122d4565b60209081029190910181015182528101919091526040016000205460ff1615610d3857600080fd5b6001600a6000828254610d4b91906121cf565b925050819055506001600c6000848481518110610d6a57610d6a6122d4565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550610dba33838381518110610dad57610dad6122d4565b60200260200101516116af565b80610dc481612279565b915050610c35565b50506001600755565b6006546001600160a01b03163314610dff5760405162461bcd60e51b81526004016106c790612118565b8051610e12906008906020840190611b5c565b5050565b6000818152600260205260408120546001600160a01b0316806105ba5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106c7565b60088054610e9a9061223e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ec69061223e565b8015610f135780601f10610ee857610100808354040283529160200191610f13565b820191906000526020600020905b815481529060010190602001808311610ef657829003601f168201915b505050505081565b60006001600160a01b038216610f865760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106c7565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b03163314610fcc5760405162461bcd60e51b81526004016106c790612118565b610fd660006117f1565b565b6060600180546105cf9061223e565b610e12338383611843565b600260075414156110455760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106c7565b600260075533321461105657600080fd5b6000611061336109a3565b905060005b8151811015610dcc57600c6000838381518110611085576110856122d4565b60209081029190910181015182528101919091526040016000205460ff16156110ad57600080fd5b6001600a60008282546110c091906121cf565b925050819055506001600c60008484815181106110df576110df6122d4565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555061112233838381518110610dad57610dad6122d4565b8061112c81612279565b915050611066565b6006546001600160a01b0316331461115e5760405162461bcd60e51b81526004016106c790612118565b60005b8151811015610e12576001600a600082825461117d91906121cf565b925050819055506001600c600084848151811061119c5761119c6122d4565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055506111df33838381518110610dad57610dad6122d4565b806111e981612279565b915050611161565b6111fb338361141d565b6112175760405162461bcd60e51b81526004016106c79061214d565b61122384848484611912565b50505050565b60098054610e9a9061223e565b6000818152600260205260409020546060906001600160a01b03166112b55760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016106c7565b60006112bf611945565b905060008151116112df576040518060200160405280600081525061130d565b806112e984611954565b60096040516020016112fd93929190611f6e565b6040516020818303038152906040525b9392505050565b6006546001600160a01b0316331461133e5760405162461bcd60e51b81526004016106c790612118565b6001600160a01b0381166113a35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106c7565b6113ac816117f1565b50565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906113e482610e16565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166114965760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106c7565b60006114a183610e16565b9050806001600160a01b0316846001600160a01b031614806114e857506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b8061080b5750836001600160a01b031661150184610652565b6001600160a01b031614949350505050565b826001600160a01b031661152682610e16565b6001600160a01b03161461158a5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016106c7565b6001600160a01b0382166115ec5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106c7565b6115f76000826113af565b6001600160a01b03831660009081526003602052604081208054600192906116209084906121fb565b90915550506001600160a01b038216600090815260036020526040812080546001929061164e9084906121cf565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b0382166117055760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106c7565b6000818152600260205260409020546001600160a01b03161561176a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106c7565b6001600160a01b03821660009081526003602052604081208054600192906117939084906121cf565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156118a55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106c7565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61191d848484611513565b61192984848484611a52565b6112235760405162461bcd60e51b81526004016106c7906120c6565b6060600880546105cf9061223e565b6060816119785750506040805180820190915260018152600360fc1b602082015290565b8160005b81156119a2578061198c81612279565b915061199b9050600a836121e7565b915061197c565b60008167ffffffffffffffff8111156119bd576119bd6122ea565b6040519080825280601f01601f1916602001820160405280156119e7576020820181803683370190505b5090505b841561080b576119fc6001836121fb565b9150611a09600a86612294565b611a149060306121cf565b60f81b818381518110611a2957611a296122d4565b60200101906001600160f81b031916908160001a905350611a4b600a866121e7565b94506119eb565b60006001600160a01b0384163b15611b5457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611a96903390899088908890600401612032565b602060405180830381600087803b158015611ab057600080fd5b505af1925050508015611ae0575060408051601f3d908101601f19168201909252611add91810190611eaa565b60015b611b3a573d808015611b0e576040519150601f19603f3d011682016040523d82523d6000602084013e611b13565b606091505b508051611b325760405162461bcd60e51b81526004016106c7906120c6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061080b565b50600161080b565b828054611b689061223e565b90600052602060002090601f016020900481019282611b8a5760008555611bd0565b82601f10611ba357805160ff1916838001178555611bd0565b82800160010185558215611bd0579182015b82811115611bd0578251825591602001919060010190611bb5565b50611bdc929150611be0565b5090565b5b80821115611bdc5760008155600101611be1565b600067ffffffffffffffff831115611c0f57611c0f6122ea565b611c22601f8401601f191660200161219e565b9050828152838383011115611c3657600080fd5b828260208301376000602084830101529392505050565b600060208284031215611c5f57600080fd5b813561130d81612300565b600060208284031215611c7c57600080fd5b815161130d81612300565b60008060408385031215611c9a57600080fd5b8235611ca581612300565b91506020830135611cb581612300565b809150509250929050565b600080600060608486031215611cd557600080fd5b8335611ce081612300565b92506020840135611cf081612300565b929592945050506040919091013590565b60008060008060808587031215611d1757600080fd5b8435611d2281612300565b93506020850135611d3281612300565b925060408501359150606085013567ffffffffffffffff811115611d5557600080fd5b8501601f81018713611d6657600080fd5b611d7587823560208401611bf5565b91505092959194509250565b60008060408385031215611d9457600080fd5b8235611d9f81612300565b915060208301358015158114611cb557600080fd5b60008060408385031215611dc757600080fd5b8235611dd281612300565b946020939093013593505050565b60006020808385031215611df357600080fd5b823567ffffffffffffffff80821115611e0b57600080fd5b818501915085601f830112611e1f57600080fd5b813581811115611e3157611e316122ea565b8060051b9150611e4284830161219e565b8181528481019084860184860187018a1015611e5d57600080fd5b600095505b83861015611e80578035835260019590950194918601918601611e62565b5098975050505050505050565b600060208284031215611e9f57600080fd5b813561130d81612315565b600060208284031215611ebc57600080fd5b815161130d81612315565b600060208284031215611ed957600080fd5b813567ffffffffffffffff811115611ef057600080fd5b8201601f81018413611f0157600080fd5b61080b84823560208401611bf5565b600060208284031215611f2257600080fd5b5035919050565b600060208284031215611f3b57600080fd5b5051919050565b60008151808452611f5a816020860160208601612212565b601f01601f19169290920160200192915050565b600084516020611f818285838a01612212565b855191840191611f948184848a01612212565b8554920191600090600181811c9080831680611fb157607f831692505b858310811415611fcf57634e487b7160e01b85526022600452602485fd5b808015611fe35760018114611ff457612021565b60ff19851688528388019550612021565b60008b81526020902060005b858110156120195781548a820152908401908801612000565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061206590830184611f42565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156120a75783518352928401929184019160010161208b565b50909695505050505050565b60208152600061130d6020830184611f42565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff811182821017156121c7576121c76122ea565b604052919050565b600082198211156121e2576121e26122a8565b500190565b6000826121f6576121f66122be565b500490565b60008282101561220d5761220d6122a8565b500390565b60005b8381101561222d578181015183820152602001612215565b838111156112235750506000910152565b600181811c9082168061225257607f821691505b6020821081141561227357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561228d5761228d6122a8565b5060010190565b6000826122a3576122a36122be565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146113ac57600080fd5b6001600160e01b0319811681146113ac57600080fdfea2646970667358221220f526e0acb97da5611ade792d130787a67c2e45c22cd1045c4bce87eaf39c884464736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
SLAPES.sol 1549 lines
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// 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 v4.4.1 (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 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: 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/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address,
address,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` 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 tokenId
) 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.
* - `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 tokenId
) internal virtual {}
}
// File: slapeold.sol
pragma solidity ^0.8.0;
/// SPDX-License-Identifier: UNLICENSED
/*
______ __ _ _ _
.' ____ \ [ | / |_ (_) / \
| (___ \_|__ _ _ .--. .---. _ .--. | | ,--. `| |-'__ _ __ .---. / _ \ _ .--. .---. .--.
_.____`.[ | | |[ '/'`\ \/ /__\\[ `/'`\]| | `'_\ : | | [ |[ \ [ ]/ /__\\ / ___ \ [ '/'`\ \/ /__\\( (`\]
| \____) || \_/ |,| \__/ || \__., | | | | // | |,| |, | | \ \/ / | \__., _/ / \ \_ | \__/ || \__., `'.'.
\______.''.__.'_/| ;.__/ '.__.'[___] [___]\'-;__/\__/[___] \__/ '.__.' |____| |____|| ;.__/ '.__.'[\__) )
[__| [__|
*/
contract SUPERLATIVEAPES is ERC721, Ownable {
using Strings for uint256;
using Counters for Counters.Counter;
string public baseURI;
string public baseExtension = ".json";
uint256 public maxTx = 5;
uint256 public maxPreTx = 2;
uint256 public maxSupply = 4444;
uint256 public presaleSupply = 2400;
uint256 public price = 0.069 ether;
//December 16th 3AM GMT
uint256 public presaleTime = 1639623600;
//December 16th 11PM GMT
uint256 public presaleClose = 1639695600;
//December 17th 3AM GMT
uint256 public mainsaleTime = 1639710000;
Counters.Counter private _tokenIdTracker;
mapping (address => bool) public presaleWallets;
mapping (address => uint256) public presaleWalletLimits;
mapping (address => uint256) public mainsaleWalletLimits;
modifier isMainsaleOpen
{
require(block.timestamp >= mainsaleTime);
_;
}
modifier isPresaleOpen
{
require(block.timestamp >= presaleTime && block.timestamp <= presaleClose, "Presale closed!");
_;
}
constructor(string memory _initBaseURI) ERC721("Superlative Apes", "SLAPE")
{
setBaseURI(_initBaseURI);
for(uint256 i=0; i<100; i++)
{
_tokenIdTracker.increment();
_safeMint(msg.sender, totalToken());
}
for(uint256 i=0; i<100; i++)
{
_tokenIdTracker.increment();
_safeMint(0xE5dF6d3Ca3CE03015a6AB93CD6d98D5b4fdb9c11, totalToken());
}
for(uint256 i=0; i<100; i++)
{
_tokenIdTracker.increment();
_safeMint(0x3047866171b5E450449f9B1B492D2670aA08A746, totalToken());
}
}
function setPrice(uint256 newPrice) external onlyOwner {
price = newPrice;
}
function setMaxTx(uint newMax) external onlyOwner {
maxTx = newMax;
}
function totalToken() public view returns (uint256) {
return _tokenIdTracker.current();
}
function mainSale(uint8 mintTotal) public payable isMainsaleOpen
{
uint256 totalMinted = mintTotal + mainsaleWalletLimits[msg.sender];
require(mintTotal >= 1 && mintTotal <= maxTx, "Mint Amount Incorrect");
require(msg.value >= price * mintTotal, "Minting a SLAPE APE Costs 0.069 Ether Each!");
require(totalToken() <= maxSupply, "SOLD OUT!");
require(totalMinted <= maxTx, "You'll pass mint limit!");
for(uint i=0;i<mintTotal;i++)
{
mainsaleWalletLimits[msg.sender]++;
_tokenIdTracker.increment();
require(totalToken() <= maxSupply, "SOLD OUT!");
_safeMint(msg.sender, totalToken());
}
}
function preSale(uint8 mintTotal) public payable isPresaleOpen
{
uint256 totalMinted = mintTotal + presaleWalletLimits[msg.sender];
require(presaleWallets[msg.sender] == true, "You aren't whitelisted!");
require(mintTotal >= 1 && mintTotal <= maxTx, "Mint Amount Incorrect");
require(msg.value >= price * mintTotal, "Minting a SLAPE APE Costs 0.069 Ether Each!");
require(totalToken() <= presaleSupply, "SOLD OUT!");
require(totalMinted <= maxPreTx, "You'll pass mint limit!");
for(uint i=0; i<mintTotal; i++)
{
presaleWalletLimits[msg.sender]++;
_tokenIdTracker.increment();
require(totalToken() <= presaleSupply, "SOLD OUT!");
_safeMint(msg.sender, totalToken());
}
}
function airdrop(address airdropPatricipent, uint8 tokenID) public payable onlyOwner
{
_transfer(address(this), airdropPatricipent, tokenID);
}
function addWhiteList(address[] memory whiteListedAddresses) public onlyOwner
{
for(uint256 i=0; i<whiteListedAddresses.length;i++)
{
presaleWallets[whiteListedAddresses[i]] = true;
}
}
function isAddressWhitelisted(address whitelist) public view returns(bool)
{
return presaleWallets[whitelist];
}
function withdrawContractEther(address payable recipient) external onlyOwner
{
recipient.transfer(getBalance());
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseURI = _newBaseURI;
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory)
{
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : "";
}
function getBalance() public view returns(uint)
{
return address(this).balance;
}
}
// File: slapeFix.sol
pragma solidity 0.8.7;
contract SLAPES is ERC721, Ownable, ReentrancyGuard, ERC721Holder {
using Address for address;
using Strings for uint256;
string public baseURI;
string public baseExtension = ".json";
uint256 public totalMinted;
SUPERLATIVEAPES slapes = SUPERLATIVEAPES(0x1e87eE9249Cc647Af9EDEecB73D6b76AF14d8C27);
mapping (uint256 => bool) public slapeIdMinted;
constructor(string memory _initBaseURI) ERC721("Superlative Apes", "SLAPE") {
setBaseURI(_initBaseURI);
}
modifier onlySender {
require(msg.sender == tx.origin);
_;
}
function slapeAuto() public payable nonReentrant onlySender
{
uint256[] memory slapeIDS = walletOfSlapeOwner(msg.sender);
for(uint256 i=0; i<slapeIDS.length; i++)
{
require(slapeIdMinted[slapeIDS[i]] == false);
totalMinted +=1;
slapeIdMinted[slapeIDS[i]] = true;
_mint(msg.sender, slapeIDS[i]);
}
}
function slapeMint(uint256[] memory slapeIDS) public payable nonReentrant onlySender
{
for(uint256 i=0; i<slapeIDS.length; i++)
{
require(msg.sender == slapes.ownerOf(slapeIDS[i]));
require(slapeIdMinted[slapeIDS[i]] == false);
totalMinted +=1;
slapeIdMinted[slapeIDS[i]] = true;
_mint(msg.sender, slapeIDS[i]);
}
}
function totalSupply() public view returns (uint256)
{
return totalMinted;
}
function devMint(uint256[] memory slap...
// [truncated — 51955 bytes total]
Read Contract
balanceOf 0x70a08231 → uint256
baseExtension 0xc6682862 → string
baseURI 0x6c0360eb → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
slapeIdMinted 0x4bd9d7b7 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalMinted 0xa2309ff8 → uint256
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
walletOfSlapeOwner 0x443323fe → uint256[]
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
devMint 0xb3fd919d
uint256[] slapeIDS
onERC721Received 0x150b7a02
address
address
uint256
bytes
returns: bytes4
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _newBaseURI
slapeAuto 0xad8f0aa6
No parameters
slapeMint 0x4f141628
uint256[] slapeIDS
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address