Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xDa0093B0243fda050e0EF7B184E382bcfEa75fc2
Balance 0 ETH
Nonce 1
Code Size 9738 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

9738 bytes
0x608060405234801561000f575f80fd5b5060043610610171575f3560e01c80635c975abb116100dc5780638456cb5911610095578063935b7aca1161006f578063935b7aca1461041b578063a6496df214610439578063a94d373b14610455578063f2fde38b1461048557610171565b80638456cb59146103d557806386d1a69f146103df5780638da5cb5b146103fd57610171565b80635c975abb146103235780636582f4fa146103415780636e99fddf1461037157806370d0d3991461038f578063715018a6146103ad57806378e97925146103b757610171565b80633ccfd60b1161012e5780633ccfd60b1461025f5780633f4ba83a1461027d578063459531fe1461028757806345f0a44f146102a5578063515f8e7f146102d557806354b547a5146102f357610171565b80630fb5a6b41461017557806313d033c0146101935780631bfce853146101b15780633197cbb6146101e1578063366a4120146101ff57806337bdc99b1461022f575b5f80fd5b61017d6104a1565b60405161018a9190611983565b60405180910390f35b61019b6104c5565b6040516101a89190611983565b60405180910390f35b6101cb60048036038101906101c691906119e0565b6104e9565b6040516101d89190611a1a565b60405180910390f35b6101e9610505565b6040516101f69190611983565b60405180910390f35b61021960048036038101906102149190611a33565b610557565b6040516102269190611a1a565b60405180910390f35b610249600480360381019061024491906119e0565b610748565b6040516102569190611a1a565b60405180910390f35b6102676108f5565b6040516102749190611a1a565b60405180910390f35b610285610a4f565b005b61028f610a61565b60405161029c9190611a8c565b60405180910390f35b6102bf60048036038101906102ba91906119e0565b610a85565b6040516102cc9190611a1a565b60405180910390f35b6102dd610a9a565b6040516102ea9190611a1a565b60405180910390f35b61030d60048036038101906103089190611a33565b610abe565b60405161031a9190611a1a565b60405180910390f35b61032b610cf2565b6040516103389190611abf565b60405180910390f35b61035b600480360381019061035691906119e0565b610d07565b6040516103689190611a1a565b60405180910390f35b610379610d34565b6040516103869190611a1a565b60405180910390f35b610397610d58565b6040516103a49190611b52565b60405180910390f35b6103b5610d7c565b005b6103bf610d8f565b6040516103cc9190611983565b60405180910390f35b6103dd610db3565b005b6103e7610dc5565b6040516103f49190611c22565b60405180910390f35b610405610fb4565b6040516104129190611c62565b60405180910390f35b610423610fdb565b6040516104309190611c9b565b60405180910390f35b610453600480360381019061044e9190611cde565b610fff565b005b61046f600480360381019061046a91906119e0565b61126f565b60405161047c9190611a1a565b60405180910390f35b61049f600480360381019061049a9190611d2e565b611284565b005b7f0000000000000000000000000000000000000000000000000000000000ed4e0081565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f6104fe824267ffffffffffffffff16610abe565b9050919050565b5f7f0000000000000000000000000000000000000000000000000000000000ed4e007f00000000000000000000000000000000000000000000000000000000675a98006105529190611d86565b905090565b5f4267ffffffffffffffff167f00000000000000000000000000000000000000000000000000000000675a980067ffffffffffffffff16106105ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c590611e1b565b60405180910390fd5b826105d7611308565b73ffffffffffffffffffffffffffffffffffffffff167f0000000000000000000000007aada103f7852c7e7da61e100d6277a3fd199b5873ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016106469190611a1a565b602060405180830381865afa158015610661573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106859190611e4d565b73ffffffffffffffffffffffffffffffffffffffff16146106db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d290611ee8565b60405180910390fd5b6106e361130f565b5f6106ed85610d07565b905080841115610732576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072990611f76565b60405180910390fd5b61073c8585611350565b50839250505092915050565b5f4267ffffffffffffffff167f00000000000000000000000000000000000000000000000000000000675a980067ffffffffffffffff16106107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690611e1b565b60405180910390fd5b816107c8611308565b73ffffffffffffffffffffffffffffffffffffffff167f0000000000000000000000007aada103f7852c7e7da61e100d6277a3fd199b5873ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016108379190611a1a565b602060405180830381865afa158015610852573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108769190611e4d565b73ffffffffffffffffffffffffffffffffffffffff16146108cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c390611ee8565b60405180910390fd5b6108d461130f565b5f6108de84610d07565b90506108ea8482611350565b508092505050919050565b5f6108fe611410565b610906611497565b5f7f00000000000000000000000072fdc31f4a9a1edf6b6132d3c1754f1cdcf5d9b173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016109609190611c62565b602060405180830381865afa15801561097b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099f9190611fa8565b90506109f36109ac610fb4565b827f00000000000000000000000072fdc31f4a9a1edf6b6132d3c1754f1cdcf5d9b173ffffffffffffffffffffffffffffffffffffffff166114d79092919063ffffffff16565b6109fb610fb4565b73ffffffffffffffffffffffffffffffffffffffff167f13c461eb29f5d65800bbef5a5b05a06ea13b8b2ef4b889ee170f149bc1c8f8bd82604051610a409190611a1a565b60405180910390a28091505090565b610a57611410565b610a5f611556565b565b7f000000000000000000000000000000000000000000000000000000000000001981565b6001602052805f5260405f205f915090505481565b7f000000000000000000000000000000000000000000000d2abaf7d589f5ac000081565b5f8060015f8581526020019081526020015f205490507f00000000000000000000000000000000000000000000000000000000675a980067ffffffffffffffff168311610b0e575f915050610cec565b7f0000000000000000000000000000000000000000000000000000000000ed4e007f00000000000000000000000000000000000000000000000000000000675a9800610b5a9190611d86565b67ffffffffffffffff168310610b735780915050610cec565b7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000675a9800610bbf9190611d86565b67ffffffffffffffff168311610be057610bd8816115b7565b915050610cec565b5f610bea826115b7565b90505f8183610bf99190611fd3565b90505f7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000675a9800610c489190611d86565b67ffffffffffffffff1690505f8187610c619190611fd3565b90505f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000ed4e00610cb09190612006565b67ffffffffffffffff1690505f818386610cca9190612041565b610cd491906120af565b90508086610ce291906120df565b9750505050505050505b92915050565b5f8060149054906101000a900460ff16905090565b5f60025f8381526020019081526020015f2054610d23836104e9565b610d2d9190611fd3565b9050919050565b7f000000000000000000000000000000000000000000000000000000000000037881565b7f00000000000000000000000072fdc31f4a9a1edf6b6132d3c1754f1cdcf5d9b181565b610d84611410565b610d8d5f6115fa565b565b7f00000000000000000000000000000000000000000000000000000000675a980081565b610dbb611410565b610dc36116bb565b565b60604267ffffffffffffffff167f00000000000000000000000000000000000000000000000000000000675a980067ffffffffffffffff1610610e3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3490611e1b565b60405180910390fd5b610e4561130f565b5f610e4e611308565b90505f7f0000000000000000000000007aada103f7852c7e7da61e100d6277a3fd199b5873ffffffffffffffffffffffffffffffffffffffff16638462151c836040518263ffffffff1660e01b8152600401610eaa9190611c62565b5f60405180830381865afa158015610ec4573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f82011682018060405250810190610eec9190612262565b90505f815167ffffffffffffffff811115610f0a57610f09612126565b5b604051908082528060200260200182016040528015610f385781602001602082028036833780820191505090505b5090505f5b8251811015610faa575f838281518110610f5a57610f596122a9565b5b602002602001015190505f610f6e82610d07565b9050610f7a8282611350565b5080848481518110610f8f57610f8e6122a9565b5b60200260200101818152505050508080600101915050610f3d565b5080935050505090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f0000000000000000000000007aada103f7852c7e7da61e100d6277a3fd199b5881565b611007611410565b4267ffffffffffffffff167f00000000000000000000000000000000000000000000000000000000675a980067ffffffffffffffff161161107d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107490612346565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000003788211156110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906123d4565b60405180910390fd5b5f7f000000000000000000000000000000000000000000000d2abaf7d589f5ac0000600185856111109190611fd3565b61111a91906120df565b6111249190612041565b90507f00000000000000000000000072fdc31f4a9a1edf6b6132d3c1754f1cdcf5d9b173ffffffffffffffffffffffffffffffffffffffff166323b872dd8330846040518463ffffffff1660e01b8152600401611183939291906123f2565b6020604051808303815f875af115801561119f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111c39190612451565b611202576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f9906124c6565b60405180910390fd5b5f8490505b838111611268577f000000000000000000000000000000000000000000000d2abaf7d589f5ac000060015f8381526020019081526020015f205f82825461124e91906120df565b925050819055508080611260906124e4565b915050611207565b5050505050565b6002602052805f5260405f205f915090505481565b61128c611410565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036112fc575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016112f39190611c62565b60405180910390fd5b611305816115fa565b50565b5f33905090565b611317610cf2565b1561134e576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b5f8061135a611308565b90508260025f8681526020019081526020015f205f82825461137c91906120df565b92505081905550837fe7e7e986be0b17af2b440da2909ef07857e9190cfecff7711e513d5fc081ec6b846040516113b39190611a1a565b60405180910390a261140681847f00000000000000000000000072fdc31f4a9a1edf6b6132d3c1754f1cdcf5d9b173ffffffffffffffffffffffffffffffffffffffff166114d79092919063ffffffff16565b8291505092915050565b611418611308565b73ffffffffffffffffffffffffffffffffffffffff16611436610fb4565b73ffffffffffffffffffffffffffffffffffffffff161461149557611459611308565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161148c9190611c62565b60405180910390fd5b565b61149f610cf2565b6114d5576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b611551838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb858560405160240161150a92919061252b565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061171d565b505050565b61155e611497565b5f8060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6115a0611308565b6040516115ad9190611c62565b60405180910390a1565b5f60647f000000000000000000000000000000000000000000000000000000000000001960ff16836115e99190612041565b6115f391906120af565b9050919050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6116c361130f565b60015f60146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611706611308565b6040516117139190611c62565b60405180910390a1565b5f611747828473ffffffffffffffffffffffffffffffffffffffff166117b290919063ffffffff16565b90505f81511415801561176b5750808060200190518101906117699190612451565b155b156117ad57826040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016117a49190611c62565b60405180910390fd5b505050565b60606117bf83835f6117c7565b905092915050565b60608147101561180e57306040517fcd7860590000000000000000000000000000000000000000000000000000000081526004016118059190611c62565b60405180910390fd5b5f808573ffffffffffffffffffffffffffffffffffffffff16848660405161183691906125be565b5f6040518083038185875af1925050503d805f8114611870576040519150601f19603f3d011682016040523d82523d5f602084013e611875565b606091505b5091509150611885868383611890565b925050509392505050565b6060826118a5576118a08261191d565b611915565b5f82511480156118cb57505f8473ffffffffffffffffffffffffffffffffffffffff163b145b1561190d57836040517f9996b3150000000000000000000000000000000000000000000000000000000081526004016119049190611c62565b60405180910390fd5b819050611916565b5b9392505050565b5f8151111561192f5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f67ffffffffffffffff82169050919050565b61197d81611961565b82525050565b5f6020820190506119965f830184611974565b92915050565b5f604051905090565b5f80fd5b5f80fd5b5f819050919050565b6119bf816119ad565b81146119c9575f80fd5b50565b5f813590506119da816119b6565b92915050565b5f602082840312156119f5576119f46119a5565b5b5f611a02848285016119cc565b91505092915050565b611a14816119ad565b82525050565b5f602082019050611a2d5f830184611a0b565b92915050565b5f8060408385031215611a4957611a486119a5565b5b5f611a56858286016119cc565b9250506020611a67858286016119cc565b9150509250929050565b5f60ff82169050919050565b611a8681611a71565b82525050565b5f602082019050611a9f5f830184611a7d565b92915050565b5f8115159050919050565b611ab981611aa5565b82525050565b5f602082019050611ad25f830184611ab0565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f611b1a611b15611b1084611ad8565b611af7565b611ad8565b9050919050565b5f611b2b82611b00565b9050919050565b5f611b3c82611b21565b9050919050565b611b4c81611b32565b82525050565b5f602082019050611b655f830184611b43565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611b9d816119ad565b82525050565b5f611bae8383611b94565b60208301905092915050565b5f602082019050919050565b5f611bd082611b6b565b611bda8185611b75565b9350611be583611b85565b805f5b83811015611c15578151611bfc8882611ba3565b9750611c0783611bba565b925050600181019050611be8565b5085935050505092915050565b5f6020820190508181035f830152611c3a8184611bc6565b905092915050565b5f611c4c82611ad8565b9050919050565b611c5c81611c42565b82525050565b5f602082019050611c755f830184611c53565b92915050565b5f611c8582611b21565b9050919050565b611c9581611c7b565b82525050565b5f602082019050611cae5f830184611c8c565b92915050565b611cbd81611c42565b8114611cc7575f80fd5b50565b5f81359050611cd881611cb4565b92915050565b5f805f60608486031215611cf557611cf46119a5565b5b5f611d02868287016119cc565b9350506020611d13868287016119cc565b9250506040611d2486828701611cca565b9150509250925092565b5f60208284031215611d4357611d426119a5565b5b5f611d5084828501611cca565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f611d9082611961565b9150611d9b83611961565b9250828201905067ffffffffffffffff811115611dbb57611dba611d59565b5b92915050565b5f82825260208201905092915050565b7f56657374696e6720706572696f64206861736e277420737461727465640000005f82015250565b5f611e05601d83611dc1565b9150611e1082611dd1565b602082019050919050565b5f6020820190508181035f830152611e3281611df9565b9050919050565b5f81519050611e4781611cb4565b92915050565b5f60208284031215611e6257611e616119a5565b5b5f611e6f84828501611e39565b91505092915050565b7f4f6e6c79204e4654206f776e65722063616e20636c61696d20766573746564205f8201527f746f6b656e730000000000000000000000000000000000000000000000000000602082015250565b5f611ed2602683611dc1565b9150611edd82611e78565b604082019050919050565b5f6020820190508181035f830152611eff81611ec6565b9050919050565b7f416d6f756e7420657863656564732072656c6561736561626c6520616d6f756e5f8201527f7400000000000000000000000000000000000000000000000000000000000000602082015250565b5f611f60602183611dc1565b9150611f6b82611f06565b604082019050919050565b5f6020820190508181035f830152611f8d81611f54565b9050919050565b5f81519050611fa2816119b6565b92915050565b5f60208284031215611fbd57611fbc6119a5565b5b5f611fca84828501611f94565b91505092915050565b5f611fdd826119ad565b9150611fe8836119ad565b925082820390508181111561200057611fff611d59565b5b92915050565b5f61201082611961565b915061201b83611961565b9250828203905067ffffffffffffffff81111561203b5761203a611d59565b5b92915050565b5f61204b826119ad565b9150612056836119ad565b9250828202612064816119ad565b9150828204841483151761207b5761207a611d59565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6120b9826119ad565b91506120c4836119ad565b9250826120d4576120d3612082565b5b828204905092915050565b5f6120e9826119ad565b91506120f4836119ad565b925082820190508082111561210c5761210b611d59565b5b92915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61215c82612116565b810181811067ffffffffffffffff8211171561217b5761217a612126565b5b80604052505050565b5f61218d61199c565b90506121998282612153565b919050565b5f67ffffffffffffffff8211156121b8576121b7612126565b5b602082029050602081019050919050565b5f80fd5b5f6121df6121da8461219e565b612184565b90508083825260208201905060208402830185811115612202576122016121c9565b5b835b8181101561222b57806122178882611f94565b845260208401935050602081019050612204565b5050509392505050565b5f82601f83011261224957612248612112565b5b81516122598482602086016121cd565b91505092915050565b5f60208284031215612277576122766119a5565b5b5f82015167ffffffffffffffff811115612294576122936119a9565b5b6122a084828501612235565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f43616e6e6f74206164642066756e64732061667465722076657374696e6720705f8201527f6572696f64206861732073746172746564000000000000000000000000000000602082015250565b5f612330603183611dc1565b915061233b826122d6565b604082019050919050565b5f6020820190508181035f83015261235d81612324565b9050919050565b7f746f496e6465782067726561746572207468616e206d6178204e465420636f755f8201527f6e74000000000000000000000000000000000000000000000000000000000000602082015250565b5f6123be602283611dc1565b91506123c982612364565b604082019050919050565b5f6020820190508181035f8301526123eb816123b2565b9050919050565b5f6060820190506124055f830186611c53565b6124126020830185611c53565b61241f6040830184611a0b565b949350505050565b61243081611aa5565b811461243a575f80fd5b50565b5f8151905061244b81612427565b92915050565b5f60208284031215612466576124656119a5565b5b5f6124738482850161243d565b91505092915050565b7f5472616e736665722066726f6d206661696c65640000000000000000000000005f82015250565b5f6124b0601483611dc1565b91506124bb8261247c565b602082019050919050565b5f6020820190508181035f8301526124dd816124a4565b9050919050565b5f6124ee826119ad565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036125205761251f611d59565b5b600182019050919050565b5f60408201905061253e5f830185611c53565b61254b6020830184611a0b565b9392505050565b5f81519050919050565b5f81905092915050565b5f5b83811015612583578082015181840152602081019050612568565b5f8484015250505050565b5f61259882612552565b6125a2818561255c565b93506125b2818560208601612566565b80840191505092915050565b5f6125c9828461258e565b91508190509291505056fea26469706673582212209ed9a090dfa500dd2c57374cedc1ac809e03515b65d36dfda366764e86ee450764736f6c63430008180033

