Address Contract Verified
Address
0xF1083e064F92db0561fd540F982Cbf73A4e2F8f6
Balance
0 ETH
Nonce
1
Code Size
12773 bytes
Creator
0x1cC5C854...CC1c at tx 0xeed9a310...47fd16
Indexed Transactions
0
Contract Bytecode
12773 bytes
0x608060405234801561001057600080fd5b506004361061030c5760003560e01c806382ba4f3c1161019d578063cb431e76116100e9578063ddb4560e116100a2578063f2fde38b1161007c578063f2fde38b146106cd578063f4a560a5146106e0578063fd5baa88146106e8578063ff1b6556146106fb57600080fd5b8063ddb4560e1461067b578063e985e9c514610684578063eb8d2444146106c057600080fd5b8063cb431e7614610606578063cb774d4714610619578063cd6a3ea514610622578063cdfa59a914610635578063ce138ec714610655578063d299eaa11461066857600080fd5b806397610f3011610156578063ae0601d911610130578063ae0601d9146105ba578063b88d4fde146105cd578063bbaa4682146105e0578063c87b56dd146105f357600080fd5b806397610f3014610579578063a22cb4651461058c578063ad2f852a1461059f57600080fd5b806382ba4f3c146105115780638da5cb5b1461052457806394003f511461053557806394985ddd1461053e578063951dd16e1461055157806395d89b411461057157600080fd5b806332cb6b0c1161025c5780635dbc8d0811610215578063715018a6116101ef578063715018a6146104e657806374df39c9146104ee578063785f403d146104f65780637a1e228d146104fe57600080fd5b80635dbc8d08146104ad5780636352211e146104c057806370a08231146104d357600080fd5b806332cb6b0c1461045a5780633ccfd60b1461046357806342842e0e1461046b57806344cf661f1461047e5780634f6ccce71461048757806355f804b31461049a57600080fd5b806310969523116102c957806323b872dd116102a357806323b872dd146103f0578063256a1a6b146104035780632a55205a146104155780632f745c591461044757600080fd5b806310969523146103b457806318160ddd146103c7578063206d1fde146103dd57600080fd5b806301ffc9a71461031157806306fdde0314610339578063076832951461034e578063081812fc14610363578063095ea7b31461038e5780630a088949146103a1575b600080fd5b61032461031f366004612c92565b610703565b60405190151581526020015b60405180910390f35b61034161072e565b6040516103309190612e9a565b61036161035c366004612d15565b6107c0565b005b610376610371366004612d15565b6107f8565b6040516001600160a01b039091168152602001610330565b61036161039c366004612b4b565b610880565b6103616103af366004612c36565b610996565b6103616103c2366004612ccc565b6109d3565b6103cf610a7c565b604051908152602001610330565b6103616103eb3660046129e9565b610ad8565b6103616103fe366004612a5c565b610b7a565b60105461032490610100900460ff1681565b610428610423366004612c70565b610bab565b604080516001600160a01b039093168352602083019190915201610330565b6103cf610455366004612b4b565b610c2f565b6103cf614e2081565b610361610ce2565b610361610479366004612a5c565b610d57565b6103cf600d5481565b6103cf610495366004612d15565b610d72565b6103616104a8366004612ccc565b610ddf565b6103616104bb366004612d15565b610f44565b6103766104ce366004612d15565b610f73565b6103cf6104e13660046129e9565b610fff565b6103616110cd565b6103cf611103565b6103cf600181565b601554610376906001600160a01b031681565b601754610376906001600160a01b031681565b6006546001600160a01b0316610376565b6103cf600e5481565b61036161054c366004612c70565b611299565b6103cf61055f3660046129e9565b60196020526000908152604090205481565b61034161131b565b601654610376906001600160a01b031681565b61036161059a366004612b1d565b61132a565b6010546103769064010000000090046001600160a01b031681565b6103616105c8366004612b77565b6113ef565b6103616105db366004612a9d565b61154c565b6103616105ee366004612c70565b611584565b610341610601366004612d15565b61194f565b601454610376906001600160a01b031681565b6103cf600b5481565b610361610630366004612b4b565b6119f0565b6103cf6106433660046129e9565b60186020526000908152604090205481565b610361610663366004612d15565b611a48565b610361610676366004612c36565b611aca565b6103cf600c5481565b610324610692366004612a23565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b6010546103249060ff1681565b6103616106db3660046129e9565b611b0e565b610361611ba9565b6103616106f6366004612d15565b611c3f565b610341611cc1565b60006001600160e01b0319821663780e9d6360e01b1480610728575061072882611d4f565b92915050565b60606000805461073d906130b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610769906130b4565b80156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b5050505050905090565b6006546001600160a01b031633146107f35760405162461bcd60e51b81526004016107ea90612f6f565b60405180910390fd5b600f55565b600061080382611d9f565b6108645760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107ea565b506000908152600360205260409020546001600160a01b031690565b600061088b82610f73565b9050806001600160a01b0316836001600160a01b031614156108f95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107ea565b336001600160a01b038216148061091557506109158133610692565b6109875760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107ea565b6109918383611de9565b505050565b6006546001600160a01b031633146109c05760405162461bcd60e51b81526004016107ea90612f6f565b6010805460ff1916911515919091179055565b6006546001600160a01b031633146109fd5760405162461bcd60e51b81526004016107ea90612f6f565b60098054610a0a906130b4565b159050610a655760405162461bcd60e51b8152602060048201526024808201527f50726f76656e616e636520686173682068617320616c7265616479206265656e604482015263081cd95d60e21b60648201526084016107ea565b8051610a789060099060208401906128f1565b5050565b600254600090815b81811015610ad35760006001600160a01b031660028281548110610aaa57610aaa61314a565b6000918252602090912001546001600160a01b031614610acb578260010192505b600101610a84565b505090565b6006546001600160a01b03163314610b025760405162461bcd60e51b81526004016107ea90612f6f565b6001600160a01b038116610b585760405162461bcd60e51b815260206004820152601a60248201527f43616e6e6f742061737369676e207a65726f206164647265737300000000000060448201526064016107ea565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b610b843382611e57565b610ba05760405162461bcd60e51b81526004016107ea90612fa4565b610991838383611f41565b6000806000610bd1601254610bcb6011548761209790919063ffffffff16565b906120aa565b600086815260136020526040812054919250906001600160a01b0316610c0a5760105464010000000090046001600160a01b0316610c23565b6000868152601360205260409020546001600160a01b03165b96919550909350505050565b6000610c3a83610fff565b8210610c585760405162461bcd60e51b81526004016107ea90612ed2565b6000805b600254811015610cc95760028181548110610c7957610c7961314a565b6000918252602090912001546001600160a01b0386811691161415610cb75783821415610ca95791506107289050565b81610cb3816130ef565b9250505b80610cc1816130ef565b915050610c5c565b5060405162461bcd60e51b81526004016107ea90612ed2565b6006546001600160a01b03163314610d0c5760405162461bcd60e51b81526004016107ea90612f6f565b47610d1f6006546001600160a01b031690565b6001600160a01b03166108fc829081150290604051600060405180830381858888f19350505050158015610a78573d6000803e3d6000fd5b6109918383836040518060200160405280600081525061154c565b6002546000908210610ddb5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016107ea565b5090565b6006546001600160a01b03163314610e095760405162461bcd60e51b81526004016107ea90612f6f565b60105462010000900460ff1615610e625760405162461bcd60e51b815260206004820152601a60248201527f4d6574616461746120616c72656164792066696e616c6973656400000000000060448201526064016107ea565b6000600a8054610e71906130b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610e9d906130b4565b8015610eea5780601f10610ebf57610100808354040283529160200191610eea565b820191906000526020600020905b815481529060010190602001808311610ecd57829003601f168201915b50508551939450610f0693600a935060208701925090506128f1565b507f99562a81a2bc5868cd8c30b7b2964f5e52ec358ace402063ecd18a505f5d08008183604051610f38929190612ead565b60405180910390a15050565b6006546001600160a01b03163314610f6e5760405162461bcd60e51b81526004016107ea90612f6f565b600c55565b60008060028381548110610f8957610f8961314a565b6000918252602090912001546001600160a01b03169050806107285760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107ea565b60006001600160a01b03821661106a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107ea565b6000805b6002548110156110c6576002818154811061108b5761108b61314a565b6000918252602090912001546001600160a01b03858116911614156110b6576110b3826130ef565b91505b6110bf816130ef565b905061106e565b5092915050565b6006546001600160a01b031633146110f75760405162461bcd60e51b81526004016107ea90612f6f565b61110160006120b6565b565b6006546000906001600160a01b031633146111305760405162461bcd60e51b81526004016107ea90612f6f565b6010546301000000900460ff161561118a5760405162461bcd60e51b815260206004820152601960248201527f7374617274696e67496e64657820616c7265616479207365740000000000000060448201526064016107ea565b601b546040516370a0823160e01b81523060048201527f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316906370a082319060240160206040518083038186803b1580156111ec57600080fd5b505afa158015611200573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112249190612d2e565b10156112865760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420656e6f756768204c494e4b202d2066696c6c20636f6e74726163742060448201526a1dda5d1a0819985d58d95d60aa1b60648201526084016107ea565b611294601a54601b54612108565b905090565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795216146113115760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064016107ea565b610a788282612293565b60606001805461073d906130b4565b6001600160a01b0382163314156113835760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107ea565b3360008181526004602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6014546001600160a01b0316336001600160a01b0316146114525760405162461bcd60e51b815260206004820152601b60248201527f43616c6c2066726f6d206e6f6e2d6d65676120636f6e7472616374000000000060448201526064016107ea565b815160051461149a5760405162461bcd60e51b8152602060048201526014602482015273125b9d985b1a5908185c9c985e481c185cdcd95960621b60448201526064016107ea565b60005b825181101561099157816001600160a01b03166114d28483815181106114c5576114c561314a565b6020026020010151610f73565b6001600160a01b0316146115185760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b60448201526064016107ea565b61153a83828151811061152d5761152d61314a565b60200260200101516122e4565b80611544816130ef565b91505061149d565b6115563383611e57565b6115725760405162461bcd60e51b81526004016107ea90612fa4565b61157e84848484612366565b50505050565b600260075414156115d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107ea565b60026007556006546001600160a01b031633146116405760105460ff166116405760405162461bcd60e51b815260206004820152601c60248201527f546865206d696e7420686173206e6f742073746172746564207965740000000060448201526064016107ea565b600082116116865760405162461bcd60e51b815260206004820152601360248201527226b4b71036b4b73a1034b99018903a37b5b2b760691b60448201526064016107ea565b600f548211156116f25760405162461bcd60e51b815260206004820152603160248201527f596f752063616e206e6f74206d696e742074686174206d616e7920746f6b656e60448201527039903832b9103a3930b739b0b1ba34b7b760791b60648201526084016107ea565b600854614e20906117039084612399565b11156117515760405162461bcd60e51b815260206004820152601d60248201527f4d696e74206d6f726520746f6b656e73207468616e20616c6c6f77656400000060448201526064016107ea565b6006546001600160a01b031633146118d15761176d81336123a5565b6117a95760405162461bcd60e51b815260206004820152600d60248201526c10a1b932b2b83d1037bbb732b960991b60448201526064016107ea565b600c54336000908152601960205260409020546117c79042906124f1565b101561180e5760405162461bcd60e51b81526020600482015260166024820152752a34b6b2903634b6b4ba103932b9ba3934b1ba34b7b760511b60448201526064016107ea565b600061181a33846124fd565b6015549091506001600160a01b031663bfd77e2b336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b15801561187757600080fd5b505af115801561188b573d6000803e3d6000fd5b50505050826018600061189b3390565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546118ca9190613026565b9091555050505b60005b8281101561190b576118f933600880549060006118f0836130ef565b91905055612574565b80611903816130ef565b9150506118d4565b5033600081815260196020526040808220429055518492917f3f2c9d57c068687834f0de942a9babb9e5acab57d516d3480a3c16ee165a427391a350506001600755565b606061195a82611d9f565b6119be5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016107ea565b600a6119c98361258e565b6040516020016119da929190612d8f565b6040516020818303038152906040529050919050565b6006546001600160a01b03163314611a1a5760405162461bcd60e51b81526004016107ea90612f6f565b600090815260136020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b6006546001600160a01b03163314611a725760405162461bcd60e51b81526004016107ea90612f6f565b60105460ff1615611ac55760405162461bcd60e51b815260206004820152601e60248201527f50617573652073616c65206265666f726520707269636520757064617465000060448201526064016107ea565b600e55565b6006546001600160a01b03163314611af45760405162461bcd60e51b81526004016107ea90612f6f565b601080549115156101000261ff0019909216919091179055565b6006546001600160a01b03163314611b385760405162461bcd60e51b81526004016107ea90612f6f565b6001600160a01b038116611b9d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107ea565b611ba6816120b6565b50565b6006546001600160a01b03163314611bd35760405162461bcd60e51b81526004016107ea90612f6f565b60105462010000900460ff1615611c2c5760405162461bcd60e51b815260206004820152601a60248201527f4d6574616461746120616c72656164792066696e616c6973656400000000000060448201526064016107ea565b6010805462ff0000191662010000179055565b6006546001600160a01b03163314611c695760405162461bcd60e51b81526004016107ea90612f6f565b60105460ff1615611cbc5760405162461bcd60e51b815260206004820152601e60248201527f50617573652073616c65206265666f726520707269636520757064617465000060448201526064016107ea565b600d55565b60098054611cce906130b4565b80601f0160208091040260200160405190810160405280929190818152602001828054611cfa906130b4565b8015611d475780601f10611d1c57610100808354040283529160200191611d47565b820191906000526020600020905b815481529060010190602001808311611d2a57829003601f168201915b505050505081565b60006001600160e01b031982166380ac58cd60e01b1480611d8057506001600160e01b03198216635b5e139f60e01b145b8061072857506301ffc9a760e01b6001600160e01b0319831614610728565b60025460009082108015610728575060006001600160a01b031660028381548110611dcc57611dcc61314a565b6000918252602090912001546001600160a01b0316141592915050565b600081815260036020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611e1e82610f73565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e6282611d9f565b611ec35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107ea565b6000611ece83610f73565b9050806001600160a01b0316846001600160a01b03161480611f095750836001600160a01b0316611efe846107f8565b6001600160a01b0316145b80611f3957506001600160a01b0380821660009081526004602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611f5482610f73565b6001600160a01b031614611fbc5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016107ea565b6001600160a01b03821661201e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107ea565b612029600082611de9565b816002828154811061203d5761203d61314a565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b60006120a38284613052565b9392505050565b60006120a3828461303e565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001612178929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b81526004016121a593929190612e73565b602060405180830381600087803b1580156121bf57600080fd5b505af11580156121d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f79190612c53565b50600083815260056020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612253906001613026565b600085815260056020526040902055611f398482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b61229f614e208261310a565b600b8190556010805463ff000000191663010000001790556040517fb4c3e909614f71d1da833a0978ffd333d79402c765cd011e506630c3fe1001f890600090a25050565b60006122ef82610f73565b90506122fc600083611de9565b6000600283815481106123115761231161314a565b6000918252602082200180546001600160a01b0319166001600160a01b0393841617905560405184928416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b612371848484611f41565b61237d8484848461268c565b61157e5760405162461bcd60e51b81526004016107ea90612f1d565b60006120a38284613026565b601054600090610100900460ff166123bf57506001610728565b6016546017546040516307ca74b760e21b81526001600160a01b03918216600482015260248101869052848216929190911690631f29d2dc9060440160206040518083038186803b15801561241357600080fd5b505afa158015612427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244b9190612a06565b6001600160a01b0316141561246257506001610728565b6017546040516331a9108f60e11b8152600481018590526001600160a01b03848116921690636352211e9060240160206040518083038186803b1580156124a857600080fd5b505afa1580156124bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e09190612a06565b6001600160a01b0316149392505050565b60006120a38284613071565b6001600160a01b038216600090815260186020526040812054801561253157600e546125299084612097565b915050610728565b8015801561253f5750600183115b1561256957600e54612529906125609061255a8660016124f1565b90612097565b600d5490612399565b5050600d5492915050565b610a78828260405180602001604052806000815250612796565b6060816125b25750506040805180820190915260018152600360fc1b602082015290565b8160005b81156125dc57806125c6816130ef565b91506125d59050600a8361303e565b91506125b6565b60008167ffffffffffffffff8111156125f7576125f7613160565b6040519080825280601f01601f191660200182016040528015612621576020820181803683370190505b5090505b8415611f3957612636600183613071565b9150612643600a8661310a565b61264e906030613026565b60f81b8183815181106126635761266361314a565b60200101906001600160f81b031916908160001a905350612685600a8661303e565b9450612625565b60006001600160a01b0384163b1561278e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906126d0903390899088908890600401612e36565b602060405180830381600087803b1580156126ea57600080fd5b505af192505050801561271a575060408051601f3d908101601f1916820190925261271791810190612caf565b60015b612774573d808015612748576040519150601f19603f3d011682016040523d82523d6000602084013e61274d565b606091505b50805161276c5760405162461bcd60e51b81526004016107ea90612f1d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611f39565b506001611f39565b6127a083836127c9565b6127ad600084848461268c565b6109915760405162461bcd60e51b81526004016107ea90612f1d565b6001600160a01b03821661281f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107ea565b61282881611d9f565b156128755760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107ea565b6002805460018101825560009182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0385169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546128fd906130b4565b90600052602060002090601f01602090048101928261291f5760008555612965565b82601f1061293857805160ff1916838001178555612965565b82800160010185558215612965579182015b8281111561296557825182559160200191906001019061294a565b50610ddb9291505b80821115610ddb576000815560010161296d565b600067ffffffffffffffff83111561299b5761299b613160565b6129ae601f8401601f1916602001612ff5565b90508281528383830111156129c257600080fd5b828260208301376000602084830101529392505050565b80356129e481613176565b919050565b6000602082840312156129fb57600080fd5b81356120a381613176565b600060208284031215612a1857600080fd5b81516120a381613176565b60008060408385031215612a3657600080fd5b8235612a4181613176565b91506020830135612a5181613176565b809150509250929050565b600080600060608486031215612a7157600080fd5b8335612a7c81613176565b92506020840135612a8c81613176565b929592945050506040919091013590565b60008060008060808587031215612ab357600080fd5b8435612abe81613176565b93506020850135612ace81613176565b925060408501359150606085013567ffffffffffffffff811115612af157600080fd5b8501601f81018713612b0257600080fd5b612b1187823560208401612981565b91505092959194509250565b60008060408385031215612b3057600080fd5b8235612b3b81613176565b91506020830135612a518161318b565b60008060408385031215612b5e57600080fd5b8235612b6981613176565b946020939093013593505050565b60008060408385031215612b8a57600080fd5b823567ffffffffffffffff80821115612ba257600080fd5b818501915085601f830112612bb657600080fd5b8135602082821115612bca57612bca613160565b8160051b9250612bdb818401612ff5565b8281528181019085830185870184018b1015612bf657600080fd5b600096505b84871015612c19578035835260019690960195918301918301612bfb565b509650612c2990508782016129d9565b9450505050509250929050565b600060208284031215612c4857600080fd5b81356120a38161318b565b600060208284031215612c6557600080fd5b81516120a38161318b565b60008060408385031215612c8357600080fd5b50508035926020909101359150565b600060208284031215612ca457600080fd5b81356120a381613199565b600060208284031215612cc157600080fd5b81516120a381613199565b600060208284031215612cde57600080fd5b813567ffffffffffffffff811115612cf557600080fd5b8201601f81018413612d0657600080fd5b611f3984823560208401612981565b600060208284031215612d2757600080fd5b5035919050565b600060208284031215612d4057600080fd5b5051919050565b60008151808452612d5f816020860160208601613088565b601f01601f19169290920160200192915050565b60008151612d85818560208601613088565b9290920192915050565b600080845481600182811c915080831680612dab57607f831692505b6020808410821415612dcb57634e487b7160e01b86526022600452602486fd5b818015612ddf5760018114612df057612e1d565b60ff19861689528489019650612e1d565b60008b81526020902060005b86811015612e155781548b820152908501908301612dfc565b505084890196505b505050505050612e2d8185612d73565b95945050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612e6990830184612d47565b9695505050505050565b60018060a01b0384168152826020820152606060408201526000612e2d6060830184612d47565b6020815260006120a36020830184612d47565b604081526000612ec06040830185612d47565b8281036020840152612e2d8185612d47565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561301e5761301e613160565b604052919050565b600082198211156130395761303961311e565b500190565b60008261304d5761304d613134565b500490565b600081600019048311821515161561306c5761306c61311e565b500290565b6000828210156130835761308361311e565b500390565b60005b838110156130a357818101518382015260200161308b565b8381111561157e5750506000910152565b600181811c908216806130c857607f821691505b602082108114156130e957634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156131035761310361311e565b5060010190565b60008261311957613119613134565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611ba657600080fd5b8015158114611ba657600080fd5b6001600160e01b031981168114611ba657600080fdfea26469706673582212206bda6d95fa412e91e8b709e9eb76b62ead4515d6e516abb3991c470b6c2f718164736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
ERC721.sol 457 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
library Address {
function isContract(address account) internal view returns (bool) {
uint size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string private _name;
string private _symbol;
// Mapping from token ID to owner address
address[] internal _owners;
mapping(uint256 => address) private _tokenApprovals;
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 (uint)
{
require(owner != address(0), "ERC721: balance query for the zero address");
uint count;
for( uint i; i < _owners.length; ++i ){
if( owner == _owners[i] )
++count;
}
return count;
}
/**
* @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 {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
{
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_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 tokenId < _owners.length && _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 ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, 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);
_owners.push(to);
emit Transfer(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);
_owners[tokenId] = address(0);
emit Transfer(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 of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_owners[tokenId] = to;
emit Transfer(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 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 {}
}
ShapeShifters.sol 288 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "../utils/ERC721EnumerableBurnable.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// /$$$$$$
// /$$__ $$
// | $$ \__/ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$$
// | $$ /$$__ $$ /$$__ $$ /$$__ $$ /$$__ $$|____ /$$/
// | $$ | $$ \__/| $$$$$$$$| $$$$$$$$| $$ \ $$ /$$$$/
// | $$ $$| $$ | $$_____/| $$_____/| $$ | $$ /$$__/
// | $$$$$$/| $$ | $$$$$$$| $$$$$$$| $$$$$$$/ /$$$$$$$$
// \______/ |__/ \_______/ \_______/| $$____/ |________/
// | $$
// | $$
// |__/
// /$$$$$$ /$$
// /$$__ $$| $$
// | $$ \__/| $$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$
// | $$$$$$ | $$__ $$ |____ $$ /$$__ $$ /$$__ $$
// \____ $$| $$ \ $$ /$$$$$$$| $$ \ $$| $$$$$$$$
// /$$ \ $$| $$ | $$ /$$__ $$| $$ | $$| $$_____/
// | $$$$$$/| $$ | $$| $$$$$$$| $$$$$$$/| $$$$$$$
// \______/ |__/ |__/ \_______/| $$____/ \_______/
// | $$
// | $$
// |__/
// /$$$$$$ /$$ /$$ /$$$$$$ /$$
// /$$__ $$| $$ |__/ /$$__ $$ | $$
// | $$ \__/| $$$$$$$ /$$| $$ \__//$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$
// | $$$$$$ | $$__ $$| $$| $$$$ |_ $$_/ /$$__ $$ /$$__ $$ /$$_____/
// \____ $$| $$ \ $$| $$| $$_/ | $$ | $$$$$$$$| $$ \__/| $$$$$$
// /$$ \ $$| $$ | $$| $$| $$ | $$ /$$| $$_____/| $$ \____ $$
// | $$$$$$/| $$ | $$| $$| $$ | $$$$/| $$$$$$$| $$ /$$$$$$$/
// \______/ |__/ |__/|__/|__/ \___/ \_______/|__/ |_______/
interface ILOOMI {
function spendLoomi(address user, uint256 amount) external;
}
interface ISTAKING {
function ownerOf(address contractAddress, uint256 tokenId) external view returns (address);
}
/**
* @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 CreepzShapeshifters is Context, ERC721EnumerableBurnable, VRFConsumerBase, Ownable, ReentrancyGuard {
using SafeMath for uint256;
using Strings for uint256;
// currentMintIndex
uint256 private currentIndex;
// Provenance hash
string public PROVENANCE_HASH;
// Base URI
string private _shapesBaseURI;
// Starting Index
uint256 public startingIndex;
// Max number of NFTs
uint256 public constant MAX_SUPPLY = 20000;
uint256 public constant BASE_RATE_TOKENS = 1;
uint256 public _purchaseTimeout;
uint256 public _basePrice;
uint256 public _regularPrice;
uint256 private _maxToMint;
bool public saleIsActive;
bool public creepzRestriction;
bool private metadataFinalised;
bool private startingIndexSet;
// Royalty info
address public royaltyAddress;
uint256 private ROYALTY_SIZE = 750;
uint256 private ROYALTY_DENOMINATOR = 10000;
mapping(uint256 => address) private _royaltyReceivers;
// MEGA Address
address public MEGA;
// Loomi contract
ILOOMI public LOOMI;
ISTAKING public STAKING;
IERC721 public CREEPZ;
// Stores the number of minted tokens by user
mapping(address => uint256) public _mintedByAddress;
mapping(address => uint256) public _lastPurchased;
bytes32 internal keyHash;
uint256 internal fee;
event TokensMinted(
address indexed mintedBy,
uint256 indexed tokensNumber
);
event StartingIndexFinalized(
uint256 indexed startingIndex
);
event BaseUriUpdated(
string oldBaseUri,
string newBaseUri
);
constructor(address _royaltyAddress, address _loomi, address _staking, address _creepz, string memory _baseURI)
ERC721("Creepz Shapeshifters", "SHAPE")
VRFConsumerBase(
0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator
0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token
)
{
royaltyAddress = _royaltyAddress;
LOOMI = ILOOMI(_loomi);
STAKING = ISTAKING(_staking);
CREEPZ = IERC721(_creepz);
keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445;
fee = 2 * 10 ** 18;
_shapesBaseURI = _baseURI;
_basePrice = 10000 ether;
_regularPrice = 15000 ether;
creepzRestriction = true;
_maxToMint = 50;
_purchaseTimeout = 1 days;
}
modifier onlyMega() {
require(_msgSender() == MEGA, "Call from non-mega contract");
_;
}
function shapePurchase(uint256 tokensToMint, uint256 tokenId) public nonReentrant {
if (_msgSender() != owner()) require(saleIsActive, "The mint has not started yet");
require(tokensToMint > 0, "Min mint is 1 token");
require(tokensToMint <= _maxToMint, "You can not mint that many tokens per transaction");
require(currentIndex.add(tokensToMint) <= MAX_SUPPLY, "Mint more tokens than allowed");
if (_msgSender() != owner()) {
require(_validateCreepzOwner(tokenId, _msgSender()), "!Creepz owner");
require(block.timestamp.sub(_lastPurchased[_msgSender()]) >= _purchaseTimeout, "Time limit restriction");
uint256 batchPrice = getTokenPrice(_msgSender(), tokensToMint);
LOOMI.spendLoomi(_msgSender(), batchPrice);
_mintedByAddress[_msgSender()] += tokensToMint;
}
for(uint256 i = 0; i < tokensToMint; i++) {
_safeMint(_msgSender(), currentIndex++);
}
_lastPurchased[_msgSender()] = block.timestamp;
emit TokensMinted(_msgSender(), tokensToMint);
}
function validateAndBurn(uint256[] memory tokenIds, address owner) external onlyMega {
require(tokenIds.length == 5, "Invalid array passed");
for (uint256 i; i < tokenIds.length; i++) {
require(ownerOf(tokenIds[i]) == owner, "Not the owner");
_burn(tokenIds[i]);
}
}
function _validateCreepzOwner(uint256 tokenId, address user) internal view returns (bool) {
if (!creepzRestriction) return true;
if (STAKING.ownerOf(address(CREEPZ), tokenId) == user) {
return true;
}
return CREEPZ.ownerOf(tokenId) == user;
}
function getTokenPrice(address user, uint256 amount) internal view returns (uint256) {
uint256 minted = _mintedByAddress[user];
if (minted > 0) return _regularPrice.mul(amount);
if (minted == 0 && amount > BASE_RATE_TOKENS) return _basePrice.add(amount.sub(1).mul(_regularPrice));
return _basePrice;
}
function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) {
uint256 amount = _salePrice.mul(ROYALTY_SIZE).div(ROYALTY_DENOMINATOR);
address royaltyReceiver = _royaltyReceivers[_tokenId] != address(0) ? _royaltyReceivers[_tokenId] : royaltyAddress;
return (royaltyReceiver, amount);
}
function addRoyaltyReceiverForTokenId(address receiver, uint256 tokenId) public onlyOwner {
_royaltyReceivers[tokenId] = receiver;
}
function updateSaleStatus(bool status) public onlyOwner {
saleIsActive = status;
}
function updateBasePrice(uint256 _newPrice) public onlyOwner {
require(!saleIsActive, "Pause sale before price update");
_basePrice = _newPrice;
}
function updateRegularPrice(uint256 _newPrice) public onlyOwner {
require(!saleIsActive, "Pause sale before price update");
_regularPrice = _newPrice;
}
function setProvenanceHash(string memory provenanceHash) public onlyOwner {
require(bytes(PROVENANCE_HASH).length == 0, "Provenance hash has already been set");
PROVENANCE_HASH = provenanceHash;
}
function setBaseURI(string memory newBaseURI) public onlyOwner {
require(!metadataFinalised, "Metadata already finalised");
string memory currentURI = _shapesBaseURI;
_shapesBaseURI = newBaseURI;
emit BaseUriUpdated(currentURI, newBaseURI);
}
function finalizeStartingIndex() public onlyOwner returns (bytes32 requestId) {
require(!startingIndexSet, 'startingIndex already set');
require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet");
return requestRandomness(keyHash, fee);
}
/**
* Callback function used by VRF Coordinator
*/
function fulfillRandomness(bytes32, uint256 randomness) internal override {
startingIndex = (randomness % MAX_SUPPLY);
startingIndexSet = true;
emit StartingIndexFinalized(startingIndex);
}
function tokenURI(uint256 tokenId) external view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return string(abi.encodePacked(_shapesBaseURI, tokenId.toString()));
}
function finalizeMetadata() public onlyOwner {
require(!metadataFinalised, "Metadata already finalised");
metadataFinalised = true;
}
function updateCreepzRestriction(bool _restrict) public onlyOwner {
creepzRestriction = _restrict;
}
function updatePurchaseTimeout(uint256 _timeoutInSeconds) public onlyOwner {
_purchaseTimeout = _timeoutInSeconds;
}
function updateMaxToMint(uint256 _max) public onlyOwner {
_maxToMint = _max;
}
function setMegaAddress(address _megaAddress) public onlyOwner {
require(_megaAddress != address(0), "Cannot assign zero address");
MEGA = _megaAddress;
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
payable(owner()).transfer(balance);
}
}
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;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// 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);
}
}
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);
}
}
ERC721EnumerableBurnable.sol 59 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "./ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account but rips out the core of the gas-wasting processing that comes from OpenZeppelin.
*/
abstract contract ERC721EnumerableBurnable is ERC721, IERC721Enumerable {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256 currentSupply) {
unchecked {
uint256 length = _owners.length;
for (uint256 tokenId = 0; tokenId < length; ++tokenId) {
if (_owners[tokenId] != address(0)) {
++currentSupply;
}
}
}
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < _owners.length, "ERC721Enumerable: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256 tokenId) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
uint count;
for(uint i; i < _owners.length; i++){
if(owner == _owners[i]){
if(count == index) return i;
else count++;
}
}
revert("ERC721Enumerable: owner index out of bounds");
}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @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;
}
VRFConsumerBase.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/LinkTokenInterface.sol";
import "./VRFRequestIDBase.sol";
/** ****************************************************************************
* @notice Interface for contracts using VRF randomness
* *****************************************************************************
* @dev PURPOSE
*
* @dev Reggie the Random Oracle (not his real job) wants to provide randomness
* @dev to Vera the verifier in such a way that Vera can be sure he's not
* @dev making his output up to suit himself. Reggie provides Vera a public key
* @dev to which he knows the secret key. Each time Vera provides a seed to
* @dev Reggie, he gives back a value which is computed completely
* @dev deterministically from the seed and the secret key.
*
* @dev Reggie provides a proof by which Vera can verify that the output was
* @dev correctly computed once Reggie tells it to her, but without that proof,
* @dev the output is indistinguishable to her from a uniform random sample
* @dev from the output space.
*
* @dev The purpose of this contract is to make it easy for unrelated contracts
* @dev to talk to Vera the verifier about the work Reggie is doing, to provide
* @dev simple access to a verifiable source of randomness.
* *****************************************************************************
* @dev USAGE
*
* @dev Calling contracts must inherit from VRFConsumerBase, and can
* @dev initialize VRFConsumerBase's attributes in their constructor as
* @dev shown:
*
* @dev contract VRFConsumer {
* @dev constuctor(<other arguments>, address _vrfCoordinator, address _link)
* @dev VRFConsumerBase(_vrfCoordinator, _link) public {
* @dev <initialization with other arguments goes here>
* @dev }
* @dev }
*
* @dev The oracle will have given you an ID for the VRF keypair they have
* @dev committed to (let's call it keyHash), and have told you the minimum LINK
* @dev price for VRF service. Make sure your contract has sufficient LINK, and
* @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
* @dev want to generate randomness from.
*
* @dev Once the VRFCoordinator has received and validated the oracle's response
* @dev to your request, it will call your contract's fulfillRandomness method.
*
* @dev The randomness argument to fulfillRandomness is the actual random value
* @dev generated from your seed.
*
* @dev The requestId argument is generated from the keyHash and the seed by
* @dev makeRequestId(keyHash, seed). If your contract could have concurrent
* @dev requests open, you can use the requestId to track which seed is
* @dev associated with which randomness. See VRFRequestIDBase.sol for more
* @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
* @dev if your contract could have multiple requests in flight simultaneously.)
*
* @dev Colliding `requestId`s are cryptographically impossible as long as seeds
* @dev differ. (Which is critical to making unpredictable randomness! See the
* @dev next section.)
*
* *****************************************************************************
* @dev SECURITY CONSIDERATIONS
*
* @dev A method with the ability to call your fulfillRandomness method directly
* @dev could spoof a VRF response with any random value, so it's critical that
* @dev it cannot be directly called by anything other than this base contract
* @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
*
* @dev For your users to trust that your contract's random behavior is free
* @dev from malicious interference, it's best if you can write it so that all
* @dev behaviors implied by a VRF response are executed *during* your
* @dev fulfillRandomness method. If your contract must store the response (or
* @dev anything derived from it) and use it later, you must ensure that any
* @dev user-significant behavior which depends on that stored value cannot be
* @dev manipulated by a subsequent VRF request.
*
* @dev Similarly, both miners and the VRF oracle itself have some influence
* @dev over the order in which VRF responses appear on the blockchain, so if
* @dev your contract could have multiple VRF requests in flight simultaneously,
* @dev you must ensure that the order in which the VRF responses arrive cannot
* @dev be used to manipulate your contract's user-significant behavior.
*
* @dev Since the ultimate input to the VRF is mixed with the block hash of the
* @dev block in which the request is made, user-provided seeds have no impact
* @dev on its economic security properties. They are only included for API
* @dev compatability with previous versions of this contract.
*
* @dev Since the block hash of the block which contains the requestRandomness
* @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
* @dev miner could, in principle, fork the blockchain to evict the block
* @dev containing the request, forcing the request to be included in a
* @dev different block with a different hash, and therefore a different input
* @dev to the VRF. However, such an attack would incur a substantial economic
* @dev cost. This cost scales with the number of blocks the VRF oracle waits
* @dev until it calls responds to a request.
*/
abstract contract VRFConsumerBase is VRFRequestIDBase {
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it. See "SECURITY CONSIDERATIONS" above for important
* @notice principles to keep in mind when implementing your fulfillRandomness
* @notice method.
*
* @dev VRFConsumerBase expects its subcontracts to have a method with this
* @dev signature, and will call it once it has verified the proof
* @dev associated with the randomness. (It is triggered via a call to
* @dev rawFulfillRandomness, below.)
*
* @param requestId The Id initially returned by requestRandomness
* @param randomness the VRF output
*/
function fulfillRandomness(
bytes32 requestId,
uint256 randomness
)
internal
virtual;
/**
* @dev In order to keep backwards compatibility we have kept the user
* seed field around. We remove the use of it because given that the blockhash
* enters later, it overrides whatever randomness the used seed provides.
* Given that it adds no security, and can easily lead to misunderstandings,
* we have removed it from usage and can now provide a simpler API.
*/
uint256 constant private USER_SEED_PLACEHOLDER = 0;
/**
* @notice requestRandomness initiates a request for VRF output given _seed
*
* @dev The fulfillRandomness method receives the output, once it's provided
* @dev by the Oracle, and verified by the vrfCoordinator.
*
* @dev The _keyHash must already be registered with the VRFCoordinator, and
* @dev the _fee must exceed the fee specified during registration of the
* @dev _keyHash.
*
* @dev The _seed parameter is vestigial, and is kept only for API
* @dev compatibility with older versions. It can't *hurt* to mix in some of
* @dev your own randomness, here, but it's not necessary because the VRF
* @dev oracle will mix the hash of the block containing your request into the
* @dev VRF seed it ultimately uses.
*
* @param _keyHash ID of public key against which randomness is generated
* @param _fee The amount of LINK to send with the request
*
* @return requestId unique ID for this request
*
* @dev The returned requestId can be used to distinguish responses to
* @dev concurrent requests. It is passed as the first argument to
* @dev fulfillRandomness.
*/
function requestRandomness(
bytes32 _keyHash,
uint256 _fee
)
internal
returns (
bytes32 requestId
)
{
LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
// This is the seed passed to VRFCoordinator. The oracle will mix this with
// the hash of the block containing this request to obtain the seed/input
// which is finally passed to the VRF cryptographic machinery.
uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
// nonces[_keyHash] must stay in sync with
// VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
// successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
// This provides protection against the user repeating their input seed,
// which would result in a predictable/duplicate output, if multiple such
// requests appeared in the same block.
nonces[_keyHash] = nonces[_keyHash] + 1;
return makeRequestId(_keyHash, vRFSeed);
}
LinkTokenInterface immutable internal LINK;
address immutable private vrfCoordinator;
// Nonces for each VRF key from which randomness has been requested.
//
// Must stay in sync with VRFCoordinator[_keyHash][this]
mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces;
/**
* @param _vrfCoordinator address of VRFCoordinator contract
* @param _link address of LINK token contract
*
* @dev https://docs.chain.link/docs/link-token-contracts
*/
constructor(
address _vrfCoordinator,
address _link
) {
vrfCoordinator = _vrfCoordinator;
LINK = LinkTokenInterface(_link);
}
// rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
// proof. rawFulfillRandomness then calls fulfillRandomness, after validating
// the origin of the call
function rawFulfillRandomness(
bytes32 requestId,
uint256 randomness
)
external
{
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
}
VRFRequestIDBase.sol 56 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract VRFRequestIDBase {
/**
* @notice returns the seed which is actually input to the VRF coordinator
*
* @dev To prevent repetition of VRF output due to repetition of the
* @dev user-supplied seed, that seed is combined in a hash with the
* @dev user-specific nonce, and the address of the consuming contract. The
* @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
* @dev the final seed, but the nonce does protect against repetition in
* @dev requests which are included in a single block.
*
* @param _userSeed VRF seed input provided by user
* @param _requester Address of the requesting contract
* @param _nonce User-specific nonce at the time of the request
*/
function makeVRFInputSeed(
bytes32 _keyHash,
uint256 _userSeed,
address _requester,
uint256 _nonce
)
internal
pure
returns (
uint256
)
{
return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
}
/**
* @notice Returns the id for this request
* @param _keyHash The serviceAgreement ID to be used for this request
* @param _vRFInputSeed The seed to be passed directly to the VRF
* @return The id for this request
*
* @dev Note that _vRFInputSeed is not the seed passed by the consuming
* @dev contract, but the one generated by makeVRFInputSeed
*/
function makeRequestId(
bytes32 _keyHash,
uint256 _vRFInputSeed
)
internal
pure
returns (
bytes32
)
{
return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
}
}
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;
}
}
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;
}
}
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);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// 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);
}
LinkTokenInterface.sol 105 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface LinkTokenInterface {
function allowance(
address owner,
address spender
)
external
view
returns (
uint256 remaining
);
function approve(
address spender,
uint256 value
)
external
returns (
bool success
);
function balanceOf(
address owner
)
external
view
returns (
uint256 balance
);
function decimals()
external
view
returns (
uint8 decimalPlaces
);
function decreaseApproval(
address spender,
uint256 addedValue
)
external
returns (
bool success
);
function increaseApproval(
address spender,
uint256 subtractedValue
) external;
function name()
external
view
returns (
string memory tokenName
);
function symbol()
external
view
returns (
string memory tokenSymbol
);
function totalSupply()
external
view
returns (
uint256 totalTokensIssued
);
function transfer(
address to,
uint256 value
)
external
returns (
bool success
);
function transferAndCall(
address to,
uint256 value,
bytes calldata data
)
external
returns (
bool success
);
function transferFrom(
address from,
address to,
uint256 value
)
external
returns (
bool success
);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @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);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
BASE_RATE_TOKENS 0x785f403d → uint256
CREEPZ 0x82ba4f3c → address
LOOMI 0x7a1e228d → address
MAX_SUPPLY 0x32cb6b0c → uint256
MEGA 0xcb431e76 → address
PROVENANCE_HASH 0xff1b6556 → string
STAKING 0x97610f30 → address
_basePrice 0x44cf661f → uint256
_lastPurchased 0x951dd16e → uint256
_mintedByAddress 0xcdfa59a9 → uint256
_purchaseTimeout 0xddb4560e → uint256
_regularPrice 0x94003f51 → uint256
balanceOf 0x70a08231 → uint256
creepzRestriction 0x256a1a6b → bool
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
royaltyAddress 0xad2f852a → address
royaltyInfo 0x2a55205a → address, uint256
saleIsActive 0xeb8d2444 → bool
startingIndex 0xcb774d47 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 23 functions
These functions modify contract state and require a wallet transaction to execute.
addRoyaltyReceiverForTokenId 0xcd6a3ea5
address receiver
uint256 tokenId
approve 0x095ea7b3
address to
uint256 tokenId
finalizeMetadata 0xf4a560a5
No parameters
finalizeStartingIndex 0x74df39c9
No parameters
returns: bytes32
rawFulfillRandomness 0x94985ddd
bytes32 requestId
uint256 randomness
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
setMegaAddress 0x206d1fde
address _megaAddress
setProvenanceHash 0x10969523
string provenanceHash
shapePurchase 0xbbaa4682
uint256 tokensToMint
uint256 tokenId
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateBasePrice 0xfd5baa88
uint256 _newPrice
updateCreepzRestriction 0xd299eaa1
bool _restrict
updateMaxToMint 0x07683295
uint256 _max
updatePurchaseTimeout 0x5dbc8d08
uint256 _timeoutInSeconds
updateRegularPrice 0xce138ec7
uint256 _newPrice
updateSaleStatus 0x0a088949
bool status
validateAndBurn 0xae0601d9
uint256[] tokenIds
address owner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address