Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x5298c6D5ac0f2964bbB27F496a8193CE78e8A8e6
Balance 0 ETH
Nonce 1
Code Size 15697 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

15697 bytes
0x6080604052600436106102515760003560e01c80636d44aef511610139578063b91fbe53116100b6578063e82942c51161007a578063e82942c514610679578063e985e9c514610699578063e9be0f3f146106b9578063f2fde38b146106ce578063f4a0a528146106ee578063fedc6ccc1461070e57610251565b8063b91fbe53146105fa578063be652c3c1461060f578063c87b56dd1461062f578063d16cd6031461064f578063d547cfb71461066457610251565b80638da5cb5b116100fd5780638da5cb5b1461057057806395d89b4114610585578063a22cb4651461059a578063b31d61b0146105ba578063b88d4fde146105da57610251565b80636d44aef5146104e657806370a0823114610506578063715018a6146105265780637fd255f11461053b5780638d4823541461055b57610251565b806323ab18f1116101d2578063403e03ab11610196578063403e03ab1461044957806342842e0e1461045e5780634f6ccce71461047e57806350b487541461049e578063525b3fe3146104b15780636352211e146104c657610251565b806323ab18f1146103b457806323b872dd146103d457806330176e13146103f457806337a13193146104145780633ccfd60b1461043457610251565b80630aad3a71116102195780630aad3a711461031d5780630d0b6b741461033f578063107810d91461035f57806318160ddd1461037f5780631edee5221461039457610251565b806301ffc9a71461025657806306fdde031461028c578063081812fc146102ae5780630955f63c146102db578063095ea7b3146102fd575b600080fd5b34801561026257600080fd5b50610276610271366004613030565b610716565b6040516102839190613235565b60405180910390f35b34801561029857600080fd5b506102a161075e565b6040516102839190613240565b3480156102ba57600080fd5b506102ce6102c93660046130f1565b6107f0565b60405161028391906131a0565b3480156102e757600080fd5b506102fb6102f6366004612f5b565b61083c565b005b34801561030957600080fd5b506102fb610318366004612e96565b610992565b34801561032957600080fd5b50610332610a2a565b6040516102839190613b33565b34801561034b57600080fd5b5061027661035a3660046130ae565b610a30565b61037261036d3660046130f1565b610b78565b60405161028391906131f1565b34801561038b57600080fd5b50610332610d95565b3480156103a057600080fd5b506102fb6103af3660046130c8565b610d9b565b3480156103c057600080fd5b506102fb6103cf3660046130f1565b610ed8565b3480156103e057600080fd5b506102fb6103ef366004612da8565b610f9a565b34801561040057600080fd5b506102fb61040f366004613068565b610fd2565b34801561042057600080fd5b506102fb61042f3660046130f1565b6110a1565b34801561044057600080fd5b506102fb611163565b34801561045557600080fd5b50610332611304565b34801561046a57600080fd5b506102fb610479366004612da8565b61130a565b34801561048a57600080fd5b506103326104993660046130f1565b611325565b6103726104ac3660046130f1565b611350565b3480156104bd57600080fd5b506103326115dd565b3480156104d257600080fd5b506102ce6104e13660046130f1565b6115e3565b3480156104f257600080fd5b506102fb6105013660046130f1565b611618565b34801561051257600080fd5b50610332610521366004612d5c565b6116da565b34801561053257600080fd5b506102fb61171e565b34801561054757600080fd5b506102fb6105563660046130f1565b6117a7565b34801561056757600080fd5b50610332611869565b34801561057c57600080fd5b506102ce61186f565b34801561059157600080fd5b506102a161187e565b3480156105a657600080fd5b506102fb6105b5366004612e5c565b61188d565b3480156105c657600080fd5b506102fb6105d5366004612ebf565b61195b565b3480156105e657600080fd5b506102fb6105f5366004612de3565b611a8d565b34801561060657600080fd5b50610332611ac6565b34801561061b57600080fd5b506102fb61062a366004612d5c565b611acc565b34801561063b57600080fd5b506102a161064a3660046130f1565b611caf565b34801561065b57600080fd5b50610276611d32565b34801561067057600080fd5b506102a1611d3b565b34801561068557600080fd5b506102fb6106943660046130ae565b611d4a565b3480156106a557600080fd5b506102766106b4366004612d76565b611f74565b3480156106c557600080fd5b50610332611fa2565b3480156106da57600080fd5b506102fb6106e9366004612d5c565b611fa8565b3480156106fa57600080fd5b506102fb6107093660046130f1565b612068565b61033261212a565b60006001600160e01b031982166380ac58cd60e01b148061074757506001600160e01b03198216635b5e139f60e01b145b8061075657506107568261226a565b90505b919050565b60606001805461076d90613c3a565b80601f016020809104026020016040519081016040528092919081815260200182805461079990613c3a565b80156107e65780601f106107bb576101008083540402835291602001916107e6565b820191906000526020600020905b8154815290600101906020018083116107c957829003601f168201915b5050505050905090565b60006107fb82612283565b6108205760405162461bcd60e51b815260040161081790613737565b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b6108446122a0565b6001600160a01b031661085561186f565b6001600160a01b03161461087b5760405162461bcd60e51b81526004016108179061380d565b6019541561089b5760405162461bcd60e51b81526004016108179061337f565b6000805b82518110156109605760198382815181106108ca57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151825460018082018555600094855293839020825160029092020180546001600160a01b0319166001600160a01b03909216919091178155910151910155825183908290811061093557634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518261094c9190613b8a565b91508061095881613c91565b91505061089f565b506011546001600160801b0382811691161461098e5760405162461bcd60e51b8152600401610817906134b3565b5050565b600061099d826115e3565b9050806001600160a01b0316836001600160a01b031614156109d15760405162461bcd60e51b8152600401610817906139a7565b806001600160a01b03166109e36122a0565b6001600160a01b031614806109ff57506109ff816106b46122a0565b610a1b5760405162461bcd60e51b8152600401610817906135b7565b610a2583836122a4565b505050565b60165481565b600080805b601954811015610aa557336001600160a01b031660198281548110610a6a57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b03161415610a935760019150610aa5565b80610a9d81613c91565b915050610a35565b50610aae6122a0565b6001600160a01b0316610abf61186f565b6001600160a01b03161480610ad15750805b610aed5760405162461bcd60e51b815260040161081790613954565b60005b60185461ffff82161015610b6c578361ffff1660188261ffff1681548110610b2857634e487b7160e01b600052603260045260246000fd5b60009182526020909120601082040154600f9091166002026101000a900461ffff161415610b5a576001925050610b72565b80610b6481613c6f565b915050610af0565b50600091505b50919050565b6060323314610b995760405162461bcd60e51b815260040161081790613580565b60075415801590610bac57504260075411155b610bc85760405162461bcd60e51b815260040161081790613644565b81600954610bd69190613bd8565b341015610bf55760405162461bcd60e51b815260040161081790613783565b600e54821115610c175760405162461bcd60e51b8152600401610817906133b6565b601854821115610c395760405162461bcd60e51b815260040161081790613614565b6013546018548391610c4a91613bf7565b1015610c685760405162461bcd60e51b81526004016108179061347c565b60105433600090815260176020526040902054610c86908490613bac565b1115610ca45760405162461bcd60e51b8152600401610817906137c7565b60008267ffffffffffffffff811115610ccd57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610cf6578160200160208202803683370190505b5033600090815260176020526040812080549293508592909190610d1b908490613bac565b9250508190555082600c6000828254610d349190613bac565b90915550600090505b83811015610d8a57610d4d612312565b828281518110610d6d57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610d8281613c91565b915050610d3d565b506107563382612469565b600c5490565b6000805b601954811015610e0f57336001600160a01b031660198281548110610dd457634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b03161415610dfd5760019150610e0f565b80610e0781613c91565b915050610d9f565b50610e186122a0565b6001600160a01b0316610e2961186f565b6001600160a01b03161480610e3b5750805b610e575760405162461bcd60e51b815260040161081790613954565b825b8261ffff168161ffff1611610ed257601880546001810182556000919091527fb13d2d76d1f4b7be834882e410b3e3a8afaf69f83600ae24db354391d2378d2e60108204018054600f9092166002026101000a61ffff818102199093169284160291909117905580610eca81613c6f565b915050610e59565b50505050565b6000805b601954811015610f4c57336001600160a01b031660198281548110610f1157634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b03161415610f3a5760019150610f4c565b80610f4481613c91565b915050610edc565b50610f556122a0565b6001600160a01b0316610f6661186f565b6001600160a01b03161480610f785750805b610f945760405162461bcd60e51b815260040161081790613954565b50600755565b610fab610fa56122a0565b82612625565b610fc75760405162461bcd60e51b815260040161081790613a56565b610a258383836126aa565b6000805b60195481101561104657336001600160a01b03166019828154811061100b57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b031614156110345760019150611046565b8061103e81613c91565b915050610fd6565b5061104f6122a0565b6001600160a01b031661106061186f565b6001600160a01b031614806110725750805b61108e5760405162461bcd60e51b815260040161081790613954565b8151610a25906012906020850190612c4b565b6000805b60195481101561111557336001600160a01b0316601982815481106110da57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b031614156111035760019150611115565b8061110d81613c91565b9150506110a5565b5061111e6122a0565b6001600160a01b031661112f61186f565b6001600160a01b031614806111415750805b61115d5760405162461bcd60e51b815260040161081790613954565b50600a55565b6000805b6019548110156111d757336001600160a01b03166019828154811061119c57634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b031614156111c557600191506111d7565b806111cf81613c91565b915050611167565b506111e06122a0565b6001600160a01b03166111f161186f565b6001600160a01b031614806112035750805b61121f5760405162461bcd60e51b815260040161081790613954565b4760005b601954811015610a25576019818154811061124e57634e487b7160e01b600052603260045260246000fd5b906000526020600020906002020160000160009054906101000a90046001600160a01b03166001600160a01b03166108fc6112c984601985815481106112a457634e487b7160e01b600052603260045260246000fd5b60009182526020909120600160029092020101546011546001600160801b03166127d7565b6040518115909202916000818181858888f193505050501580156112f1573d6000803e3d6000fd5b50806112fc81613c91565b915050611223565b60165490565b610a2583838360405180602001604052806000815250611a8d565b600061133082612283565b61134c5760405162461bcd60e51b815260040161081790613534565b5090565b60603233146113715760405162461bcd60e51b815260040161081790613580565b6008541580159061138457504260085411155b6113a05760405162461bcd60e51b8152600401610817906138da565b336000908152601a602052604090205460ff1615156001146113d45760405162461bcd60e51b815260040161081790613911565b81600a546113e29190613bd8565b3410156114015760405162461bcd60e51b815260040161081790613783565b600d548211156114235760405162461bcd60e51b815260040161081790613253565b6018548211156114455760405162461bcd60e51b815260040161081790613614565b601354601854839161145691613bf7565b10156114745760405162461bcd60e51b81526004016108179061347c565b6015546016546114849084613bac565b11156114a25760405162461bcd60e51b815260040161081790613a1f565b600f54336000908152601760205260409020546114c0908490613bac565b11156114de5760405162461bcd60e51b8152600401610817906134ea565b60008267ffffffffffffffff81111561150757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611530578160200160208202803683370190505b5033600090815260176020526040812080549293508592909190611555908490613bac565b9250508190555082600c600082825461156e9190613bac565b9250508190555082601660008282546115879190613bac565b90915550600090505b83811015610d8a576115a0612312565b8282815181106115c057634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806115d581613c91565b915050611590565b60155481565b6000818152600360205260408120546001600160a01b0316806107565760405162461bcd60e51b8152600401610817906136b9565b6000805b60195481101561168c57336001600160a01b03166019828154811061165157634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b0316141561167a576001915061168c565b8061168481613c91565b91505061161c565b506116956122a0565b6001600160a01b03166116a661186f565b6001600160a01b031614806116b85750805b6116d45760405162461bcd60e51b815260040161081790613954565b50600855565b60006001600160a01b0382166117025760405162461bcd60e51b81526004016108179061366f565b506001600160a01b031660009081526004602052604090205490565b6117266122a0565b6001600160a01b031661173761186f565b6001600160a01b03161461175d5760405162461bcd60e51b81526004016108179061380d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000805b60195481101561181b57336001600160a01b0316601982815481106117e057634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b03161415611809576001915061181b565b8061181381613c91565b9150506117ab565b506118246122a0565b6001600160a01b031661183561186f565b6001600160a01b031614806118475750805b6118635760405162461bcd60e51b815260040161081790613954565b50601555565b60095490565b6000546001600160a01b031690565b60606002805461076d90613c3a565b6118956122a0565b6001600160a01b0316826001600160a01b031614156118c65760405162461bcd60e51b815260040161081790613445565b80600660006118d36122a0565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556119176122a0565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161194f9190613235565b60405180910390a35050565b6000805b6019548110156119cf57336001600160a01b03166019828154811061199457634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b031614156119bd57600191506119cf565b806119c781613c91565b91505061195f565b506119d86122a0565b6001600160a01b03166119e961186f565b6001600160a01b031614806119fb5750805b611a175760405162461bcd60e51b815260040161081790613954565b60005b8251811015610a25576001601a6000858481518110611a4957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580611a8581613c91565b915050611a1a565b611a9e611a986122a0565b83612625565b611aba5760405162461bcd60e51b815260040161081790613a56565b610ed2848484846128ae565b60185490565b6000805b601954811015611b4057336001600160a01b031660198281548110611b0557634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b03161415611b2e5760019150611b40565b80611b3881613c91565b915050611ad0565b50611b496122a0565b6001600160a01b0316611b5a61186f565b6001600160a01b03161480611b6c5750805b611b885760405162461bcd60e51b815260040161081790613954565b6013546018541015611bac5760405162461bcd60e51b8152600401610817906139e8565b60145460ff1615611bcf5760405162461bcd60e51b815260040161081790613ae8565b601354600c6000828254611be39190613bac565b909155505060135460009067ffffffffffffffff811115611c1457634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611c3d578160200160208202803683370190505b50905060005b601354811015611c9257611c55612312565b828281518110611c7557634e487b7160e01b600052603260045260246000fd5b602090810291909101015280611c8a81613c91565b915050611c43565b50611c9d8382612469565b50506014805460ff1916600117905550565b6060611cba82612283565b611cd65760405162461bcd60e51b81526004016108179061388b565b6000611ce0611d3b565b90506000815111611d005760405180602001604052806000815250611d2b565b80611d0a846128e1565b604051602001611d1b929190613135565b6040516020818303038152906040525b9392505050565b60145460ff1681565b60606012805461076d90613c3a565b6000805b601954811015611dbe57336001600160a01b031660198281548110611d8357634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b03161415611dac5760019150611dbe565b80611db681613c91565b915050611d4e565b50611dc76122a0565b6001600160a01b0316611dd861186f565b6001600160a01b03161480611dea5750805b611e065760405162461bcd60e51b815260040161081790613954565b60005b60185461ffff821611610a25578261ffff1660188261ffff1681548110611e4057634e487b7160e01b600052603260045260246000fd5b60009182526020909120601082040154600f9091166002026101000a900461ffff1614611e6c57611f62565b60188054611e7c90600190613bf7565b81548110611e9a57634e487b7160e01b600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff1660188261ffff1681548110611ee357634e487b7160e01b600052603260045260246000fd5b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055506018805480611f3157634e487b7160e01b600052603160045260246000fd5b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a02191690559055610a25565b80611f6c81613c6f565b915050611e09565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b60135481565b611fb06122a0565b6001600160a01b0316611fc161186f565b6001600160a01b031614611fe75760405162461bcd60e51b81526004016108179061380d565b6001600160a01b03811661200d5760405162461bcd60e51b815260040161081790613302565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000805b6019548110156120dc57336001600160a01b0316601982815481106120a157634e487b7160e01b600052603260045260246000fd5b60009182526020909120600290910201546001600160a01b031614156120ca57600191506120dc565b806120d481613c91565b91505061206c565b506120e56122a0565b6001600160a01b03166120f661186f565b6001600160a01b031614806121085750805b6121245760405162461bcd60e51b815260040161081790613954565b50600955565b600032331461214b5760405162461bcd60e51b815260040161081790613580565b6007541580159061215e57504260075411155b61217a5760405162461bcd60e51b815260040161081790613644565b60095434101561219c5760405162461bcd60e51b815260040161081790613aa7565b6018546121bb5760405162461bcd60e51b815260040161081790613614565b6013546018546000916121cd91613bf7565b116121ea5760405162461bcd60e51b8152600401610817906139e8565b601054336000908152601760205260409020541061221a5760405162461bcd60e51b8152600401610817906137c7565b33600090815260176020526040812080549161223583613c91565b9091555050600c805490600061224a83613c91565b91905055506000612259612312565b905061226533826129fc565b905090565b6001600160e01b031981166301ffc9a760e01b14919050565b6000908152600360205260409020546001600160a01b0316151590565b3390565b600081815260056020526040902080546001600160a01b0319166001600160a01b03841690811790915581906122d9826115e3565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080612323601880549050612adb565b905060006018828154811061234857634e487b7160e01b600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff169050601860016018805490506123869190613bf7565b815481106123a457634e487b7160e01b600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff16601883815481106123e957634e487b7160e01b600052603260045260246000fd5b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff160217905550601880548061243757634e487b7160e01b600052603160045260246000fd5b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a0219169055905591505090565b6001600160a01b03821661248f5760405162461bcd60e51b815260040161081790613702565b80516001600160a01b038316600090815260046020526040812080549091906124b9908490613bac565b90915550600090505b8151811015610a25576124fb8282815181106124ee57634e487b7160e01b600052603260045260246000fd5b6020026020010151612283565b156125185760405162461bcd60e51b815260040161081790613348565b61254b60008484848151811061253e57634e487b7160e01b600052603260045260246000fd5b6020026020010151610a25565b826003600084848151811061257057634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508181815181106125ca57634e487b7160e01b600052603260045260246000fd5b6020026020010151836001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061261d81613c91565b9150506124c2565b600061263082612283565b61264c5760405162461bcd60e51b815260040161081790613534565b6000612657836115e3565b9050806001600160a01b0316846001600160a01b031614806126925750836001600160a01b0316612687846107f0565b6001600160a01b0316145b806126a257506126a28185611f74565b949350505050565b826001600160a01b03166126bd826115e3565b6001600160a01b0316146126e35760405162461bcd60e51b815260040161081790613842565b6001600160a01b0382166127095760405162461bcd60e51b815260040161081790613401565b612714838383610a25565b61271f6000826122a4565b6001600160a01b0383166000908152600460205260408120805460019290612748908490613bf7565b90915550506001600160a01b0382166000908152600460205260408120805460019290612776908490613bac565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000806127ed6001600160801b03841686613bc4565b905060006128046001600160801b03851687613cac565b9050600061281b6001600160801b03861687613bc4565b905060006128326001600160801b03871688613cac565b90506001600160801b0386166128488285613bd8565b6128529190613bc4565b61285c8385613bd8565b6128668387613bd8565b6001600160801b03891661287a8689613bd8565b6128849190613bd8565b61288e9190613bac565b6128989190613bac565b6128a29190613bac565b98975050505050505050565b6128b98484846126aa565b6128c584848484612b2a565b610ed25760405162461bcd60e51b8152600401610817906132b0565b60608161290657506040805180820190915260018152600360fc1b6020820152610759565b8160005b8115612930578061291a81613c91565b91506129299050600a83613bc4565b915061290a565b60008167ffffffffffffffff81111561295957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612983576020820181803683370190505b5090505b84156126a257612998600183613bf7565b91506129a5600a86613cac565b6129b0906030613bac565b60f81b8183815181106129d357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506129f5600a86613bc4565b9450612987565b6001600160a01b038216612a225760405162461bcd60e51b815260040161081790613702565b612a2b81612283565b15612a485760405162461bcd60e51b815260040161081790613348565b612a5460008383610a25565b6001600160a01b0382166000908152600460205260408120805460019290612a7d908490613bac565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6018546000908190612aee600143613bf7565b40414433604051602001612b06959493929190613164565b60408051601f1981840301815291905280516020909101209050611d2b8382613cac565b6000612b3e846001600160a01b0316612c45565b15612c3a57836001600160a01b031663150b7a02612b5a6122a0565b8786866040518563ffffffff1660e01b8152600401612b7c94939291906131b4565b602060405180830381600087803b158015612b9657600080fd5b505af1925050508015612bc6575060408051601f3d908101601f19168201909252612bc39181019061304c565b60015b612c20573d808015612bf4576040519150601f19603f3d011682016040523d82523d6000602084013e612bf9565b606091505b508051612c185760405162461bcd60e51b8152600401610817906132b0565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506126a2565b506001949350505050565b3b151590565b828054612c5790613c3a565b90600052602060002090601f016020900481019282612c795760008555612cbf565b82601f10612c9257805160ff1916838001178555612cbf565b82800160010185558215612cbf579182015b82811115612cbf578251825591602001919060010190612ca4565b5061134c9291505b8082111561134c5760008155600101612cc7565b600067ffffffffffffffff831115612cf557612cf5613cec565b612d08601f8401601f1916602001613b3c565b9050828152838383011115612d1c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461075957600080fd5b803561ffff8116811461075957600080fd5b600060208284031215612d6d578081fd5b611d2b82612d33565b60008060408385031215612d88578081fd5b612d9183612d33565b9150612d9f60208401612d33565b90509250929050565b600080600060608486031215612dbc578081fd5b612dc584612d33565b9250612dd360208501612d33565b9150604084013590509250925092565b60008060008060808587031215612df8578081fd5b612e0185612d33565b9350612e0f60208601612d33565b925060408501359150606085013567ffffffffffffffff811115612e31578182fd5b8501601f81018713612e41578182fd5b612e5087823560208401612cdb565b91505092959194509250565b60008060408385031215612e6e578182fd5b612e7783612d33565b915060208301358015158114612e8b578182fd5b809150509250929050565b60008060408385031215612ea8578182fd5b612eb183612d33565b946020939093013593505050565b60006020808385031215612ed1578182fd5b823567ffffffffffffffff811115612ee7578283fd5b8301601f81018513612ef7578283fd5b8035612f0a612f0582613b66565b613b3c565b8181528381019083850185840285018601891015612f26578687fd5b8694505b83851015612f4f57612f3b81612d33565b835260019490940193918501918501612f2a565b50979650505050505050565b60006020808385031215612f6d578182fd5b823567ffffffffffffffff80821115612f84578384fd5b818501915085601f830112612f97578384fd5b8135612fa5612f0582613b66565b818152848101908486016040808502870188018b1015612fc3578889fd5b8896505b848710156130215780828c031215612fdd578889fd5b80518181018181108882111715612ff657612ff6613cec565b825261300183612d33565b815282890135898201528452600196909601959287019290810190612fc7565b50909998505050505050505050565b600060208284031215613041578081fd5b8135611d2b81613d02565b60006020828403121561305d578081fd5b8151611d2b81613d02565b600060208284031215613079578081fd5b813567ffffffffffffffff81111561308f578182fd5b8201601f8101841361309f578182fd5b6126a284823560208401612cdb565b6000602082840312156130bf578081fd5b611d2b82612d4a565b600080604083850312156130da578182fd5b6130e383612d4a565b9150612d9f60208401612d4a565b600060208284031215613102578081fd5b5035919050565b60008151808452613121816020860160208601613c0e565b601f01601f19169290920160200192915050565b60008351613147818460208801613c0e565b83519083019061315b818360208801613c0e565b01949350505050565b94855260208501939093526bffffffffffffffffffffffff19606092831b81166040860152605485019190915291901b16607482015260880190565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906131e790830184613109565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156132295783518352928401929184019160010161320d565b50909695505050505050565b901515815260200190565b600060208252611d2b6020830184613109565b6020808252603a908201527f596f752063616e206f6e6c7920636c61696d2033206d696e657273207065722060408201527f7472616e73616374696f6e20647572696e672070726573616c65000000000000606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601c908201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604082015260600190565b6020808252601e908201527f436f6c6c61626f7261746f7273207765726520616c7265616479207365740000604082015260600190565b6020808252602b908201527f596f752063616e206f6e6c7920636c61696d2036204d696e657273207065722060408201526a3a3930b739b0b1ba34b7b760a91b606082015260800190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252601c908201527f4e6f204d696e657273206c65667420746f20626520636c61696d656400000000604082015260600190565b6020808252601e908201527f546f74616c2063757420646f6573206e6f742061646420746f20313030250000604082015260600190565b6020808252602a908201527f596f752063616e206f6e6c7920636c61696d2033206d696e65727320647572696040820152696e672070726573616c6560b01b606082015260800190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b6020808252601e908201527f5468652063616c6c657220697320616e6f7468657220636f6e74726163740000604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b602080825260169082015275139bdd08195b9bdd59da081b5a5b995c9cc81b19599d60521b604082015260600190565b602080825260119082015270596f752061726520746f6f206561726c7960781b604082015260600190565b6020808252602a908201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604082015269726f206164647265737360b01b606082015260800190565b60208082526029908201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460408201526832b73a103a37b5b2b760b91b606082015260800190565b6020808252818101527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b60208082526024908201527f4e6f7420656e6f75676820457468657220746f20636c61696d20746865204d696040820152636e65727360e01b606082015260800190565b60208082526026908201527f596f752063616e206f6e6c7920636c61696d2039206d696e65727320706572206040820152651dd85b1b195d60d21b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960408201526839903737ba1037bbb760b91b606082015260800190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b60208082526017908201527f50726573616c65206e6f74207374617274656420796574000000000000000000604082015260600190565b60208082526023908201527f596f7520617265206e6f742077686974656c697374656420666f722070726573604082015262616c6560e81b606082015260800190565b60208082526033908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015272103737b910309031b7b63630b137b930ba37b960691b606082015260800190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b6020808252601c908201527f4e6f206d696e657273206c65667420746f20626520636c61696d656400000000604082015260600190565b6020808252601f908201527f4e6f206d6f7265206d696e657273206c65667420666f722070726573616c6500604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526021908201527f4e6f7420656e6f75676820457468657220746f20636c61696d2061206d696e656040820152603960f91b606082015260800190565b6020808252602b908201527f4d696e657273207765726520616c726561647920726573657276656420666f7260408201526a206769766561776179732160a81b606082015260800190565b90815260200190565b60405181810167ffffffffffffffff81118282101715613b5e57613b5e613cec565b604052919050565b600067ffffffffffffffff821115613b8057613b80613cec565b5060209081020190565b60006001600160801b0380831681851680830382111561315b5761315b613cc0565b60008219821115613bbf57613bbf613cc0565b500190565b600082613bd357613bd3613cd6565b500490565b6000816000190483118215151615613bf257613bf2613cc0565b500290565b600082821015613c0957613c09613cc0565b500390565b60005b83811015613c29578181015183820152602001613c11565b83811115610ed25750506000910152565b600281046001821680613c4e57607f821691505b60208210811415610b7257634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415613c8757613c87613cc0565b6001019392505050565b6000600019821415613ca557613ca5613cc0565b5060010190565b600082613cbb57613cbb613cd6565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114613d1857600080fd5b5056fea2646970667358221220f5548e2129524c7885d198ecb0aabe4b27cfec09f7d748952009520ee6d7ff0164736f6c63430008000033

