Address Contract Verified
Address
0x17A2b200CeC625b431C3AE7334D2d8dDB41712Ce
Balance
0 ETH
Nonce
1
Code Size
22088 bytes
Creator
0xdef619cb...22Df at tx 0x1ca80f23...404ed2
Indexed Transactions
0
Contract Bytecode
22088 bytes
0x60806040526004361061027c5760003560e01c806367cefb071161014f578063b0ec6dff116100c1578063d5e156dc1161007a578063d5e156dc146109c7578063dbddb26a146109f2578063ddd0eebd14610a1d578063e985e9c514610a46578063f242432a14610a83578063f2fde38b14610aac5761027c565b8063b0ec6dff146108c4578063b7dc3b18146108ef578063bd85b0391461090b578063c002d23d14610948578063d327c69914610973578063d55eb4961461099c5761027c565b8063853828b611610113578063853828b6146107a0578063876b1566146107cb5780638a209125146107f65780638da5cb5b146108335780639534dd3e1461085e578063a22cb4651461089b5761027c565b806367cefb07146106c857806370e448a0146106f3578063715018a6146107355780637a4f62581461074c5780638456cb59146107895761027c565b80631b804297116101f35780633f4ba83a116101ac5780633f4ba83a146105b65780634e1273f4146105cd5780634f558e791461060a57806358d3d2e01461064757806358d9a212146106725780635c975abb1461069d5761027c565b80631b804297146104a05780631dd36e51146104cb5780632864b34b146104e75780632a55205a146105245780632eb2c2d61461056257806332cb6b0c1461058b5761027c565b80630c2e05e0116102455780630c2e05e01461038c5780630d0c6af6146103b75780630e89341c146103e2578063122e04a81461041f5780631657c43f1461044a57806318160ddd146104755761027c565b8062fdd58e1461028157806301ffc9a7146102be578063025e7c27146102fb57806302fe53051461033857806308e1310014610361575b600080fd5b34801561028d57600080fd5b506102a860048036038101906102a39190613b70565b610ad5565b6040516102b59190613bbf565b60405180910390f35b3480156102ca57600080fd5b506102e560048036038101906102e09190613c32565b610b2f565b6040516102f29190613c7a565b60405180910390f35b34801561030757600080fd5b50610322600480360381019061031d9190613c95565b610ba9565b60405161032f9190613cd1565b60405180910390f35b34801561034457600080fd5b5061035f600480360381019061035a9190613e32565b610be8565b005b34801561036d57600080fd5b50610376610bfc565b6040516103839190614063565b60405180910390f35b34801561039857600080fd5b506103a1610dbf565b6040516103ae9190613bbf565b60405180910390f35b3480156103c357600080fd5b506103cc610dc4565b6040516103d99190613cd1565b60405180910390f35b3480156103ee57600080fd5b5061040960048036038101906104049190613c95565b610ddc565b60405161041691906140cf565b60405180910390f35b34801561042b57600080fd5b50610434610e70565b6040516104419190613cd1565b60405180910390f35b34801561045657600080fd5b5061045f610e88565b60405161046c91906140cf565b60405180910390f35b34801561048157600080fd5b5061048a610f57565b6040516104979190613bbf565b60405180910390f35b3480156104ac57600080fd5b506104b5610f61565b6040516104c29190614150565b60405180910390f35b6104e560048036038101906104e09190613e32565b610f87565b005b3480156104f357600080fd5b5061050e60048036038101906105099190613e32565b611275565b60405161051b9190613cd1565b60405180910390f35b34801561053057600080fd5b5061054b6004803603810190610546919061416b565b6112be565b6040516105599291906141ab565b60405180910390f35b34801561056e57600080fd5b506105896004803603810190610584919061433d565b6112ee565b005b34801561059757600080fd5b506105a0611396565b6040516105ad9190613bbf565b60405180910390f35b3480156105c257600080fd5b506105cb61139b565b005b3480156105d957600080fd5b506105f460048036038101906105ef91906144cf565b6113ad565b60405161060191906145f6565b60405180910390f35b34801561061657600080fd5b50610631600480360381019061062c9190613c95565b6114bc565b60405161063e9190613c7a565b60405180910390f35b34801561065357600080fd5b5061065c6114d0565b6040516106699190613bbf565b60405180910390f35b34801561067e57600080fd5b506106876114d6565b6040516106949190613bbf565b60405180910390f35b3480156106a957600080fd5b506106b26114dc565b6040516106bf9190613c7a565b60405180910390f35b3480156106d457600080fd5b506106dd6114f3565b6040516106ea9190614063565b60405180910390f35b3480156106ff57600080fd5b5061071a60048036038101906107159190613c95565b611855565b60405161072c96959493929190614618565b60405180910390f35b34801561074157600080fd5b5061074a611969565b005b34801561075857600080fd5b50610773600480360381019061076e9190613e32565b61197d565b6040516107809190613c7a565b60405180910390f35b34801561079557600080fd5b5061079e611a03565b005b3480156107ac57600080fd5b506107b5611a15565b6040516107c29190613c7a565b60405180910390f35b3480156107d757600080fd5b506107e0611ae6565b6040516107ed919061472f565b60405180910390f35b34801561080257600080fd5b5061081d60048036038101906108189190613e32565b611b74565b60405161082a9190613c7a565b60405180910390f35b34801561083f57600080fd5b50610848611d1d565b6040516108559190613cd1565b60405180910390f35b34801561086a57600080fd5b5061088560048036038101906108809190614751565b611d47565b60405161089291906140cf565b60405180910390f35b3480156108a757600080fd5b506108c260048036038101906108bd91906147aa565b611de7565b005b3480156108d057600080fd5b506108d9611dfd565b6040516108e69190613bbf565b60405180910390f35b610909600480360381019061090491906147ea565b611e02565b005b34801561091757600080fd5b50610932600480360381019061092d9190613c95565b6123b8565b60405161093f9190613bbf565b60405180910390f35b34801561095457600080fd5b5061095d6123d5565b60405161096a9190613bbf565b60405180910390f35b34801561097f57600080fd5b5061099a60048036038101906109959190613c95565b6123e1565b005b3480156109a857600080fd5b506109b16123f3565b6040516109be91906148aa565b60405180910390f35b3480156109d357600080fd5b506109dc61243b565b6040516109e99190613cd1565b60405180910390f35b3480156109fe57600080fd5b50610a07612453565b604051610a1491906140cf565b60405180910390f35b348015610a2957600080fd5b50610a446004803603810190610a3f9190614751565b6124e1565b005b348015610a5257600080fd5b50610a6d6004803603810190610a6891906148c5565b61252d565b604051610a7a9190613c7a565b60405180910390f35b348015610a8f57600080fd5b50610aaa6004803603810190610aa59190614905565b6125c1565b005b348015610ab857600080fd5b50610ad36004803603810190610ace9190614751565b6125e7565b005b600080600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610ba25750610ba18261266d565b5b9050919050565b600d8181548110610bb957600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610bf061274f565b610bf9816127d6565b50565b6060610c0661274f565b600e805480602002602001604051908101604052809291908181526020016000905b82821015610db657838290600052602060002090600602016040518060c00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054610d07906149cb565b80601f0160208091040260200160405190810160405280929190818152602001828054610d33906149cb565b8015610d805780601f10610d5557610100808354040283529160200191610d80565b820191906000526020600020905b815481529060010190602001808311610d6357829003601f168201915b50505050508152602001600382015481526020016004820154815260200160058201548152505081526020019060010190610c28565b50505050905090565b600d81565b73031deb56fa8eb212ef3bcf8cb2f126993ededc1981565b606060028054610deb906149cb565b80601f0160208091040260200160405190810160405280929190818152602001828054610e17906149cb565b8015610e645780601f10610e3957610100808354040283529160200191610e64565b820191906000526020600020905b815481529060010190602001808311610e4757829003601f168201915b50505050509050919050565b73031deb56fa8eb212ef3bcf8cb2f126993ededc1981565b6060600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054610ed4906149cb565b80601f0160208091040260200160405190810160405280929190818152602001828054610f00906149cb565b8015610f4d5780601f10610f2257610100808354040283529160200191610f4d565b820191906000526020600020905b815481529060010190602001808311610f3057829003601f168201915b5050505050905090565b6000600654905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610f8f6127e9565b6000610f9c336000610ad5565b118061104657506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e336008546040518363ffffffff1660e01b81526004016110039291906141ab565b602060405180830381865afa158015611020573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110449190614a11565b115b611085576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107c90614ab0565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080546110d1906149cb565b905014611113576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110a90614b1c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600c8260405161113b9190614b78565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b790614bdb565b60405180910390fd5b80600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020908161120c9190614d9d565b5033600c8260405161121e9190614b78565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061127261282f565b50565b600c818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073031deb56fa8eb212ef3bcf8cb2f126993ededc19600a846112e39190614ecd565b915091509250929050565b60006112f8612839565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415801561133d575061133b868261252d565b155b156113815780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401611378929190614efe565b60405180910390fd5b61138e8686868686612841565b505050505050565b60c881565b6113a361274f565b6113ab612939565b565b606081518351146113f957815183516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016113f0929190614f27565b60405180910390fd5b6000835167ffffffffffffffff81111561141657611415613d07565b5b6040519080825280602002602001820160405280156114445781602001602082028036833780820191505090505b50905060005b84518110156114b157611481611469828761299c90919063ffffffff16565b61147c83876129b090919063ffffffff16565b610ad5565b82828151811061149457611493614f50565b5b602002602001018181525050806114aa90614f7f565b905061144a565b508091505092915050565b6000806114c8836123b8565b119050919050565b60085481565b60095481565b6000600460149054906101000a900460ff16905090565b60606000805b600e805490508110156115a0573373ffffffffffffffffffffffffffffffffffffffff16600e828154811061153157611530614f50565b5b906000526020600020906006020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361158d57818061158990614f7f565b9250505b808061159890614f7f565b9150506114f9565b5060008167ffffffffffffffff8111156115bd576115bc613d07565b5b6040519080825280602002602001820160405280156115f657816020015b6115e3613a3c565b8152602001906001900390816115db5790505b5090506000805b600e8054905081101561184b573373ffffffffffffffffffffffffffffffffffffffff16600e828154811061163557611634614f50565b5b906000526020600020906006020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361183857600e818154811061169657611695614f50565b5b90600052602060002090600602016040518060c00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160028201805461176b906149cb565b80601f0160208091040260200160405190810160405280929190818152602001828054611797906149cb565b80156117e45780601f106117b9576101008083540402835291602001916117e4565b820191906000526020600020905b8154815290600101906020018083116117c757829003601f168201915b50505050508152602001600382015481526020016004820154815260200160058201548152505083838151811061181e5761181d614f50565b5b6020026020010181905250818061183490614f7f565b9250505b808061184390614f7f565b9150506115fd565b5081935050505090565b600e818154811061186557600080fd5b90600052602060002090600602016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020180546118d4906149cb565b80601f0160208091040260200160405190810160405280929190818152602001828054611900906149cb565b801561194d5780601f106119225761010080835404028352916020019161194d565b820191906000526020600020905b81548152906001019060200180831161193057829003601f168201915b5050505050908060030154908060040154908060050154905086565b61197161274f565b61197b60006129c4565b565b60008073ffffffffffffffffffffffffffffffffffffffff16600c836040516119a69190614b78565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036119f957600090506119fe565b600190505b919050565b611a0b61274f565b611a13612a8a565b565b6000611a1f61274f565b600073031deb56fa8eb212ef3bcf8cb2f126993ededc1973ffffffffffffffffffffffffffffffffffffffff1647604051611a5990614ff8565b60006040518083038185875af1925050503d8060008114611a96576040519150601f19603f3d011682016040523d82523d6000602084013e611a9b565b606091505b5050905080611adf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad690615059565b60405180910390fd5b8091505090565b6060600d805480602002602001604051908101604052809291908181526020018280548015611b6a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611b20575b5050505050905090565b600080611b82336000610ad5565b148015611c2d57506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e336008546040518363ffffffff1660e01b8152600401611bea9291906141ab565b602060405180830381865afa158015611c07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2b9190614a11565b145b15611c3b5760009050611d18565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054611c87906149cb565b90501115611c985760009050611d18565b600073ffffffffffffffffffffffffffffffffffffffff16600c83604051611cc09190614b78565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d135760009050611d18565b600190505b919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600b6020528060005260406000206000915090508054611d66906149cb565b80601f0160208091040260200160405190810160405280929190818152602001828054611d92906149cb565b8015611ddf5780601f10611db457610100808354040283529160200191611ddf565b820191906000526020600020905b815481529060010190602001808311611dc257829003601f168201915b505050505081565b611df9611df2612839565b8383612aed565b5050565b600a81565b611e0a612c5d565b611e126127e9565b600a821115611e56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4d906150c5565b60405180910390fd5b816706f05b59d3b20000611e6a91906150e5565b3414611eab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ea290615199565b60405180910390fd5b60c882600954611ebb91906151b9565b1115611efc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ef390615239565b60405180910390fd5b81611f0f611f08611d1d565b6000610ad5565b1015611f50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f47906152a5565b60405180910390fd5b6000808251111561227657600073ffffffffffffffffffffffffffffffffffffffff16600c83604051611f839190614b78565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603612008576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fff90615311565b60405180910390fd5b600d6064846706f05b59d3b2000061202091906150e5565b61202a9190614ecd565b61203491906150e5565b90506000600c836040516120489190614b78565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060006040518060c001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001858152602001868152602001848152602001428152509050600e81908060018154018082558091505060019003906000526020600020906006020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020190816121a59190614d9d565b50606082015181600301556080820151816004015560a08201518160050155505060008273ffffffffffffffffffffffffffffffffffffffff16846040516121ec90614ff8565b60006040518083038185875af1925050503d8060008114612229576040519150601f19603f3d011682016040523d82523d6000602084013e61222e565b606091505b5050905080612272576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122699061537d565b60405180910390fd5b5050505b826009600082825461228891906151b9565b9250508190555061229833612c9e565b6122bc6122a3611d1d565b3360008660405180602001604052806000815250612d17565b6122cc6122c7611d1d565b612e22565b600073031deb56fa8eb212ef3bcf8cb2f126993ededc1973ffffffffffffffffffffffffffffffffffffffff1682856706f05b59d3b2000061230e91906150e5565b612318919061539d565b60405161232490614ff8565b60006040518083038185875af1925050503d8060008114612361576040519150601f19603f3d011682016040523d82523d6000602084013e612366565b606091505b50509050806123aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a19061541d565b60405180910390fd5b50506123b461282f565b5050565b600060056000838152602001908152602001600020549050919050565b6706f05b59d3b2000081565b6123e961274f565b8060088190555050565b6123fb613a9e565b6000604051806080016040528060c8815260200160095481526020016706f05b59d3b20000815260200161242d6114dc565b151581525090508091505090565b734faa0fac32f844acaf59b5b5a72c0d38de8bd0cd81565b600a8054612460906149cb565b80601f016020809104026020016040519081016040528092919081815260200182805461248c906149cb565b80156124d95780601f106124ae576101008083540402835291602001916124d9565b820191906000526020600020905b8154815290600101906020018083116124bc57829003601f168201915b505050505081565b6124e961274f565b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6125ca84612c9e565b6125d78585858585612f0f565b6125e085612e22565b5050505050565b6125ef61274f565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036126615760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016126589190613cd1565b60405180910390fd5b61266a816129c4565b50565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061273857507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612748575061274782612fb7565b5b9050919050565b612757612839565b73ffffffffffffffffffffffffffffffffffffffff16612775611d1d565b73ffffffffffffffffffffffffffffffffffffffff16146127d457612798612839565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016127cb9190613cd1565b60405180910390fd5b565b80600290816127e59190614d9d565b5050565b600260035403612825576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600381905550565b6001600381905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036128b35760006040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016128aa9190613cd1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036129255760006040517f01a8351400000000000000000000000000000000000000000000000000000000815260040161291c9190613cd1565b60405180910390fd5b6129328585858585613021565b5050505050565b6129416130d3565b6000600460146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612985612839565b6040516129929190613cd1565b60405180910390a1565b600060208202602084010151905092915050565b600060208202602084010151905092915050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612a92612c5d565b6001600460146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612ad6612839565b604051612ae39190613cd1565b60405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612b5f5760006040517fced3e100000000000000000000000000000000000000000000000000000000008152600401612b569190613cd1565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612c509190613c7a565b60405180910390a3505050565b612c656114dc565b15612c9c576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6000612cab826000610ad5565b03612d1457600d819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612d895760006040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612d809190613cd1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603612dfb5760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401612df29190613cd1565b60405180910390fd5b600080612e088585613113565b91509150612e198787848487613021565b50505050505050565b6000612e2f826000610ad5565b03612f0c5760005b600d80549050811015612f0a578173ffffffffffffffffffffffffffffffffffffffff16600d8281548110612e6f57612e6e614f50565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603612ef757600d8181548110612ec957612ec8614f50565b5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b8080612f0290614f7f565b915050612e37565b505b50565b6000612f19612839565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015612f5e5750612f5c868261252d565b155b15612fa25780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401612f99929190614efe565b60405180910390fd5b612faf8686868686612d17565b505050505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b61302d85858585613143565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146130cc57600061306b612839565b905060018451036130bb57600061308c6000866129b090919063ffffffff16565b905060006130a46000866129b090919063ffffffff16565b90506130b4838989858589613155565b50506130ca565b6130c9818787878787613309565b5b505b5050505050565b6130db6114dc565b613111576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b61314f848484846134bd565b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b1115613301578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b81526004016131b6959493929190615492565b6020604051808303816000875af19250505080156131f257506040513d601f19601f820116820180604052508101906131ef9190615501565b60015b613276573d8060008114613222576040519150601f19603f3d011682016040523d82523d6000602084013e613227565b606091505b50600081510361326e57846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016132659190613cd1565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146132ff57846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016132f69190613cd1565b60405180910390fd5b505b505050505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b11156134b5578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161336a95949392919061552e565b6020604051808303816000875af19250505080156133a657506040513d601f19601f820116820180604052508101906133a39190615501565b60015b61342a573d80600081146133d6576040519150601f19603f3d011682016040523d82523d6000602084013e6133db565b606091505b50600081510361342257846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016134199190613cd1565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146134b357846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016134aa9190613cd1565b60405180910390fd5b505b505050505050565b6134c984848484613674565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036135a9576000805b835181101561358d57600083828151811061351f5761351e614f50565b5b60200260200101519050806005600087858151811061354157613540614f50565b5b60200260200101518152602001908152602001600020600082825461356691906151b9565b92505081905550808361357991906151b9565b9250508061358690614f7f565b9050613501565b5080600660008282546135a091906151b9565b92505081905550505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361366e576000805b835181101561365b5760008382815181106135ff576135fe614f50565b5b60200260200101519050806005600087858151811061362157613620614f50565b5b60200260200101518152602001908152602001600020600082825403925050819055508083019250508061365490614f7f565b90506135e1565b5080600660008282540392505081905550505b50505050565b61367c612c5d565b6136888484848461368e565b50505050565b80518251146136d857815181516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016136cf929190614f27565b60405180910390fd5b60006136e2612839565b905060005b83518110156138f757600061370582866129b090919063ffffffff16565b9050600061371c83866129b090919063ffffffff16565b9050600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461384957600080600084815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156137f157888183856040517f03dee4c50000000000000000000000000000000000000000000000000000000081526004016137e89493929190615596565b60405180910390fd5b81810360008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16146138e4578060008084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546138dc91906151b9565b925050819055505b5050806138f090614f7f565b90506136e7565b5060018351036139b65760006139176000856129b090919063ffffffff16565b9050600061392f6000856129b090919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6285856040516139a7929190614f27565b60405180910390a45050613a35565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051613a2c9291906155db565b60405180910390a45b5050505050565b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001606081526020016000815260200160008152602001600081525090565b60405180608001604052806000815260200160008152602001600081526020016000151581525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613b0782613adc565b9050919050565b613b1781613afc565b8114613b2257600080fd5b50565b600081359050613b3481613b0e565b92915050565b6000819050919050565b613b4d81613b3a565b8114613b5857600080fd5b50565b600081359050613b6a81613b44565b92915050565b60008060408385031215613b8757613b86613ad2565b5b6000613b9585828601613b25565b9250506020613ba685828601613b5b565b9150509250929050565b613bb981613b3a565b82525050565b6000602082019050613bd46000830184613bb0565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613c0f81613bda565b8114613c1a57600080fd5b50565b600081359050613c2c81613c06565b92915050565b600060208284031215613c4857613c47613ad2565b5b6000613c5684828501613c1d565b91505092915050565b60008115159050919050565b613c7481613c5f565b82525050565b6000602082019050613c8f6000830184613c6b565b92915050565b600060208284031215613cab57613caa613ad2565b5b6000613cb984828501613b5b565b91505092915050565b613ccb81613afc565b82525050565b6000602082019050613ce66000830184613cc2565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613d3f82613cf6565b810181811067ffffffffffffffff82111715613d5e57613d5d613d07565b5b80604052505050565b6000613d71613ac8565b9050613d7d8282613d36565b919050565b600067ffffffffffffffff821115613d9d57613d9c613d07565b5b613da682613cf6565b9050602081019050919050565b82818337600083830152505050565b6000613dd5613dd084613d82565b613d67565b905082815260208101848484011115613df157613df0613cf1565b5b613dfc848285613db3565b509392505050565b600082601f830112613e1957613e18613cec565b5b8135613e29848260208601613dc2565b91505092915050565b600060208284031215613e4857613e47613ad2565b5b600082013567ffffffffffffffff811115613e6657613e65613ad7565b5b613e7284828501613e04565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613eb081613afc565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613ef0578082015181840152602081019050613ed5565b60008484015250505050565b6000613f0782613eb6565b613f118185613ec1565b9350613f21818560208601613ed2565b613f2a81613cf6565b840191505092915050565b613f3e81613b3a565b82525050565b600060c083016000830151613f5c6000860182613ea7565b506020830151613f6f6020860182613ea7565b5060408301518482036040860152613f878282613efc565b9150506060830151613f9c6060860182613f35565b506080830151613faf6080860182613f35565b5060a0830151613fc260a0860182613f35565b508091505092915050565b6000613fd98383613f44565b905092915050565b6000602082019050919050565b6000613ff982613e7b565b6140038185613e86565b93508360208202850161401585613e97565b8060005b8581101561405157848403895281516140328582613fcd565b945061403d83613fe1565b925060208a01995050600181019050614019565b50829750879550505050505092915050565b6000602082019050818103600083015261407d8184613fee565b905092915050565b600082825260208201905092915050565b60006140a182613eb6565b6140ab8185614085565b93506140bb818560208601613ed2565b6140c481613cf6565b840191505092915050565b600060208201905081810360008301526140e98184614096565b905092915050565b6000819050919050565b600061411661411161410c84613adc565b6140f1565b613adc565b9050919050565b6000614128826140fb565b9050919050565b600061413a8261411d565b9050919050565b61414a8161412f565b82525050565b60006020820190506141656000830184614141565b92915050565b6000806040838503121561418257614181613ad2565b5b600061419085828601613b5b565b92505060206141a185828601613b5b565b9150509250929050565b60006040820190506141c06000830185613cc2565b6141cd6020830184613bb0565b9392505050565b600067ffffffffffffffff8211156141ef576141ee613d07565b5b602082029050602081019050919050565b600080fd5b6000614218614213846141d4565b613d67565b9050808382526020820190506020840283018581111561423b5761423a614200565b5b835b8181101561426457806142508882613b5b565b84526020840193505060208101905061423d565b5050509392505050565b600082601f83011261428357614282613cec565b5b8135614293848260208601614205565b91505092915050565b600067ffffffffffffffff8211156142b7576142b6613d07565b5b6142c082613cf6565b9050602081019050919050565b60006142e06142db8461429c565b613d67565b9050828152602081018484840111156142fc576142fb613cf1565b5b614307848285613db3565b509392505050565b600082601f83011261432457614323613cec565b5b81356143348482602086016142cd565b91505092915050565b600080600080600060a0868803121561435957614358613ad2565b5b600061436788828901613b25565b955050602061437888828901613b25565b945050604086013567ffffffffffffffff81111561439957614398613ad7565b5b6143a58882890161426e565b935050606086013567ffffffffffffffff8111156143c6576143c5613ad7565b5b6143d28882890161426e565b925050608086013567ffffffffffffffff8111156143f3576143f2613ad7565b5b6143ff8882890161430f565b9150509295509295909350565b600067ffffffffffffffff82111561442757614426613d07565b5b602082029050602081019050919050565b600061444b6144468461440c565b613d67565b9050808382526020820190506020840283018581111561446e5761446d614200565b5b835b8181101561449757806144838882613b25565b845260208401935050602081019050614470565b5050509392505050565b600082601f8301126144b6576144b5613cec565b5b81356144c6848260208601614438565b91505092915050565b600080604083850312156144e6576144e5613ad2565b5b600083013567ffffffffffffffff81111561450457614503613ad7565b5b614510858286016144a1565b925050602083013567ffffffffffffffff81111561453157614530613ad7565b5b61453d8582860161426e565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600061457f8383613f35565b60208301905092915050565b6000602082019050919050565b60006145a382614547565b6145ad8185614552565b93506145b883614563565b8060005b838110156145e95781516145d08882614573565b97506145db8361458b565b9250506001810190506145bc565b5085935050505092915050565b600060208201905081810360008301526146108184614598565b905092915050565b600060c08201905061462d6000830189613cc2565b61463a6020830188613cc2565b818103604083015261464c8187614096565b905061465b6060830186613bb0565b6146686080830185613bb0565b61467560a0830184613bb0565b979650505050505050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60006146b88383613ea7565b60208301905092915050565b6000602082019050919050565b60006146dc82614680565b6146e6818561468b565b93506146f18361469c565b8060005b8381101561472257815161470988826146ac565b9750614714836146c4565b9250506001810190506146f5565b5085935050505092915050565b6000602082019050818103600083015261474981846146d1565b905092915050565b60006020828403121561476757614766613ad2565b5b600061477584828501613b25565b91505092915050565b61478781613c5f565b811461479257600080fd5b50565b6000813590506147a48161477e565b92915050565b600080604083850312156147c1576147c0613ad2565b5b60006147cf85828601613b25565b92505060206147e085828601614795565b9150509250929050565b6000806040838503121561480157614800613ad2565b5b600061480f85828601613b5b565b925050602083013567ffffffffffffffff8111156148305761482f613ad7565b5b61483c85828601613e04565b9150509250929050565b61484f81613c5f565b82525050565b60808201600082015161486b6000850182613f35565b50602082015161487e6020850182613f35565b5060408201516148916040850182613f35565b5060608201516148a46060850182614846565b50505050565b60006080820190506148bf6000830184614855565b92915050565b600080604083850312156148dc576148db613ad2565b5b60006148ea85828601613b25565b92505060206148fb85828601613b25565b9150509250929050565b600080600080600060a0868803121561492157614920613ad2565b5b600061492f88828901613b25565b955050602061494088828901613b25565b945050604061495188828901613b5b565b935050606061496288828901613b5b565b925050608086013567ffffffffffffffff81111561498357614982613ad7565b5b61498f8882890161430f565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806149e357607f821691505b6020821081036149f6576149f561499c565b5b50919050565b600081519050614a0b81613b44565b92915050565b600060208284031215614a2757614a26613ad2565b5b6000614a35848285016149fc565b91505092915050565b7f596f75206e65656420746f206f776e206174206c65617374203120706861736560008201527f2031206f722070686173652032206e6674000000000000000000000000000000602082015250565b6000614a9a603183614085565b9150614aa582614a3e565b604082019050919050565b60006020820190508181036000830152614ac981614a8d565b9050919050565b7f526566657272616c20636f646520616c7265616479206d696e74656400000000600082015250565b6000614b06601c83614085565b9150614b1182614ad0565b602082019050919050565b60006020820190508181036000830152614b3581614af9565b9050919050565b600081905092915050565b6000614b5282613eb6565b614b5c8185614b3c565b9350614b6c818560208601613ed2565b80840191505092915050565b6000614b848284614b47565b915081905092915050565b7f526566657272616c20636f646520616c726561647920696e2075736500000000600082015250565b6000614bc5601c83614085565b9150614bd082614b8f565b602082019050919050565b60006020820190508181036000830152614bf481614bb8565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302614c5d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614c20565b614c678683614c20565b95508019841693508086168417925050509392505050565b6000614c9a614c95614c9084613b3a565b6140f1565b613b3a565b9050919050565b6000819050919050565b614cb483614c7f565b614cc8614cc082614ca1565b848454614c2d565b825550505050565b600090565b614cdd614cd0565b614ce8818484614cab565b505050565b5b81811015614d0c57614d01600082614cd5565b600181019050614cee565b5050565b601f821115614d5157614d2281614bfb565b614d2b84614c10565b81016020851015614d3a578190505b614d4e614d4685614c10565b830182614ced565b50505b505050565b600082821c905092915050565b6000614d7460001984600802614d56565b1980831691505092915050565b6000614d8d8383614d63565b9150826002028217905092915050565b614da682613eb6565b67ffffffffffffffff811115614dbf57614dbe613d07565b5b614dc982546149cb565b614dd4828285614d10565b600060209050601f831160018114614e075760008415614df5578287015190505b614dff8582614d81565b865550614e67565b601f198416614e1586614bfb565b60005b82811015614e3d57848901518255600182019150602085019450602081019050614e18565b86831015614e5a5784890151614e56601f891682614d63565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000614ed882613b3a565b9150614ee383613b3a565b925082614ef357614ef2614e6f565b5b828204905092915050565b6000604082019050614f136000830185613cc2565b614f206020830184613cc2565b9392505050565b6000604082019050614f3c6000830185613bb0565b614f496020830184613bb0565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000614f8a82613b3a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614fbc57614fbb614e9e565b5b600182019050919050565b600081905092915050565b50565b6000614fe2600083614fc7565b9150614fed82614fd2565b600082019050919050565b600061500382614fd5565b9150819050919050565b7f57495448445241575f4641494c45440000000000000000000000000000000000600082015250565b6000615043600f83614085565b915061504e8261500d565b602082019050919050565b6000602082019050818103600083015261507281615036565b9050919050565b7f4d6178696d756d203130206d696e747320706572207472616e73616374696f6e600082015250565b60006150af602083614085565b91506150ba82615079565b602082019050919050565b600060208201905081810360008301526150de816150a2565b9050919050565b60006150f082613b3a565b91506150fb83613b3a565b925082820261510981613b3a565b915082820484148315176151205761511f614e9e565b5b5092915050565b7f496e636f727265637420616d6f756e74206f662065746865722070726f76696460008201527f656420666f7220746865206d696e742100000000000000000000000000000000602082015250565b6000615183603083614085565b915061518e82615127565b604082019050919050565b600060208201905081810360008301526151b281615176565b9050919050565b60006151c482613b3a565b91506151cf83613b3a565b92508282019050808211156151e7576151e6614e9e565b5b92915050565b7f4d6178696d756d206e756d626572206f6620746f6b656e73206d696e74656400600082015250565b6000615223601f83614085565b915061522e826151ed565b602082019050919050565b6000602082019050818103600083015261525281615216565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b600061528f601483614085565b915061529a82615259565b602082019050919050565b600060208201905081810360008301526152be81615282565b9050919050565b7f496e76616c696420726566657272616c20636f64650000000000000000000000600082015250565b60006152fb601583614085565b9150615306826152c5565b602082019050919050565b6000602082019050818103600083015261532a816152ee565b9050919050565b7f4661696c656420746f2073656e6420726566657272616c206574680000000000600082015250565b6000615367601b83614085565b915061537282615331565b602082019050919050565b600060208201905081810360008301526153968161535a565b9050919050565b60006153a882613b3a565b91506153b383613b3a565b92508282039050818111156153cb576153ca614e9e565b5b92915050565b7f4661696c656420746f2073656e64207769746864726177616c20657468000000600082015250565b6000615407601d83614085565b9150615412826153d1565b602082019050919050565b60006020820190508181036000830152615436816153fa565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006154648261543d565b61546e8185615448565b935061547e818560208601613ed2565b61548781613cf6565b840191505092915050565b600060a0820190506154a76000830188613cc2565b6154b46020830187613cc2565b6154c16040830186613bb0565b6154ce6060830185613bb0565b81810360808301526154e08184615459565b90509695505050505050565b6000815190506154fb81613c06565b92915050565b60006020828403121561551757615516613ad2565b5b6000615525848285016154ec565b91505092915050565b600060a0820190506155436000830188613cc2565b6155506020830187613cc2565b81810360408301526155628186614598565b905081810360608301526155768185614598565b9050818103608083015261558a8184615459565b90509695505050505050565b60006080820190506155ab6000830187613cc2565b6155b86020830186613bb0565b6155c56040830185613bb0565b6155d26060830184613bb0565b95945050505050565b600060408201905081810360008301526155f58185614598565b905081810360208301526156098184614598565b9050939250505056fea2646970667358221220d6365948e2fc8bb08cd3ba339c913dbf43346577853b1cd5f258af012f9d6ad664736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: paris
Optimization: No
IgnisElitePhaseII.sol 288 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
////////////////////////////
// //
// //
// //
// ┳ • ┏┓┓• //
// ┃┏┓┏┓┓┏ ┣ ┃┓╋┏┓ //
// ┻┗┫┛┗┗┛ ┗┛┗┗┗┗ //
// ┛ //
// //
// //
// //
////////////////////////////
contract IgnisElitePhaseII is ERC1155, IERC2981, ReentrancyGuard, Ownable, ERC1155Pausable, ERC1155Supply {
uint256 public constant MINT_PRICE = 0.5 ether;
uint256 public constant MAX_SUPPLY = 200;
uint256 public constant GIVEAWAY_SUPPLY = 10;
uint256 public constant REFERRAL_PERCENTAGE = 13;
address public constant WITHDRAW_ADDRESS = 0x031DeB56fA8eB212EF3bCF8Cb2F126993eDEDc19;
address public constant ROYALTY_RECEIVER = 0x031DeB56fA8eB212EF3bCF8Cb2F126993eDEDc19;
address public constant GIVEAWAY_ADDRESS = 0x4faa0fac32F844ACAF59b5B5a72C0D38de8bd0CD;
IERC1155 public PHASE1_CONTRACT;
uint256 public PHASE1_ID = 1;
uint256 public MINTED_SUPPLY = 0;
string public BASE_URI = "https://cdn.ignislabs.ai/elite-phase-ii/{id}.json";
mapping(address => string) public referralCodes;
mapping(string => address) public iReferralCodes;
address[] public owners;
struct MintSettings {
uint256 maxSupply;
uint256 mintedSupply;
uint256 mintPrice;
bool isPaused;
}
struct ReferralMint {
address minter;
address receiver;
string code;
uint256 num;
uint256 ethEarned;
uint256 timestamp;
}
ReferralMint[] public referralMints;
constructor(address _phaseOneContractAddress) ERC1155(BASE_URI) Ownable(msg.sender) {
mint(msg.sender, 0, MAX_SUPPLY - GIVEAWAY_SUPPLY, "");
mint(GIVEAWAY_ADDRESS, 0, GIVEAWAY_SUPPLY, "");
MINTED_SUPPLY = GIVEAWAY_SUPPLY;
PHASE1_CONTRACT = IERC1155(_phaseOneContractAddress);
owners.push(msg.sender);
owners.push(GIVEAWAY_ADDRESS);
pause();
}
function setPhaseOneContract(address _contractAddress) external onlyOwner
{
PHASE1_CONTRACT = IERC1155(_contractAddress);
}
function setPhaseOneId(uint256 _newId) external onlyOwner
{
PHASE1_ID = _newId;
}
function canMintReferralCode(string memory referralCode) external view returns (bool)
{
if (balanceOf(msg.sender, 0) == 0 && PHASE1_CONTRACT.balanceOf(msg.sender, PHASE1_ID) == 0) {
return false;
}
if (bytes(referralCodes[msg.sender]).length > 0) {
return false;
}
if (iReferralCodes[referralCode] != address(0)) {
return false;
}
return true;
}
function mintReferralCode(string memory referralCode) public payable nonReentrant
{
require(balanceOf(msg.sender, 0) > 0 || PHASE1_CONTRACT.balanceOf(msg.sender, PHASE1_ID) > 0, "You need to own at least 1 phase 1 or phase 2 nft");
require(bytes(referralCodes[msg.sender]).length == 0, "Referral code already minted");
require(iReferralCodes[referralCode] == address(0), "Referral code already in use");
referralCodes[msg.sender] = referralCode;
iReferralCodes[referralCode] = msg.sender;
}
function myReferralCode() external view returns (string memory)
{
return referralCodes[msg.sender];
}
function isValidReferralCode(string memory referralCode) public view returns(bool)
{
if (iReferralCodes[referralCode] == address(0)) {
return false;
}
return true;
}
function buy(uint256 num, string memory referralCode) external payable whenNotPaused nonReentrant
{
require(num <= 10, "Maximum 10 mints per transaction");
require(msg.value == (MINT_PRICE * num), "Incorrect amount of ether provided for the mint!");
require((MINTED_SUPPLY + num) <= MAX_SUPPLY, "Maximum number of tokens minted");
require(balanceOf(owner(), 0) >= num, "Insufficient balance");
uint256 referralEthEarned = 0;
if (bytes(referralCode).length > 0) {
// require valid referralCode
require(iReferralCodes[referralCode] != address(0), "Invalid referral code");
referralEthEarned = ((MINT_PRICE * num) / 100) * REFERRAL_PERCENTAGE;
address referralReceiver = iReferralCodes[referralCode];
ReferralMint memory referralMint = ReferralMint(msg.sender, referralReceiver, referralCode, num, referralEthEarned, block.timestamp);
referralMints.push(referralMint);
// send eth to referralReceiver
(bool sent,) = referralReceiver.call{value: referralEthEarned}("");
require(sent, "Failed to send referral eth");
}
MINTED_SUPPLY += num;
_safeTransferBefore(msg.sender);
_safeTransferFrom(owner(), msg.sender, 0, num, "");
_safeTransferAfter(owner());
// send eth to withdraw address
(bool sentRemaining,) = WITHDRAW_ADDRESS.call{value: (MINT_PRICE * num) - referralEthEarned}("");
require(sentRemaining, "Failed to send withdrawal eth");
}
function _safeTransferBefore(address to) internal
{
if (balanceOf(to, 0) == 0) {
owners.push(to);
}
}
function _safeTransferAfter(address from) internal
{
if (balanceOf(from, 0) == 0) {
for (uint256 i = 0; i < owners.length; i++) {
if (owners[i] == from) {
delete owners[i];
}
}
}
}
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual override
{
_safeTransferBefore(to);
super.safeTransferFrom(from, to, id, value, data);
_safeTransferAfter(from);
}
function getTokenHolders() external view returns (address[] memory) {
return owners;
}
function getAllReferralMints() external view onlyOwner returns (ReferralMint[] memory)
{
return referralMints;
}
function getMyReferralMints() external view returns (ReferralMint[] memory)
{
uint256 count = 0;
for (uint256 i = 0; i < referralMints.length; i++) {
if (referralMints[i].receiver == msg.sender) {
count++;
}
}
ReferralMint[] memory myReferralMints = new ReferralMint[](count);
uint256 c = 0;
for (uint256 i = 0; i < referralMints.length; i++) {
if (referralMints[i].receiver == msg.sender) {
myReferralMints[c] = referralMints[i];
c++;
}
}
return myReferralMints;
}
function getMintSettings() external view returns (MintSettings memory) {
MintSettings memory mintSettings = MintSettings(
MAX_SUPPLY, MINTED_SUPPLY, MINT_PRICE, paused()
);
return mintSettings;
}
function withdrawAll() external onlyOwner returns (bool)
{
(bool sent,) = WITHDRAW_ADDRESS.call{value: address(this).balance}("");
require(sent, "WITHDRAW_FAILED");
return sent;
}
function setURI(string memory newUri) public onlyOwner
{
_setURI(newUri);
}
function pause() public onlyOwner
{
_pause();
}
function unpause() public onlyOwner
{
_unpause();
}
function mint(address account, uint256 id, uint256 amount, bytes memory data) internal onlyOwner
{
_mint(account, id, amount, data);
}
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal override(ERC1155, ERC1155Pausable, ERC1155Supply)
{
super._update(from, to, ids, values);
}
/**
* @dev Interface implementation for the NFT Royalty Standard (ERC-2981).
* Called by marketplaces that supports the standard with the sale price to determine how much royalty
* is owed and to whom.
* The first parameter tokenId (the NFT asset queried for royalty information) is not used as royalties
* are calculated equally for all tokens.
* @param salePrice - the sale price of the NFT asset specified by `tokenId`
* @return receiver - address of who should be sent the royalty payment
* @return royaltyAmount - the royalty payment amount for `salePrice`
*/
function royaltyInfo(uint256, uint256 salePrice) external pure override returns (address, uint256)
{
return (ROYALTY_RECEIVER, salePrice / 10);
}
function supportsInterface(
bytes4 interfaceId
) public view override(ERC1155, IERC165) returns (bool)
{
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
}
Arrays.sol 127 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using StorageSlot for bytes32;
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* `array` is expected to be sorted in ascending order, and to contain no
* repeated elements.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
// We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
// following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.
/// @solidity memory-safe-assembly
assembly {
mstore(0, arr.slot)
slot := add(keccak256(0, 0x20), pos)
}
return slot.getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// 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;
}
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* 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);
}
}
Pausable.sol 119 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @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());
}
}
Math.sol 415 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Muldiv operation overflow.
*/
error MathOverflowedMulDiv();
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
return a / b;
}
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
* Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0 = x * y; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
if (denominator <= prod1) {
revert MathOverflowedMulDiv();
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator.
// Always >= 1. See https://cs.stackexchange.com/q/138556/92363.
uint256 twos = denominator & (0 - denominator);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
// works in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
StorageSlot.sol 135 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}
IERC2981.sol 23 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}
ERC1155.sol 468 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.20;
import {IERC1155} from "./IERC1155.sol";
import {IERC1155Receiver} from "./IERC1155Receiver.sol";
import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol";
import {Context} from "../../utils/Context.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {Arrays} from "../../utils/Arrays.sol";
import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*/
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
using Arrays for uint256[];
using Arrays for address[];
mapping(uint256 id => mapping(address account => uint256)) private _balances;
mapping(address account => mapping(address operator => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256 /* id */) public view virtual returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*/
function balanceOf(address account, uint256 id) public view virtual returns (uint256) {
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] memory accounts,
uint256[] memory ids
) public view virtual returns (uint256[] memory) {
if (accounts.length != ids.length) {
revert ERC1155InvalidArrayLength(ids.length, accounts.length);
}
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeTransferFrom(from, to, id, value, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) public virtual {
address sender = _msgSender();
if (from != sender && !isApprovedForAll(from, sender)) {
revert ERC1155MissingApprovalForAll(sender, from);
}
_safeBatchTransferFrom(from, to, ids, values, data);
}
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
* (or `to`) is the zero address.
*
* Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
* or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
* - `ids` and `values` must have the same length.
*
* NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
*/
function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
if (ids.length != values.length) {
revert ERC1155InvalidArrayLength(ids.length, values.length);
}
address operator = _msgSender();
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids.unsafeMemoryAccess(i);
uint256 value = values.unsafeMemoryAccess(i);
if (from != address(0)) {
uint256 fromBalance = _balances[id][from];
if (fromBalance < value) {
revert ERC1155InsufficientBalance(from, fromBalance, value, id);
}
unchecked {
// Overflow not possible: value <= fromBalance
_balances[id][from] = fromBalance - value;
}
}
if (to != address(0)) {
_balances[id][to] += value;
}
}
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
emit TransferSingle(operator, from, to, id, value);
} else {
emit TransferBatch(operator, from, to, ids, values);
}
}
/**
* @dev Version of {_update} that performs the token acceptance check by calling
* {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
* contains code (eg. is a smart contract at the moment of execution).
*
* IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
* update to the contract state after this function would break the check-effect-interaction pattern. Consider
* overriding {_update} instead.
*/
function _updateWithAcceptanceCheck(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal virtual {
_update(from, to, ids, values);
if (to != address(0)) {
address operator = _msgSender();
if (ids.length == 1) {
uint256 id = ids.unsafeMemoryAccess(0);
uint256 value = values.unsafeMemoryAccess(0);
_doSafeTransferAcceptanceCheck(operator, from, to, id, value, data);
} else {
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data);
}
}
}
/**
* @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
* - `ids` and `values` must have the same length.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, to, ids, values, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the values in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
if (to == address(0)) {
revert ERC1155InvalidReceiver(address(0));
}
_updateWithAcceptanceCheck(address(0), to, ids, values, data);
}
/**
* @dev Destroys a `value` amount of tokens of type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
*/
function _burn(address from, uint256 id, uint256 value) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
(uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `value` amount of tokens of type `id`.
* - `ids` and `values` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
if (from == address(0)) {
revert ERC1155InvalidSender(address(0));
}
_updateWithAcceptanceCheck(from, address(0), ids, values, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the zero address.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
if (operator == address(0)) {
revert ERC1155InvalidOperator(address(0));
}
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address
* if it contains code at the moment of execution.
*/
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 value,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
// Tokens rejected
revert ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-ERC1155Receiver implementer
revert ERC1155InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address
* if it contains code at the moment of execution.
*/
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory values,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
// Tokens rejected
revert ERC1155InvalidReceiver(to);
}
} catch (bytes memory reason) {
if (reason.length == 0) {
// non-ERC1155Receiver implementer
revert ERC1155InvalidReceiver(to);
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
/**
* @dev Creates an array in memory with only one value for each of the elements provided.
*/
function _asSingletonArrays(
uint256 element1,
uint256 element2
) private pure returns (uint256[] memory array1, uint256[] memory array2) {
/// @solidity memory-safe-assembly
assembly {
// Load the free memory pointer
array1 := mload(0x40)
// Set array length to 1
mstore(array1, 1)
// Store the single element at the next word after the length (where content starts)
mstore(add(array1, 0x20), element1)
// Repeat for next array locating it right after the first array
array2 := add(array1, 0x40)
mstore(array2, 1)
mstore(add(array2, 0x20), element2)
// Update the free memory pointer by pointing after the second array
mstore(0x40, add(array2, 0x40))
}
}
}
ReentrancyGuard.sol 84 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
IERC1155.sol 127 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the value of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155Received} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `value` amount.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* WARNING: This function can potentially allow a reentrancy attack when transferring tokens
* to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
* Ensure to follow the checks-effects-interactions pattern and consider employing
* reentrancy guards when interacting with untrusted contracts.
*
* Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
*
* Requirements:
*
* - `ids` and `values` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external;
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
ERC165.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./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);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// 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);
}
IERC1155Receiver.sol 59 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC1155Supply.sol 87 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.20;
import {ERC1155} from "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*
* NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens
* that can be minted.
*
* CAUTION: This extension should not be added in an upgrade to an already deployed contract.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 id => uint256) private _totalSupply;
uint256 private _totalSupplyAll;
/**
* @dev Total value of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Total value of tokens.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupplyAll;
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_update}.
*/
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory values
) internal virtual override {
super._update(from, to, ids, values);
if (from == address(0)) {
uint256 totalMintValue = 0;
for (uint256 i = 0; i < ids.length; ++i) {
uint256 value = values[i];
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply[ids[i]] += value;
totalMintValue += value;
}
// Overflow check required: The rest of the code assumes that totalSupplyAll never overflows
_totalSupplyAll += totalMintValue;
}
if (to == address(0)) {
uint256 totalBurnValue = 0;
for (uint256 i = 0; i < ids.length; ++i) {
uint256 value = values[i];
unchecked {
// Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i])
_totalSupply[ids[i]] -= value;
// Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
totalBurnValue += value;
}
}
unchecked {
// Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
_totalSupplyAll -= totalBurnValue;
}
}
}
}
ERC1155Pausable.sol 38 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Pausable.sol)
pragma solidity ^0.8.20;
import {ERC1155} from "../ERC1155.sol";
import {Pausable} from "../../../utils/Pausable.sol";
/**
* @dev ERC1155 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*
* IMPORTANT: This contract does not include public pause and unpause functions. In
* addition to inheriting this contract, you must define both functions, invoking the
* {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate
* access control, e.g. using {AccessControl} or {Ownable}. Not doing so will
* make the contract pause mechanism of the contract unreachable, and thus unusable.
*/
abstract contract ERC1155Pausable is ERC1155, Pausable {
/**
* @dev See {ERC1155-_update}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory values
) internal virtual override whenNotPaused {
super._update(from, to, ids, values);
}
}
IERC1155MetadataURI.sol 20 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.20;
import {IERC1155} from "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
BASE_URI 0xdbddb26a → string
GIVEAWAY_ADDRESS 0xd5e156dc → address
GIVEAWAY_SUPPLY 0xb0ec6dff → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
MINTED_SUPPLY 0x58d9a212 → uint256
MINT_PRICE 0xc002d23d → uint256
PHASE1_CONTRACT 0x1b804297 → address
PHASE1_ID 0x58d3d2e0 → uint256
REFERRAL_PERCENTAGE 0x0c2e05e0 → uint256
ROYALTY_RECEIVER 0x0d0c6af6 → address
WITHDRAW_ADDRESS 0x122e04a8 → address
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
canMintReferralCode 0x8a209125 → bool
exists 0x4f558e79 → bool
getAllReferralMints 0x08e13100 → tuple[]
getMintSettings 0xd55eb496 → tuple
getMyReferralMints 0x67cefb07 → tuple[]
getTokenHolders 0x876b1566 → address[]
iReferralCodes 0x2864b34b → address
isApprovedForAll 0xe985e9c5 → bool
isValidReferralCode 0x7a4f6258 → bool
myReferralCode 0x1657c43f → string
owner 0x8da5cb5b → address
owners 0x025e7c27 → address
paused 0x5c975abb → bool
referralCodes 0x9534dd3e → string
referralMints 0x70e448a0 → address, address, string, uint256, uint256, uint256
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
totalSupply 0x18160ddd → uint256
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
buy 0xb7dc3b18
uint256 num
string referralCode
mintReferralCode 0x1dd36e51
string referralCode
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] values
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 value
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setPhaseOneContract 0xddd0eebd
address _contractAddress
setPhaseOneId 0xd327c699
uint256 _newId
setURI 0x02fe5305
string newUri
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
withdrawAll 0x853828b6
No parameters
returns: bool
Recent Transactions
No transactions found for this address