Verified Source Code Partial Match

Compiler: v0.8.24+commit.e11b9ed9 EVM: shanghai Optimization: No
FoundersKeyQBXVestingManaged.sol 1196 lines
// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;


/**
 * @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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// File: @openzeppelin/contracts/utils/Pausable.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;


/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// File: @openzeppelin/contracts/utils/Address.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // 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 FailedInnerCall();
        }
    }
}

// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;




/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// File: @openzeppelin/contracts/token/ERC721/IERC721.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;


/**
 * @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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 address zero.
     *
     * 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);
}

// File: contracts/IFoundersNFT.sol

// contracts/IFoundersNFT.sol

pragma solidity ^0.8.24;


interface IFoundersNFT is IERC721 {
    function tokensOfOwner(address beneficiary) external view returns (uint256[] calldata ids);
}
// File: contracts/FoundersKeyQBXVestingManaged.sol


pragma solidity ^0.8.24;

// Uncomment this line to use console.log
// import "hardhat/console.sol";







contract FoundersKeyQBXVestingManaged is Context, Ownable, Pausable {
    using SafeERC20 for IERC20;

    uint64 public immutable startTime;
    uint8 public immutable tgeVestingPercentage;
    // in seconds
    uint64 public immutable duration;
    uint64 public immutable cliff;
    IERC20 public immutable qiibeeCoin;
    IFoundersNFT public immutable founderNFT;

    // `62179` tokens per NFT holder
    uint256 public immutable QBX_AMOUNT = 62179 * (10 ** 18);
    // NFT IDs on-chain from [1->888]
    uint256 public immutable NFT_COUNT = 888;

    /**
     * @dev amount of QBX per nNFT
     */
    mapping(uint256 => uint) public amounts;
    /**
     * @dev amount of QBX released per NFT
     */
    mapping(uint256 => uint) public released;

    event ERC20Released(uint256 indexed nftId, uint256 amount);
    event OwnerWithdraw(address indexed owner, uint256 amount);

    modifier ifVestingStarted() {
        require(
            startTime < uint64(block.timestamp),
            "Vesting period hasn't started"
        );
        _;
    }

    modifier ifNftOwned(uint256 nftId) {
        require(
            founderNFT.ownerOf(nftId) == _msgSender(),
            "Only NFT owner can claim vested tokens"
        );
        _;
    }

    constructor(
        uint64 startTime_,
        uint64 durationDays_,
        uint64 cliffDays_,
        uint8 tgeVestingPercentage_,
        IERC20 qbxContractAddress_,
        IFoundersNFT founderNFTAddress_
    ) Ownable(msg.sender) {
        require(
            startTime_ > uint64(block.timestamp),
            "startTime_ cannot be in the past"
        );

        require(
            tgeVestingPercentage >= 0,
            "tgeVestingPercentage must be greater than or equal to 0"
        );

        require(
            tgeVestingPercentage <= 100,
            "tgeVestingPercentage must be less than or equal to 100"
        );

        require(durationDays_ > 0, "durationDays_ should be greater than 0");

        require(
            durationDays_ > cliffDays_,
            "durationDays_ should be greater than cliffDays_"
        );

        startTime = startTime_;
        tgeVestingPercentage = tgeVestingPercentage_;
        // convert into seconds
        duration = durationDays_ * 1 days;
        cliff = cliffDays_ * 1 days;
        qiibeeCoin = qbxContractAddress_;
        founderNFT = founderNFTAddress_;
    }

    /**
     * @dev Getter for the end timestamp.
     */
    function endTime() public view returns (uint64) {
        return startTime + duration;
    }

    /**
     * @dev Pause contract.
     */
    function pause() public onlyOwner {
        _pause();
    }

    /**
     * @dev Unpause contract.
     */
    function unpause() public onlyOwner {
        _unpause();
    }

    /**
     * @dev Withdraw the QBX balance of this contract after pausing in case of emergency.
     * Can only be called by the owner
     */
    function withdraw() public onlyOwner whenPaused returns (uint256) {
        uint256 balance = qiibeeCoin.balanceOf(address(this));
        qiibeeCoin.safeTransfer(owner(), balance);
        emit OwnerWithdraw(owner(), balance);
        return balance;
    }

    /**
     * @dev Call after calling `allow` on QBX token contract.
     * Will withdraw required QBX from `spender`
     * Will add `QBX_AMOUNT`.
     * Cannot be called after vesting period has started.
     * Note that from and toIndex are inclusive - [1, 888], [1,1] - to seed a single one
     */
    function addTokens(
        uint256 fromIndex,
        uint256 toIndex,
        address spender
    ) public onlyOwner {
        require(
            startTime > uint64(block.timestamp),
            "Cannot add funds after vesting period has started"
        );

        require(toIndex <= NFT_COUNT, "toIndex greater than max NFT count");

        // +1 to have inclusive range: [1, 2] instead of [1, 2)
        uint256 totalAmount = (toIndex - fromIndex + 1) * QBX_AMOUNT;

        require(
            qiibeeCoin.transferFrom(spender, address(this), totalAmount),
            "Transfer from failed"
        );

        for (uint256 nftId = fromIndex; nftId <= toIndex; nftId++) {
            amounts[nftId] += QBX_AMOUNT;
        }
    }

    /**
     * @dev Release all the QBX that have already vested across all the NFTs the caller owns.
     *
     * Emits {ERC20Released} events.
     */
    function release()
        public
        ifVestingStarted
        whenNotPaused
        returns (uint256[] memory)
    {
        address beneficiary = _msgSender();

        uint256[] memory nftsHeld = founderNFT.tokensOfOwner(beneficiary);
        uint256[] memory releasedAmounts = new uint256[](nftsHeld.length);

        for (uint256 i = 0; i < nftsHeld.length; i++) {
            uint256 nftId = nftsHeld[i];

            uint256 amount = releaseable(nftId);
            _release(nftId, amount);
            releasedAmounts[i] = amount;
        }

        return releasedAmounts;
    }

    /**
     * @dev Release all the QBX that have already vested for a particular NFT id.
     * Can only be called by the owner of the NFT.
     *
     * Emits a {ERC20Released} event.
     */
    function release(
        uint256 nftId
    )
        public
        ifVestingStarted
        ifNftOwned(nftId)
        whenNotPaused
        returns (uint256)
    {
        uint256 amount = releaseable(nftId);

        _release(nftId, amount);

        return amount;
    }

    /**
     * @dev Release `amount` QBX from those have already vested for a particular NFT id.
     * Can only be called by the owner of the NFT.
     *
     * Emits a {ERC20Released} event.
     */
    function release(
        uint256 nftId,
        uint256 amount
    )
        public
        ifVestingStarted
        ifNftOwned(nftId)
        whenNotPaused
        returns (uint256)
    {
        uint256 amountReleaseable = releaseable(nftId);

        require(
            amount <= amountReleaseable,
            "Amount exceeds releaseable amount"
        );

        _release(nftId, amount);

        return amount;
    }

    /**
     * @dev Release `amount` for a particular `nftId`.
     * IMPORTANT: No checks performed here. Use with care
     *
     * Emits a {ERC20Released} event.
     */
    function _release(
        uint256 nftId,
        uint256 amount
    ) internal returns (uint256) {
        address beneficiary = _msgSender();

        released[nftId] += amount;
        emit ERC20Released(nftId, amount);

        qiibeeCoin.safeTransfer(beneficiary, amount);

        return amount;
    }

    /**
     * @dev Calculates the total amount of releasable QBX. Vested - released. `beneficiary` is the address to check for.
     */
    function releaseable(uint256 nftId) public view returns (uint256) {
        return vestedAmount(nftId) - released[nftId];
    }

    /**
     * @dev Calculates the total amount of vested QBX. `nftId` is the nft id to check for.
     */
    function vestedAmount(uint256 nftId) public view returns (uint256) {
        return vestedAmount(nftId, uint64(block.timestamp));
    }

    /**
     * @dev Calculates the total amount of vested QBX at a certain time.
     * `nftId` is the NFT & `timestamp` is the time at which to check for.
     */
    function vestedAmount(
        uint256 nftId,
        uint256 timestamp
    ) public view returns (uint256) {
        uint256 totalAmount = amounts[nftId];

        if (timestamp <= startTime) {
            return 0; // Pre TGE; no tokens vested yet
        } else if (timestamp >= (startTime + duration)) {
            return totalAmount; // Vesting period completed: all tokens vested
        } else if (timestamp <= (startTime + cliff)) {
            // Cliff not passed. Calculate the amount vested at TGE
            return vestedAtTGE(totalAmount);
        } else {
            // Calculate the amount vested after the cliff
            uint256 amountVestedAtTGE = vestedAtTGE(totalAmount);
            uint256 remainingAmount = totalAmount - amountVestedAtTGE; // Remaining tokens after those vested at TGE

            // Linear vesting starts from the end of the cliff
            uint256 vestingStartTime = startTime + cliff;
            uint256 elapsedTime = timestamp - vestingStartTime;
            uint256 effectiveDuration = duration - cliff;

            uint256 amountVestedSinceCliff = (remainingAmount * elapsedTime) /
                effectiveDuration;

            return amountVestedAtTGE + amountVestedSinceCliff;
        }
    }

    function vestedAtTGE(uint256 amount) internal view returns (uint256) {
        return (amount * tgeVestingPercentage) / 100;
    }
}

Read Contract

NFT_COUNT 0x6e99fddf → uint256
QBX_AMOUNT 0x515f8e7f → uint256
amounts 0x45f0a44f → uint256
cliff 0x13d033c0 → uint64
duration 0x0fb5a6b4 → uint64
endTime 0x3197cbb6 → uint64
founderNFT 0x935b7aca → address
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
qiibeeCoin 0x70d0d399 → address
releaseable 0x6582f4fa → uint256
released 0xa94d373b → uint256
startTime 0x78e97925 → uint64
tgeVestingPercentage 0x459531fe → uint8
vestedAmount 0x1bfce853 → uint256
vestedAmount 0x54b547a5 → uint256

Write Contract 9 functions

These functions modify contract state and require a wallet transaction to execute.

addTokens 0xa6496df2
uint256 fromIndex
uint256 toIndex
address spender
pause 0x8456cb59
No parameters
release 0x366a4120
uint256 nftId
uint256 amount
returns: uint256
release 0x37bdc99b
uint256 nftId
returns: uint256
release 0x86d1a69f
No parameters
returns: uint256[]
renounceOwnership 0x715018a6
No parameters
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
withdraw 0x3ccfd60b
No parameters
returns: uint256

Recent Transactions

No transactions found for this address