Verified Source Code Full Match

Compiler: v0.8.0+commit.c7dfd78e EVM: istanbul Optimization: Yes (200 runs)
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
ERC721.sol 520 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./Address.sol";
import "./Context.sol";
import "./Strings.sol";
import "./ERC165.sol";
import "./Ownable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, Ownable {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) internal _owners;

    // Mapping owner address to token count
    mapping(address => uint256) internal _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            owner != address(0),
            "ERC721: balance query for the zero address"
        );
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        address owner = _owners[tokenId];
        require(
            owner != address(0),
            "ERC721: owner query for nonexistent token"
        );
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        string memory baseURI = _baseURI();
        return
            bytes(baseURI).length > 0
                ? string(abi.encodePacked(baseURI, tokenId.toString()))
                : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
     * in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner ||
                ERC721.isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(
            _exists(tokenId),
            "ERC721: approved query for nonexistent token"
        );

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override
        returns (bool)
    {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: transfer caller is not owner nor approved"
        );

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: transfer caller is not owner nor approved"
        );
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        virtual
        returns (bool)
    {
        require(
            _exists(tokenId),
            "ERC721: operator query for nonexistent token"
        );
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner ||
            getApproved(tokenId) == spender ||
            ERC721.isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    function _batchMint(address to, uint256[] memory tokenIds)
        internal
        virtual
    {
        require(to != address(0), "ERC721: mint to the zero address");
        _balances[to] += tokenIds.length;

        for (uint256 i; i < tokenIds.length; i++) {
            require(!_exists(tokenIds[i]), "ERC721: token already minted");

            _beforeTokenTransfer(address(0), to, tokenIds[i]);

            _owners[tokenIds[i]] = to;

            emit Transfer(address(0), to, tokenIds[i]);
        }
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(
            ERC721.ownerOf(tokenId) == from,
            "ERC721: transfer of token that is not own"
        );
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try
                IERC721Receiver(to).onERC721Received(
                    _msgSender(),
                    from,
                    tokenId,
                    _data
                )
            returns (bytes4 retval) {
                return retval == IERC721Receiver(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert(
                        "ERC721: transfer to non ERC721Receiver implementer"
                    );
                } else {
                    // solhint-disable-next-line no-inline-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     * 
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
Address.sol 189 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant alphabet = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = alphabet[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

}
TheEnigma.sol 461 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC721.sol";

contract TheEnigma is ERC721 {
    event Mint(address indexed from, uint256 indexed tokenId);

    modifier callerIsUser() {
        require(tx.origin == msg.sender, "The caller is another contract");
        _;
    }

    modifier onlyCollaborator() {
        bool isCollaborator = false;
        for (uint256 i; i < collaborators.length; i++) {
            if (collaborators[i].addr == msg.sender) {
                isCollaborator = true;

                break;
            }
        }

        require(
            owner() == _msgSender() || isCollaborator,
            "Ownable: caller is not the owner nor a collaborator"
        );

        _;
    }

    modifier claimStarted() {
        require(
            startClaimDate != 0 && startClaimDate <= block.timestamp,
            "You are too early"
        );

        _;
    }

    modifier presaleStarted() {
        require(
            startPresaleDate != 0 && startPresaleDate <= block.timestamp,
            "Presale not started yet"
        );

        _;
    }

    modifier onlyWhitelisted() {
        require(whitelistedAddresses[msg.sender] == true, "You are not whitelisted for presale");

        _;
    }

    struct Collaborators {
        address addr;
        uint256 cut;
    }

    uint256 private startClaimDate = 1636912800;
    uint256 private startPresaleDate = 1636750800;
    uint256 private mintPrice = 140000000000000000;
    uint256 private presaleMintPrice = 70000000000000000;

    uint256 private totalTokens = 8000;
    uint256 private totalMintedTokens = 0;

    uint256 private maxMinerPerTransactionDuringPresale = 3;
    uint256 private maxMinerPerTransaction = 6;

    uint256 private maxMinerPerWalletDuringPresale = 3;
    uint256 private maxMinerPerWallet = 9;

    uint128 private basisPoints = 10000;
    string private baseURI =
        "https://enigmaminer.s3.amazonaws.com/";
    
    uint256 public giveawayCount = 200;
    bool public giveawayReservationComplete = false;
    
    uint256 public presaleLimit = 6300;
    uint256 public presaleMintedTokens = 0;

    mapping(address => uint256) private claimedMinerPerWallet;

    uint16[] availableMiners;
    Collaborators[] private collaborators;

    mapping (address => bool) whitelistedAddresses;

    constructor() ERC721("TheEnigma", "ENG") {}

    // ONLY OWNER

    /**
     * Sets the collaborators of the project with their cuts
     */
    function addCollaborators(Collaborators[] memory _collaborators)
        external
        onlyOwner
    {
        require(collaborators.length == 0, "Collaborators were already set");

        uint128 totalCut;
        for (uint256 i; i < _collaborators.length; i++) {
            collaborators.push(_collaborators[i]);
            totalCut += uint128(_collaborators[i].cut);
        }

        require(totalCut == basisPoints, "Total cut does not add to 100%");
    }

    // ONLY COLLABORATORS

    /**
     * @dev Allows to withdraw the Ether in the contract and split it among the collaborators
     */
    function withdraw() external onlyCollaborator {
        uint256 totalBalance = address(this).balance;

        for (uint256 i; i < collaborators.length; i++) {
            payable(collaborators[i].addr).transfer(
                mulScale(totalBalance, collaborators[i].cut, basisPoints)
            );
        }
    }

    /**
     * @dev Sets the base URI for the API that provides the NFT data.
     */
    function setBaseTokenURI(string memory _uri) external onlyCollaborator {
        baseURI = _uri;
    }

    /**
     * @dev Sets the claim price for each miner
     */
    function setMintPrice(uint256 _mintPrice) external onlyCollaborator {
        mintPrice = _mintPrice;
    }

    /**
     * @dev Sets the claim price for each miner
     */
    function setPresaleMintPrice(uint256 _presaleMintPrice) external onlyCollaborator {
        presaleMintPrice = _presaleMintPrice;
    }

    /**
     * @dev Populates the available miners
     */
    function addAvailableMiners(uint16 from, uint16 to)
        external
        onlyCollaborator
    {
        for (uint16 i = from; i <= to; i++) {
            availableMiners.push(i);
        }
    }

    /**
     * @dev Removes a chosen miner from the available list, only a utility function
     */
    function removeMinerFromAvailableMiners(uint16 tokenId)
        external
        onlyCollaborator
    {
        for (uint16 i; i <= availableMiners.length; i++) {
            if (availableMiners[i] != tokenId) {
                continue;
            }

            availableMiners[i] = availableMiners[availableMiners.length - 1];
            availableMiners.pop();

            break;
        }
    }

    /**
     * @dev Sets the date that users can start claiming miners
     */
    function setStartClaimDate(uint256 _startClaimDate)
        external
        onlyCollaborator
    {
        startClaimDate = _startClaimDate;
    }

    /**
     * @dev Sets the date that users can start claiming miners for presale
     */
    function setStartPresaleDate(uint256 _startPresaleDate)
        external
        onlyCollaborator
    {
        startPresaleDate = _startPresaleDate;
    }

    /**
     * @dev Sets the presale limit for presale
     */
    function setPresaleLimit(uint256 _presaleLimit)
        external
        onlyCollaborator
    {
        presaleLimit = _presaleLimit;
    }

    /**
     * @dev Checks if a miner is in the available list
     */
    function isMinerAvailable(uint16 tokenId)
        external
        view
        onlyCollaborator
        returns (bool)
    {
        for (uint16 i; i < availableMiners.length; i++) {
            if (availableMiners[i] == tokenId) {
                return true;
            }
        }

        return false;
    }


    /**
     * @dev Give random miners to the provided address
     */
    function reserveGiveawayMiners(address _address)
        external
        onlyCollaborator
    {
        require(availableMiners.length >= giveawayCount, "No miners left to be claimed");
        require(!giveawayReservationComplete, "Miners were already reserved for giveaways!");
        
        totalMintedTokens += giveawayCount;

        uint256[] memory tokenIds = new uint256[](giveawayCount);

        for (uint256 i; i < giveawayCount; i++) {
            tokenIds[i] = getMinerToBeClaimed();
        }

        _batchMint(_address, tokenIds);
        giveawayReservationComplete = true;
    }

    /**
    * @dev Whitelist addresses
     */
    function whitelistAddress (address[] memory users) external onlyCollaborator {
        for (uint i = 0; i < users.length; i++) {
            whitelistedAddresses[users[i]] = true;
        }
    }

    // END ONLY COLLABORATORS

    /**
     * @dev Claim a single Miner
     */
    function claimMiner() external payable callerIsUser claimStarted returns (uint256) {
        require(msg.value >= mintPrice, "Not enough Ether to claim a miner");

        require(availableMiners.length > 0, "Not enough miners left");

        require(availableMiners.length - giveawayCount > 0, "No miners left to be claimed");

        require(claimedMinerPerWallet[msg.sender] < maxMinerPerWallet, "You can only claim 9 miners per wallet");

        claimedMinerPerWallet[msg.sender]++;
        totalMintedTokens++;

        uint256 tokenId = getMinerToBeClaimed();

        _mint(msg.sender, tokenId);
        return tokenId;
    }

    /**
     * @dev Claim up to 6 miners at once
     */
    function claimMiners(uint256 quantity)
        external
        payable
        callerIsUser
        claimStarted
        returns (uint256[] memory)
    {
        require(
            msg.value >= mintPrice * quantity,
            "Not enough Ether to claim the Miners"
        );
        
        require(quantity <= maxMinerPerTransaction, "You can only claim 6 Miners per transaction");
        
        require(availableMiners.length >= quantity, "Not enough miners left");

        require(availableMiners.length - giveawayCount >= quantity, "No Miners left to be claimed");

        require(claimedMinerPerWallet[msg.sender] + quantity <= maxMinerPerWallet, "You can only claim 9 miners per wallet");

        uint256[] memory tokenIds = new uint256[](quantity);

        claimedMinerPerWallet[msg.sender] += quantity;
        totalMintedTokens += quantity;

        for (uint256 i; i < quantity; i++) {
            tokenIds[i] = getMinerToBeClaimed();
        }

        _batchMint(msg.sender, tokenIds);
        return tokenIds;
    }

    /**
     * @dev Claim up to 3 miners at once in presale
     */
    function presaleMintMiners(uint256 quantity)
        external
        payable
        callerIsUser
        presaleStarted
        onlyWhitelisted
        returns (uint256[] memory)
    {
        require(
            msg.value >= presaleMintPrice * quantity,
            "Not enough Ether to claim the Miners"
        );
        
        require(quantity <= maxMinerPerTransactionDuringPresale, "You can only claim 3 miners per transaction during presale");

        require(availableMiners.length >= quantity, "Not enough miners left");

        require(availableMiners.length - giveawayCount >= quantity, "No Miners left to be claimed");

        require(quantity + presaleMintedTokens <= presaleLimit, "No more miners left for presale");

        require(claimedMinerPerWallet[msg.sender] + quantity <= maxMinerPerWalletDuringPresale, "You can only claim 3 miners during presale");

        uint256[] memory tokenIds = new uint256[](quantity);

        claimedMinerPerWallet[msg.sender] += quantity;
        totalMintedTokens += quantity;
        presaleMintedTokens += quantity;

        for (uint256 i; i < quantity; i++) {
            tokenIds[i] = getMinerToBeClaimed();
        }

        _batchMint(msg.sender, tokenIds);
        return tokenIds;
    }

    /**
     * @dev Returns the tokenId by index
     */
    function tokenByIndex(uint256 tokenId) external view returns (uint256) {
        require(
            _exists(tokenId),
            "ERC721: operator query for nonexistent token"
        );

        return tokenId;
    }

    /**
     * @dev Returns the base URI for the tokens API.
     */
    function baseTokenURI() external view returns (string memory) {
        return baseURI;
    }

    /**
     * @dev Returns how many Miners are still available to be claimed
     */
    function getAvailableMiners() external view returns (uint256) {
        return availableMiners.length;
    }

    /**
     * @dev Returns the claim price
     */
    function getmintPrice() external view returns (uint256) {
        return mintPrice;
    }

    /**
     * @dev Returns the total supply
     */
    function totalSupply() external view virtual returns (uint256) {
        return totalMintedTokens;
    }

    /**
     * @dev Returns the total minted tokens in presale
     */
    function totalPresaleMintCount() external view virtual returns (uint256) {
        return presaleMintedTokens;
    }

    // Private and Internal functions

    /**
     * @dev Returns a random available Miner to be claimed
     */
    function getMinerToBeClaimed() private returns (uint256) {
        uint256 random = _getRandomNumber(availableMiners.length);
        uint256 tokenId = uint256(availableMiners[random]);

        availableMiners[random] = availableMiners[availableMiners.length - 1];
        availableMiners.pop();

        return tokenId;
    }

    /**
     * @dev Generates a pseudo-random number.
     */
    function _getRandomNumber(uint256 _upper) private view returns (uint256) {
        uint256 random = uint256(
            keccak256(
                abi.encodePacked(
                    availableMiners.length,
                    blockhash(block.number - 1),
                    block.coinbase,
                    block.difficulty,
                    msg.sender
                )
            )
        );

        return random % _upper;
    }

    /**
     * @dev See {ERC721}.
     */
    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }

    function mulScale(
        uint256 x,
        uint256 y,
        uint128 scale
    ) internal pure returns (uint256) {
        uint256 a = x / scale;
        uint256 b = x % scale;
        uint256 c = y / scale;
        uint256 d = y % scale;

        return a * c * scale + a * d + b * c + (b * d) / scale;
    }
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Receiver.sol 21 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

Read Contract

balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
getApproved 0x081812fc → address
getAvailableMiners 0xb91fbe53 → uint256
getmintPrice 0x8d482354 → uint256
giveawayCount 0xe9be0f3f → uint256
giveawayReservationComplete 0xd16cd603 → bool
isApprovedForAll 0xe985e9c5 → bool
isMinerAvailable 0x0d0b6b74 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
presaleLimit 0x525b3fe3 → uint256
presaleMintedTokens 0x0aad3a71 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenURI 0xc87b56dd → string
totalPresaleMintCount 0x403e03ab → uint256
totalSupply 0x18160ddd → uint256

Write Contract 22 functions

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

addAvailableMiners 0x1edee522
uint16 from
uint16 to
addCollaborators 0xe455ce91
tuple[] _collaborators
approve 0x095ea7b3
address to
uint256 tokenId
claimMiner 0xfedc6ccc
No parameters
returns: uint256
claimMiners 0x107810d9
uint256 quantity
returns: uint256[]
presaleMintMiners 0x50b48754
uint256 quantity
returns: uint256[]
removeMinerFromAvailableMiners 0xe82942c5
uint16 tokenId
renounceOwnership 0x715018a6
No parameters
reserveGiveawayMiners 0xbe652c3c
address _address
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseTokenURI 0x30176e13
string _uri
setMintPrice 0xf4a0a528
uint256 _mintPrice
setPresaleLimit 0x7fd255f1
uint256 _presaleLimit
setPresaleMintPrice 0x37a13193
uint256 _presaleMintPrice
setStartClaimDate 0x23ab18f1
uint256 _startClaimDate
setStartPresaleDate 0x6d44aef5
uint256 _startPresaleDate
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistAddress 0xb31d61b0
address[] users
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address