Address Contract Partially Verified
Address
0xeF04AdC4FFDA7fE40a7e32CA64cD85b14bE001c8
Balance
0 ETH
Nonce
1
Code Size
21151 bytes
Creator
0xFbf1612D...b9fe at tx 0xb59e1d92...ffa8e8
Indexed Transactions
0
Contract Bytecode
21151 bytes
0x6080604052600436106102935760003560e01c80639ce6e4b21161015a578063c9901975116100c1578063e985e9c51161007a578063e985e9c5146109e9578063eff9553714610a26578063f2fde38b14610a51578063f8dcbddb14610a7a578063fba36f3a14610aa3578063fe90f54114610ace57610293565b8063c9901975146108d4578063cbccefb214610911578063ccb4807b1461093c578063d2cab05614610965578063e5adee6314610981578063e8a3d485146109be57610293565b8063a7d601fd11610113578063a7d601fd146107c1578063b3ab66b0146107ea578063b88d4fde14610806578063c0e727401461082f578063c87b56dd1461085a578063c9262f771461089757610293565b80639ce6e4b2146106c9578063a035b1fe146106f2578063a0bcfc7f1461071d578063a22cb46514610746578063a2624f581461076f578063a58fdc111461079857610293565b806346f265fd116101fe57806370a08231116101b757806370a08231146105cb57806370a12fb114610608578063715018a6146106335780637cb647591461064a5780638da5cb5b1461067357806395d89b411461069e57610293565b806346f265fd146104a9578063525f8a5c146104e65780636352211e1461050f5780636995c1761461054c5780636c0360eb146105775780636f8b44b0146105a257610293565b80631cbaee2d116102505780631cbaee2d146103ad57806323b872dd146103d85780632fc37ab21461040157806332cb6b0c1461042c57806342842e0e1461045757806342966c681461048057610293565b806301ffc9a71461029857806306fdde03146102d5578063081812fc14610300578063095ea7b31461033d57806318160ddd146103665780631b96c85c14610391575b600080fd5b3480156102a457600080fd5b506102bf60048036038101906102ba9190613416565b610af9565b6040516102cc919061345e565b60405180910390f35b3480156102e157600080fd5b506102ea610bdb565b6040516102f79190613509565b60405180910390f35b34801561030c57600080fd5b5061032760048036038101906103229190613561565b610c6d565b60405161033491906135cf565b60405180910390f35b34801561034957600080fd5b50610364600480360381019061035f9190613616565b610cb3565b005b34801561037257600080fd5b5061037b610dca565b6040516103889190613665565b60405180910390f35b6103ab60048036038101906103a69190613616565b610ddb565b005b3480156103b957600080fd5b506103c2610e7c565b6040516103cf9190613665565b60405180910390f35b3480156103e457600080fd5b506103ff60048036038101906103fa9190613680565b610e82565b005b34801561040d57600080fd5b50610416610ee2565b60405161042391906136ec565b60405180910390f35b34801561043857600080fd5b50610441610ee8565b60405161044e9190613665565b60405180910390f35b34801561046357600080fd5b5061047e60048036038101906104799190613680565b610eee565b005b34801561048c57600080fd5b506104a760048036038101906104a29190613561565b610f0e565b005b3480156104b557600080fd5b506104d060048036038101906104cb919061387b565b610f63565b6040516104dd919061345e565b60405180910390f35b3480156104f257600080fd5b5061050d60048036038101906105089190613561565b610f7a565b005b34801561051b57600080fd5b5061053660048036038101906105319190613561565b610f8c565b60405161054391906135cf565b60405180910390f35b34801561055857600080fd5b5061056161103d565b60405161056e9190613665565b60405180910390f35b34801561058357600080fd5b5061058c611043565b6040516105999190613509565b60405180910390f35b3480156105ae57600080fd5b506105c960048036038101906105c49190613561565b6110d1565b005b3480156105d757600080fd5b506105f260048036038101906105ed91906138d7565b6110e3565b6040516105ff9190613665565b60405180910390f35b34801561061457600080fd5b5061061d61119a565b60405161062a91906136ec565b60405180910390f35b34801561063f57600080fd5b506106486111a0565b005b34801561065657600080fd5b50610671600480360381019061066c9190613904565b6111b4565b005b34801561067f57600080fd5b506106886111c6565b60405161069591906135cf565b60405180910390f35b3480156106aa57600080fd5b506106b36111f0565b6040516106c09190613509565b60405180910390f35b3480156106d557600080fd5b506106f060048036038101906106eb9190613561565b611282565b005b3480156106fe57600080fd5b50610707611294565b6040516107149190613665565b60405180910390f35b34801561072957600080fd5b50610744600480360381019061073f91906139e6565b61129a565b005b34801561075257600080fd5b5061076d60048036038101906107689190613a5b565b61132a565b005b34801561077b57600080fd5b5061079660048036038101906107919190613561565b611340565b005b3480156107a457600080fd5b506107bf60048036038101906107ba9190613904565b611352565b005b3480156107cd57600080fd5b506107e860048036038101906107e391906139e6565b611364565b005b61080460048036038101906107ff9190613561565b61137f565b005b34801561081257600080fd5b5061082d60048036038101906108289190613b3c565b611852565b005b34801561083b57600080fd5b506108446118b4565b6040516108519190613509565b60405180910390f35b34801561086657600080fd5b50610881600480360381019061087c9190613561565b611942565b60405161088e9190613509565b60405180910390f35b3480156108a357600080fd5b506108be60048036038101906108b991906138d7565b611a65565b6040516108cb9190613665565b60405180910390f35b3480156108e057600080fd5b506108fb60048036038101906108f6919061387b565b611a7d565b604051610908919061345e565b60405180910390f35b34801561091d57600080fd5b50610926611a94565b6040516109339190613c36565b60405180910390f35b34801561094857600080fd5b50610963600480360381019061095e91906139e6565b611aa7565b005b61097f600480360381019061097a9190613cac565b611ac2565b005b34801561098d57600080fd5b506109a860048036038101906109a391906138d7565b61206c565b6040516109b59190613665565b60405180910390f35b3480156109ca57600080fd5b506109d3612084565b6040516109e09190613509565b60405180910390f35b3480156109f557600080fd5b50610a106004803603810190610a0b9190613d0c565b612116565b604051610a1d919061345e565b60405180910390f35b348015610a3257600080fd5b50610a3b6121aa565b604051610a489190613509565b60405180910390f35b348015610a5d57600080fd5b50610a786004803603810190610a7391906138d7565b612238565b005b348015610a8657600080fd5b50610aa16004803603810190610a9c9190613561565b6122bb565b005b348015610aaf57600080fd5b50610ab8612302565b604051610ac59190613665565b60405180910390f35b348015610ada57600080fd5b50610ae3612308565b604051610af091906135cf565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610bc457507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610bd45750610bd38261232e565b5b9050919050565b606060008054610bea90613d7b565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1690613d7b565b8015610c635780601f10610c3857610100808354040283529160200191610c63565b820191906000526020600020905b815481529060010190602001808311610c4657829003601f168201915b5050505050905090565b6000610c7882612398565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610cbe82610f8c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610d2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2590613e1e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610d4d6123e3565b73ffffffffffffffffffffffffffffffffffffffff161480610d7c5750610d7b81610d766123e3565b612116565b5b610dbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db290613eb0565b60405180910390fd5b610dc583836123eb565b505050565b6000610dd660076124a4565b905090565b610de36124b2565b600e5481610df160076124a4565b610dfb9190613eff565b1115610e3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3390613f7f565b60405180910390fd5b60005b81811015610e7757610e516007612530565b610e6483610e5f60076124a4565b612546565b8080610e6f90613f9f565b915050610e3f565b505050565b60115481565b610e93610e8d6123e3565b82612564565b610ed2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec990614059565b60405180910390fd5b610edd838383612642565b505050565b60095481565b600e5481565b610f0983838360405180602001604052806000815250611852565b505050565b610f183382612564565b610f57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4e906140c5565b60405180910390fd5b610f60816128a8565b50565b6000610f7282600954856129c5565b905092915050565b610f826124b2565b8060118190555050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611034576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102b90614131565b60405180910390fd5b80915050919050565b60125481565b600b805461105090613d7b565b80601f016020809104026020016040519081016040528092919081815260200182805461107c90613d7b565b80156110c95780601f1061109e576101008083540402835291602001916110c9565b820191906000526020600020905b8154815290600101906020018083116110ac57829003601f168201915b505050505081565b6110d96124b2565b80600e8190555050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611153576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114a906141c3565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a5481565b6111a86124b2565b6111b260006129dc565b565b6111bc6124b2565b8060098190555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546111ff90613d7b565b80601f016020809104026020016040519081016040528092919081815260200182805461122b90613d7b565b80156112785780601f1061124d57610100808354040283529160200191611278565b820191906000526020600020905b81548152906001019060200180831161125b57829003601f168201915b5050505050905090565b61128a6124b2565b8060128190555050565b600f5481565b6112a26124b2565b6002808111156112b5576112b4613bbf565b5b600860009054906101000a900460ff1660028111156112d7576112d6613bbf565b5b14611317576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130e9061422f565b60405180910390fd5b80600b908161132691906143fb565b5050565b61133c6113356123e3565b8383612aa2565b5050565b6113486124b2565b8060108190555050565b61135a6124b2565b80600a8190555050565b61136c6124b2565b80600c908161137b91906143fb565b5050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16146113ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e490614519565b60405180910390fd5b60006012546011546113ff9190613eff565b90506000600f5403611446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143d90614585565b60405180910390fd5b8061144f612c0e565b1015611490576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611487906145f1565b60405180910390fd5b6012548161149e9190613eff565b6114a6612c0e565b106114e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dd9061465d565b60405180910390fd5b600160028111156114fa576114f9613bbf565b5b600860009054906101000a900460ff16600281111561151c5761151b613bbf565b5b1461155c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611553906146c9565b60405180910390fd5b6000821161159f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159690614735565b60405180910390fd5b600e54826115ad60076124a4565b6115b79190613eff565b11156115f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115ef90613f7f565b60405180910390fd5b60105482601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116469190613eff565b1115611687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167e906147c7565b60405180910390fd5b81600f5461169591906147e7565b3410156116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ce90614875565b60405180910390fd5b600082600f546116e791906147e7565b346116f29190614895565b90506000811115611745573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611743573d6000803e3d6000fd5b505b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc84600f5461178f91906147e7565b9081150290604051600060405180830381858888f193505050501580156117ba573d6000803e3d6000fd5b5082601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461180a9190613eff565b9250508190555060005b8381101561184c576118266007612530565b6118393361183460076124a4565b612546565b808061184490613f9f565b915050611814565b50505050565b61186361185d6123e3565b83612564565b6118a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189990614059565b60405180910390fd5b6118ae84848484612c16565b50505050565b600d80546118c190613d7b565b80601f01602080910402602001604051908101604052809291908181526020018280546118ed90613d7b565b801561193a5780601f1061190f5761010080835404028352916020019161193a565b820191906000526020600020905b81548152906001019060200180831161191d57829003601f168201915b505050505081565b606061194d82612c72565b61198c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198390614915565b60405180910390fd5b6000600b805461199b90613d7b565b905011611a3257600c80546119af90613d7b565b80601f01602080910402602001604051908101604052809291908181526020018280546119db90613d7b565b8015611a285780601f106119fd57610100808354040283529160200191611a28565b820191906000526020600020905b815481529060010190602001808311611a0b57829003601f168201915b5050505050611a5e565b600b611a3d83612cde565b604051602001611a4e929190614a40565b6040516020818303038152906040525b9050919050565b60146020528060005260406000206000915090505481565b6000611a8c82600a54856129c5565b905092915050565b600860009054906101000a900460ff1681565b611aaf6124b2565b80600d9081611abe91906143fb565b5050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611b30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2790614519565b60405180910390fd5b601154611b3b612c0e565b1015611b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7390614ae1565b60405180910390fd5b601254601154611b8c9190613eff565b611b94612c0e565b10611bd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bcb90614b4d565b60405180910390fd5b60016002811115611be857611be7613bbf565b5b600860009054906101000a900460ff166002811115611c0a57611c09613bbf565b5b14611c4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c419061422f565b60405180910390fd5b60008311611c8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8490614735565b60405180910390fd5b611c98338383612e3e565b80611caa5750611ca9338383612e9c565b5b611ce9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce090614bb9565b60405180910390fd5b600e5483611cf760076124a4565b611d019190613eff565b1115611d42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3990613f7f565b60405180910390fd5b60105483601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d909190613eff565b1115611dd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc8906147c7565b60405180910390fd5b6000611dde338484612e9c565b8015611e2957506001601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b15611ea3576000600185611e3d9190614895565b600f54611e4a91906147e7565b905080341015611e8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8690614875565b60405180910390fd5b8034611e9b9190614895565b915050611f0f565b83600f54611eb191906147e7565b341015611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea90614875565b60405180910390fd5b83600f54611f0191906147e7565b34611f0c9190614895565b90505b6000811115611f60573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f5e573d6000803e3d6000fd5b505b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8234611fa89190614895565b9081150290604051600060405180830381858888f19350505050158015611fd3573d6000803e3d6000fd5b5083601460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546120239190613eff565b9250508190555060005b848110156120655761203f6007612530565b6120523361204d60076124a4565b612546565b808061205d90613f9f565b91505061202d565b5050505050565b60156020528060005260406000206000915090505481565b6060600d805461209390613d7b565b80601f01602080910402602001604051908101604052809291908181526020018280546120bf90613d7b565b801561210c5780601f106120e15761010080835404028352916020019161210c565b820191906000526020600020905b8154815290600101906020018083116120ef57829003601f168201915b5050505050905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600c80546121b790613d7b565b80601f01602080910402602001604051908101604052809291908181526020018280546121e390613d7b565b80156122305780601f1061220557610100808354040283529160200191612230565b820191906000526020600020905b81548152906001019060200180831161221357829003601f168201915b505050505081565b6122406124b2565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036122af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a690614c4b565b60405180910390fd5b6122b8816129dc565b50565b6122c36124b2565b8060028111156122d6576122d5613bbf565b5b600860006101000a81548160ff021916908360028111156122fa576122f9613bbf565b5b021790555050565b60105481565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6123a181612c72565b6123e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d790614131565b60405180910390fd5b50565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661245e83610f8c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081600001549050919050565b6124ba6123e3565b73ffffffffffffffffffffffffffffffffffffffff166124d86111c6565b73ffffffffffffffffffffffffffffffffffffffff161461252e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252590614cb7565b60405180910390fd5b565b6001816000016000828254019250508190555050565b612560828260405180602001604052806000815250612efa565b5050565b600061256f82612c72565b6125ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a590614d49565b60405180910390fd5b60006125b983610f8c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061262857508373ffffffffffffffffffffffffffffffffffffffff1661261084610c6d565b73ffffffffffffffffffffffffffffffffffffffff16145b8061263957506126388185612116565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661266282610f8c565b73ffffffffffffffffffffffffffffffffffffffff16146126b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126af90614ddb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161271e90614e6d565b60405180910390fd5b612732838383612f55565b61273d6000826123eb565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461278d9190614895565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546127e49190613eff565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46128a3838383612f5a565b505050565b60006128b382610f8c565b90506128c181600084612f55565b6128cc6000836123eb565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461291c9190614895565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46129c181600084612f5a565b5050565b6000826129d28584612f5f565b1490509392505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612b10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b0790614ed9565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612c01919061345e565b60405180910390a3505050565b600042905090565b612c21848484612642565b612c2d84848484612fb5565b612c6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c6390614f6b565b60405180910390fd5b50505050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b606060008203612d25576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612e39565b600082905060005b60008214612d57578080612d4090613f9f565b915050600a82612d509190614fba565b9150612d2d565b60008167ffffffffffffffff811115612d7357612d72613738565b5b6040519080825280601f01601f191660200182016040528015612da55781602001600182028036833780820191505090505b5090505b60008514612e3257600182612dbe9190614895565b9150600a85612dcd9190614feb565b6030612dd99190613eff565b60f81b818381518110612def57612dee61501c565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612e2b9190614fba565b9450612da9565b8093505050505b919050565b6000612e93612e4c8561313c565b848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050610f63565b90509392505050565b6000612ef1612eaa8561313c565b848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050611a7d565b90509392505050565b612f04838361316c565b612f116000848484612fb5565b612f50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f4790614f6b565b60405180910390fd5b505050565b505050565b505050565b60008082905060005b8451811015612faa57612f9582868381518110612f8857612f8761501c565b5b6020026020010151613345565b91508080612fa290613f9f565b915050612f68565b508091505092915050565b6000612fd68473ffffffffffffffffffffffffffffffffffffffff16613370565b1561312f578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612fff6123e3565b8786866040518563ffffffff1660e01b815260040161302194939291906150a0565b6020604051808303816000875af192505050801561305d57506040513d601f19601f8201168201806040525081019061305a9190615101565b60015b6130df573d806000811461308d576040519150601f19603f3d011682016040523d82523d6000602084013e613092565b606091505b5060008151036130d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130ce90614f6b565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613134565b600190505b949350505050565b60008160405160200161314f9190615176565b604051602081830303815290604052805190602001209050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036131db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131d2906151dd565b60405180910390fd5b6131e481612c72565b15613224576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161321b90615249565b60405180910390fd5b61323060008383612f55565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546132809190613eff565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461334160008383612f5a565b5050565b600081831061335d576133588284613393565b613368565b6133678383613393565b5b905092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600082600052816020526040600020905092915050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6133f3816133be565b81146133fe57600080fd5b50565b600081359050613410816133ea565b92915050565b60006020828403121561342c5761342b6133b4565b5b600061343a84828501613401565b91505092915050565b60008115159050919050565b61345881613443565b82525050565b6000602082019050613473600083018461344f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156134b3578082015181840152602081019050613498565b60008484015250505050565b6000601f19601f8301169050919050565b60006134db82613479565b6134e58185613484565b93506134f5818560208601613495565b6134fe816134bf565b840191505092915050565b6000602082019050818103600083015261352381846134d0565b905092915050565b6000819050919050565b61353e8161352b565b811461354957600080fd5b50565b60008135905061355b81613535565b92915050565b600060208284031215613577576135766133b4565b5b60006135858482850161354c565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006135b98261358e565b9050919050565b6135c9816135ae565b82525050565b60006020820190506135e460008301846135c0565b92915050565b6135f3816135ae565b81146135fe57600080fd5b50565b600081359050613610816135ea565b92915050565b6000806040838503121561362d5761362c6133b4565b5b600061363b85828601613601565b925050602061364c8582860161354c565b9150509250929050565b61365f8161352b565b82525050565b600060208201905061367a6000830184613656565b92915050565b600080600060608486031215613699576136986133b4565b5b60006136a786828701613601565b93505060206136b886828701613601565b92505060406136c98682870161354c565b9150509250925092565b6000819050919050565b6136e6816136d3565b82525050565b600060208201905061370160008301846136dd565b92915050565b613710816136d3565b811461371b57600080fd5b50565b60008135905061372d81613707565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613770826134bf565b810181811067ffffffffffffffff8211171561378f5761378e613738565b5b80604052505050565b60006137a26133aa565b90506137ae8282613767565b919050565b600067ffffffffffffffff8211156137ce576137cd613738565b5b602082029050602081019050919050565b600080fd5b60006137f76137f2846137b3565b613798565b9050808382526020820190506020840283018581111561381a576138196137df565b5b835b81811015613843578061382f888261371e565b84526020840193505060208101905061381c565b5050509392505050565b600082601f83011261386257613861613733565b5b81356138728482602086016137e4565b91505092915050565b60008060408385031215613892576138916133b4565b5b60006138a08582860161371e565b925050602083013567ffffffffffffffff8111156138c1576138c06133b9565b5b6138cd8582860161384d565b9150509250929050565b6000602082840312156138ed576138ec6133b4565b5b60006138fb84828501613601565b91505092915050565b60006020828403121561391a576139196133b4565b5b60006139288482850161371e565b91505092915050565b600080fd5b600067ffffffffffffffff82111561395157613950613738565b5b61395a826134bf565b9050602081019050919050565b82818337600083830152505050565b600061398961398484613936565b613798565b9050828152602081018484840111156139a5576139a4613931565b5b6139b0848285613967565b509392505050565b600082601f8301126139cd576139cc613733565b5b81356139dd848260208601613976565b91505092915050565b6000602082840312156139fc576139fb6133b4565b5b600082013567ffffffffffffffff811115613a1a57613a196133b9565b5b613a26848285016139b8565b91505092915050565b613a3881613443565b8114613a4357600080fd5b50565b600081359050613a5581613a2f565b92915050565b60008060408385031215613a7257613a716133b4565b5b6000613a8085828601613601565b9250506020613a9185828601613a46565b9150509250929050565b600067ffffffffffffffff821115613ab657613ab5613738565b5b613abf826134bf565b9050602081019050919050565b6000613adf613ada84613a9b565b613798565b905082815260208101848484011115613afb57613afa613931565b5b613b06848285613967565b509392505050565b600082601f830112613b2357613b22613733565b5b8135613b33848260208601613acc565b91505092915050565b60008060008060808587031215613b5657613b556133b4565b5b6000613b6487828801613601565b9450506020613b7587828801613601565b9350506040613b868782880161354c565b925050606085013567ffffffffffffffff811115613ba757613ba66133b9565b5b613bb387828801613b0e565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110613bff57613bfe613bbf565b5b50565b6000819050613c1082613bee565b919050565b6000613c2082613c02565b9050919050565b613c3081613c15565b82525050565b6000602082019050613c4b6000830184613c27565b92915050565b600080fd5b60008083601f840112613c6c57613c6b613733565b5b8235905067ffffffffffffffff811115613c8957613c88613c51565b5b602083019150836020820283011115613ca557613ca46137df565b5b9250929050565b600080600060408486031215613cc557613cc46133b4565b5b6000613cd38682870161354c565b935050602084013567ffffffffffffffff811115613cf457613cf36133b9565b5b613d0086828701613c56565b92509250509250925092565b60008060408385031215613d2357613d226133b4565b5b6000613d3185828601613601565b9250506020613d4285828601613601565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613d9357607f821691505b602082108103613da657613da5613d4c565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e08602183613484565b9150613e1382613dac565b604082019050919050565b60006020820190508181036000830152613e3781613dfb565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000602082015250565b6000613e9a603e83613484565b9150613ea582613e3e565b604082019050919050565b60006020820190508181036000830152613ec981613e8d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613f0a8261352b565b9150613f158361352b565b9250828201905080821115613f2d57613f2c613ed0565b5b92915050565b7f4d617820737570706c7920657863656564656400000000000000000000000000600082015250565b6000613f69601383613484565b9150613f7482613f33565b602082019050919050565b60006020820190508181036000830152613f9881613f5c565b9050919050565b6000613faa8261352b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613fdc57613fdb613ed0565b5b600182019050919050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206e6f7220617070726f766564000000000000000000000000000000000000602082015250565b6000614043602e83613484565b915061404e82613fe7565b604082019050919050565b6000602082019050818103600083015261407281614036565b9050919050565b7f4e6f74206f776e6572206e6f7220617070726f76656400000000000000000000600082015250565b60006140af601683613484565b91506140ba82614079565b602082019050919050565b600060208201905081810360008301526140de816140a2565b9050919050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b600061411b601883613484565b9150614126826140e5565b602082019050919050565b6000602082019050818103600083015261414a8161410e565b9050919050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b60006141ad602983613484565b91506141b882614151565b604082019050919050565b600060208201905081810360008301526141dc816141a0565b9050919050565b7f57686974656c6973742073616c65206973206e6f742061637469766174656400600082015250565b6000614219601f83613484565b9150614224826141e3565b602082019050919050565b600060208201905081810360008301526142488161420c565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026142b17fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614274565b6142bb8683614274565b95508019841693508086168417925050509392505050565b6000819050919050565b60006142f86142f36142ee8461352b565b6142d3565b61352b565b9050919050565b6000819050919050565b614312836142dd565b61432661431e826142ff565b848454614281565b825550505050565b600090565b61433b61432e565b614346818484614309565b505050565b5b8181101561436a5761435f600082614333565b60018101905061434c565b5050565b601f8211156143af576143808161424f565b61438984614264565b81016020851015614398578190505b6143ac6143a485614264565b83018261434b565b50505b505050565b600082821c905092915050565b60006143d2600019846008026143b4565b1980831691505092915050565b60006143eb83836143c1565b9150826002028217905092915050565b61440482613479565b67ffffffffffffffff81111561441d5761441c613738565b5b6144278254613d7b565b61443282828561436e565b600060209050601f8311600181146144655760008415614453578287015190505b61445d85826143df565b8655506144c5565b601f1984166144738661424f565b60005b8281101561449b57848901518255600182019150602085019450602081019050614476565b868310156144b857848901516144b4601f8916826143c1565b8355505b6001600288020188555050505b505050505050565b7f5468652063616c6c657220697320616e6f7468657220636f6e74726163740000600082015250565b6000614503601e83613484565b915061450e826144cd565b602082019050919050565b60006020820190508181036000830152614532816144f6565b9050919050565b7f5072696365206973203000000000000000000000000000000000000000000000600082015250565b600061456f600a83613484565b915061457a82614539565b602082019050919050565b6000602082019050818103600083015261459e81614562565b9050919050565b7f5075626c69632053616c6520686173206e6f7420737461727465642079657400600082015250565b60006145db601f83613484565b91506145e6826145a5565b602082019050919050565b6000602082019050818103600083015261460a816145ce565b9050919050565b7f5075626c69632053616c652069732066696e6973686564000000000000000000600082015250565b6000614647601783613484565b915061465282614611565b602082019050919050565b600060208201905081810360008301526146768161463a565b9050919050565b7f5075626c69632073616c65206973206e6f742061637469766174656400000000600082015250565b60006146b3601c83613484565b91506146be8261467d565b602082019050919050565b600060208201905081810360008301526146e2816146a6565b9050919050565b7f4e6f7420616c6c6f77207175616e746974792030000000000000000000000000600082015250565b600061471f601483613484565b915061472a826146e9565b602082019050919050565b6000602082019050818103600083015261474e81614712565b9050919050565b7f596f752063616e206f6e6c792070757263686173652032204e465473206f6e2060008201527f4d696e74696e672e000000000000000000000000000000000000000000000000602082015250565b60006147b1602883613484565b91506147bc82614755565b604082019050919050565b600060208201905081810360008301526147e0816147a4565b9050919050565b60006147f28261352b565b91506147fd8361352b565b925082820261480b8161352b565b9150828204841483151761482257614821613ed0565b5b5092915050565b7f4e6f7420656e6f756768742066756e6473000000000000000000000000000000600082015250565b600061485f601183613484565b915061486a82614829565b602082019050919050565b6000602082019050818103600083015261488e81614852565b9050919050565b60006148a08261352b565b91506148ab8361352b565b92508282039050818111156148c3576148c2613ed0565b5b92915050565b7f4e6f6e6578697374656e7420746f6b656e000000000000000000000000000000600082015250565b60006148ff601183613484565b915061490a826148c9565b602082019050919050565b6000602082019050818103600083015261492e816148f2565b9050919050565b600081905092915050565b6000815461494d81613d7b565b6149578186614935565b945060018216600081146149725760018114614987576149ba565b60ff19831686528115158202860193506149ba565b6149908561424f565b60005b838110156149b257815481890152600182019150602081019050614993565b838801955050505b50505092915050565b60006149ce82613479565b6149d88185614935565b93506149e8818560208601613495565b80840191505092915050565b7f2e6a736f6e000000000000000000000000000000000000000000000000000000600082015250565b6000614a2a600583614935565b9150614a35826149f4565b600582019050919050565b6000614a4c8285614940565b9150614a5882846149c3565b9150614a6382614a1d565b91508190509392505050565b7f57686974656c6973742053616c6520686173206e6f742073746172746564207960008201527f6574000000000000000000000000000000000000000000000000000000000000602082015250565b6000614acb602283613484565b9150614ad682614a6f565b604082019050919050565b60006020820190508181036000830152614afa81614abe565b9050919050565b7f57686974656c6973742053616c652069732066696e6973686564000000000000600082015250565b6000614b37601a83613484565b9150614b4282614b01565b602082019050919050565b60006020820190508181036000830152614b6681614b2a565b9050919050565b7f4e6f742077686974656c69737465640000000000000000000000000000000000600082015250565b6000614ba3600f83613484565b9150614bae82614b6d565b602082019050919050565b60006020820190508181036000830152614bd281614b96565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614c35602683613484565b9150614c4082614bd9565b604082019050919050565b60006020820190508181036000830152614c6481614c28565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614ca1602083613484565b9150614cac82614c6b565b602082019050919050565b60006020820190508181036000830152614cd081614c94565b9050919050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000614d33602c83613484565b9150614d3e82614cd7565b604082019050919050565b60006020820190508181036000830152614d6281614d26565b9050919050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b6000614dc5602583613484565b9150614dd082614d69565b604082019050919050565b60006020820190508181036000830152614df481614db8565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614e57602483613484565b9150614e6282614dfb565b604082019050919050565b60006020820190508181036000830152614e8681614e4a565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b6000614ec3601983613484565b9150614ece82614e8d565b602082019050919050565b60006020820190508181036000830152614ef281614eb6565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000614f55603283613484565b9150614f6082614ef9565b604082019050919050565b60006020820190508181036000830152614f8481614f48565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614fc58261352b565b9150614fd08361352b565b925082614fe057614fdf614f8b565b5b828204905092915050565b6000614ff68261352b565b91506150018361352b565b92508261501157615010614f8b565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b60006150728261504b565b61507c8185615056565b935061508c818560208601613495565b615095816134bf565b840191505092915050565b60006080820190506150b560008301876135c0565b6150c260208301866135c0565b6150cf6040830185613656565b81810360608301526150e18184615067565b905095945050505050565b6000815190506150fb816133ea565b92915050565b600060208284031215615117576151166133b4565b5b6000615125848285016150ec565b91505092915050565b60008160601b9050919050565b60006151468261512e565b9050919050565b60006151588261513b565b9050919050565b61517061516b826135ae565b61514d565b82525050565b6000615182828461515f565b60148201915081905092915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b60006151c7602083613484565b91506151d282615191565b602082019050919050565b600060208201905081810360008301526151f6816151ba565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000615233601c83613484565b915061523e826151fd565b602082019050919050565b6000602082019050818103600083015261526281615226565b905091905056fea264697066735822122019a87dd63b72a6324be5dbd5828f95782574007fae7ad76bfb69f519582bd05364736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
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);
}
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @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);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* 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;
/**
* @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 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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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 `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ERC721.sol 454 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @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: address zero is not a valid owner");
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: invalid token ID");
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) {
_requireMinted(tokenId);
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 overridden 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 token owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
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: caller is not token 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: caller is not token 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) {
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(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);
_afterTokenTransfer(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 from incorrect owner");
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);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {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 an {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 Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @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 {
/// @solidity memory-safe-assembly
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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
MerkleProof.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
* consuming from one or the other at each step according to the instructions given by
* `proofFlags`.
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
return hashes[totalHashes - 1];
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
ClickChicken.sol 221 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./MultisigOwnable.sol";
contract ClickChicken is ERC721, Ownable {
using Strings for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
enum Step {
Before,
Sale,
After
}
Step public sellingStep;
bytes32 public _merkleRoot; // WL
bytes32 public _merkleRootOG; // OG
string public baseURI;
string public blindURI;
string public _contractURI;
uint public MAX_SUPPLY = 4444;
uint public price; // require
uint public ALLOW_QUANTITY = 2; // require
uint public saleStartTime = 1663952400; // 09.23.2022
uint public saleTimeFrame = 600 minutes; // 10 hours
address public verifyAccount;
constructor(
uint __price,
bytes32 __merkelRoot,
bytes32 __merkelRootOG,
string memory __blindURI,
string memory __contractURI,
address __verifyAccount
) ERC721("ClickChicken", "CC") {
price = __price;
_merkleRoot = __merkelRoot;
_merkleRootOG = __merkelRootOG;
blindURI = __blindURI;
_contractURI = __contractURI;
verifyAccount = __verifyAccount;
}
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract");
_;
}
mapping(address => uint) public claimedQuantity;
function whitelistMint(uint _quantity, bytes32[] calldata _proof) external payable callerIsUser {
require(currentTime() >= saleStartTime, "Whitelist Sale has not started yet");
require(currentTime() < saleStartTime + saleTimeFrame, "Whitelist Sale is finished");
require(sellingStep == Step.Sale, "Whitelist sale is not activated");
require(_quantity > 0, "Not allow quantity 0");
require(isWhiteListed(msg.sender, _proof) || isOGListed(msg.sender, _proof), "Not whitelisted");
require(_tokenIdCounter.current() + _quantity <= MAX_SUPPLY, "Max supply exceeded");
require(claimedQuantity[msg.sender] + _quantity <= ALLOW_QUANTITY, "You can only purchase 2 NFTs on Minting.");
uint256 lessAmount;
if (isOGListed(msg.sender, _proof) && claimedQuantity[msg.sender] < 1) {
uint seedVal = price * (_quantity - 1);
require(msg.value >= seedVal, "Not enought funds");
lessAmount = msg.value - seedVal;
} else {
require(msg.value >= price * _quantity, "Not enought funds");
lessAmount = msg.value - (price * _quantity);
}
if (lessAmount > 0) payable(msg.sender).transfer(lessAmount);
payable(verifyAccount).transfer(msg.value - lessAmount);
claimedQuantity[msg.sender] += _quantity;
for (uint256 i = 0; i < _quantity; i++) {
_tokenIdCounter.increment();
_safeMint(msg.sender, _tokenIdCounter.current());
}
}
mapping(address => uint) public publicClaimedQuantity;
function publicSaleMint(uint _quantity) external payable callerIsUser {
uint publicStartTime = saleStartTime + saleTimeFrame;
require(price != 0, "Price is 0");
require(currentTime() >= publicStartTime, "Public Sale has not started yet");
require(currentTime() < publicStartTime + saleTimeFrame,"Public Sale is finished");
require(sellingStep == Step.Sale, "Public sale is not activated");
require(_quantity > 0, "Not allow quantity 0");
require(_tokenIdCounter.current() + _quantity <= MAX_SUPPLY, "Max supply exceeded");
require(publicClaimedQuantity[msg.sender] + _quantity <= ALLOW_QUANTITY, "You can only purchase 2 NFTs on Minting.");
require(msg.value >= price * _quantity, "Not enought funds");
uint256 lessAmount = msg.value - (price * _quantity);
if (lessAmount > 0) payable(msg.sender).transfer(lessAmount);
payable(verifyAccount).transfer(price * _quantity);
publicClaimedQuantity[msg.sender] += _quantity;
for (uint256 i = 0; i < _quantity; i++) {
_tokenIdCounter.increment();
_safeMint(msg.sender, _tokenIdCounter.current());
}
}
function promotionMint(address _to, uint _quantity) external payable onlyOwner {
require(_tokenIdCounter.current() + _quantity <= MAX_SUPPLY, "Max supply exceeded");
for (uint256 i = 0; i < _quantity; i++) {
_tokenIdCounter.increment();
_safeMint(_to, _tokenIdCounter.current());
}
}
function totalSupply() external view returns (uint256) {
return _tokenIdCounter.current();
}
function setContractUri(string memory __newContractURI) external onlyOwner {
_contractURI = __newContractURI;
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
function setSaleTimeFrame(uint __newSaleTimeFrame) external onlyOwner {
saleTimeFrame = __newSaleTimeFrame;
}
function setAllowQuantity(uint __newAllowQuantity) external onlyOwner {
ALLOW_QUANTITY = __newAllowQuantity;
}
function setMaxSupply(uint __newMaxSupply) external onlyOwner {
MAX_SUPPLY = __newMaxSupply;
}
function setSaleStartTime(uint _saleStartTime) external onlyOwner {
saleStartTime = _saleStartTime;
}
function setBaseUri(string memory _baseURI) external onlyOwner {
require(sellingStep == Step.After, "Whitelist sale is not activated");
baseURI = _baseURI;
}
function setBlindUri(string memory _blindURI) external onlyOwner {
blindURI = _blindURI;
}
function setStep(uint _step) external onlyOwner {
sellingStep = Step(_step);
}
//Whitelist
function setMerkleRoot(bytes32 __merkleRoot) external onlyOwner {
_merkleRoot = __merkleRoot;
}
//OGlist
function setMerkleRootOG(bytes32 __merkleRootOG) external onlyOwner {
_merkleRootOG = __merkleRootOG;
}
function tokenURI(uint256 __tokenId) public view virtual override returns (string memory) {
require(_exists(__tokenId), "Nonexistent token");
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, Strings.toString(__tokenId), ".json")) : blindURI;
}
function currentTime() internal view returns (uint) {
return block.timestamp;
}
function isWhiteListed(address _account, bytes32[] calldata _proof) internal view returns (bool) {
return _verify(leaf(_account), _proof);
}
function isOGListed(address _account, bytes32[] calldata _proof) internal view returns (bool) {
return _verifyOG(leaf(_account), _proof);
}
function leaf(address _account) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_account));
}
function _verify(bytes32 _leaf, bytes32[] memory _proof) public view returns (bool) {
return MerkleProof.verify(_proof, _merkleRoot, _leaf);
}
function _verifyOG(bytes32 _leaf, bytes32[] memory _proof) public view returns (bool) {
return MerkleProof.verify(_proof, _merkleRootOG, _leaf);
}
//******************************************************//
// Burn //
//******************************************************//
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual override returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
function burn(uint256 _tokenId) public virtual {
require(_isApprovedOrOwner(msg.sender, _tokenId), "Not owner nor approved");
_burn(_tokenId);
}
}
MultisigOwnable.sol 33 lines
//SPDX-License-Identifier: CC0
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/*
Opensea only allows EOAs to make changes to collections,
which makes it impossible to use multisigs to secure these NFT contracts
since when you want to make changes you need to transfer ownership to an EOA, who can rug.
This contract establishes a second owner that can change the EOA owner,
this way a multisig can give ownership to an EOA and later claim it back.
*/
abstract contract MultisigOwnable is Ownable {
address public realOwner;
constructor() {
realOwner = msg.sender;
}
modifier onlyDeployerOwner() {
require(realOwner == msg.sender, "MultisigOwnable: caller is not the real owner");
_;
}
function transferDeployerOwnership(address newRealOwner) public onlyDeployerOwner {
realOwner = newRealOwner;
}
function transferFounderOwnership(address newOwner) public onlyDeployerOwner {
_transferOwnership(newOwner);
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Read Contract
ALLOW_QUANTITY 0xfba36f3a → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
_contractURI 0xc0e72740 → string
_merkleRoot 0x2fc37ab2 → bytes32
_merkleRootOG 0x70a12fb1 → bytes32
_verify 0x46f265fd → bool
_verifyOG 0xc9901975 → bool
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
blindURI 0xeff95537 → string
claimedQuantity 0xc9262f77 → uint256
contractURI 0xe8a3d485 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
price 0xa035b1fe → uint256
publicClaimedQuantity 0xe5adee63 → uint256
saleStartTime 0x1cbaee2d → uint256
saleTimeFrame 0x6995c176 → uint256
sellingStep 0xcbccefb2 → uint8
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
verifyAccount 0xfe90f541 → address
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 _tokenId
promotionMint 0x1b96c85c
address _to
uint256 _quantity
publicSaleMint 0xb3ab66b0
uint256 _quantity
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes data
setAllowQuantity 0xa2624f58
uint256 __newAllowQuantity
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseUri 0xa0bcfc7f
string _baseURI
setBlindUri 0xa7d601fd
string _blindURI
setContractUri 0xccb4807b
string __newContractURI
setMaxSupply 0x6f8b44b0
uint256 __newMaxSupply
setMerkleRoot 0x7cb64759
bytes32 __merkleRoot
setMerkleRootOG 0xa58fdc11
bytes32 __merkleRootOG
setSaleStartTime 0x525f8a5c
uint256 _saleStartTime
setSaleTimeFrame 0x9ce6e4b2
uint256 __newSaleTimeFrame
setStep 0xf8dcbddb
uint256 _step
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistMint 0xd2cab056
uint256 _quantity
bytes32[] _proof
Recent Transactions
No transactions found for this address