Address Contract Verified
Address
0xa851f5B0b5c3f6061A5195EEFDbCa0Da11043B0E
Balance
0 ETH
Nonce
1
Code Size
14115 bytes
Creator
0x0c90C87b...2380 at tx 0x363e5575...ced830
Indexed Transactions
0
Contract Bytecode
14115 bytes
0x608060405234801561001057600080fd5b506004361061025b5760003560e01c80636b20c45411610145578063a3106b95116100bd578063e985e9c51161008c578063f242432a11610071578063f242432a146104b5578063f2fde38b146104c8578063f5298aca146104db5761025b565b8063e985e9c51461048f578063ef140d35146104a25761025b565b8063a3106b951461044e578063bd85b03914610461578063d351cfdc14610474578063e8a3d485146104875761025b565b80638da5cb5b11610114578063938e3d7b116100f9578063938e3d7b1461042057806395d89b4114610433578063a22cb4651461043b5761025b565b80638da5cb5b14610405578063922d62bd1461040d5761025b565b80636b20c454146103b5578063715018a6146103c857806383240f83146103d05780638770d21e146103f25761025b565b806334d722c9116101d85780634e1273f4116101a757806355a373d61161018c57806355a373d61461039257806359c74f291461039a5780635e2da7e2146103a25761025b565b80634e1273f41461035f5780634f558e791461037f5761025b565b806334d722c91461032757806336d300b31461033c5780633ccfd60b1461034f578063471a4294146103575761025b565b80630e89341c1161022f57806326a4e8d21161021457806326a4e8d2146102f95780632eb2c2d61461030c578063317d94531461031f5761025b565b80630e89341c146102d357806322089d40146102e65761025b565b8062fdd58e1461026057806301ffc9a71461028957806302fe5305146102a957806306fdde03146102be575b600080fd5b61027361026e36600461278a565b6104ee565b60405161028091906134bd565b60405180910390f35b61029c610297366004612914565b610545565b6040516102809190612bf1565b6102bc6102b736600461294c565b6105bf565b005b6102c661060a565b6040516102809190612bfc565b6102c66102e136600461299a565b61069d565b6102bc6102f43660046129ca565b610731565b6102bc61030736600461258e565b61091c565b6102bc61031a3660046125da565b61098a565b6102736109e8565b61032f610aae565b6040516102809190612ac9565b6102bc61034a3660046129eb565b610abd565b6102bc610b3f565b61029c610c3c565b61037261036d3660046127e5565b610c4c565b6040516102809190612bb0565b61029c61038d36600461299a565b610d6c565b61032f610d83565b6102bc610d92565b6102bc6103b03660046129ca565b610e0d565b6102bc6103c33660046126e3565b610e6b565b6102bc610ec5565b6103e36103de36600461299a565b610f10565b604051610280939291906134d4565b6102bc610400366004612a16565b610f31565b61032f610fb2565b6102bc61041b3660046127b3565b610fc1565b6102bc61042e36600461294c565b61101b565b6102c661106d565b6102bc610449366004612754565b61107c565b6102bc61045c36600461258e565b61108e565b61027361046f36600461299a565b6110fc565b6102bc6104823660046128ae565b61110e565b6102c661116d565b61029c61049d3660046125a8565b61117c565b6102bc6104b036600461299a565b6111aa565b6102bc6104c3366004612680565b6111f4565b6102bc6104d636600461258e565b61124b565b6102bc6104e93660046127b3565b6112b9565b60006001600160a01b03831661051f5760405162461bcd60e51b815260040161051690612d00565b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806105a857506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b806105b757506105b78261130e565b90505b919050565b6105c7611340565b6001600160a01b03166105d8610fb2565b6001600160a01b0316146105fe5760405162461bcd60e51b81526004016105169061316d565b61060781611344565b50565b60606008805461061990613571565b80601f016020809104026020016040519081016040528092919081815260200182805461064590613571565b80156106925780601f1061066757610100808354040283529160200191610692565b820191906000526020600020905b81548152906001019060200180831161067557829003601f168201915b505050505090505b90565b6060600280546106ac90613571565b80601f01602080910402602001604051908101604052809291908181526020018280546106d890613571565b80156107255780601f106106fa57610100808354040283529160200191610725565b820191906000526020600020905b81548152906001019060200180831161070857829003601f168201915b50505050509050919050565b600260055414156107545760405162461bcd60e51b815260040161051690613418565b600260055532331461076557600080fd5b6007546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610796903390600401612ac9565b60206040518083038186803b1580156107ae57600080fd5b505afa1580156107c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e691906129b2565b6000848152600c60205260409020549091508190610805908490613526565b11156108235760405162461bcd60e51b815260040161051690612cc9565b600b54600160a01b900460ff1661084c5760405162461bcd60e51b815260040161051690613486565b6000838152600c602052604090206001015482111561087d5760405162461bcd60e51b815260040161051690612f65565b6000838152600c602052604090206002015482610899856110fc565b6108a3919061350e565b11156108c15760405162461bcd60e51b81526004016105169061344f565b6000838152600c60205260409020546108f790339030906108e3908690613526565b6007546001600160a01b0316929190611357565b610912338484604051806020016040528060008152506113c4565b5050600160055550565b610924611340565b6001600160a01b0316610935610fb2565b6001600160a01b03161461095b5760405162461bcd60e51b81526004016105169061316d565b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610992611340565b6001600160a01b0316856001600160a01b031614806109b857506109b88561049d611340565b6109d45760405162461bcd60e51b81526004016105169061301f565b6109e185858585856114d5565b5050505050565b60006109f2611340565b6001600160a01b0316610a03610fb2565b6001600160a01b031614610a295760405162461bcd60e51b81526004016105169061316d565b6007546040516370a0823160e01b81526001600160a01b03909116906370a0823190610a59903090600401612ac9565b60206040518083038186803b158015610a7157600080fd5b505afa158015610a85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa991906129b2565b905090565b600b546001600160a01b031681565b610ac5611340565b6001600160a01b0316610ad6610fb2565b6001600160a01b031614610afc5760405162461bcd60e51b81526004016105169061316d565b6000600c6000610b0c60066116b4565b8152602081019190915260400160002084815560028101849055600181018390559050610b3960066116b8565b50505050565b610b47611340565b6001600160a01b0316610b58610fb2565b6001600160a01b031614610b7e5760405162461bcd60e51b81526004016105169061316d565b478015610b9657610b96610b90610fb2565b826116c1565b6007546040516370a0823160e01b81526001600160a01b03909116906370a0823190610bc6903090600401612ac9565b60206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1691906129b2565b9050801561060757610607610c29610fb2565b6007546001600160a01b0316908361175d565b600b54600160a01b900460ff1681565b60608151835114610c6f5760405162461bcd60e51b815260040161051690613301565b6000835167ffffffffffffffff811115610c9957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610cc2578160200160208202803683370190505b50905060005b8451811015610d6457610d29858281518110610cf457634e487b7160e01b600052603260045260246000fd5b6020026020010151858381518110610d1c57634e487b7160e01b600052603260045260246000fd5b60200260200101516104ee565b828281518110610d4957634e487b7160e01b600052603260045260246000fd5b6020908102919091010152610d5d816135d9565b9050610cc8565b509392505050565b6000908152600c6020526040902060020154151590565b6007546001600160a01b031681565b610d9a611340565b6001600160a01b0316610dab610fb2565b6001600160a01b031614610dd15760405162461bcd60e51b81526004016105169061316d565b600b80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff8116600160a01b9182900460ff1615909102179055565b610e15611340565b6001600160a01b0316610e26610fb2565b6001600160a01b031614610e4c5760405162461bcd60e51b81526004016105169061316d565b610e67338383604051806020016040528060008152506113c4565b5050565b610e73611340565b6001600160a01b0316836001600160a01b03161480610e995750610e998361049d611340565b610eb55760405162461bcd60e51b815260040161051690612e17565b610ec083838361177c565b505050565b610ecd611340565b6001600160a01b0316610ede610fb2565b6001600160a01b031614610f045760405162461bcd60e51b81526004016105169061316d565b610f0e6000611945565b565b600c6020526000908152604090208054600182015460029092015490919083565b610f39611340565b6001600160a01b0316610f4a610fb2565b6001600160a01b031614610f705760405162461bcd60e51b81526004016105169061316d565b610f7984610d6c565b610f955760405162461bcd60e51b8152600401610516906131ff565b6000938452600c6020526040909320918255600282015560010155565b6004546001600160a01b031690565b610fc9611340565b6001600160a01b0316610fda610fb2565b6001600160a01b0316146110005760405162461bcd60e51b81526004016105169061316d565b610ec0838383604051806020016040528060008152506113c4565b611023611340565b6001600160a01b0316611034610fb2565b6001600160a01b03161461105a5760405162461bcd60e51b81526004016105169061316d565b8051610e6790600a9060208401906123ef565b60606009805461061990613571565b610e67611087611340565b83836119a4565b611096611340565b6001600160a01b03166110a7610fb2565b6001600160a01b0316146110cd5760405162461bcd60e51b81526004016105169061316d565b600b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60009081526003602052604090205490565b600b546001600160a01b031633148061113657503361112b610fb2565b6001600160a01b0316145b6111525760405162461bcd60e51b81526004016105169061307c565b610e6733838360405180602001604052806000815250611a47565b6060600a805461061990613571565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6111b2611340565b6001600160a01b03166111c3610fb2565b6001600160a01b0316146111e95760405162461bcd60e51b81526004016105169061316d565b610607610c29610fb2565b6111fc611340565b6001600160a01b0316856001600160a01b0316148061122257506112228561049d611340565b61123e5760405162461bcd60e51b815260040161051690612e17565b6109e18585858585611bd7565b611253611340565b6001600160a01b0316611264610fb2565b6001600160a01b03161461128a5760405162461bcd60e51b81526004016105169061316d565b6001600160a01b0381166112b05760405162461bcd60e51b815260040161051690612d5d565b61060781611945565b6112c1611340565b6001600160a01b0316836001600160a01b031614806112e757506112e78361049d611340565b6113035760405162461bcd60e51b815260040161051690612e17565b610ec0838383611d34565b6001600160e01b031981167f01ffc9a70000000000000000000000000000000000000000000000000000000014919050565b3390565b8051610e679060029060208401906123ef565b610b39846323b872dd60e01b85858560405160240161137893929190612b3b565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611e64565b6001600160a01b0384166113ea5760405162461bcd60e51b8152600401610516906133bb565b60006113f4611340565b9050600061140185611ef3565b9050600061140e85611ef3565b905061141f83600089858589611f4c565b6000868152602081815260408083206001600160a01b038b1684529091528120805487929061144f90849061350e565b92505081905550866001600160a01b031660006001600160a01b0316846001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6289896040516114a69291906134c6565b60405180910390a46114bd836000898585896116ac565b6114cc83600089898989611f5a565b50505050505050565b81518351146114f65760405162461bcd60e51b81526004016105169061335e565b6001600160a01b03841661151c5760405162461bcd60e51b815260040161051690612fc2565b6000611526611340565b9050611536818787878787611f4c565b60005b845181101561163857600085828151811061156457634e487b7160e01b600052603260045260246000fd5b60200260200101519050600085838151811061159057634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156115e05760405162461bcd60e51b815260040161051690613110565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061161d90849061350e565b9250508190555050505080611631906135d9565b9050611539565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611688929190612bc3565b60405180910390a461169e8187878787876116ac565b6116ac81878787878761207f565b505050505050565b5490565b80546001019055565b804710156116e15760405162461bcd60e51b815260040161051690612ed1565b6000826001600160a01b0316826040516116fa9061069a565b60006040518083038185875af1925050503d8060008114611737576040519150601f19603f3d011682016040523d82523d6000602084013e61173c565b606091505b5050905080610ec05760405162461bcd60e51b815260040161051690612e74565b610ec08363a9059cbb60e01b8484604051602401611378929190612b97565b6001600160a01b0383166117a25760405162461bcd60e51b8152600401610516906130b3565b80518251146117c35760405162461bcd60e51b81526004016105169061335e565b60006117cd611340565b90506117ed81856000868660405180602001604052806000815250611f4c565b60005b83518110156118ce57600084828151811061181b57634e487b7160e01b600052603260045260246000fd5b60200260200101519050600084838151811061184757634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038c1683529093529190912054909150818110156118975760405162461bcd60e51b815260040161051690612dba565b6000928352602083815260408085206001600160a01b038b16865290915290922091039055806118c6816135d9565b9150506117f0565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb868660405161191f929190612bc3565b60405180910390a4610b39818560008686604051806020016040528060008152506116ac565b600480546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156119d65760405162461bcd60e51b815260040161051690613247565b6001600160a01b0383811660008181526001602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190611a3a908590612bf1565b60405180910390a3505050565b6001600160a01b038416611a6d5760405162461bcd60e51b8152600401610516906133bb565b8151835114611a8e5760405162461bcd60e51b81526004016105169061335e565b6000611a98611340565b9050611aa981600087878787611f4c565b60005b8451811015611b6057838181518110611ad557634e487b7160e01b600052603260045260246000fd5b6020026020010151600080878481518110611b0057634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254611b48919061350e565b90915550819050611b58816135d9565b915050611aac565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611bb1929190612bc3565b60405180910390a4611bc8816000878787876116ac565b6109e18160008787878761207f565b6001600160a01b038416611bfd5760405162461bcd60e51b815260040161051690612fc2565b6000611c07611340565b90506000611c1485611ef3565b90506000611c2185611ef3565b9050611c31838989858589611f4c565b6000868152602081815260408083206001600160a01b038c16845290915290205485811015611c725760405162461bcd60e51b815260040161051690613110565b6000878152602081815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290611caf90849061350e565b92505081905550876001600160a01b0316896001600160a01b0316856001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628a8a604051611d059291906134c6565b60405180910390a4611d1b848a8a86868a6116ac565b611d29848a8a8a8a8a611f5a565b505050505050505050565b6001600160a01b038316611d5a5760405162461bcd60e51b8152600401610516906130b3565b6000611d64611340565b90506000611d7184611ef3565b90506000611d7e84611ef3565b9050611d9e83876000858560405180602001604052806000815250611f4c565b6000858152602081815260408083206001600160a01b038a16845290915290205484811015611ddf5760405162461bcd60e51b815260040161051690612dba565b6000868152602081815260408083206001600160a01b03808c16808652919093528184208986039055905190918716907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6290611e3e908b908b906134c6565b60405180910390a46114cc848860008686604051806020016040528060008152506116ac565b6000611eb9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121509092919063ffffffff16565b805190915015610ec05780806020019051810190611ed791906128f8565b610ec05760405162461bcd60e51b8152600401610516906132a4565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110611f3b57634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b6116ac868686868686612169565b611f6c846001600160a01b03166122e7565b156116ac5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190611fa59089908990889088908890600401612b5f565b602060405180830381600087803b158015611fbf57600080fd5b505af1925050508015611fef575060408051601f3d908101601f19168201909252611fec91810190612930565b60015b61204f57611ffb613620565b806308c379a014156120355750612010613637565b8061201b5750612037565b8060405162461bcd60e51b81526004016105169190612bfc565b505b60405162461bcd60e51b815260040161051690612c0f565b6001600160e01b0319811663f23a6e6160e01b146114cc5760405162461bcd60e51b815260040161051690612c6c565b612091846001600160a01b03166122e7565b156116ac5760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906120ca9089908990889088908890600401612add565b602060405180830381600087803b1580156120e457600080fd5b505af1925050508015612114575060408051601f3d908101601f1916820190925261211191810190612930565b60015b61212057611ffb613620565b6001600160e01b0319811663bc197c8160e01b146114cc5760405162461bcd60e51b815260040161051690612c6c565b606061215f84846000856122f6565b90505b9392505050565b6121778686868686866116ac565b6001600160a01b03851661221a5760005b8351811015612218578281815181106121b157634e487b7160e01b600052603260045260246000fd5b6020026020010151600360008684815181106121dd57634e487b7160e01b600052603260045260246000fd5b602002602001015181526020019081526020016000206000828254612202919061350e565b909155506122119050816135d9565b9050612188565b505b6001600160a01b0384166116ac5760005b83518110156114cc57600084828151811061225657634e487b7160e01b600052603260045260246000fd5b60200260200101519050600084838151811061228257634e487b7160e01b600052603260045260246000fd5b60200260200101519050600060036000848152602001908152602001600020549050818110156122c45760405162461bcd60e51b8152600401610516906131a2565b600092835260036020526040909220910390556122e0816135d9565b905061222b565b6001600160a01b03163b151590565b6060824710156123185760405162461bcd60e51b815260040161051690612f08565b612321856122e7565b61233d5760405162461bcd60e51b815260040161051690613210565b600080866001600160a01b031685876040516123599190612aad565b60006040518083038185875af1925050503d8060008114612396576040519150601f19603f3d011682016040523d82523d6000602084013e61239b565b606091505b50915091506123ab8282866123b6565b979650505050505050565b606083156123c5575081612162565b8251156123d55782518084602001fd5b8160405162461bcd60e51b81526004016105169190612bfc565b8280546123fb90613571565b90600052602060002090601f01602090048101928261241d5760008555612463565b82601f1061243657805160ff1916838001178555612463565b82800160010185558215612463579182015b82811115612463578251825591602001919060010190612448565b5061246f929150612473565b5090565b5b8082111561246f5760008155600101612474565b600067ffffffffffffffff8311156124a2576124a261360a565b6040516124b9601f8501601f1916602001826135ac565b8091508381528484840111156124ce57600080fd5b83836020830137600060208583010152509392505050565b80356001600160a01b03811681146105ba57600080fd5b600082601f83011261250d578081fd5b8135602061251a826134ea565b60405161252782826135ac565b838152828101915085830183850287018401881015612544578586fd5b855b8581101561256257813584529284019290840190600101612546565b5090979650505050505050565b600082601f83011261257f578081fd5b61216283833560208501612488565b60006020828403121561259f578081fd5b612162826124e6565b600080604083850312156125ba578081fd5b6125c3836124e6565b91506125d1602084016124e6565b90509250929050565b600080600080600060a086880312156125f1578081fd5b6125fa866124e6565b9450612608602087016124e6565b9350604086013567ffffffffffffffff80821115612624578283fd5b61263089838a016124fd565b94506060880135915080821115612645578283fd5b61265189838a016124fd565b93506080880135915080821115612666578283fd5b506126738882890161256f565b9150509295509295909350565b600080600080600060a08688031215612697578081fd5b6126a0866124e6565b94506126ae602087016124e6565b93506040860135925060608601359150608086013567ffffffffffffffff8111156126d7578182fd5b6126738882890161256f565b6000806000606084860312156126f7578283fd5b612700846124e6565b9250602084013567ffffffffffffffff8082111561271c578384fd5b612728878388016124fd565b9350604086013591508082111561273d578283fd5b5061274a868287016124fd565b9150509250925092565b60008060408385031215612766578182fd5b61276f836124e6565b9150602083013561277f816136c9565b809150509250929050565b6000806040838503121561279c578182fd5b6127a5836124e6565b946020939093013593505050565b6000806000606084860312156127c7578081fd5b6127d0846124e6565b95602085013595506040909401359392505050565b600080604083850312156127f7578182fd5b823567ffffffffffffffff8082111561280e578384fd5b818501915085601f830112612821578384fd5b8135602061282e826134ea565b60405161283b82826135ac565b8381528281019150858301838502870184018b1015612858578889fd5b8896505b848710156128815761286d816124e6565b83526001969096019591830191830161285c565b5096505086013592505080821115612897578283fd5b506128a4858286016124fd565b9150509250929050565b600080604083850312156128c0578182fd5b823567ffffffffffffffff808211156128d7578384fd5b6128e3868387016124fd565b93506020850135915080821115612897578283fd5b600060208284031215612909578081fd5b8151612162816136c9565b600060208284031215612925578081fd5b8135612162816136d7565b600060208284031215612941578081fd5b8151612162816136d7565b60006020828403121561295d578081fd5b813567ffffffffffffffff811115612973578182fd5b8201601f81018413612983578182fd5b61299284823560208401612488565b949350505050565b6000602082840312156129ab578081fd5b5035919050565b6000602082840312156129c3578081fd5b5051919050565b600080604083850312156129dc578182fd5b50508035926020909101359150565b6000806000606084860312156129ff578081fd5b505081359360208301359350604090920135919050565b60008060008060808587031215612a2b578182fd5b5050823594602084013594506040840135936060013592509050565b6000815180845260208085019450808401835b83811015612a7657815187529582019590820190600101612a5a565b509495945050505050565b60008151808452612a99816020860160208601613545565b601f01601f19169290920160200192915050565b60008251612abf818460208701613545565b9190910192915050565b6001600160a01b0391909116815260200190565b60006001600160a01b03808816835280871660208401525060a06040830152612b0960a0830186612a47565b8281036060840152612b1b8186612a47565b90508281036080840152612b2f8185612a81565b98975050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a060808301526123ab60a0830184612a81565b6001600160a01b03929092168252602082015260400190565b6000602082526121626020830184612a47565b600060408252612bd66040830185612a47565b8281036020840152612be88185612a47565b95945050505050565b901515815260200190565b6000602082526121626020830184612a81565b60208082526034908201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560408201527f526563656976657220696d706c656d656e746572000000000000000000000000606082015260800190565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a6563746560408201527f6420746f6b656e73000000000000000000000000000000000000000000000000606082015260800190565b60208082526018908201527f4e6f7420656e6f756768202441504520746f206d696e742e0000000000000000604082015260600190565b6020808252602b908201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60408201527f65726f2061646472657373000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60408201527f616e636500000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201527f20617070726f7665640000000000000000000000000000000000000000000000606082015260800190565b6020808252603a908201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260408201527f6563697069656e74206d61792068617665207265766572746564000000000000606082015260800190565b6020808252601d908201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526030908201527f596f752063616e2774206d696e742074686174206d616e7920746f6b656e732060408201527f706572207472616e73616374696f6e2e00000000000000000000000000000000606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526032908201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060408201527f6f776e6572206e6f7220617070726f7665640000000000000000000000000000606082015260800190565b6020808252601d908201527f596f75206d757374206861766520746865204d696e74657220726f6c65000000604082015260600190565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201527f72207472616e7366657200000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526028908201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460408201527f616c537570706c79000000000000000000000000000000000000000000000000606082015260800190565b602080825260009082015260400190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526029908201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360408201527f20666f722073656c660000000000000000000000000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526029908201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860408201527f206d69736d617463680000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060408201527f6d69736d61746368000000000000000000000000000000000000000000000000606082015260800190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360408201527f7300000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526016908201527f546f6b656e732061726520616c6c206d696e7465642e00000000000000000000604082015260600190565b60208082526019908201527f5075626c6963206d696e74206973206e6f742061637469766500000000000000604082015260600190565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b600067ffffffffffffffff8211156135045761350461360a565b5060209081020190565b60008219821115613521576135216135f4565b500190565b6000816000190483118215151615613540576135406135f4565b500290565b60005b83811015613560578181015183820152602001613548565b83811115610b395750506000910152565b60028104600182168061358557607f821691505b602082108114156135a657634e487b7160e01b600052602260045260246000fd5b50919050565b601f8201601f1916810167ffffffffffffffff811182821017156135d2576135d261360a565b6040525050565b60006000198214156135ed576135ed6135f4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561069a57600481823e5160e01c90565b600060443d10156136475761069a565b6040516003193d81016004833e81513d67ffffffffffffffff816024840111818411171561367957505050505061069a565b82850191508151818111156136935750505050505061069a565b843d87010160208285010111156136af5750505050505061069a565b6136be602082860101876135ac565b509094505050505090565b801515811461060757600080fd5b6001600160e01b03198116811461060757600080fdfea264697066735822122038bc0d3d1b73ee06142dc23bcb53a88432c2ada53b7bf342319660f3580d144064736f6c63430008010033
Verified Source Code Full Match
Compiler: v0.8.1+commit.df193b15
EVM: istanbul
Optimization: Yes (1000 runs)
ERC1155.sol 511 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @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, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
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);
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// 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;
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
SBSCardActions.sol 229 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.1;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
/**
* ( ( ( ( * ( )
* )\ ) ( )\ ) )\ ) )\ ) ( ` ( )\ ) ( /(
* (()/(( )\(()/( (()/(( ( (()/( )\))( )\ (()/( )\())
* /(_))((_)/(_)) /(_))\ )\ /(_)) ((_)()((((_)( /(_)|(_)\
* (_))((_)_(_)) (_))((_)((_)(_)) (_()((_)\ _ )\(_)) _((_)
* / __|| _ ) __| | _ \ __| __| | | \/ (_)_\(_) __|| || |
* \__ \| _ \__ \ | _/ _|| _|| |__ | |\/| |/ _ \ \__ \| __ |
* |___/|___/___/ |_| |___|___|____| |_| |_/_/ \_\|___/|_||_|
*/
/**
* @title SBS Card Actions ERC1155 Smart Contract only accepting $APE coin
* @dev Extends ERC1155
*/
contract SBSCardActions is ERC1155, ERC1155Supply, ERC1155Burnable, Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
using Counters for Counters.Counter;
Counters.Counter private counter;
address public tokenContract = 0x4d224452801ACEd8B2F0aebE155379bb5D594381;
string _name = "SBS Card Actions";
string _symbol = "SBSCA";
string private _contractURI;
address public minterAddress;
bool public mintIsActive = false;
mapping(uint256 => Action) public actions;
struct Action {
uint256 tokenPrice;
uint256 maxTokensPerTxn;
uint256 maxTokens;
}
constructor() ERC1155("") {}
/**
* @notice public mint for card actions
*/
function mintAction(uint256 tokenId, uint256 qty) external nonReentrant {
require(tx.origin == msg.sender);
uint256 apeBalance = IERC20(tokenContract).balanceOf(msg.sender);
require(actions[tokenId].tokenPrice * qty <= apeBalance, "Not enough $APE to mint.");
require(mintIsActive, "Public mint is not active");
require(
qty <= actions[tokenId].maxTokensPerTxn,
"You can't mint that many tokens per transaction."
);
require(
totalSupply(tokenId) + qty <= actions[tokenId].maxTokens,
"Tokens are all minted."
);
IERC20(tokenContract).safeTransferFrom(msg.sender, address(this), actions[tokenId].tokenPrice * qty);
_mint(msg.sender, tokenId, qty, "");
}
/**
* @notice create a new card action
*/
function addAction(
uint256 _tokenPrice,
uint256 _maxTokens,
uint256 _maxTokensPerTxn
) external onlyOwner {
Action storage p = actions[counter.current()];
p.tokenPrice = _tokenPrice;
p.maxTokens = _maxTokens;
p.maxTokensPerTxn = _maxTokensPerTxn;
counter.increment();
}
/**
* @notice edit an existing card action
*/
function editAction(
uint256 _actionId,
uint256 _tokenPrice,
uint256 _maxTokens,
uint256 _maxTokensPerTxn
) external onlyOwner {
require(exists(_actionId), "");
actions[_actionId].tokenPrice = _tokenPrice;
actions[_actionId].maxTokens = _maxTokens;
actions[_actionId].maxTokensPerTxn = _maxTokensPerTxn;
}
/**
* @notice turn on/off public mint
*/
function flipMintState() external onlyOwner {
mintIsActive = !mintIsActive;
}
/**
* @notice set address of minter for airdrops
*/
function setMinterAddress(address minter) public onlyOwner {
minterAddress = minter;
}
modifier onlyMinter {
require(minterAddress == msg.sender || owner() == msg.sender, "You must have the Minter role");
_;
}
/**
* @notice mint a collection
*/
function mintReserve(uint256 tokenId, uint256 amount) public onlyOwner {
_mint(msg.sender, tokenId, amount, "");
}
/**
* @notice mint a batch of token collections for airdrops
*/
function mintBatch(
uint256[] memory ids,
uint256[] memory amounts
) public onlyMinter {
_mintBatch(msg.sender, ids, amounts, "");
}
/**
* @notice mint a collection to a wallet
*/
function mintToWallet(address toWallet, uint256 tokenId, uint256 amount) public onlyOwner {
_mint(toWallet, tokenId, amount, "");
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
/**
* @notice erc20 token balance of contract address
*/
function getContractTokenBalance() public onlyOwner view returns(uint256){
return IERC20(tokenContract).balanceOf(address(this));
}
/**
* @notice does token exist
*/
function exists(uint256 id) public view override returns (bool) {
return actions[id].maxTokens > 0;
}
// @title SETTER FUNCTIONS
/**
* @notice set token base uri
*/
function setURI(string memory baseURI) public onlyOwner {
_setURI(baseURI);
}
/**
* @notice set token contract for erc20
*/
function setTokenAddress(address token) public onlyOwner {
tokenContract = token;
}
/**
* @notice set contract uri https://docs.opensea.io/docs/contract-level-metadata
*/
function setContractURI(string memory newContractURI) public onlyOwner {
_contractURI = newContractURI;
}
/**
* @notice Withdraw $APE and ETH in contract to ownership wallet
*/
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
if(balance > 0){
Address.sendValue(payable(owner()), balance);
}
balance = IERC20(tokenContract).balanceOf(address(this));
if(balance > 0){
IERC20(tokenContract).safeTransfer(owner(), balance);
}
}
/**
* @notice Withdraw $APE in contract to ownership wallet - only use as backup
*/
function withdrawAPE(uint256 amount) external onlyOwner {
IERC20(tokenContract).safeTransfer(owner(), amount);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override(ERC1155, ERC1155Supply) {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// 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);
}
ERC1155Supply.sol 64 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
if (to == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 supply = _totalSupply[id];
require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
unchecked {
_totalSupply[id] = supply - amount;
}
}
}
}
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @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;
}
}
ERC1155Burnable.sol 40 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of {ERC1155} that allows token holders to destroy both their
* own tokens and those that they have been approved to use.
*
* _Available since v3.1._
*/
abstract contract ERC1155Burnable is ERC1155 {
function burn(
address account,
uint256 id,
uint256 value
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_burn(account, id, value);
}
function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory values
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_burnBatch(account, ids, values);
}
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// 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);
}
}
}
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// 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;
}
}
Read Contract
actions 0x83240f83 → uint256, uint256, uint256
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
contractURI 0xe8a3d485 → string
exists 0x4f558e79 → bool
getContractTokenBalance 0x317d9453 → uint256
isApprovedForAll 0xe985e9c5 → bool
mintIsActive 0x471a4294 → bool
minterAddress 0x34d722c9 → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenContract 0x55a373d6 → address
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
Write Contract 20 functions
These functions modify contract state and require a wallet transaction to execute.
addAction 0x36d300b3
uint256 _tokenPrice
uint256 _maxTokens
uint256 _maxTokensPerTxn
burn 0xf5298aca
address account
uint256 id
uint256 value
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] values
editAction 0x8770d21e
uint256 _actionId
uint256 _tokenPrice
uint256 _maxTokens
uint256 _maxTokensPerTxn
flipMintState 0x59c74f29
No parameters
mintAction 0x22089d40
uint256 tokenId
uint256 qty
mintBatch 0xd351cfdc
uint256[] ids
uint256[] amounts
mintReserve 0x5e2da7e2
uint256 tokenId
uint256 amount
mintToWallet 0x922d62bd
address toWallet
uint256 tokenId
uint256 amount
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setContractURI 0x938e3d7b
string newContractURI
setMinterAddress 0xa3106b95
address minter
setTokenAddress 0x26a4e8d2
address token
setURI 0x02fe5305
string baseURI
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
withdrawAPE 0xef140d35
uint256 amount
Recent Transactions
No transactions found for this address