Address Contract Verified
Address
0x3A7DC718Eaf31f0a55988161f3d75D7CA785b034
Balance
0 ETH
Nonce
1
Code Size
22866 bytes
Creator
0xb7E0c211...D273 at tx 0xad4eb6bb...667ac7
Indexed Transactions
0
Contract Bytecode
22866 bytes
0x6080604052600436106101c15760003560e01c80634f558e79116100f7578063bc197c8111610095578063f23a6e6111610064578063f23a6e6114610694578063f242432a146106d1578063f2fde38b146106fa578063f7bca79c14610723576101c1565b8063bc197c81146105b2578063bd85b039146105ef578063cd7c03261461062c578063e985e9c514610657576101c1565b80638a28a5a2116100d15780638a28a5a2146104f65780638da5cb5b1461053357806395d89b411461055e578063a22cb46514610589576101c1565b80634f558e791461047957806366aac863146104b6578063715018a6146104df576101c1565b80631b3e2234116101645780632eb2c2d61161013e5780632eb2c2d6146103bf5780633408e470146103e85780633adf80b4146104135780634e1273f41461043c576101c1565b80631b3e22341461032c57806320379ee5146103575780632d0335ab14610382576101c1565b806306fdde03116101a057806306fdde03146102695780630c53c51c146102945780630e89341c146102c45780630f7e597014610301576101c1565b8062fdd58e146101c657806301ffc9a71461020357806302fe530514610240575b600080fd5b3480156101d257600080fd5b506101ed60048036038101906101e89190613eba565b61073f565b6040516101fa91906152b2565b60405180910390f35b34801561020f57600080fd5b5061022a60048036038101906102259190614000565b610808565b6040516102379190614eb3565b60405180910390f35b34801561024c57600080fd5b506102676004803603810190610262919061407b565b6108ea565b005b34801561027557600080fd5b5061027e610972565b60405161028b9190614fb0565b60405180910390f35b6102ae60048036038101906102a99190613e2b565b610a00565b6040516102bb9190614f8e565b60405180910390f35b3480156102d057600080fd5b506102eb60048036038101906102e691906140bc565b610c72565b6040516102f89190614fb0565b60405180910390f35b34801561030d57600080fd5b50610316610dd4565b6040516103239190614fb0565b60405180910390f35b34801561033857600080fd5b50610341610e0d565b60405161034e9190614cd5565b60405180910390f35b34801561036357600080fd5b5061036c610e33565b6040516103799190614ece565b60405180910390f35b34801561038e57600080fd5b506103a960048036038101906103a49190613ade565b610e3d565b6040516103b691906152b2565b60405180910390f35b3480156103cb57600080fd5b506103e660048036038101906103e19190613c0f565b610e86565b005b3480156103f457600080fd5b506103fd61127c565b60405161040a91906152b2565b60405180910390f35b34801561041f57600080fd5b5061043a6004803603810190610435919061417a565b611289565b005b34801561044857600080fd5b50610463600480360381019061045e9190613ef6565b611369565b6040516104709190614e5a565b60405180910390f35b34801561048557600080fd5b506104a0600480360381019061049b91906140bc565b61151a565b6040516104ad9190614eb3565b60405180910390f35b3480156104c257600080fd5b506104dd60048036038101906104d89190613f62565b6115ce565b005b3480156104eb57600080fd5b506104f46117a4565b005b34801561050257600080fd5b5061051d600480360381019061051891906140bc565b6118e1565b60405161052a9190614fb0565b60405180910390f35b34801561053f57600080fd5b50610548611981565b6040516105559190614cd5565b60405180910390f35b34801561056a57600080fd5b506105736119ab565b6040516105809190614fb0565b60405180910390f35b34801561059557600080fd5b506105b060048036038101906105ab9190613def565b611a39565b005b3480156105be57600080fd5b506105d960048036038101906105d49190613b43565b611bba565b6040516105e69190614f73565b60405180910390f35b3480156105fb57600080fd5b50610616600480360381019061061191906140bc565b611dbc565b60405161062391906152b2565b60405180910390f35b34801561063857600080fd5b50610641611e70565b60405161064e9190614cd5565b60405180910390f35b34801561066357600080fd5b5061067e60048036038101906106799190613b07565b611e96565b60405161068b9190614eb3565b60405180910390f35b3480156106a057600080fd5b506106bb60048036038101906106b69190613cce565b611f98565b6040516106c89190614f73565b60405180910390f35b3480156106dd57600080fd5b506106f860048036038101906106f39190613d60565b6120ce565b005b34801561070657600080fd5b50610721600480360381019061071c9190613ade565b6123e6565b005b61073d6004803603810190610738919061410e565b612592565b005b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a790615052565b60405180910390fd5b60008083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806108d357507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806108e357506108e2826127d7565b5b9050919050565b6108f2612841565b73ffffffffffffffffffffffffffffffffffffffff16610910611981565b73ffffffffffffffffffffffffffffffffffffffff1614610966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095d906151b2565b60405180910390fd5b61096f81612850565b50565b6009805461097f90615621565b80601f01602080910402602001604051908101604052809291908181526020018280546109ab90615621565b80156109f85780601f106109cd576101008083540402835291602001916109f8565b820191906000526020600020905b8154815290600101906020018083116109db57829003601f168201915b505050505081565b606060006040518060600160405280600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481526020018873ffffffffffffffffffffffffffffffffffffffff168152602001878152509050610a83878287878761286a565b610ac2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab9906151d2565b60405180910390fd5b610b156001600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461297390919063ffffffff16565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b873388604051610b8b93929190614cf0565b60405180910390a16000803073ffffffffffffffffffffffffffffffffffffffff16888a604051602001610bc0929190614c76565b604051602081830303815290604052604051610bdc9190614c5f565b6000604051808303816000865af19150503d8060008114610c19576040519150601f19603f3d011682016040523d82523d6000602084013e610c1e565b606091505b509150915081610c63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5a90615092565b60405180910390fd5b80935050505095945050505050565b60606000600860008481526020019081526020016000208054610c9490615621565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc090615621565b8015610d0d5780601f10610ce257610100808354040283529160200191610d0d565b820191906000526020600020905b815481529060010190602001808311610cf057829003601f168201915b50505050509050600081511115610dc257600860008481526020019081526020016000208054610d3c90615621565b80601f0160208091040260200160405190810160405280929190818152602001828054610d6890615621565b8015610db55780601f10610d8a57610100808354040283529160200191610db5565b820191906000526020600020905b815481529060010190602001808311610d9857829003601f168201915b5050505050915050610dcf565b610dcb83612989565b9150505b919050565b6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600454905090565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b8151835114610eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec190615252565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415610f3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3190615132565b60405180910390fd5b610f42612841565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480610f885750610f8785610f82612841565b611e96565b5b610fc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbe90615152565b60405180910390fd5b6000610fd1612841565b9050610fe1818787878787612a1d565b60005b84518110156111e7576000858281518110611028577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600085838151811061106d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600080600084815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590615192565b60405180910390fd5b818161111a91906154fc565b60008085815260200190815260200160002060008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111cc91906154a6565b92505081905550505050806111e090615653565b9050610fe4565b508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161125e929190614e7c565b60405180910390a4611274818787878787612a25565b505050505050565b6000804690508091505090565b611291612841565b73ffffffffffffffffffffffffffffffffffffffff166112af611981565b73ffffffffffffffffffffffffffffffffffffffff1614611305576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fc906151b2565b60405180910390fd5b8060086000848152602001908152602001600020908051906020019061132c9291906136d9565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b8260405161135d9190614fb0565b60405180910390a25050565b606081518351146113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a690615212565b60405180910390fd5b6000835167ffffffffffffffff8111156113f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156114205781602001602082028036833780820191505090505b50905060005b845181101561150f576114b985828151811061146b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518583815181106114ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015161073f565b8282815181106114f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250508061150890615653565b9050611426565b508091505092915050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f558e79836040518263ffffffff1660e01b815260040161157791906152b2565b60206040518083038186803b15801561158f57600080fd5b505afa1580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c79190613fd7565b9050919050565b6002600b541415611614576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160b90615292565b60405180910390fd5b6002600b81905550818190508484905014611664576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165b90614fd2565b60405180910390fd5b6116f861166f612841565b858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050612bf5565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632eb2c2d63061173f612841565b878787876040518763ffffffff1660e01b815260040161176496959493929190614d2e565b600060405180830381600087803b15801561177e57600080fd5b505af1158015611792573d6000803e3d6000fd5b505050506001600b8190555050505050565b6117ac612841565b73ffffffffffffffffffffffffffffffffffffffff166117ca611981565b73ffffffffffffffffffffffffffffffffffffffff1614611820576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611817906151b2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6008602052806000526040600020600091509050805461190090615621565b80601f016020809104026020016040519081016040528092919081815260200182805461192c90615621565b80156119795780601f1061194e57610100808354040283529160200191611979565b820191906000526020600020905b81548152906001019060200180831161195c57829003601f168201915b505050505081565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600a80546119b890615621565b80601f01602080910402602001604051908101604052809291908181526020018280546119e490615621565b8015611a315780601f10611a0657610100808354040283529160200191611a31565b820191906000526020600020905b815481529060010190602001808311611a1457829003601f168201915b505050505081565b8173ffffffffffffffffffffffffffffffffffffffff16611a58612841565b73ffffffffffffffffffffffffffffffffffffffff161415611aaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa6906151f2565b60405180910390fd5b8060016000611abc612841565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611b69612841565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611bae9190614eb3565b60405180910390a35050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611bfd612841565b73ffffffffffffffffffffffffffffffffffffffff1614611c53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4a90615232565b60405180910390fd5b848490508787905014611c9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9290615032565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614158015611d0357503073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614155b15611da657611da588888880806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505060405180602001604052806000815250612efb565b5b63bc197c8160e01b905098975050505050505050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bd85b039836040518263ffffffff1660e01b8152600401611e1991906152b2565b60206040518083038186803b158015611e3157600080fd5b505afa158015611e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6991906140e5565b9050919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663c4552791866040518263ffffffff1660e01b8152600401611f0e9190614cd5565b60206040518083038186803b158015611f2657600080fd5b505afa158015611f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5e9190614052565b73ffffffffffffffffffffffffffffffffffffffff161415611f84576001915050611f92565b611f8e8484613165565b9150505b92915050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fdb612841565b73ffffffffffffffffffffffffffffffffffffffff1614612031576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202890615232565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415801561209957503073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614155b156120ba576120b9868686604051806020016040528060008152506131f9565b5b63f23a6e6160e01b90509695505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561213e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161213590615132565b60405180910390fd5b612146612841565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148061218c575061218b85612186612841565b611e96565b5b6121cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c2906150d2565b60405180910390fd5b60006121d5612841565b90506121f58187876121e68861338f565b6121ef8861338f565b87612a1d565b600080600086815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508381101561228c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161228390615192565b60405180910390fd5b838161229891906154fc565b60008087815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008087815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461234a91906154a6565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6288886040516123c792919061530d565b60405180910390a46123dd828888888888613455565b50505050505050565b6123ee612841565b73ffffffffffffffffffffffffffffffffffffffff1661240c611981565b73ffffffffffffffffffffffffffffffffffffffff1614612462576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612459906151b2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156124d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c990615072565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600115158173ffffffffffffffffffffffffffffffffffffffff16634f558e79876040518263ffffffff1660e01b81526004016125f691906152b2565b60206040518083038186803b15801561260e57600080fd5b505afa158015612622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126469190613fd7565b151514612688576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267f906150f2565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663f7bca79c34878787876040518663ffffffff1660e01b81526004016126c894939291906152cd565b6000604051808303818588803b1580156126e157600080fd5b505af11580156126f5573d6000803e3d6000fd5b505050505061271f612705612841565b8686869050604051806020016040528060008152506131f9565b5050505050565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156127d057600080368080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509050600080369050905073ffffffffffffffffffffffffffffffffffffffff8183015116925050506127d4565b3390505b90565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600061284b612726565b905090565b80600290805190602001906128669291906136d9565b5050565b60008073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156128db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128d290615112565b60405180910390fd5b60016128ee6128e987613625565b61368d565b8386866040516000815260200160405260405161290e9493929190614f2e565b6020604051602081039080840390855afa158015612930573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b6000818361298191906154a6565b905092915050565b60606002805461299890615621565b80601f01602080910402602001604051908101604052809291908181526020018280546129c490615621565b8015612a115780601f106129e657610100808354040283529160200191612a11565b820191906000526020600020905b8154815290600101906020018083116129f457829003601f168201915b50505050509050919050565b505050505050565b612a448473ffffffffffffffffffffffffffffffffffffffff166136c6565b15612bed578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401612a8a959493929190614d98565b602060405180830381600087803b158015612aa457600080fd5b505af1925050508015612ad557506040513d601f19601f82011682018060405250810190612ad29190614029565b60015b612b6457612ae1615782565b80612aec5750612b29565b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b209190614fb0565b60405180910390fd5b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b5b90614ff2565b60405180910390fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612beb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612be290615012565b60405180910390fd5b505b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612c65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c5c90615172565b60405180910390fd5b8051825114612ca9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ca090615252565b60405180910390fd5b6000612cb3612841565b9050612cd381856000868660405180602001604052806000815250612a1d565b60005b8351811015612e75576000848281518110612d1a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190506000848381518110612d5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050600080600084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015612e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df7906150b2565b60405180910390fd5b8181612e0c91906154fc565b60008085815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050508080612e6d90615653565b915050612cd6565b50600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612eed929190614e7c565b60405180910390a450505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612f6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f6290615272565b60405180910390fd5b8151835114612faf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fa690615252565b60405180910390fd5b6000612fb9612841565b9050612fca81600087878787612a1d565b60005b84518110156130cf5783818151811061300f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151600080878481518110613053577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546130b591906154a6565b9250508190555080806130c790615653565b915050612fcd565b508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613147929190614e7c565b60405180910390a461315e81600087878787612a25565b5050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415613269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161326090615272565b60405180910390fd5b6000613273612841565b9050613294816000876132858861338f565b61328e8861338f565b87612a1d565b8260008086815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546132f391906154a6565b925050819055508473ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62878760405161337192919061530d565b60405180910390a461338881600087878787613455565b5050505050565b60606000600167ffffffffffffffff8111156133d4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156134025781602001602082028036833780820191505090505b5090508281600081518110613440577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080915050919050565b6134748473ffffffffffffffffffffffffffffffffffffffff166136c6565b1561361d578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b81526004016134ba959493929190614e00565b602060405180830381600087803b1580156134d457600080fd5b505af192505050801561350557506040513d601f19601f820116820180604052508101906135029190614029565b60015b61359457613511615782565b8061351c5750613559565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135509190614fb0565b60405180910390fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161358b90614ff2565b60405180910390fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461361b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161361290615012565b60405180910390fd5b505b505050505050565b60006040518060800160405280604381526020016158da6043913980519060200120826000015183602001518460400151805190602001206040516020016136709493929190614ee9565b604051602081830303815290604052805190602001209050919050565b6000613697610e33565b826040516020016136a9929190614c9e565b604051602081830303815290604052805190602001209050919050565b600080823b905060008111915050919050565b8280546136e590615621565b90600052602060002090601f016020900481019282613707576000855561374e565b82601f1061372057805160ff191683800117855561374e565b8280016001018555821561374e579182015b8281111561374d578251825591602001919060010190613732565b5b50905061375b919061375f565b5090565b5b80821115613778576000816000905550600101613760565b5090565b600061378f61378a84615367565b615336565b905080838252602082019050828560208602820111156137ae57600080fd5b60005b858110156137de57816137c488826138d0565b8452602084019350602083019250506001810190506137b1565b5050509392505050565b60006137fb6137f684615393565b615336565b9050808382526020820190508285602086028201111561381a57600080fd5b60005b8581101561384a57816138308882613a9f565b84526020840193506020830192505060018101905061381d565b5050509392505050565b6000613867613862846153bf565b615336565b90508281526020810184848401111561387f57600080fd5b61388a8482856155df565b509392505050565b60006138a56138a0846153ef565b615336565b9050828152602081018484840111156138bd57600080fd5b6138c88482856155df565b509392505050565b6000813590506138df81615838565b92915050565b600082601f8301126138f657600080fd5b813561390684826020860161377c565b91505092915050565b60008083601f84011261392157600080fd5b8235905067ffffffffffffffff81111561393a57600080fd5b60208301915083602082028301111561395257600080fd5b9250929050565b600082601f83011261396a57600080fd5b813561397a8482602086016137e8565b91505092915050565b6000813590506139928161584f565b92915050565b6000815190506139a78161584f565b92915050565b6000813590506139bc81615866565b92915050565b6000813590506139d18161587d565b92915050565b6000815190506139e68161587d565b92915050565b60008083601f8401126139fe57600080fd5b8235905067ffffffffffffffff811115613a1757600080fd5b602083019150836001820283011115613a2f57600080fd5b9250929050565b600082601f830112613a4757600080fd5b8135613a57848260208601613854565b91505092915050565b600081519050613a6f81615894565b92915050565b600082601f830112613a8657600080fd5b8135613a96848260208601613892565b91505092915050565b600081359050613aae816158ab565b92915050565b600081519050613ac3816158ab565b92915050565b600081359050613ad8816158c2565b92915050565b600060208284031215613af057600080fd5b6000613afe848285016138d0565b91505092915050565b60008060408385031215613b1a57600080fd5b6000613b28858286016138d0565b9250506020613b39858286016138d0565b9150509250929050565b60008060008060008060008060a0898b031215613b5f57600080fd5b6000613b6d8b828c016138d0565b9850506020613b7e8b828c016138d0565b975050604089013567ffffffffffffffff811115613b9b57600080fd5b613ba78b828c0161390f565b9650965050606089013567ffffffffffffffff811115613bc657600080fd5b613bd28b828c0161390f565b9450945050608089013567ffffffffffffffff811115613bf157600080fd5b613bfd8b828c016139ec565b92509250509295985092959890939650565b600080600080600060a08688031215613c2757600080fd5b6000613c35888289016138d0565b9550506020613c46888289016138d0565b945050604086013567ffffffffffffffff811115613c6357600080fd5b613c6f88828901613959565b935050606086013567ffffffffffffffff811115613c8c57600080fd5b613c9888828901613959565b925050608086013567ffffffffffffffff811115613cb557600080fd5b613cc188828901613a36565b9150509295509295909350565b60008060008060008060a08789031215613ce757600080fd5b6000613cf589828a016138d0565b9650506020613d0689828a016138d0565b9550506040613d1789828a01613a9f565b9450506060613d2889828a01613a9f565b935050608087013567ffffffffffffffff811115613d4557600080fd5b613d5189828a016139ec565b92509250509295509295509295565b600080600080600060a08688031215613d7857600080fd5b6000613d86888289016138d0565b9550506020613d97888289016138d0565b9450506040613da888828901613a9f565b9350506060613db988828901613a9f565b925050608086013567ffffffffffffffff811115613dd657600080fd5b613de288828901613a36565b9150509295509295909350565b60008060408385031215613e0257600080fd5b6000613e10858286016138d0565b9250506020613e2185828601613983565b9150509250929050565b600080600080600060a08688031215613e4357600080fd5b6000613e51888289016138d0565b955050602086013567ffffffffffffffff811115613e6e57600080fd5b613e7a88828901613a36565b9450506040613e8b888289016139ad565b9350506060613e9c888289016139ad565b9250506080613ead88828901613ac9565b9150509295509295909350565b60008060408385031215613ecd57600080fd5b6000613edb858286016138d0565b9250506020613eec85828601613a9f565b9150509250929050565b60008060408385031215613f0957600080fd5b600083013567ffffffffffffffff811115613f2357600080fd5b613f2f858286016138e5565b925050602083013567ffffffffffffffff811115613f4c57600080fd5b613f5885828601613959565b9150509250929050565b60008060008060408587031215613f7857600080fd5b600085013567ffffffffffffffff811115613f9257600080fd5b613f9e8782880161390f565b9450945050602085013567ffffffffffffffff811115613fbd57600080fd5b613fc98782880161390f565b925092505092959194509250565b600060208284031215613fe957600080fd5b6000613ff784828501613998565b91505092915050565b60006020828403121561401257600080fd5b6000614020848285016139c2565b91505092915050565b60006020828403121561403b57600080fd5b6000614049848285016139d7565b91505092915050565b60006020828403121561406457600080fd5b600061407284828501613a60565b91505092915050565b60006020828403121561408d57600080fd5b600082013567ffffffffffffffff8111156140a757600080fd5b6140b384828501613a75565b91505092915050565b6000602082840312156140ce57600080fd5b60006140dc84828501613a9f565b91505092915050565b6000602082840312156140f757600080fd5b600061410584828501613ab4565b91505092915050565b6000806000806060858703121561412457600080fd5b600061413287828801613a9f565b945050602085013567ffffffffffffffff81111561414f57600080fd5b61415b8782880161390f565b9350935050604061416e87828801613a9f565b91505092959194509250565b6000806040838503121561418d57600080fd5b600061419b85828601613a9f565b925050602083013567ffffffffffffffff8111156141b857600080fd5b6141c485828601613a75565b9150509250929050565b60006141da8383614c32565b60208301905092915050565b6141ef81615542565b82525050565b6141fe81615530565b82525050565b61421561421082615530565b61569c565b82525050565b6000614227838561545d565b93507f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561425657600080fd5b6020830292506142678385846155df565b82840190509392505050565b600061427e8261542f565b614288818561545d565b93506142938361541f565b8060005b838110156142c45781516142ab88826141ce565b97506142b683615450565b925050600181019050614297565b5085935050505092915050565b6142da81615554565b82525050565b6142e981615560565b82525050565b6143006142fb82615560565b6156ae565b82525050565b61430f8161556a565b82525050565b60006143208261543a565b61432a818561546e565b935061433a8185602086016155ee565b61434381615757565b840191505092915050565b60006143598261543a565b614363818561547f565b93506143738185602086016155ee565b80840191505092915050565b600061438a82615445565b614394818561548a565b93506143a48185602086016155ee565b6143ad81615757565b840191505092915050565b60006143c5601d8361548a565b91507f69647320616e64207175616e746974696573206d757374206d617463680000006000830152602082019050919050565b600061440560348361548a565b91507f455243313135353a207472616e7366657220746f206e6f6e204552433131353560008301527f526563656976657220696d706c656d656e7465720000000000000000000000006020830152604082019050919050565b600061446b60288361548a565b91507f455243313135353a204552433131353552656365697665722072656a6563746560008301527f6420746f6b656e730000000000000000000000000000000000000000000000006020830152604082019050919050565b60006144d160108361548a565b91507f504152414d535f4e4f545f4d41544348000000000000000000000000000000006000830152602082019050919050565b6000614511602b8361548a565b91507f455243313135353a2062616c616e636520717565727920666f7220746865207a60008301527f65726f20616464726573730000000000000000000000000000000000000000006020830152604082019050919050565b600061457760268361548a565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006145dd601c8361548a565b91507f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006000830152602082019050919050565b600061461d60248361548a565b91507f455243313135353a206275726e20616d6f756e7420657863656564732062616c60008301527f616e6365000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061468360028361549b565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b60006146c360298361548a565b91507f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260008301527f20617070726f76656400000000000000000000000000000000000000000000006020830152604082019050919050565b600061472960108361548a565b91507f696e76616c696420746f6b656e206964000000000000000000000000000000006000830152602082019050919050565b600061476960258361548a565b91507f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360008301527f49474e45520000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006147cf60258361548a565b91507f455243313135353a207472616e7366657220746f20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061483560328361548a565b91507f455243313135353a207472616e736665722063616c6c6572206973206e6f742060008301527f6f776e6572206e6f7220617070726f76656400000000000000000000000000006020830152604082019050919050565b600061489b60238361548a565b91507f455243313135353a206275726e2066726f6d20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614901602a8361548a565b91507f455243313135353a20696e73756666696369656e742062616c616e636520666f60008301527f72207472616e73666572000000000000000000000000000000000000000000006020830152604082019050919050565b600061496760208361548a565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006149a760218361548a565b91507f5369676e657220616e64207369676e617475726520646f206e6f74206d61746360008301527f68000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614a0d60008361546e565b9150600082019050919050565b6000614a2760298361548a565b91507f455243313135353a2073657474696e6720617070726f76616c2073746174757360008301527f20666f722073656c6600000000000000000000000000000000000000000000006020830152604082019050919050565b6000614a8d60298361548a565b91507f455243313135353a206163636f756e747320616e6420696473206c656e67746860008301527f206d69736d6174636800000000000000000000000000000000000000000000006020830152604082019050919050565b6000614af360138361548a565b91507f72656a656374656420746f6b656e2074797065000000000000000000000000006000830152602082019050919050565b6000614b3360288361548a565b91507f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060008301527f6d69736d617463680000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614b9960218361548a565b91507f455243313135353a206d696e7420746f20746865207a65726f2061646472657360008301527f73000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614bff601f8361548a565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b614c3b816155c8565b82525050565b614c4a816155c8565b82525050565b614c59816155d2565b82525050565b6000614c6b828461434e565b915081905092915050565b6000614c82828561434e565b9150614c8e8284614204565b6014820191508190509392505050565b6000614ca982614676565b9150614cb582856142ef565b602082019150614cc582846142ef565b6020820191508190509392505050565b6000602082019050614cea60008301846141f5565b92915050565b6000606082019050614d0560008301866141f5565b614d1260208301856141e6565b8181036040830152614d248184614315565b9050949350505050565b600060a082019050614d4360008301896141f5565b614d5060208301886141f5565b8181036040830152614d6381868861421b565b90508181036060830152614d7881848661421b565b90508181036080830152614d8b81614a00565b9050979650505050505050565b600060a082019050614dad60008301886141f5565b614dba60208301876141f5565b8181036040830152614dcc8186614273565b90508181036060830152614de08185614273565b90508181036080830152614df48184614315565b90509695505050505050565b600060a082019050614e1560008301886141f5565b614e2260208301876141f5565b614e2f6040830186614c41565b614e3c6060830185614c41565b8181036080830152614e4e8184614315565b90509695505050505050565b60006020820190508181036000830152614e748184614273565b905092915050565b60006040820190508181036000830152614e968185614273565b90508181036020830152614eaa8184614273565b90509392505050565b6000602082019050614ec860008301846142d1565b92915050565b6000602082019050614ee360008301846142e0565b92915050565b6000608082019050614efe60008301876142e0565b614f0b6020830186614c41565b614f1860408301856141f5565b614f2560608301846142e0565b95945050505050565b6000608082019050614f4360008301876142e0565b614f506020830186614c50565b614f5d60408301856142e0565b614f6a60608301846142e0565b95945050505050565b6000602082019050614f886000830184614306565b92915050565b60006020820190508181036000830152614fa88184614315565b905092915050565b60006020820190508181036000830152614fca818461437f565b905092915050565b60006020820190508181036000830152614feb816143b8565b9050919050565b6000602082019050818103600083015261500b816143f8565b9050919050565b6000602082019050818103600083015261502b8161445e565b9050919050565b6000602082019050818103600083015261504b816144c4565b9050919050565b6000602082019050818103600083015261506b81614504565b9050919050565b6000602082019050818103600083015261508b8161456a565b9050919050565b600060208201905081810360008301526150ab816145d0565b9050919050565b600060208201905081810360008301526150cb81614610565b9050919050565b600060208201905081810360008301526150eb816146b6565b9050919050565b6000602082019050818103600083015261510b8161471c565b9050919050565b6000602082019050818103600083015261512b8161475c565b9050919050565b6000602082019050818103600083015261514b816147c2565b9050919050565b6000602082019050818103600083015261516b81614828565b9050919050565b6000602082019050818103600083015261518b8161488e565b9050919050565b600060208201905081810360008301526151ab816148f4565b9050919050565b600060208201905081810360008301526151cb8161495a565b9050919050565b600060208201905081810360008301526151eb8161499a565b9050919050565b6000602082019050818103600083015261520b81614a1a565b9050919050565b6000602082019050818103600083015261522b81614a80565b9050919050565b6000602082019050818103600083015261524b81614ae6565b9050919050565b6000602082019050818103600083015261526b81614b26565b9050919050565b6000602082019050818103600083015261528b81614b8c565b9050919050565b600060208201905081810360008301526152ab81614bf2565b9050919050565b60006020820190506152c76000830184614c41565b92915050565b60006060820190506152e26000830187614c41565b81810360208301526152f581858761421b565b90506153046040830184614c41565b95945050505050565b60006040820190506153226000830185614c41565b61532f6020830184614c41565b9392505050565b6000604051905081810181811067ffffffffffffffff8211171561535d5761535c615728565b5b8060405250919050565b600067ffffffffffffffff82111561538257615381615728565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156153ae576153ad615728565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156153da576153d9615728565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561540a57615409615728565b5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006154b1826155c8565b91506154bc836155c8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156154f1576154f06156ca565b5b828201905092915050565b6000615507826155c8565b9150615512836155c8565b925082821015615525576155246156ca565b5b828203905092915050565b600061553b826155a8565b9050919050565b600061554d826155a8565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006155a182615530565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b8381101561560c5780820151818401526020810190506155f1565b8381111561561b576000848401525b50505050565b6000600282049050600182168061563957607f821691505b6020821081141561564d5761564c6156f9565b5b50919050565b600061565e826155c8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415615691576156906156ca565b5b600182019050919050565b60006156a7826156b8565b9050919050565b6000819050919050565b60006156c382615768565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b60008160e01c9050919050565b600060443d101561579257615835565b60046000803e6157a3600051615775565b6308c379a081146157b45750615835565b60405160043d036004823e80513d602482011167ffffffffffffffff821117156157e057505050615835565b808201805167ffffffffffffffff8111156157ff575050505050615835565b8060208301013d850181111561581a57505050505050615835565b61582382615757565b60208401016040528296505050505050505b90565b61584181615530565b811461584c57600080fd5b50565b61585881615554565b811461586357600080fd5b50565b61586f81615560565b811461587a57600080fd5b50565b6158868161556a565b811461589157600080fd5b50565b61589d81615596565b81146158a857600080fd5b50565b6158b4816155c8565b81146158bf57600080fd5b50565b6158cb816155d2565b81146158d657600080fd5b5056fe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529a2646970667358221220b07be7f63211479760f4fe715e4950f45c8e2702c2ee1d9baff5081b8e114dc764736f6c63430008000033
Verified Source Code Full Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: No
ERC1155Tradable.sol 112 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC1155/ERC1155.sol";
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/utils/Strings.sol";
import "openzeppelin-solidity/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "./common/meta-transactions/ContentMixin.sol";
import "./common/meta-transactions/NativeMetaTransaction.sol";
contract OwnableDelegateProxy { }
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
/**
* @title ERC1155Tradable
* ERC1155Tradable - ERC1155 contract that whitelists an operator address, has create and mint functionality, and supports useful standards from OpenZeppelin,
like _exists(), name(), symbol(), and totalSupply()
*/
abstract contract ERC1155Tradable is ContextMixin, ERC1155, NativeMetaTransaction, Ownable {
using Strings for string;
using SafeMath for uint256;
address public proxyRegistryAddress;
mapping (uint256 => string) public customUri;
// Contract name
string public name;
// Contract symbol
string public symbol;
function _initialize() virtual internal {}
constructor(
string memory _uri,
address _proxyRegistryAddress
) ERC1155(_uri) {
proxyRegistryAddress = _proxyRegistryAddress;
_initializeEIP712(name);
_initialize();
}
function uri(
uint256 _id
) override public view returns (string memory) {
// We have to convert string to bytes to check for existence
bytes memory customUriBytes = bytes(customUri[_id]);
if (customUriBytes.length > 0) {
return customUri[_id];
} else {
return super.uri(_id);
}
}
/**
* @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].
* @param _newURI New URI for all tokens
*/
function setURI(
string memory _newURI
) public onlyOwner {
_setURI(_newURI);
}
/**
* @dev Will update the base URI for the token
* @param _tokenId The token to update. _msgSender() must be its creator.
* @param _newURI New URI for the token.
*/
function setCustomURI(
uint256 _tokenId,
string memory _newURI
) public onlyOwner {
customUri[_tokenId] = _newURI;
emit URI(_newURI, _tokenId);
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings.
*/
function isApprovedForAll(
address _owner,
address _operator
) override public view returns (bool isOperator) {
// Whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(_owner)) == _operator) {
return true;
}
return ERC1155.isApprovedForAll(_owner, _operator);
}
/**
* This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea.
*/
function _msgSender()
internal
override
view
returns (address sender)
{
return ContextMixin.msgSender();
}
}
CryptocardsERC1155Wrapper.sol 167 lines
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/token/ERC1155/IERC1155.sol";
import "openzeppelin-solidity/contracts/token/ERC1155/IERC1155Receiver.sol";
import "openzeppelin-solidity/contracts/security/ReentrancyGuard.sol";
import "./ERC1155Tradable.sol";
interface ERC1155V1Wrapper is IERC1155 {
function exists(uint256 id) external view returns (bool);
function totalSupply(uint256 id) external view returns (uint256);
function bulkPreBuyCollectible(uint256 _id, uint256[] calldata _printIndexes, uint256 initialPrintPrice) external payable;
}
contract CryptocardsERC1155Wrapper is ERC1155Tradable, ReentrancyGuard, IERC1155Receiver {
using SafeMath for uint256;
// Initial ERC1155 wrapper
address public cardsWrapperV1;
constructor(address _proxyRegistryAddress, address _erc1155V1Wrapper) ERC1155Tradable("", _proxyRegistryAddress){
cardsWrapperV1 = _erc1155V1Wrapper;
// Set the name for display purposes
name = "Cryptocards";
// Set the symbol for display purposes
symbol = "CC";
}
function _initialize() override internal {
setCustomURI(1, "ipfs://QmQMRVoEx7XytHjnaNob6NZWR9wCSTNzZmiGjk7KwMa72c");
setCustomURI(4, "ipfs://QmdyipWhUjB3fHMcJ3etzkMJBbTxUspCpM7XCWTN4shSCW");
setCustomURI(6, "ipfs://QmaQ7A8EkgaPuQQnnwY7vTzCVLFpE4NKJ3n62dCbW6wPDs");
setCustomURI(7, "ipfs://QmbmQZeCC6PWDtMC9SfTHEf1fcYFwbQfLAU1L41Tp3pSGe");
setCustomURI(8, "ipfs://QmViAYAcnnbeoUwCUDcaKwLAjPTg7h4bLHL9k7429LXBZh");
setCustomURI(9, "ipfs://Qmd6Tp3oqY2akdhBn1aAS2NeZFbNm9dqcKrvFFAJRG7dsk");
setCustomURI(10, "ipfs://Qmb1FoWm58HZjh5GCB2aFmhNDCKEK1Cj578YzsBtH7ot41");
setCustomURI(11, "ipfs://QmSQmKRb6HBNhFZTF53bRQiNBCRugkf8APqq4w3qmXcdP7");
setCustomURI(12, "ipfs://QmdYdrrwL9Zm51muWyLTVcwd6HqZcokYWauAobvEYQuJDU");
setCustomURI(13, "ipfs://QmcFLGAHR6VG6iEgaPcSjxfzMnYHk5AKYVePXBEhUg62iS");
setCustomURI(16, "ipfs://QmfYUR4XqMWFkfZwNd8ftFxztFzLfeXfTU3S5DqxgCFUgv");
setCustomURI(17, "ipfs://QmTx6sWPqmWiQQzpMVJbJYXz2DPCfsZ5ygHqSUYwgDiYr4");
setCustomURI(18, "ipfs://QmTquEE43ehwZd814QwJjrBycfJ94y7AmUrKxcC8U9pvk7");
setCustomURI(19, "ipfs://QmUL5F7WN9Gpws4NYYU1uYezz8FZixZ5a7jvCBnMHdR5gF");
setCustomURI(20, "ipfs://QmVkyt5T1XJrtuJ5HK1dPPdjHeRc4zCrfMcMpzWR6AtsSD");
setCustomURI(21, "ipfs://QmXnEHvJwRxf58G26NCtaoavseA9WwMvaWhj6bdkPLRfTN");
setCustomURI(22, "ipfs://QmSH6TNAkx1XA2WEtyTVC3VuNhRzD9QS8Ky7r4jTgv2UPM");
setCustomURI(23, "ipfs://Qmbs8AErdJiyjCNLFW4p9xRR9S4jtECADU2mhBXsKePBeV");
setCustomURI(24, "ipfs://QmXdUiriRH6hRWBj2BJPhVt9nvPtXXwvn8utTMZusSvCgV");
setCustomURI(25, "ipfs://QmSQJEw6TRKpdqmN5HYmoMQH74xHDTCvx7ELtX8R6J481P");
setCustomURI(26, "ipfs://QmeQ4b1viDxmsPVxU6NhxiFZdqTGN9qAqR65LkUv25tKiC");
setCustomURI(27, "ipfs://QmUqdAusa4PEVfN5j9S7S6DUxrEoLsXf61Ct8g79yHPpVQ");
setCustomURI(28, "ipfs://QmamADMQufmbQB46M7atrZyN82cick74bzhqvLLNd4XW2R");
setCustomURI(29, "ipfs://QmTrVhVLXmMnuXds3ZSZzKvnuu8Hdb7vkfseqEEjLWgACg");
setCustomURI(30, "ipfs://QmcytoP4ooabRaN95KbrJQ9eVpGmfRd4hWvZDFFvGgq7CP");
setCustomURI(31, "ipfs://QmReZLY1F9VotQLfAM7ofTQ5AdXR8B7shaXutX1hCh9qwE");
setCustomURI(32, "ipfs://QmevHyW2jDoRTN1FDaP57axFEEiXEGPPug853RfwxFuP97");
setCustomURI(33, "ipfs://QmUFRgGXHf2ju8sixM4MCVis9s1YW61ddiMzrYihKvMdzY");
setCustomURI(34, "ipfs://QmNheeuRT3Wr9brWJgwYRcRpXx2xcwVwMaYsE26S3TDc9R");
setCustomURI(35, "ipfs://Qmeq6ZuHqoYQHGmmLPw7Tk88cSKqBqnWV1TYxx7w8MgQ8F");
setCustomURI(36, "ipfs://QmUEpWo6EKyUvcSVBN9SGLNywuqHjdsNTRgCKbxF5LUu4j");
setCustomURI(37, "ipfs://QmQaQ2H8y7GJC4fwKJMpoRrZdy1hHVCLcdAYHAKRC2MnWV");
setCustomURI(38, "ipfs://QmRaxZpmQGW4Sdy9MRw7piENHsjoPTj2sajFTsDMSfib4W");
setCustomURI(39, "ipfs://QmRsSsG65jcir2A2Weo3VoAUsmv9uiWvfLentxKa7SfYSZ");
setCustomURI(40, "ipfs://QmSsnEU8g6U1SVf4oZ3UyZNvesLQFHbibHn7sPGp31kGyz");
setCustomURI(41, "ipfs://QmYrN2RPrJEnjaeqbK47N1FTydQ2xPaeXHcjowYsJEzKMZ");
setCustomURI(42, "ipfs://QmQUM8sP7PJhhf6sXX4u9UyGyAhpDhFWqG4MQvnDfzUgLr");
setCustomURI(43, "ipfs://QmRSBsWdfz8VwzEUH1Pwi5VqaQ1mtT9XyzV1MpnH1gbiTv");
setCustomURI(44, "ipfs://QmQLoQbixDn5iY1TJo4FEJQ3V1zTodoS95MN47Pkp9ngNv");
setCustomURI(45, "ipfs://QmTCy3gxZMNF7Cnsn9zT6NCNDUSW8Jr5mDGtTVMMmQEzav");
setCustomURI(46, "ipfs://Qme6tLCFDADrWmZF4TkdtGjj9AncoqwbE5gtP1A7kV1prh");
setCustomURI(48, "ipfs://QmfJmy9t6pRDFcA25cQSjhnFxex92LPu73wzQjDPuP9sMZ");
setCustomURI(49, "ipfs://QmeJZoriPwx1sp5xzbYBwjVHVmeepKCp13YgGpi1u4KWuT");
setCustomURI(50, "ipfs://QmNTfbRLpHknnRNDu1Qaz6qK6Lv92VmhmTBn5VAe1Umyjo");
setCustomURI(51, "ipfs://QmZ3q8CYwWmoGJmAVChSQ7STrVfx45ZAV55jh7rfjXRncb");
setCustomURI(53, "ipfs://QmatSm4F4MKStT5h4uYYHJXMTHqttsmKwiCff8mnNeGjBm");
setCustomURI(54, "ipfs://QmYZZqSaTnWRxZP8dgQDYUVXxjSJBqiPMAm9DYvoWXFWqN");
setCustomURI(55, "ipfs://QmWwZZQxV1pfTZethyDQ3ywBogiC8HoRWvmAxLAGDwmEkX");
setCustomURI(56, "ipfs://QmQCiwLE4vJVKvQL8JwRq8x5uiUkXiGC4zjppwrAt2jjpS");
setCustomURI(57, "ipfs://QmXjaHNNmx7nCqdSrJzJWwUjNyVbgaGmM73TXYtiHUUW2c");
setCustomURI(58, "ipfs://QmQ2pnZ19iy9CwGQpzqAtQVGhHdaMyqFchqqY2ySAq6Nxy");
setCustomURI(61, "ipfs://QmYAqRyNKsYWaXHPkfcpPXCMpd1VqsGRZT7keyvSPSNGBT");
setCustomURI(62, "ipfs://QmPtSsSuNke7mttvBetc1q6dafymCUa9mQW4H9UUoa75NH");
setCustomURI(63, "ipfs://QmRSyYZbYhzDbBa2bVhLYHePwvwm1mEJw8hMupSdnXfKd4");
setCustomURI(65, "ipfs://QmbW2T4DNbg8L4xTzCCrAJjsmK4AQywcRTMxYxUAbTQjr3");
setCustomURI(66, "ipfs://QmVaAk2u5Ci8jX5cb5mMXThAbkC9SA9v68PNybaNqxwvBW");
setCustomURI(67, "ipfs://QmXevTvmDnm2q7YybhFWqydUnD56sa6uW4fhSmffZXv7oJ");
setCustomURI(68, "ipfs://QmUYh2aL4RVhbDafXvdLR5wBJWQHrBZqyZkbMQijQZJKTP");
setCustomURI(69, "ipfs://Qmab2oPjwxtE8xcFX9UNc3StpzUJ1BTx88jcJwFmSnaUcJ");
setCustomURI(70, "ipfs://QmTMs7dqGFFuZzPetV2B9SpjHTRko1fhsbtdS3z428vcVJ");
setCustomURI(71, "ipfs://QmaJn7ZTPCqnS7u6YUGjjuLFyBDsEua4YdmL3v1usvvZyj");
}
/**
* @dev Returns the total quantity for a token ID
* @param _id uint256 ID of the token to query
* @return amount of token in existence
*/
function totalSupply(uint256 _id) public view returns (uint256) {
return ERC1155V1Wrapper(cardsWrapperV1).totalSupply(_id);
}
function exists(uint256 _id) external view returns (bool) {
return ERC1155V1Wrapper(cardsWrapperV1).exists(_id);
}
/**
@dev batch version of unwrap.
*/
function unwrapToERC1155V1Cards(uint256[] calldata _ids, uint256[] calldata _quantities) external nonReentrant {
require(_ids.length == _quantities.length, "ids and quantities must match");
_burnBatch(_msgSender(), _ids, _quantities);
ERC1155V1Wrapper(cardsWrapperV1).safeBatchTransferFrom(address(this), _msgSender(), _ids, _quantities, "");
}
/**
@dev buy bulk Cryptocards from the presale
*/
function bulkPreBuyCollectible(uint256 _id, uint256[] calldata _printIndexes, uint256 initialPrintPrice) external payable {
ERC1155V1Wrapper wrapper = ERC1155V1Wrapper(cardsWrapperV1);
require(wrapper.exists(_id) == true, "invalid token id");
wrapper.bulkPreBuyCollectible{value:msg.value}(_id, _printIndexes, initialPrintPrice);
// mint to user
_mint(_msgSender(), _id, _printIndexes.length, "");
}
// ============ Callback ============
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata
) external override returns (bytes4){
require(_msgSender() == cardsWrapperV1, "rejected token type");
// during bulkPreBuyCollectible w1 mints to to current wrapper and we avoid minting here in that scenario
if (operator != address(this) && from != address(this)) {
// mint wrapped tokens
_mint(from, id, value, "");
}
return IERC1155Receiver.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata
) external override returns (bytes4){
require(_msgSender() == cardsWrapperV1, "rejected token type");
require(ids.length == values.length, "PARAMS_NOT_MATCH");
// during bulkPreBuyCollectible w1 mints to to current wrapper and we avoid minting here in that scenario
if (operator != address(this) && from != address(this)) {
// mint wrapped tokens
_mintBatch(from, ids, values, "");
}
return IERC1155Receiver.onERC1155BatchReceived.selector;
}
}
EIP712Base.sol 77 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Initializable} from "./Initializable.sol";
contract EIP712Base is Initializable {
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
string constant public ERC712_VERSION = "1";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256(
bytes(
"EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)"
)
);
bytes32 internal domainSeperator;
// supposed to be called once while initializing.
// one of the contracts that inherits this contract follows proxy pattern
// so it is not possible to do this in a constructor
function _initializeEIP712(
string memory name
)
internal
initializer
{
_setDomainSeperator(name);
}
function _setDomainSeperator(string memory name) internal {
domainSeperator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(ERC712_VERSION)),
address(this),
bytes32(getChainId())
)
);
}
function getDomainSeperator() public view returns (bytes32) {
return domainSeperator;
}
function getChainId() public view returns (uint256) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
/**
* Accept message hash and returns hash message in EIP712 compatible form
* So that it can be used to recover signer from signature signed using EIP712 formatted data
* https://eips.ethereum.org/EIPS/eip-712
* "\\x19" makes the encoding deterministic
* "\\x01" is the version byte to make it compatible to EIP-191
*/
function toTypedMessageHash(bytes32 messageHash)
internal
view
returns (bytes32)
{
return
keccak256(
abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash)
);
}
}
Address.sol 189 lines
// SPDX-License-Identifier: MIT
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;
// solhint-disable-next-line no-inline-assembly
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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT
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 () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = 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");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
ContentMixin.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract ContextMixin {
function msgSender()
internal
view
returns (address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
} else {
sender = payable(msg.sender);
}
return sender;
}
}
Initializable.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
SafeMath.sol 218 lines
// SPDX-License-Identifier: MIT
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 no longer needed starting with Solidity 0.8. 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. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* 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;
}
}
}
ERC1155.sol 398 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping (uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping (address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor (string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155).interfaceId
|| interfaceId == type(IERC1155MetadataURI).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
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(to != address(0), "ERC1155: transfer to the zero address");
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
_balances[id][from] = fromBalance - amount;
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, 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(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
_balances[id][from] = fromBalance - amount;
_balances[id][to] += 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;
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 (uint i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
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];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
_balances[id][account] = 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 (uint i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
_balances[id][account] = 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(to).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(to).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;
}
}
IERC1155.sol 103 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}
NativeMetaTransaction.sol 106 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {SafeMath} from "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
import {EIP712Base} from "./EIP712Base.sol";
contract NativeMetaTransaction is EIP712Base {
using SafeMath for uint256;
bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256(
bytes(
"MetaTransaction(uint256 nonce,address from,bytes functionSignature)"
)
);
event MetaTransactionExecuted(
address userAddress,
address payable relayerAddress,
bytes functionSignature
);
mapping(address => uint256) nonces;
/*
* Meta transaction structure.
* No point of including value field here as if user is doing value transfer then he has the funds to pay for gas
* He should call the desired function directly in that case.
*/
struct MetaTransaction {
uint256 nonce;
address from;
bytes functionSignature;
}
function executeMetaTransaction(
address userAddress,
bytes memory functionSignature,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) public payable returns (bytes memory) {
MetaTransaction memory metaTx = MetaTransaction({
nonce: nonces[userAddress],
from: userAddress,
functionSignature: functionSignature
});
require(
verify(userAddress, metaTx, sigR, sigS, sigV),
"Signer and signature do not match"
);
// increase nonce for user (to avoid re-use)
nonces[userAddress] = nonces[userAddress].add(1);
emit MetaTransactionExecuted(
userAddress,
payable(msg.sender),
functionSignature
);
// Append userAddress and relayer address at the end to extract it from calling context
(bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
}
function hashMetaTransaction(MetaTransaction memory metaTx)
internal
pure
returns (bytes32)
{
return
keccak256(
abi.encode(
META_TRANSACTION_TYPEHASH,
metaTx.nonce,
metaTx.from,
keccak256(metaTx.functionSignature)
)
);
}
function getNonce(address user) public view returns (uint256 nonce) {
nonce = nonces[user];
}
function verify(
address signer,
MetaTransaction memory metaTx,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) internal view returns (bool) {
require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER");
return
signer ==
ecrecover(
toTypedMessageHash(hashMetaTransaction(metaTx)),
sigV,
sigR,
sigS
);
}
}
ReentrancyGuard.sol 62 lines
// SPDX-License-Identifier: MIT
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 make 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 28 lines
// SPDX-License-Identifier: MIT
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 24 lines
// SPDX-License-Identifier: MIT
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);
}
IERC1155Receiver.sol 57 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
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);
}
ERC1155Holder.sol 18 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC1155Receiver.sol";
/**
* @dev _Available since v3.1._
*/
contract ERC1155Holder is ERC1155Receiver {
function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
ERC1155Receiver.sol 19 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId
|| super.supportsInterface(interfaceId);
}
}
IERC1155MetadataURI.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
ERC712_VERSION 0x0f7e5970 → string
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
cardsWrapperV1 0x1b3e2234 → address
customUri 0x8a28a5a2 → string
exists 0x4f558e79 → bool
getChainId 0x3408e470 → uint256
getDomainSeperator 0x20379ee5 → bytes32
getNonce 0x2d0335ab → uint256
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
proxyRegistryAddress 0xcd7c0326 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
bulkPreBuyCollectible 0xf7bca79c
uint256 _id
uint256[] _printIndexes
uint256 initialPrintPrice
executeMetaTransaction 0x0c53c51c
address userAddress
bytes functionSignature
bytes32 sigR
bytes32 sigS
uint8 sigV
returns: bytes
onERC1155BatchReceived 0xbc197c81
address operator
address from
uint256[] ids
uint256[] values
bytes
returns: bytes4
onERC1155Received 0xf23a6e61
address operator
address from
uint256 id
uint256 value
bytes
returns: bytes4
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
setCustomURI 0x3adf80b4
uint256 _tokenId
string _newURI
setURI 0x02fe5305
string _newURI
transferOwnership 0xf2fde38b
address newOwner
unwrapToERC1155V1Cards 0x66aac863
uint256[] _ids
uint256[] _quantities
Recent Transactions
No transactions found for this address