Address Contract Partially Verified
Address
0x075b6Eb71ccf661c47bF23C287132b2F68990eFe
Balance
0.021004 ETH
Nonce
1
Code Size
19677 bytes
Creator
0xf14B9855...1Fad at tx 0x4ccff212...b51e66
Indexed Transactions
0
Contract Bytecode
19677 bytes
0x6080604052600436106101c15760003560e01c80637533d788116100f7578063b88d4fde11610095578063e985e9c511610064578063e985e9c514610623578063eb8d72b714610660578063ed88c68e14610689578063f2fde38b14610693576101c1565b8063b88d4fde14610585578063c87b56dd146105ae578063cf89fa03146105eb578063d1deba1f14610607576101c1565b8063943fb872116100d1578063943fb872146104dd57806395d89b4114610506578063a22cb46514610531578063b2bdfa7b1461055a576101c1565b80637533d788146104375780638da5cb5b146104745780638ee749121461049f576101c1565b80632e1a7d4d116101645780636352211e1161013e5780636352211e1461038a5780636ecd2306146103c757806370a08231146103e3578063715018a614610420576101c1565b80632e1a7d4d1461030f57806342842e0e1461033857806355f804b314610361576101c1565b8063081812fc116101a0578063081812fc14610257578063095ea7b3146102945780631c37a822146102bd57806323b872dd146102e6576101c1565b80621d3567146101c657806301ffc9a7146101ef57806306fdde031461022c575b600080fd5b3480156101d257600080fd5b506101ed60048036038101906101e89190612d4c565b6106bc565b005b3480156101fb57600080fd5b5061021660048036038101906102119190612e43565b6108fe565b6040516102239190612e8b565b60405180910390f35b34801561023857600080fd5b506102416109e0565b60405161024e9190612f2e565b60405180910390f35b34801561026357600080fd5b5061027e60048036038101906102799190612f86565b610a72565b60405161028b9190612ff4565b60405180910390f35b3480156102a057600080fd5b506102bb60048036038101906102b6919061303b565b610af7565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612d4c565b610c0f565b005b3480156102f257600080fd5b5061030d6004803603810190610308919061307b565b610c8f565b005b34801561031b57600080fd5b5061033660048036038101906103319190612f86565b610cef565b005b34801561034457600080fd5b5061035f600480360381019061035a919061307b565b610e3d565b005b34801561036d57600080fd5b506103886004803603810190610383919061316f565b610e5d565b005b34801561039657600080fd5b506103b160048036038101906103ac9190612f86565b610ef3565b6040516103be9190612ff4565b60405180910390f35b6103e160048036038101906103dc91906131f1565b610fa5565b005b3480156103ef57600080fd5b5061040a6004803603810190610405919061321e565b61108c565b604051610417919061325a565b60405180910390f35b34801561042c57600080fd5b50610435611144565b005b34801561044357600080fd5b5061045e60048036038101906104599190613275565b6111cc565b60405161046b91906132f7565b60405180910390f35b34801561048057600080fd5b5061048961126c565b6040516104969190612ff4565b60405180910390f35b3480156104ab57600080fd5b506104c660048036038101906104c19190613319565b611295565b6040516104d49291906133a1565b60405180910390f35b3480156104e957600080fd5b5061050460048036038101906104ff9190612f86565b6112e9565b005b34801561051257600080fd5b5061051b61136f565b6040516105289190612f2e565b60405180910390f35b34801561053d57600080fd5b50610558600480360381019061055391906133f6565b611401565b005b34801561056657600080fd5b5061056f611417565b60405161057c9190612ff4565b60405180910390f35b34801561059157600080fd5b506105ac60048036038101906105a79190613436565b61143d565b005b3480156105ba57600080fd5b506105d560048036038101906105d09190612f86565b61149f565b6040516105e29190612f2e565b60405180910390f35b610605600480360381019061060091906134b9565b611546565b005b610621600480360381019061061c9190613559565b611839565b005b34801561062f57600080fd5b5061064a600480360381019061064591906135fd565b6119d9565b6040516106579190612e8b565b60405180910390f35b34801561066c57600080fd5b506106876004803603810190610682919061363d565b611a6d565b005b610691611b19565b005b34801561069f57600080fd5b506106ba60048036038101906106b5919061321e565b611b1b565b005b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461071657600080fd5b600960008561ffff1661ffff168152602001908152602001600020805461073c906136cc565b905083511480156107825750600960008561ffff1661ffff168152602001908152602001600020604051610770919061379d565b60405180910390208380519060200120145b6107c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b890613826565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16631c37a822858585856040518563ffffffff1660e01b81526004016108009493929190613864565b600060405180830381600087803b15801561081a57600080fd5b505af192505050801561082b575060015b6108f7576040518060400160405280825181526020018280519060200120815250600860008661ffff1661ffff1681526020019081526020016000208460405161087591906138e8565b908152602001604051809103902060008467ffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101559050507fe6f254030bcb01ffd20558175c13fcaed6d1520be7becee4c961b65f79243b0d848484846040516108ea9493929190613864565b60405180910390a16108f8565b5b50505050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109c957507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806109d957506109d882611c13565b5b9050919050565b6060600180546109ef906136cc565b80601f0160208091040260200160405190810160405280929190818152602001828054610a1b906136cc565b8015610a685780601f10610a3d57610100808354040283529160200191610a68565b820191906000526020600020905b815481529060010190602001808311610a4b57829003601f168201915b5050505050905090565b6000610a7d82611c7d565b610abc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab390613971565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610b0282610ef3565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6a90613a03565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b92611ce9565b73ffffffffffffffffffffffffffffffffffffffff161480610bc15750610bc081610bbb611ce9565b6119d9565b5b610c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf790613a95565b60405180910390fd5b610c0a8383611cf1565b505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7490613b27565b60405180910390fd5b610c8984848484611daa565b50505050565b610ca0610c9a611ce9565b82611dd7565b610cdf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd690613bb9565b60405180910390fd5b610cea838383611eb5565b505050565b610cf7611ce9565b73ffffffffffffffffffffffffffffffffffffffff16610d1561126c565b73ffffffffffffffffffffffffffffffffffffffff1614610d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6290613c25565b60405180910390fd5b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682604051610db390613c6b565b60006040518083038185875af1925050503d8060008114610df0576040519150601f19603f3d011682016040523d82523d6000602084013e610df5565b606091505b5050905080610e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3090613cf2565b60405180910390fd5b5050565b610e588383836040518060200160405280600081525061143d565b505050565b610e65611ce9565b73ffffffffffffffffffffffffffffffffffffffff16610e8361126c565b73ffffffffffffffffffffffffffffffffffffffff1614610ed9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed090613c25565b60405180910390fd5b80600b9080519060200190610eef929190612a4f565b5050565b6000806003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9390613d84565b60405180910390fd5b80915050919050565b60038160ff1610610feb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe290613e16565b60405180910390fd5b600d548160ff16600c54610fff9190613e65565b1115611040576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103790613f07565b60405180910390fd5b61105e33600c6000815461105390613f27565b919050819055612111565b60028160ff1614156110895761108833600c6000815461107d90613f27565b919050819055612111565b5b50565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f490613fe2565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61114c611ce9565b73ffffffffffffffffffffffffffffffffffffffff1661116a61126c565b73ffffffffffffffffffffffffffffffffffffffff16146111c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b790613c25565b60405180910390fd5b6111ca600061212f565b565b600960205280600052604060002060009150905080546111eb906136cc565b80601f0160208091040260200160405190810160405280929190818152602001828054611217906136cc565b80156112645780601f1061123957610100808354040283529160200191611264565b820191906000526020600020905b81548152906001019060200180831161124757829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60086020528260005260406000208280516020810182018051848252602083016020850120818352809550505050505060205280600052604060002060009250925050508060000154908060010154905082565b6112f1611ce9565b73ffffffffffffffffffffffffffffffffffffffff1661130f61126c565b73ffffffffffffffffffffffffffffffffffffffff1614611365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135c90613c25565b60405180910390fd5b80600e8190555050565b60606002805461137e906136cc565b80601f01602080910402602001604051908101604052809291908181526020018280546113aa906136cc565b80156113f75780601f106113cc576101008083540402835291602001916113f7565b820191906000526020600020905b8154815290600101906020018083116113da57829003601f168201915b5050505050905090565b61141361140c611ce9565b83836121f3565b5050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61144e611448611ce9565b83611dd7565b61148d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148490613bb9565b60405180910390fd5b61149984848484612360565b50505050565b60606114aa82611c7d565b6114e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e090614074565b60405180910390fd5b60006114f36123bc565b90506000815111611513576040518060200160405280600081525061153e565b8061151d8461244e565b60405160200161152e9291906140d0565b6040516020818303038152906040525b915050919050565b61154f81610ef3565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b390614166565b60405180910390fd5b6000600960008461ffff1661ffff16815260200190815260200160002080546115e4906136cc565b905011611626576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161d906141f8565b60405180910390fd5b61162f816125af565b60003382604051602001611644929190614218565b6040516020818303038152906040529050600060019050600081600e54604051602001611672929190614298565b60405160208183030381529060405290506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340a7bb108730876000876040518663ffffffff1660e01b81526004016116e99594939291906142c4565b604080518083038186803b15801561170057600080fd5b505afa158015611714573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611738919061433a565b5090508034101561177e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177590614412565b60405180910390fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c58031003488600960008b61ffff1661ffff16815260200190815260200160002088336000896040518863ffffffff1660e01b81526004016117ff969594939291906144d3565b6000604051808303818588803b15801561181857600080fd5b505af115801561182c573d6000803e3d6000fd5b5050505050505050505050565b6000600860008761ffff1661ffff1681526020019081526020016000208560405161186491906138e8565b908152602001604051809103902060008567ffffffffffffffff16815260200190815260200160002090506000801b816001015414156118d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118d0906145bb565b60405180910390fd5b8060000154838390501480156119095750806001015483836040516118ff929190614600565b6040518091039020145b611948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193f90614665565b60405180910390fd5b600081600001819055506000801b81600101819055503073ffffffffffffffffffffffffffffffffffffffff16631c37a82287878787876040518663ffffffff1660e01b815260040161199f9594939291906146b2565b600060405180830381600087803b1580156119b957600080fd5b505af11580156119cd573d6000803e3d6000fd5b50505050505050505050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b611a75611ce9565b73ffffffffffffffffffffffffffffffffffffffff16611a9361126c565b73ffffffffffffffffffffffffffffffffffffffff1614611ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae090613c25565b60405180910390fd5b8181600960008661ffff1661ffff1681526020019081526020016000209190611b13929190612ad5565b50505050565b565b611b23611ce9565b73ffffffffffffffffffffffffffffffffffffffff16611b4161126c565b73ffffffffffffffffffffffffffffffffffffffff1614611b97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8e90613c25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611c07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfe90614779565b60405180910390fd5b611c108161212f565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611d6483610ef3565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008082806020019051810190611dc191906147c5565b91509150611dcf8282612111565b505050505050565b6000611de282611c7d565b611e21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1890614877565b60405180910390fd5b6000611e2c83610ef3565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611e9b57508373ffffffffffffffffffffffffffffffffffffffff16611e8384610a72565b73ffffffffffffffffffffffffffffffffffffffff16145b80611eac5750611eab81856119d9565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611ed582610ef3565b73ffffffffffffffffffffffffffffffffffffffff1614611f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f2290614909565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f929061499b565b60405180910390fd5b611fa68383836126c0565b611fb1600082611cf1565b6001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461200191906149bb565b925050819055506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120589190613e65565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b61212b8282604051806020016040528060008152506126c5565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612262576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161225990614a3b565b60405180910390fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516123539190612e8b565b60405180910390a3505050565b61236b848484611eb5565b61237784848484612720565b6123b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123ad90614acd565b60405180910390fd5b50505050565b6060600b80546123cb906136cc565b80601f01602080910402602001604051908101604052809291908181526020018280546123f7906136cc565b80156124445780601f1061241957610100808354040283529160200191612444565b820191906000526020600020905b81548152906001019060200180831161242757829003601f168201915b5050505050905090565b60606000821415612496576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506125aa565b600082905060005b600082146124c85780806124b190613f27565b915050600a826124c19190614b1c565b915061249e565b60008167ffffffffffffffff8111156124e4576124e3612be1565b5b6040519080825280601f01601f1916602001820160405280156125165781602001600182028036833780820191505090505b5090505b600085146125a35760018261252f91906149bb565b9150600a8561253e9190614b4d565b603061254a9190613e65565b60f81b8183815181106125605761255f614b7e565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561259c9190614b1c565b945061251a565b8093505050505b919050565b60006125ba82610ef3565b90506125c8816000846126c0565b6125d3600083611cf1565b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461262391906149bb565b925050819055506003600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b505050565b6126cf83836128b7565b6126dc6000848484612720565b61271b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161271290614acd565b60405180910390fd5b505050565b60006127418473ffffffffffffffffffffffffffffffffffffffff16612a3c565b156128aa578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261276a611ce9565b8786866040518563ffffffff1660e01b815260040161278c9493929190614bad565b602060405180830381600087803b1580156127a657600080fd5b505af19250505080156127d757506040513d601f19601f820116820180604052508101906127d49190614c0e565b60015b61285a573d8060008114612807576040519150601f19603f3d011682016040523d82523d6000602084013e61280c565b606091505b50600081511415612852576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284990614acd565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506128af565b600190505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612927576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161291e90614c87565b60405180910390fd5b612933600083836126c0565b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546129839190613e65565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b828054612a5b906136cc565b90600052602060002090601f016020900481019282612a7d5760008555612ac4565b82601f10612a9657805160ff1916838001178555612ac4565b82800160010185558215612ac4579182015b82811115612ac3578251825591602001919060010190612aa8565b5b509050612ad19190612b5b565b5090565b828054612ae1906136cc565b90600052602060002090601f016020900481019282612b035760008555612b4a565b82601f10612b1c57803560ff1916838001178555612b4a565b82800160010185558215612b4a579182015b82811115612b49578235825591602001919060010190612b2e565b5b509050612b579190612b5b565b5090565b5b80821115612b74576000816000905550600101612b5c565b5090565b6000604051905090565b600080fd5b600080fd5b600061ffff82169050919050565b612ba381612b8c565b8114612bae57600080fd5b50565b600081359050612bc081612b9a565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c1982612bd0565b810181811067ffffffffffffffff82111715612c3857612c37612be1565b5b80604052505050565b6000612c4b612b78565b9050612c578282612c10565b919050565b600067ffffffffffffffff821115612c7757612c76612be1565b5b612c8082612bd0565b9050602081019050919050565b82818337600083830152505050565b6000612caf612caa84612c5c565b612c41565b905082815260208101848484011115612ccb57612cca612bcb565b5b612cd6848285612c8d565b509392505050565b600082601f830112612cf357612cf2612bc6565b5b8135612d03848260208601612c9c565b91505092915050565b600067ffffffffffffffff82169050919050565b612d2981612d0c565b8114612d3457600080fd5b50565b600081359050612d4681612d20565b92915050565b60008060008060808587031215612d6657612d65612b82565b5b6000612d7487828801612bb1565b945050602085013567ffffffffffffffff811115612d9557612d94612b87565b5b612da187828801612cde565b9350506040612db287828801612d37565b925050606085013567ffffffffffffffff811115612dd357612dd2612b87565b5b612ddf87828801612cde565b91505092959194509250565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612e2081612deb565b8114612e2b57600080fd5b50565b600081359050612e3d81612e17565b92915050565b600060208284031215612e5957612e58612b82565b5b6000612e6784828501612e2e565b91505092915050565b60008115159050919050565b612e8581612e70565b82525050565b6000602082019050612ea06000830184612e7c565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ee0578082015181840152602081019050612ec5565b83811115612eef576000848401525b50505050565b6000612f0082612ea6565b612f0a8185612eb1565b9350612f1a818560208601612ec2565b612f2381612bd0565b840191505092915050565b60006020820190508181036000830152612f488184612ef5565b905092915050565b6000819050919050565b612f6381612f50565b8114612f6e57600080fd5b50565b600081359050612f8081612f5a565b92915050565b600060208284031215612f9c57612f9b612b82565b5b6000612faa84828501612f71565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612fde82612fb3565b9050919050565b612fee81612fd3565b82525050565b60006020820190506130096000830184612fe5565b92915050565b61301881612fd3565b811461302357600080fd5b50565b6000813590506130358161300f565b92915050565b6000806040838503121561305257613051612b82565b5b600061306085828601613026565b925050602061307185828601612f71565b9150509250929050565b60008060006060848603121561309457613093612b82565b5b60006130a286828701613026565b93505060206130b386828701613026565b92505060406130c486828701612f71565b9150509250925092565b600067ffffffffffffffff8211156130e9576130e8612be1565b5b6130f282612bd0565b9050602081019050919050565b600061311261310d846130ce565b612c41565b90508281526020810184848401111561312e5761312d612bcb565b5b613139848285612c8d565b509392505050565b600082601f83011261315657613155612bc6565b5b81356131668482602086016130ff565b91505092915050565b60006020828403121561318557613184612b82565b5b600082013567ffffffffffffffff8111156131a3576131a2612b87565b5b6131af84828501613141565b91505092915050565b600060ff82169050919050565b6131ce816131b8565b81146131d957600080fd5b50565b6000813590506131eb816131c5565b92915050565b60006020828403121561320757613206612b82565b5b6000613215848285016131dc565b91505092915050565b60006020828403121561323457613233612b82565b5b600061324284828501613026565b91505092915050565b61325481612f50565b82525050565b600060208201905061326f600083018461324b565b92915050565b60006020828403121561328b5761328a612b82565b5b600061329984828501612bb1565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006132c9826132a2565b6132d381856132ad565b93506132e3818560208601612ec2565b6132ec81612bd0565b840191505092915050565b6000602082019050818103600083015261331181846132be565b905092915050565b60008060006060848603121561333257613331612b82565b5b600061334086828701612bb1565b935050602084013567ffffffffffffffff81111561336157613360612b87565b5b61336d86828701612cde565b925050604061337e86828701612f71565b9150509250925092565b6000819050919050565b61339b81613388565b82525050565b60006040820190506133b6600083018561324b565b6133c36020830184613392565b9392505050565b6133d381612e70565b81146133de57600080fd5b50565b6000813590506133f0816133ca565b92915050565b6000806040838503121561340d5761340c612b82565b5b600061341b85828601613026565b925050602061342c858286016133e1565b9150509250929050565b600080600080608085870312156134505761344f612b82565b5b600061345e87828801613026565b945050602061346f87828801613026565b935050604061348087828801612f71565b925050606085013567ffffffffffffffff8111156134a1576134a0612b87565b5b6134ad87828801612cde565b91505092959194509250565b600080604083850312156134d0576134cf612b82565b5b60006134de85828601612bb1565b92505060206134ef85828601612f71565b9150509250929050565b600080fd5b600080fd5b60008083601f84011261351957613518612bc6565b5b8235905067ffffffffffffffff811115613536576135356134f9565b5b602083019150836001820283011115613552576135516134fe565b5b9250929050565b60008060008060006080868803121561357557613574612b82565b5b600061358388828901612bb1565b955050602086013567ffffffffffffffff8111156135a4576135a3612b87565b5b6135b088828901612cde565b94505060406135c188828901612d37565b935050606086013567ffffffffffffffff8111156135e2576135e1612b87565b5b6135ee88828901613503565b92509250509295509295909350565b6000806040838503121561361457613613612b82565b5b600061362285828601613026565b925050602061363385828601613026565b9150509250929050565b60008060006040848603121561365657613655612b82565b5b600061366486828701612bb1565b935050602084013567ffffffffffffffff81111561368557613684612b87565b5b61369186828701613503565b92509250509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806136e457607f821691505b602082108114156136f8576136f761369d565b5b50919050565b600081905092915050565b60008190508160005260206000209050919050565b6000815461372b816136cc565b61373581866136fe565b94506001821660008114613750576001811461376157613794565b60ff19831686528186019350613794565b61376a85613709565b60005b8381101561378c5781548189015260018201915060208101905061376d565b838801955050505b50505092915050565b60006137a9828461371e565b915081905092915050565b7f4e6f6e626c6f636b696e6752656365697665723a20696e76616c696420736f7560008201527f7263652073656e64696e6720636f6e7472616374000000000000000000000000602082015250565b6000613810603483612eb1565b915061381b826137b4565b604082019050919050565b6000602082019050818103600083015261383f81613803565b9050919050565b61384f81612b8c565b82525050565b61385e81612d0c565b82525050565b60006080820190506138796000830187613846565b818103602083015261388b81866132be565b905061389a6040830185613855565b81810360608301526138ac81846132be565b905095945050505050565b60006138c2826132a2565b6138cc81856136fe565b93506138dc818560208601612ec2565b80840191505092915050565b60006138f482846138b7565b915081905092915050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b600061395b602c83612eb1565b9150613966826138ff565b604082019050919050565b6000602082019050818103600083015261398a8161394e565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006139ed602183612eb1565b91506139f882613991565b604082019050919050565b60006020820190508181036000830152613a1c816139e0565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b6000613a7f603883612eb1565b9150613a8a82613a23565b604082019050919050565b60006020820190508181036000830152613aae81613a72565b9050919050565b7f4e6f6e626c6f636b696e6752656365697665723a2063616c6c6572206d75737460008201527f206265204272696467652e000000000000000000000000000000000000000000602082015250565b6000613b11602b83612eb1565b9150613b1c82613ab5565b604082019050919050565b60006020820190508181036000830152613b4081613b04565b9050919050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b6000613ba3603183612eb1565b9150613bae82613b47565b604082019050919050565b60006020820190508181036000830152613bd281613b96565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613c0f602083612eb1565b9150613c1a82613bd9565b602082019050919050565b60006020820190508181036000830152613c3e81613c02565b9050919050565b50565b6000613c556000836136fe565b9150613c6082613c45565b600082019050919050565b6000613c7682613c48565b9150819050919050565b7f74696e792064696e6f733a204661696c656420746f207769746864726177204560008201527f7468657200000000000000000000000000000000000000000000000000000000602082015250565b6000613cdc602483612eb1565b9150613ce782613c80565b604082019050919050565b60006020820190508181036000830152613d0b81613ccf565b9050919050565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b6000613d6e602983612eb1565b9150613d7982613d12565b604082019050919050565b60006020820190508181036000830152613d9d81613d61565b9050919050565b7f74696e792064696e6f733a204d61782032204e46547320706572207472616e7360008201527f616374696f6e0000000000000000000000000000000000000000000000000000602082015250565b6000613e00602683612eb1565b9150613e0b82613da4565b604082019050919050565b60006020820190508181036000830152613e2f81613df3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613e7082612f50565b9150613e7b83612f50565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613eb057613eaf613e36565b5b828201905092915050565b7f74696e792064696e6f733a204d696e74206578636565647320737570706c7900600082015250565b6000613ef1601f83612eb1565b9150613efc82613ebb565b602082019050919050565b60006020820190508181036000830152613f2081613ee4565b9050919050565b6000613f3282612f50565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613f6557613f64613e36565b5b600182019050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b6000613fcc602a83612eb1565b9150613fd782613f70565b604082019050919050565b60006020820190508181036000830152613ffb81613fbf565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b600061405e602f83612eb1565b915061406982614002565b604082019050919050565b6000602082019050818103600083015261408d81614051565b9050919050565b600081905092915050565b60006140aa82612ea6565b6140b48185614094565b93506140c4818560208601612ec2565b80840191505092915050565b60006140dc828561409f565b91506140e8828461409f565b91508190509392505050565b7f596f75206d757374206f776e2074686520746f6b656e20746f2074726176657260008201527f7365000000000000000000000000000000000000000000000000000000000000602082015250565b6000614150602283612eb1565b915061415b826140f4565b604082019050919050565b6000602082019050818103600083015261417f81614143565b9050919050565b7f5468697320636861696e2069732063757272656e746c7920756e617661696c6160008201527f626c6520666f722074726176656c000000000000000000000000000000000000602082015250565b60006141e2602e83612eb1565b91506141ed82614186565b604082019050919050565b60006020820190508181036000830152614211816141d5565b9050919050565b600060408201905061422d6000830185612fe5565b61423a602083018461324b565b9392505050565b60008160f01b9050919050565b600061425982614241565b9050919050565b61427161426c82612b8c565b61424e565b82525050565b6000819050919050565b61429261428d82612f50565b614277565b82525050565b60006142a48285614260565b6002820191506142b48284614281565b6020820191508190509392505050565b600060a0820190506142d96000830188613846565b6142e66020830187612fe5565b81810360408301526142f881866132be565b90506143076060830185612e7c565b818103608083015261431981846132be565b90509695505050505050565b60008151905061433481612f5a565b92915050565b6000806040838503121561435157614350612b82565b5b600061435f85828601614325565b925050602061437085828601614325565b9150509250929050565b7f74696e792064696e6f733a206d73672e76616c7565206e6f7420656e6f75676860008201527f20746f20636f766572206d6573736167654665652e2053656e6420676173206660208201527f6f72206d65737361676520666565730000000000000000000000000000000000604082015250565b60006143fc604f83612eb1565b91506144078261437a565b606082019050919050565b6000602082019050818103600083015261442b816143ef565b9050919050565b6000815461443f816136cc565b61444981866132ad565b945060018216600081146144645760018114614476576144a9565b60ff19831686526020860193506144a9565b61447f85613709565b60005b838110156144a157815481890152600182019150602081019050614482565b808801955050505b50505092915050565b60006144bd82612fb3565b9050919050565b6144cd816144b2565b82525050565b600060c0820190506144e86000830189613846565b81810360208301526144fa8188614432565b9050818103604083015261450e81876132be565b905061451d60608301866144c4565b61452a6080830185612fe5565b81810360a083015261453c81846132be565b9050979650505050505050565b7f4e6f6e626c6f636b696e6752656365697665723a206e6f2073746f726564206d60008201527f6573736167650000000000000000000000000000000000000000000000000000602082015250565b60006145a5602683612eb1565b91506145b082614549565b604082019050919050565b600060208201905081810360008301526145d481614598565b9050919050565b60006145e783856136fe565b93506145f4838584612c8d565b82840190509392505050565b600061460d8284866145db565b91508190509392505050565b7f4c617965725a65726f3a20696e76616c6964207061796c6f6164000000000000600082015250565b600061464f601a83612eb1565b915061465a82614619565b602082019050919050565b6000602082019050818103600083015261467e81614642565b9050919050565b600061469183856132ad565b935061469e838584612c8d565b6146a783612bd0565b840190509392505050565b60006080820190506146c76000830188613846565b81810360208301526146d981876132be565b90506146e86040830186613855565b81810360608301526146fb818486614685565b90509695505050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614763602683612eb1565b915061476e82614707565b604082019050919050565b6000602082019050818103600083015261479281614756565b9050919050565b6147a2816144b2565b81146147ad57600080fd5b50565b6000815190506147bf81614799565b92915050565b600080604083850312156147dc576147db612b82565b5b60006147ea858286016147b0565b92505060206147fb85828601614325565b9150509250929050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000614861602c83612eb1565b915061486c82614805565b604082019050919050565b6000602082019050818103600083015261489081614854565b9050919050565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b60006148f3602983612eb1565b91506148fe82614897565b604082019050919050565b60006020820190508181036000830152614922816148e6565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614985602483612eb1565b915061499082614929565b604082019050919050565b600060208201905081810360008301526149b481614978565b9050919050565b60006149c682612f50565b91506149d183612f50565b9250828210156149e4576149e3613e36565b5b828203905092915050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000614a25601983612eb1565b9150614a30826149ef565b602082019050919050565b60006020820190508181036000830152614a5481614a18565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000614ab7603283612eb1565b9150614ac282614a5b565b604082019050919050565b60006020820190508181036000830152614ae681614aaa565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614b2782612f50565b9150614b3283612f50565b925082614b4257614b41614aed565b5b828204905092915050565b6000614b5882612f50565b9150614b6383612f50565b925082614b7357614b72614aed565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000608082019050614bc26000830187612fe5565b614bcf6020830186612fe5565b614bdc604083018561324b565b8181036060830152614bee81846132be565b905095945050505050565b600081519050614c0881612e17565b92915050565b600060208284031215614c2457614c23612b82565b5b6000614c3284828501614bf9565b91505092915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000614c71602083612eb1565b9150614c7c82614c3b565b602082019050919050565b60006020820190508181036000830152614ca081614c64565b905091905056fea2646970667358221220a26308d94432bf952f70f18f4ef99788a52e0d8c5479f5c21336663bde72828f64736f6c63430008090033
Verified Source Code Partial Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: No
TinyDinos3D.sol 1662 lines
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
// File: contracts/interfaces/ILayerZeroUserApplicationConfig.sol
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
// @param _configType - type of configuration. every messaging library has its own convention.
// @param _config - configuration in the bytes. can encode arbitrary content.
function setConfig(
uint16 _version,
uint16 _chainId,
uint256 _configType,
bytes calldata _config
) external;
// @notice set the send() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setSendVersion(uint16 _version) external;
// @notice set the lzReceive() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setReceiveVersion(uint16 _version) external;
// @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload
// @param _srcChainId - the chainId of the source chain
// @param _srcAddress - the contract address of the source contract at the source chain
function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress)
external;
}
// File: contracts/interfaces/ILayerZeroEndpoint.sol
pragma solidity >=0.5.0;
interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {
// @notice send a LayerZero message to the specified address at a LayerZero endpoint.
// @param _dstChainId - the destination chain identifier
// @param _destination - the address on destination chain (in bytes). address length/format may vary by chains
// @param _payload - a custom bytes payload to send to the destination contract
// @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address
// @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction
// @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination
function send(
uint16 _dstChainId,
bytes calldata _destination,
bytes calldata _payload,
address payable _refundAddress,
address _zroPaymentAddress,
bytes calldata _adapterParams
) external payable;
// @notice used by the messaging library to publish verified payload
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source contract (as bytes) at the source chain
// @param _dstAddress - the address on destination chain
// @param _nonce - the unbound message ordering nonce
// @param _gasLimit - the gas limit for external contract execution
// @param _payload - verified payload to send to the destination contract
function receivePayload(
uint16 _srcChainId,
bytes calldata _srcAddress,
address _dstAddress,
uint64 _nonce,
uint256 _gasLimit,
bytes calldata _payload
) external;
// @notice get the inboundNonce of a receiver from a source chain which could be EVM or non-EVM chain
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source chain contract address
function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress)
external
view
returns (uint64);
// @notice get the outboundNonce from this source chain which, consequently, is always an EVM
// @param _srcAddress - the source chain contract address
function getOutboundNonce(uint16 _dstChainId, address _srcAddress)
external
view
returns (uint64);
// @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery
// @param _dstChainId - the destination chain identifier
// @param _userApplication - the user app address on this EVM chain
// @param _payload - the custom message to send over LayerZero
// @param _payInZRO - if false, user app pays the protocol fee in native token
// @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain
function estimateFees(
uint16 _dstChainId,
address _userApplication,
bytes calldata _payload,
bool _payInZRO,
bytes calldata _adapterParam
) external view returns (uint256 nativeFee, uint256 zroFee);
// @notice get this Endpoint's immutable source identifier
function getChainId() external view returns (uint16);
// @notice the interface to retry failed message on this Endpoint destination
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source chain contract address
// @param _payload - the payload to be retried
function retryPayload(
uint16 _srcChainId,
bytes calldata _srcAddress,
bytes calldata _payload
) external;
// @notice query if any STORED payload (message blocking) at the endpoint.
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source chain contract address
function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress)
external
view
returns (bool);
// @notice query if the _libraryAddress is valid for sending msgs.
// @param _userApplication - the user app address on this EVM chain
function getSendLibraryAddress(address _userApplication)
external
view
returns (address);
// @notice query if the _libraryAddress is valid for receiving msgs.
// @param _userApplication - the user app address on this EVM chain
function getReceiveLibraryAddress(address _userApplication)
external
view
returns (address);
// @notice query if the non-reentrancy guard for send() is on
// @return true if the guard is on. false otherwise
function isSendingPayload() external view returns (bool);
// @notice query if the non-reentrancy guard for receive() is on
// @return true if the guard is on. false otherwise
function isReceivingPayload() external view returns (bool);
// @notice get the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
// @param _userApplication - the contract address of the user application
// @param _configType - type of configuration. every messaging library has its own convention.
function getConfig(
uint16 _version,
uint16 _chainId,
address _userApplication,
uint256 _configType
) external view returns (bytes memory);
// @notice get the send() LayerZero messaging library version
// @param _userApplication - the contract address of the user application
function getSendVersion(address _userApplication)
external
view
returns (uint16);
// @notice get the lzReceive() LayerZero messaging library version
// @param _userApplication - the contract address of the user application
function getReceiveVersion(address _userApplication)
external
view
returns (uint16);
}
// File: contracts/interfaces/ILayerZeroReceiver.sol
pragma solidity >=0.5.0;
interface ILayerZeroReceiver {
// @notice LayerZero endpoint will invoke this function to deliver the message on the destination
// @param _srcChainId - the source endpoint identifier
// @param _srcAddress - the source sending contract address from the source chain
// @param _nonce - the ordered message nonce
// @param _payload - the signed payload is the UA bytes has encoded to be sent
function lzReceive(
uint16 _srcChainId,
bytes calldata _srcAddress,
uint64 _nonce,
bytes calldata _payload
) external;
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length)
internal
pure
returns (string memory)
{
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return interfaceId == type(IERC165).interfaceId;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId)
external
view
returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC165, IERC165)
returns (bool)
{
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner)
public
view
virtual
override
returns (uint256)
{
require(
owner != address(0),
"ERC721: balance query for the zero address"
);
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId)
public
view
virtual
override
returns (address)
{
address owner = _owners[tokenId];
require(
owner != address(0),
"ERC721: owner query for nonexistent token"
);
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId)
public
view
virtual
override
returns (address)
{
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved)
public
virtual
override
{
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId)
internal
view
virtual
returns (bool)
{
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
// File: contracts/NonblockingReceiver.sol
pragma solidity ^0.8.6;
abstract contract NonblockingReceiver is Ownable, ILayerZeroReceiver {
ILayerZeroEndpoint internal endpoint;
struct FailedMessages {
uint256 payloadLength;
bytes32 payloadHash;
}
mapping(uint16 => mapping(bytes => mapping(uint256 => FailedMessages)))
public failedMessages;
mapping(uint16 => bytes) public trustedRemoteLookup;
event MessageFailed(
uint16 _srcChainId,
bytes _srcAddress,
uint64 _nonce,
bytes _payload
);
function lzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) external override {
require(msg.sender == address(endpoint)); // boilerplate! lzReceive must be called by the endpoint for security
require(
_srcAddress.length == trustedRemoteLookup[_srcChainId].length &&
keccak256(_srcAddress) ==
keccak256(trustedRemoteLookup[_srcChainId]),
"NonblockingReceiver: invalid source sending contract"
);
// try-catch all errors/exceptions
// having failed messages does not block messages passing
try this.onLzReceive(_srcChainId, _srcAddress, _nonce, _payload) {
// do nothing
} catch {
// error / exception
failedMessages[_srcChainId][_srcAddress][_nonce] = FailedMessages(
_payload.length,
keccak256(_payload)
);
emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload);
}
}
function onLzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) public {
// only internal transaction
require(
msg.sender == address(this),
"NonblockingReceiver: caller must be Bridge."
);
// handle incoming message
_LzReceive(_srcChainId, _srcAddress, _nonce, _payload);
}
// abstract function
function _LzReceive(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes memory _payload
) internal virtual;
function _lzSend(
uint16 _dstChainId,
bytes memory _payload,
address payable _refundAddress,
address _zroPaymentAddress,
bytes memory _txParam
) internal {
endpoint.send{value: msg.value}(
_dstChainId,
trustedRemoteLookup[_dstChainId],
_payload,
_refundAddress,
_zroPaymentAddress,
_txParam
);
}
function retryMessage(
uint16 _srcChainId,
bytes memory _srcAddress,
uint64 _nonce,
bytes calldata _payload
) external payable {
// assert there is message to retry
FailedMessages storage failedMsg = failedMessages[_srcChainId][
_srcAddress
][_nonce];
require(
failedMsg.payloadHash != bytes32(0),
"NonblockingReceiver: no stored message"
);
require(
_payload.length == failedMsg.payloadLength &&
keccak256(_payload) == failedMsg.payloadHash,
"LayerZero: invalid payload"
);
// clear the stored message
failedMsg.payloadLength = 0;
failedMsg.payloadHash = bytes32(0);
// execute the message. revert if it fails again
this.onLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
}
function setTrustedRemote(uint16 _chainId, bytes call...
// [truncated — 54310 bytes total]
Read Contract
_owner 0xb2bdfa7b → address
balanceOf 0x70a08231 → uint256
failedMessages 0x8ee74912 → uint256, bytes32
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
trustedRemoteLookup 0x7533d788 → bytes
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
donate 0xed88c68e
No parameters
lzReceive 0x001d3567
uint16 _srcChainId
bytes _srcAddress
uint64 _nonce
bytes _payload
mint 0x6ecd2306
uint8 numTokens
onLzReceive 0x1c37a822
uint16 _srcChainId
bytes _srcAddress
uint64 _nonce
bytes _payload
renounceOwnership 0x715018a6
No parameters
retryMessage 0xd1deba1f
uint16 _srcChainId
bytes _srcAddress
uint64 _nonce
bytes _payload
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string URI
setGasForDestinationLzReceive 0x943fb872
uint256 newVal
setTrustedRemote 0xeb8d72b7
uint16 _chainId
bytes _trustedRemote
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
traverseChains 0xcf89fa03
uint16 _chainId
uint256 tokenId
withdraw 0x2e1a7d4d
uint256 amt
Recent Transactions
No transactions found for this address