Address Contract Partially Verified
Address
0x89908C13f686F798C688D6f9074Dc41fD0679A7F
Balance
0 ETH
Nonce
1
Code Size
15153 bytes
Creator
0xa909db7F...14C0 at tx 0xe05e4420...139094
Indexed Transactions
0
Contract Bytecode
15153 bytes
0x6080604052600436106102165760003560e01c8063715018a611610126578063d1822209116100a7578063e985e9c511610079578063f2fde38b11610061578063f2fde38b14610801578063fb2f494214610821578063fdd2069e1461085557005b8063e985e9c5146107c1578063f242432a146107e157005b8063d182220914610733578063d5abeb0114610753578063d67b06c114610776578063da80e59b1461079657005b80639b642de1116100f8578063a22cb465116100e0578063a22cb46514610585578063a411104c146105a5578063d06fcba8146105f557005b80639b642de1146105455780639c5e92fb1461056557005b8063715018a6146104ac578063891cb017146104c15780638da5cb5b146104e157806395d89b41146104ff57005b80632eb2c2d6116101b057806346914712116101825780634e1273f41161016a5780634e1273f41461043f57806352bdc3901461046c578063562e438b1461048c57005b806346914712146103d35780634d383176146103f357005b80632eb2c2d614610366578063313ce5671461038657806333abe5441461039a57806345a7d498146103b357005b80630e89341c116101e95780630e89341c146102f157806318054c371461031157806318160ddd146103315780632e1a7d4d1461034657005b8062fdd58e1461021f57806301ffc9a71461025257806306fdde031461028257806309a3beef146102d157005b3661021d57005b005b34801561022b57600080fd5b5061023f61023a366004613029565b61087a565b6040519081526020015b60405180910390f35b34801561025e57600080fd5b5061027261026d366004613069565b610931565b6040519015158152602001610249565b34801561028e57600080fd5b5060408051808201909152600d81527f4177616b656e65642d476561720000000000000000000000000000000000000060208201525b60405161024991906130d3565b3480156102dd57600080fd5b5061021d6102ec3660046130e6565b6109ce565b3480156102fd57600080fd5b506102c461030c36600461315e565b610a67565b34801561031d57600080fd5b5061021d61032c366004613185565b610afb565b34801561033d57600080fd5b5061023f610bb5565b34801561035257600080fd5b5061021d61036136600461315e565b610bda565b34801561037257600080fd5b5061021d610381366004613312565b610d53565b34801561039257600080fd5b50600061023f565b3480156103a657600080fd5b5060045461ffff1661023f565b3480156103bf57600080fd5b5061021d6103ce36600461343b565b610df5565b3480156103df57600080fd5b5061021d6103ee36600461349f565b61124a565b3480156103ff57600080fd5b506104277f0000000000000000000000002b19466ee159de81c0393b933472bba4ebd8e0be81565b6040516001600160a01b039091168152602001610249565b34801561044b57600080fd5b5061045f61045a366004613532565b6112eb565b60405161024991906135c7565b34801561047857600080fd5b5061021d6104873660046135da565b611429565b34801561049857600080fd5b5061021d6104a73660046135da565b6114f8565b3480156104b857600080fd5b5061021d6115f3565b3480156104cd57600080fd5b5061021d6104dc36600461343b565b611659565b3480156104ed57600080fd5b506003546001600160a01b0316610427565b34801561050b57600080fd5b5060408051808201909152600581527f476561727300000000000000000000000000000000000000000000000000000060208201526102c4565b34801561055157600080fd5b5061021d6105603660046135f5565b6119eb565b34801561057157600080fd5b5061021d610580366004613646565b611a51565b34801561059157600080fd5b5061021d6105a0366004613185565b611f2e565b3480156105b157600080fd5b506102726105c0366004613029565b6000908152602081815260408083206001600160a01b039490941683529290522054640100000000900463ffffffff16151590565b34801561060157600080fd5b506004546106c59061ffff808216916201000081048216916401000000008204811691660100000000000081048216916801000000000000000082048116916a010000000000000000000081049091169063ffffffff6c0100000000000000000000000082048116917001000000000000000000000000000000008104821691740100000000000000000000000000000000000000008204169067ffffffffffffffff7801000000000000000000000000000000000000000000000000909104168a565b6040805161ffff9b8c168152998b1660208b0152978a169789019790975294881660608801529287166080870152951660a085015263ffffffff94851660c0850152841660e08401529290921661010082015267ffffffffffffffff90911661012082015261014001610249565b34801561073f57600080fd5b5061021d61074e3660046135da565b612019565b34801561075f57600080fd5b506004546601000000000000900461ffff1661023f565b34801561078257600080fd5b5061021d61079136600461367b565b6120a8565b3480156107a257600080fd5b506004546c01000000000000000000000000900463ffffffff1661023f565b3480156107cd57600080fd5b506102726107dc3660046136b0565b612469565b3480156107ed57600080fd5b5061021d6107fc3660046136e3565b6124bc565b34801561080d57600080fd5b5061021d61081c366004613748565b612557565b34801561082d57600080fd5b506104277f00000000000000000000000031ae5109e5adb582f4f42ca9aaa9a723a325f21481565b34801561086157600080fd5b5060045468010000000000000000900461ffff1661023f565b60006001600160a01b0383166108fd5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b039490941683529290522054640100000000900463ffffffff1690565b60006001600160e01b031982167fd9b67a2600000000000000000000000000000000000000000000000000000000148061099457506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b806109c857507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6003546001600160a01b03163314610a285760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b8484604051610a5a929190613763565b60405180910390a2505050565b606060028054610a7690613792565b80601f0160208091040260200160405190810160405280929190818152602001828054610aa290613792565b8015610aef5780601f10610ac457610100808354040283529160200191610aef565b820191906000526020600020905b815481529060010190602001808311610ad257829003601f168201915b50505050509050919050565b6003546001600160a01b03163314610b555760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b6001600160a01b038216600081815260056020908152604091829020805460ff191685151590811790915591519182527f270dbb8ba4292910ae92862466486be25c355c837270a3d8824b36a8bc7c653b91015b60405180910390a25050565b600454600090610bd19060019062010000900461ffff166137e3565b61ffff16905090565b6003546001600160a01b03163314610c345760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b47811115610c845760405162461bcd60e51b815260206004820152601860248201527f6578636565642077697468647261772062616c616e63652e000000000000000060448201526064016108f4565b80610c8c5750475b60006064610c9b836005613806565b610ca59190613825565b604051909150732130c75cac9e1ef6381c6f354331b3049221391c9082156108fc029083906000818181858888f19350505050158015610ce9573d6000803e3d6000fd5b50336108fc610cf88385613847565b6040518115909202916000818181858888f19350505050158015610d20573d6000803e3d6000fd5b5060405182815233907fccbd99ba6da8f29b2a4f65e474e3c3973564d356c162c08d45f3dc7f0cb5b3aa90602001610ba9565b6001600160a01b038516331480610d6f5750610d6f8533612469565b610de15760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f766564000000000000000000000000000060648201526084016108f4565b610dee8585858585612636565b5050505050565b8151815114610e6c5760405162461bcd60e51b815260206004820152603360248201527f4d757374207468652073616d65206c656e677468206265747765656e206d756c60448201527f74697061737320616e6420617661746172732e0000000000000000000000000060648201526084016108f4565b815160045461ffff9182169133916201000090041660005b838161ffff161015611225577f00000000000000000000000031ae5109e5adb582f4f42ca9aaa9a723a325f2146001600160a01b031663616cd9fa878361ffff1681518110610ed557610ed561385e565b60200260200101516040518263ffffffff1660e01b8152600401610f03919061ffff91909116815260200190565b602060405180830381865afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f449190613874565b611213577f00000000000000000000000031ae5109e5adb582f4f42ca9aaa9a723a325f2146001600160a01b03166309b60a27878361ffff1681518110610f8d57610f8d61385e565b60209081029190910101516040516001600160e01b031960e084901b16815261ffff91821660048201526001600160a01b03871660248201529085166044820152606401600060405180830381600087803b158015610feb57600080fd5b505af1158015610fff573d6000803e3d6000fd5b50505050858161ffff16815181106110195761101961385e565b60209081029190910181015161ffff848116600090815280845260408082206001600160a01b0389811684529552902080546bffffffff00000000ffff0000191662010000938316939093026bffffffff0000000000000000191692909217680100000000000000004263ffffffff16021790915586517f0000000000000000000000002b19466ee159de81c0393b933472bba4ebd8e0be90921691631fc68a279188919085169081106110cf576110cf61385e565b60209081029190910101516040516001600160e01b031960e084901b16815261ffff91821660048201526001600160a01b03871660248201529085166044820152606401600060405180830381600087803b15801561112d57600080fd5b505af1158015611141573d6000803e3d6000fd5b505050508161ffff167f496528518bcc717be334d30fdc9269aeae3d48b548e4033b7c1858575e3d767884878461ffff16815181106111825761118261385e565b60200260200101516040516111b09291906001600160a01b0392909216825261ffff16602082015260400190565b60405180910390a26040805161ffff84168152600160208201526000916001600160a01b0386169182917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611210600183613891565b91505b8061121d816138b7565b915050610e84565b506004805461ffff909216620100000263ffff00001990921691909117905550505050565b6003546001600160a01b031633146112a45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b6004805463ffffffff9092166c01000000000000000000000000027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff909216919091179055565b606081518351146113645760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016108f4565b6000835167ffffffffffffffff811115611380576113806131bc565b6040519080825280602002602001820160405280156113a9578160200160208202803683370190505b50905060005b8451811015611421576113f48582815181106113cd576113cd61385e565b60200260200101518583815181106113e7576113e761385e565b602002602001015161087a565b8282815181106114065761140661385e565b602090810291909101015261141a816138d9565b90506113af565b509392505050565b6003546001600160a01b031633146114835760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b600480547fffffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffffff166801000000000000000061ffff8416908102919091179091556040519081527f0b5775d94cccfd234eaeda693f5ec7294926bb1f2d51c2faa66f7cc663b5f86c9060200160405180910390a150565b6003546001600160a01b031633146115525760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b60045461ffff6601000000000000909104811690821611156115b65760405162461bcd60e51b815260206004820152601160248201527f657863656564206d617820737570706c7900000000000000000000000000000060448201526064016108f4565b6004805461ffff909216640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff0000ffffffff909216919091179055565b6003546001600160a01b0316331461164d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b6116576000612942565b565b805182513391146116d25760405162461bcd60e51b815260206004820152602f60248201527f4d757374207468652073616d65206c656e677468206265747765656e2061766160448201527f7461727320616e642067656172732e000000000000000000000000000000000060648201526084016108f4565b60005b83518110156119e557611735828583815181106116f4576116f461385e565b602002602001015161ffff166000908152602081815260408083206001600160a01b039490941683529290522054640100000000900463ffffffff16151590565b6117815760405162461bcd60e51b815260206004820152601d60248201527f486f6c6465723a646964206e6f74206f776e207468697320746f6b656e00000060448201526064016108f4565b7f0000000000000000000000002b19466ee159de81c0393b933472bba4ebd8e0be6001600160a01b0316631fc68a278483815181106117c2576117c261385e565b6020026020010151848785815181106117dd576117dd61385e565b60209081029190910101516040516001600160e01b031960e086901b16815261ffff93841660048201526001600160a01b039092166024830152919091166044820152606401600060405180830381600087803b15801561183d57600080fd5b505af1158015611851573d6000803e3d6000fd5b50505050600080600086848151811061186c5761186c61385e565b602002602001015161ffff1681526020019081526020016000206000846001600160a01b03166001600160a01b0316815260200190815260200160002060000160046101000a81548163ffffffff021916908363ffffffff1602179055508381815181106118dc576118dc61385e565b602002602001015161ffff167f496528518bcc717be334d30fdc9269aeae3d48b548e4033b7c1858575e3d76788385848151811061191c5761191c61385e565b602002602001015160405161194a9291906001600160a01b0392909216825261ffff16602082015260400190565b60405180910390a260006001600160a01b0316826001600160a01b0316836001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628785815181106119a4576119a461385e565b602002602001015160016040516119cb92919061ffff929092168252602082015260400190565b60405180910390a4806119dd816138d9565b9150506116d5565b50505050565b6003546001600160a01b03163314611a455760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b611a4e816129ac565b50565b8051600454611a6d90640100000000900461ffff166001613891565b60045461ffff91821691611a8a9184916201000090910416613891565b61ffff161115611adc5760405162461bcd60e51b815260206004820152601660248201527f45786365656420746865206d617820737570706c79210000000000000000000060448201526064016108f4565b60045461ffff16611b2f5760405162461bcd60e51b815260206004820152601960248201527f4d696e74696e6720616c72656164792073746f70206e6f77210000000000000060448201526064016108f4565b60045461ffff6801000000000000000090910481169082161115611bbb5760405162461bcd60e51b815260206004820152602560248201527f65786365656420746865206d6178206d696e74696e67206c696d69742070657260448201527f2074696d6500000000000000000000000000000000000000000000000000000060648201526084016108f4565b815160045461ffff9182169133916201000090041660005b838161ffff161015611225577f00000000000000000000000031ae5109e5adb582f4f42ca9aaa9a723a325f2146001600160a01b031663616cd9fa878361ffff1681518110611c2457611c2461385e565b60200260200101516040518263ffffffff1660e01b8152600401611c52919061ffff91909116815260200190565b602060405180830381865afa158015611c6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c939190613874565b611f1c577f00000000000000000000000031ae5109e5adb582f4f42ca9aaa9a723a325f2146001600160a01b03166309b60a27878361ffff1681518110611cdc57611cdc61385e565b60209081029190910101516040516001600160e01b031960e084901b16815261ffff91821660048201526001600160a01b03871660248201529085166044820152606401600060405180830381600087803b158015611d3a57600080fd5b505af1158015611d4e573d6000803e3d6000fd5b50505061ffff83166000908152602081815260408083206001600160a01b03881684529091529020805460019250600490611d9990849063ffffffff640100000000909104166138f4565b92506101000a81548163ffffffff021916908363ffffffff160217905550858161ffff1681518110611dcd57611dcd61385e565b60209081029190910181015161ffff848116600090815280845260408082206001600160a01b0389168084529552812080546bffffffff00000000ffff000019166201000093909416929092026bffffffff0000000000000000191692909217680100000000000000004263ffffffff1602179055336040805161ffff87168152600160208201526001600160a01b0392909216917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4858161ffff1681518110611ea357611ea361385e565b602002602001015161ffff168261ffff167fa12b61d85beb74739a4e8bce8bcae3b100f55a7b5e16ab91ff117a9c69439d4e858642604051611f06939291906001600160a01b039384168152919092166020820152604081019190915260600190565b60405180910390a3611f19600183613891565b91505b80611f26816138b7565b915050611bd3565b336001600160a01b0383161415611fad5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016108f4565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6003546001600160a01b031633146120735760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b600480547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff92909216919091179055565b6003546001600160a01b031633146121025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b60045461211c90640100000000900461ffff166001613891565b815160045461ffff92831692612139929162010000900416613891565b61ffff16111561218b5760405162461bcd60e51b815260206004820152601660248201527f45786365656420746865206d617820737570706c79210000000000000000000060448201526064016108f4565b805160045462010000900461ffff1660005b8260ff168160ff1610156124465760016000808461ffff1681526020019081526020016000206000868460ff16815181106121da576121da61385e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060000160048282829054906101000a900463ffffffff1661222391906138f4565b92506101000a81548163ffffffff021916908363ffffffff160217905550426000808461ffff1681526020019081526020016000206000868460ff168151811061226f5761226f61385e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060000160086101000a81548163ffffffff021916908363ffffffff16021790555061ffff6000808461ffff1681526020019081526020016000206000868460ff16815181106122e8576122e861385e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060000160026101000a81548161ffff021916908361ffff160217905550838160ff16815181106123425761234261385e565b60200260200101516001600160a01b031660006001600160a01b03166123653390565b6040805161ffff87168152600160208201526001600160a01b0392909216917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461ffff8261ffff167fa12b61d85beb74739a4e8bce8bcae3b100f55a7b5e16ab91ff117a9c69439d4e868460ff16815181106123ed576123ed61385e565b60200260200101516123fc3390565b604080516001600160a01b039384168152929091166020830152429082015260600160405180910390a381612430816138b7565b925050808061243e90613913565b91505061219d565b506004805461ffff909216620100000263ffff0000199092169190911790555050565b6001600160a01b03811660009081526005602052604081205460ff16806124b557506001600160a01b0380841660009081526001602090815260408083209386168352929052205460ff165b9392505050565b6001600160a01b0385163314806124d857506124d88533612469565b61254a5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f766564000000000000000000000000000000000000000000000060648201526084016108f4565b610dee85858585856129c3565b6003546001600160a01b031633146125b15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b6001600160a01b03811661262d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016108f4565b611a4e81612942565b81518351146126ad5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d6174636800000000000000000000000000000000000000000000000060648201526084016108f4565b6001600160a01b0384166127295760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016108f4565b3360005b84518110156128d457600085828151811061274a5761274a61385e565b6020026020010151905060008583815181106127685761276861385e565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150640100000000900463ffffffff168181101561281c5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108f4565b6000838152602081815260408083206001600160a01b038e811685529252808320805467ffffffff00000000191664010000000087870363ffffffff908116820292909217909255928d16845292205461287a928592910416613933565b6000938452602084815260408086206001600160a01b038d168752909152909320805463ffffffff949094166401000000000267ffffffff000000001990941693909317909255506128cd9050816138d9565b905061272d565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161292492919061394b565b60405180910390a461293a818787878787612bf9565b505050505050565b600380546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516129bf906002906020840190612f74565b5050565b6001600160a01b038416612a3f5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016108f4565b33612a58818787612a4f88612de6565b610dee88612de6565b6000848152602081815260408083206001600160a01b038a168452909152902054640100000000900463ffffffff1683811015612afd5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016108f4565b6000858152602081815260408083206001600160a01b038b811685529252808320805467ffffffff00000000191664010000000089870363ffffffff908116820292909217909255928a168452922054612b5b928792910416613933565b6000868152602081815260408083206001600160a01b038b811680865291845293829020805463ffffffff969096166401000000000267ffffffff00000000199096169590951790945580518981529182018890528a8316928616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4612bf0828888888888612e31565b50505050505050565b6001600160a01b0384163b1561293a576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190612c569089908990889088908890600401613979565b6020604051808303816000875af1925050508015612c91575060408051601f3d908101601f19168201909252612c8e918101906139d7565b60015b612d4757612c9d6139f4565b806308c379a01415612cd75750612cb2613a10565b80612cbd5750612cd9565b8060405162461bcd60e51b81526004016108f491906130d3565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016108f4565b6001600160e01b031981167fbc197c810000000000000000000000000000000000000000000000000000000014612bf05760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108f4565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612e2057612e2061385e565b602090810291909101015292915050565b6001600160a01b0384163b1561293a576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190612e8e9089908990889088908890600401613ab8565b6020604051808303816000875af1925050508015612ec9575060408051601f3d908101601f19168201909252612ec6918101906139d7565b60015b612ed557612c9d6139f4565b6001600160e01b031981167ff23a6e610000000000000000000000000000000000000000000000000000000014612bf05760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016108f4565b828054612f8090613792565b90600052602060002090601f016020900481019282612fa25760008555612fe8565b82601f10612fbb57805160ff1916838001178555612fe8565b82800160010185558215612fe8579182015b82811115612fe8578251825591602001919060010190612fcd565b50612ff4929150612ff8565b5090565b5b80821115612ff45760008155600101612ff9565b80356001600160a01b038116811461302457600080fd5b919050565b6000806040838503121561303c57600080fd5b6130458361300d565b946020939093013593505050565b6001600160e01b031981168114611a4e57600080fd5b60006020828403121561307b57600080fd5b81356124b581613053565b6000815180845260005b818110156130ac57602081850181015186830182015201613090565b818111156130be576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006124b56020830184613086565b6000806000604084860312156130fb57600080fd5b833567ffffffffffffffff8082111561311357600080fd5b818601915086601f83011261312757600080fd5b81358181111561313657600080fd5b87602082850101111561314857600080fd5b6020928301989097509590910135949350505050565b60006020828403121561317057600080fd5b5035919050565b8015158114611a4e57600080fd5b6000806040838503121561319857600080fd5b6131a18361300d565b915060208301356131b181613177565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156131f8576131f86131bc565b6040525050565b600067ffffffffffffffff821115613219576132196131bc565b5060051b60200190565b600082601f83011261323457600080fd5b81356020613241826131ff565b60405161324e82826131d2565b83815260059390931b850182019282810191508684111561326e57600080fd5b8286015b848110156132895780358352918301918301613272565b509695505050505050565b600067ffffffffffffffff8311156132ae576132ae6131bc565b6040516132c56020601f19601f87011601826131d2565b8091508381528484840111156132da57600080fd5b83836020830137600060208583010152509392505050565b600082601f83011261330357600080fd5b6124b583833560208501613294565b600080600080600060a0868803121561332a57600080fd5b6133338661300d565b94506133416020870161300d565b9350604086013567ffffffffffffffff8082111561335e57600080fd5b61336a89838a01613223565b9450606088013591508082111561338057600080fd5b61338c89838a01613223565b935060808801359150808211156133a257600080fd5b506133af888289016132f2565b9150509295509295909350565b803561ffff8116811461302457600080fd5b600082601f8301126133df57600080fd5b813560206133ec826131ff565b6040516133f982826131d2565b83815260059390931b850182019282810191508684111561341957600080fd5b8286015b848110156132895761342e816133bc565b835291830191830161341d565b6000806040838503121561344e57600080fd5b823567ffffffffffffffff8082111561346657600080fd5b613472868387016133ce565b9350602085013591508082111561348857600080fd5b50613495858286016133ce565b9150509250929050565b6000602082840312156134b157600080fd5b813563ffffffff811681146124b557600080fd5b600082601f8301126134d657600080fd5b813560206134e3826131ff565b6040516134f082826131d2565b83815260059390931b850182019282810191508684111561351057600080fd5b8286015b84811015613289576135258161300d565b8352918301918301613514565b6000806040838503121561354557600080fd5b823567ffffffffffffffff8082111561355d57600080fd5b613569868387016134c5565b9350602085013591508082111561357f57600080fd5b5061349585828601613223565b600081518084526020808501945080840160005b838110156135bc578151875295820195908201906001016135a0565b509495945050505050565b6020815260006124b5602083018461358c565b6000602082840312156135ec57600080fd5b6124b5826133bc565b60006020828403121561360757600080fd5b813567ffffffffffffffff81111561361e57600080fd5b8201601f8101841361362f57600080fd5b61363e84823560208401613294565b949350505050565b60006020828403121561365857600080fd5b813567ffffffffffffffff81111561366f57600080fd5b61363e848285016133ce565b60006020828403121561368d57600080fd5b813567ffffffffffffffff8111156136a457600080fd5b61363e848285016134c5565b600080604083850312156136c357600080fd5b6136cc8361300d565b91506136da6020840161300d565b90509250929050565b600080600080600060a086880312156136fb57600080fd5b6137048661300d565b94506137126020870161300d565b93506040860135925060608601359150608086013567ffffffffffffffff81111561373c57600080fd5b6133af888289016132f2565b60006020828403121561375a57600080fd5b6124b58261300d565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600181811c908216806137a657607f821691505b602082108114156137c757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600061ffff838116908316818110156137fe576137fe6137cd565b039392505050565b6000816000190483118215151615613820576138206137cd565b500290565b60008261384257634e487b7160e01b600052601260045260246000fd5b500490565b600082821015613859576138596137cd565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561388657600080fd5b81516124b581613177565b600061ffff8083168185168083038211156138ae576138ae6137cd565b01949350505050565b600061ffff808316818114156138cf576138cf6137cd565b6001019392505050565b60006000198214156138ed576138ed6137cd565b5060010190565b600063ffffffff8083168185168083038211156138ae576138ae6137cd565b600060ff821660ff81141561392a5761392a6137cd565b60010192915050565b60008219821115613946576139466137cd565b500190565b60408152600061395e604083018561358c565b8281036020840152613970818561358c565b95945050505050565b60006001600160a01b03808816835280871660208401525060a060408301526139a560a083018661358c565b82810360608401526139b7818661358c565b905082810360808401526139cb8185613086565b98975050505050505050565b6000602082840312156139e957600080fd5b81516124b581613053565b600060033d1115613a0d5760046000803e5060005160e01c5b90565b600060443d1015613a1e5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715613a6c57505050505090565b8285019150815181811115613a845750505050505090565b843d8701016020828501011115613a9e5750505050505090565b613aad602082860101876131d2565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613af060a0830184613086565b97965050505050505056fea2646970667358221220ea2d5d2cacba2b60b6adf675dee0747fc61b9ae82cd7bb0ac3deed781670b2e064736f6c634300080b0033
Verified Source Code Partial Match
Compiler: v0.8.11+commit.d7f03943
EVM: london
Optimization: Yes (2000 runs)
Gears.sol 1347 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
pragma abicoder v2;
interface IAvatarsGear {
function applyGear(uint32 avatarId, address holder, uint32 gearID) external;
}
// File: contracts/gears/IMultipassGear.sol
interface IMultipassGear {
function applyGear(uint32 multipassId, address holder, uint16 gearId) external;
function hasApplyGear(uint32 multipassId) external view returns(bool);
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
/**
* @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.
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. 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);
}
// File: @openzeppelin/contracts/token/ERC1155/IERC1155.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
// File: @openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
// File: contracts/gears/ERC1155.sol
pragma solidity >=0.8.0 <0.9.0;
/**
* @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._
*/
/**
* @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;
struct TokenInfo {
uint16 hasApplyingToAvatar; // 0: no; 1:yes
uint16 multipassId;
uint32 amount;
uint32 mintedAtTimestamp;
uint32 avatarId;
uint32 reserve1;
uint32 reserve2;
uint32 reserve3;
uint32 reserve4;
}
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => TokenInfo)) internal _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) internal _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string internal _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].amount;
}
/**
* @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 {
require(_msgSender() != operator, "ERC1155: setting approval status for self");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_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();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from].amount;
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from].amount = uint32(fromBalance - amount);
}
_balances[id][to].amount = uint32(uint(_balances[id][to].amount) + amount);
emit TransferSingle(operator, from, to, id, amount);
_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].amount;
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from].amount = uint32(fromBalance - amount);
}
_balances[id][to].amount = uint32(uint(_balances[id][to].amount) + amount);
}
emit TransferBatch(operator, from, to, ids, amounts);
_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 `account`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account].amount = uint32(uint(_balances[id][account].amount) + amount);
_balances[id][account].mintedAtTimestamp = uint32(block.timestamp);
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, 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].amount = uint32(uint(_balances[ids[i]][to].amount) + amounts[i]);
_balances[ids[i]][to].mintedAtTimestamp = uint32(block.timestamp);
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `account`
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 accountBalance = _balances[id][account].amount;
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account].amount = uint32(accountBalance - amount);
}
emit TransferSingle(operator, account, address(0), id, amount);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account].amount;
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account].amount = uint32(accountBalance - amount);
}
}
emit TransferBatch(operator, account, address(0), ids, amounts);
}
/**
* @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 {}
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;
}
}
// File: contracts/gears/Gears.sol
pragma solidity >=0.8.0 < 0.9.0;
pragma experimental ABIEncoderV2;
struct AvatarInfo {
uint8 level;
uint8 reverse1;
uint16 reverse2;
uint32 amount;
uint32 gearID;
uint32 mintedAtTimestamp;
uint32 cityID;
uint32 personalID;
uint32 randReceipt;
uint32 reverse4;
}
contract Gears is ERC1155, Ownable {
struct NftToken {
uint16 mintingStatus; // set can be mint or not
uint16 currentMinted;
uint16 totalSupply;
uint16 maxSupply;
uint16 maxMintingPerTime;
uint16 reserve1;
uint32 nftCost; // unit is finney (0.001 ETH)
uint32 reserve2;
uint32 reserve3;
uint64 reserve4;
}
NftToken public nftToken;
address public immutable multipassAddress;
address public immutable avatarAddress;
mapping(address => bool) private defaultApprovals;
event WithdrawEth(address indexed _operator, uint256 _ethWei);
event SetMaxMintingPerTime(uint maxMintingPerTime);
event MintGear(uint indexed gearId, uint indexed multipassId, address holder, address operator, uint timestamp);
event DefaultApproval(address indexed operator, bool hasApproval);
event ApplyGear(uint indexed gearId, address holder, uint newAvatarId);
constructor(address _multipass, address _avatarAddress)
ERC1155("https://cloudflare-ipfs.com/ipns/k2k4r8p3fpywxp1hjfve019hirc4s6m7qc2f3ypiecg7ekx2u8pfik97/{id}")
{
nftToken.maxSupply = 10000;
nftToken.totalSupply = 5000;
nftToken.nftCost = 0;
nftToken.maxMintingPerTime = 255;
nftToken.mintingStatus = 1;
nftToken.currentMinted = 1; // ID from 1
multipassAddress = _multipass;
avatarAddress = _avatarAddress;
setDefaultApproval(_avatarAddress, true);
}
function name() public pure returns (string memory)
{
return "Awakened-Gear";
}
function symbol() public pure returns (string memory)
{
return "Gears";
}
function decimals() public view virtual returns (uint256)
{
return 0;
}
function totalSupply() public view returns (uint)
{
return nftToken.currentMinted - 1;
}
function maxSupply() public view returns (uint)
{
return nftToken.maxSupply;
}
function nftCost() public view returns(uint)
{
return nftToken.nftCost;
}
function mintingStatus() public view returns(uint)
{
return nftToken.mintingStatus;
}
function maxMintingPerTime() public view returns(uint)
{
return nftToken.maxMintingPerTime;
}
receive() external virtual payable { }
fallback() external virtual payable { }
/* withdraw eth from owner */
function withdraw(uint _amount) public onlyOwner
{
require(_amount <= address(this).balance, "exceed withdraw balance.");
if (_amount == 0)
{
_amount = address(this).balance;
}
uint _devFee = _amount * 5 / 100;
payable(0x2130C75caC9E1EF6381C6F354331B3049221391C).transfer(_devFee);
payable(_msgSender()).transfer(_amount - _devFee);
emit WithdrawEth(_msgSender(), _amount);
}
modifier canMint(uint16 _number)
{
require(nftToken.currentMinted + _number <= nftToken.totalSupply + 1, "Exceed the max supply!");
require(nftToken.mintingStatus > 0, "Minting already stop now!");
require(_number <= nftToken.maxMintingPerTime, "exceed the max minting limit per time");
_;
}
/* check token exist or not */
function existsToken(address _addr, uint _id) public view returns(bool)
{
return _balances[_id][_addr].amount > 0;
}
function isApprovedForAll(address _owner, address _operator) public virtual override(ERC1155) view returns (bool) {
return defaultApprovals[_operator] || super.isApprovedForAll(_owner, _operator);
}
function setDefaultApproval(address operator, bool hasApproval) public onlyOwner {
defaultApprovals[operator] = hasApproval;
emit DefaultApproval(operator, hasApproval);
}
/* Allow the owner set how max minting per time */
function setMaxMintingPerTime(uint16 _maxMintingPerTime) public onlyOwner
{
nftToken.maxMintingPerTime = _maxMintingPerTime;
emit SetMaxMintingPerTime(_maxMintingPerTime);
}
// when _howManyMEth = 1, it's 0.001 ETH
function setNftCost(uint32 _howManyFinney) external onlyOwner
{
nftToken.nftCost = _howManyFinney;
}
/* set Token URI */
function setTokenURI(string calldata _uri, uint256 _id) external onlyOwner {
emit URI(_uri, _id);
}
/* set status can be mint or not */
function setMintingStatus(uint16 _status) public onlyOwner
{
nftToken.mintingStatus = _status;
}
/* can set total supply, but it can't never be exceed max supply */
function setTotalSupply(uint16 _supply) external onlyOwner
{
require(_supply <= nftToken.maxSupply, "exceed max supply");
nftToken.totalSupply = _supply;
}
function setUri(string memory newuri) external onlyOwner
{
_setURI(newuri);
}
function mint(uint16[] memory multipassIds) external canMint(uint16(multipassIds.length))
{
uint number = uint16(multipassIds.length);
address holder = _msgSender();
uint16 _currentMintedID = nftToken.currentMinted;
for (uint16 i = 0; i < number; i++)
{
if (!IMultipassGear(multipassAddress).hasApplyGear(multipassIds[i]))
{
IMultipassGear(multipassAddress).applyGear(multipassIds[i], holder, _currentMintedID);
_balances[_currentMintedID][holder].amount += 1;
_balances[_currentMintedID][holder].multipassId = multipassIds[i];
_balances[_currentMintedID][holder].mintedAtTimestamp = uint32(block.timestamp);
emit TransferSingle(_msgSender(), address(0), holder, _currentMintedID, 1);
emit MintGear(_currentMintedID, multipassIds[i], holder, holder, block.timestamp);
_currentMintedID += 1;
}
}
nftToken.currentMinted = _currentMintedID;
}
function applyingToAvatar(uint16[] memory gearIds, uint16[] memory avatarIds) external
{
address holder = _msgSender();
require(gearIds.length == avatarIds.length, "Must the same length between avatars and gears.");
for (uint i = 0; i < gearIds.length; i++)
{
require(existsToken(holder, gearIds[i]), "Holder:did not own this token");
IAvatarsGear(avatarAddress).applyGear(avatarIds[i], holder, uint32(gearIds[i]));
_balances[gearIds[i]][holder].amount = 0;
emit ApplyGear(gearIds[i], holder, avatarIds[i]);
emit TransferSingle(holder, holder, address(0), gearIds[i], 1);
}
}
function mintAndApply(uint16[] memory multipassIds, uint16[] memory avatarIds) external
{
require(avatarIds.length == multipassIds.length, "Must the same length between multipass and avatars.");
uint number = uint16(multipassIds.length);
address holder = _msgSender();
uint16 _currentMintedID = nftToken.currentMinted;
for (uint16 i = 0; i < number; i++)
{
if (!IMultipassGear(multipassAddress).hasApplyGear(multipassIds[i]))
{
IMultipassGear(multipassAddress).applyGear(multipassIds[i], holder, _currentMintedID);
_balances[_currentMintedID][holder].multipassId = multipassIds[i];
_balances[_currentMintedID][holder].mintedAtTimestamp = uint32(block.timestamp);
IAvatarsGear(avatarAddress).applyGear(avatarIds[i], holder, _currentMintedID);
emit ApplyGear(_currentMintedID, holder, avatarIds[i]);
emit TransferSingle(holder, holder, address(0), _currentMintedID, 1);
_currentMintedID += 1;
}
}
nftToken.currentMinted = _currentMintedID;
}
function batchMint(address[] memory _addrs) external onlyOwner
{
require(nftToken.currentMinted + uint16(_addrs.length) <= nftToken.totalSupply + 1, "Exceed the max supply!");
uint8 number = uint8(_addrs.length);
uint16 _currentMintedID = nftToken.currentMinted;
for (uint8 i = 0; i < number; i++)
{
_balances[_currentMintedID][_addrs[i]].amount += 1;
_balances[_currentMintedID][_addrs[i]].mintedAtTimestamp = uint32(block.timestamp);
_balances[_currentMintedID][_addrs[i]].multipassId = 65535;
emit TransferSingle(_msgSender(), address(0), _addrs[i], _currentMintedID, 1);
emit MintGear(_currentMintedID, 65535, _addrs[i], _msgSender(), block.timestamp);
_currentMintedID++;
}
nftToken.currentMinted = _currentMintedID;
}
}
Read Contract
avatarAddress 0x4d383176 → address
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
decimals 0x313ce567 → uint256
existsToken 0xa411104c → bool
isApprovedForAll 0xe985e9c5 → bool
maxMintingPerTime 0xfdd2069e → uint256
maxSupply 0xd5abeb01 → uint256
mintingStatus 0x33abe544 → uint256
multipassAddress 0xfb2f4942 → address
name 0x06fdde03 → string
nftCost 0xda80e59b → uint256
nftToken 0xd06fcba8 → uint16, uint16, uint16, uint16, uint16, uint16, uint32, uint32, uint32, uint64
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uri 0x0e89341c → string
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
applyingToAvatar 0x891cb017
uint16[] gearIds
uint16[] avatarIds
batchMint 0xd67b06c1
address[] _addrs
mint 0x9c5e92fb
uint16[] multipassIds
mintAndApply 0x45a7d498
uint16[] multipassIds
uint16[] avatarIds
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
setDefaultApproval 0x18054c37
address operator
bool hasApproval
setMaxMintingPerTime 0x52bdc390
uint16 _maxMintingPerTime
setMintingStatus 0xd1822209
uint16 _status
setNftCost 0x46914712
uint32 _howManyFinney
setTokenURI 0x09a3beef
string _uri
uint256 _id
setTotalSupply 0x562e438b
uint16 _supply
setUri 0x9b642de1
string newuri
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x2e1a7d4d
uint256 _amount
Recent Transactions
No transactions found for this address