Address Contract Partially Verified
Address
0xcD041F40d497038E2da65988b7D7e2C0D9244619
Balance
0 ETH
Nonce
1
Code Size
14486 bytes
Creator
0xacF1A2Bd...a0De at tx 0x9936adfb...7d03f5
Indexed Transactions
0
Contract Bytecode
14486 bytes
0x6080604052600436106102515760003560e01c806370a0823111610139578063b88d4fde116100b6578063e985e9c51161007a578063e985e9c5146106c6578063e9ffdfd71461070f578063ebf0c71714610774578063eff955371461078a578063f2f5a7e51461079f578063f2fde38b146107bf57600080fd5b8063b88d4fde14610626578063c87b56dd14610646578063cad96cca14610666578063d62fd29614610693578063e2fdcc17146106a657600080fd5b80639d3c8cc4116100fd5780639d3c8cc414610596578063a22cb465146105b6578063a38bffda146105d6578063a475b5dd146105ec578063b533731d1461060657600080fd5b806370a082311461050e578063715018a61461052e5780638da5cb5b1461054357806395d89b4114610561578063972a2a621461057657600080fd5b80633031fa1a116101d25780634f6ccce7116101965780634f6ccce71461046f5780635f0f45b21461048f57806362a5af3b146104a45780636352211e146104c35780636c0360eb146104e35780636fdaddf1146104f857600080fd5b80633031fa1a146103e55780633d4437821461040557806342842e0e1461041a5780634cdb44001461043a5780634e71d92d1461045a57600080fd5b806311f8d07e1161021957806311f8d07e1461032757806318160ddd1461034757806323b872dd146103665780632a55205a146103865780632f745c59146103c557600080fd5b806301ffc9a714610256578063066142951461028b57806306fdde03146102ad578063081812fc146102cf578063095ea7b314610307575b600080fd5b34801561026257600080fd5b50610276610271366004612f44565b6107df565b60405190151581526020015b60405180910390f35b34801561029757600080fd5b506102ab6102a6366004612f68565b610830565b005b3480156102b957600080fd5b506102c26108a0565b6040516102829190612fe2565b3480156102db57600080fd5b506102ef6102ea366004612ff5565b610932565b6040516001600160a01b039091168152602001610282565b34801561031357600080fd5b506102ab610322366004613025565b6109c7565b34801561033357600080fd5b506102ab61034236600461304f565b610adc565b34801561035357600080fd5b506008545b604051908152602001610282565b34801561037257600080fd5b506102ab61038136600461307b565b610b4b565b34801561039257600080fd5b506103a66103a1366004612f68565b610b7c565b604080516001600160a01b039093168352602083019190915201610282565b3480156103d157600080fd5b506103586103e0366004613025565b610c82565b3480156103f157600080fd5b506102ab610400366004613156565b610d18565b34801561041157600080fd5b506102ab610d59565b34801561042657600080fd5b506102ab61043536600461307b565b610dbc565b34801561044657600080fd5b506102ab6104553660046131c3565b610dd7565b34801561046657600080fd5b506102ab610fa1565b34801561047b57600080fd5b5061035861048a366004612ff5565b61107d565b34801561049b57600080fd5b506102ab611110565b3480156104b057600080fd5b50600f5461027690610100900460ff1681565b3480156104cf57600080fd5b506102ef6104de366004612ff5565b611149565b3480156104ef57600080fd5b506102c26111c0565b34801561050457600080fd5b50610358612bcc81565b34801561051a57600080fd5b50610358610529366004613260565b61124e565b34801561053a57600080fd5b506102ab6112d5565b34801561054f57600080fd5b50600a546001600160a01b03166102ef565b34801561056d57600080fd5b506102c261130b565b34801561058257600080fd5b506102766105913660046132e1565b61131a565b3480156105a257600080fd5b506014546102ef906001600160a01b031681565b3480156105c257600080fd5b506102ab6105d1366004613326565b611458565b3480156105e257600080fd5b50610358600e5481565b3480156105f857600080fd5b50600f546102769060ff1681565b34801561061257600080fd5b506102ab610621366004613260565b611463565b34801561063257600080fd5b506102ab610641366004613362565b6115dd565b34801561065257600080fd5b506102c2610661366004612ff5565b611615565b34801561067257600080fd5b50610686610681366004612ff5565b611741565b6040516102829190613436565b6102ab6106a1366004613449565b6117d0565b3480156106b257600080fd5b506013546102ef906001600160a01b031681565b3480156106d257600080fd5b506102766106e1366004613490565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561071b57600080fd5b5061072f61072a366004612ff5565b611bd1565b6040516102829190600060a08201905060ff83511682526020830151602083015260408301516040830152606083015160608301526080830151608083015292915050565b34801561078057600080fd5b5061035860105481565b34801561079657600080fd5b506102c2611c58565b3480156107ab57600080fd5b506102ab6107ba366004612ff5565b611c65565b3480156107cb57600080fd5b506102ab6107da366004613260565b611d92565b6000631a93499b60e11b6001600160e01b031983160161080157506001919050565b636ad56fd360e11b6001600160e01b031983160161082157506001919050565b61082a82611e2a565b92915050565b600a546001600160a01b031633146108635760405162461bcd60e51b815260040161085a906134c3565b60405180910390fd5b600f54610100900460ff161561088b5760405162461bcd60e51b815260040161085a906134f8565b60009182526012602052604090912060010155565b6060600080546108af9061352f565b80601f01602080910402602001604051908101604052809291908181526020018280546108db9061352f565b80156109285780601f106108fd57610100808354040283529160200191610928565b820191906000526020600020905b81548152906001019060200180831161090b57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109ab5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161085a565b506000908152600460205260409020546001600160a01b031690565b60006109d282611149565b9050806001600160a01b0316836001600160a01b031603610a3f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161085a565b336001600160a01b0382161480610a5b5750610a5b81336106e1565b610acd5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161085a565b610ad78383611e4f565b505050565b600a546001600160a01b03163314610b065760405162461bcd60e51b815260040161085a906134c3565b600f54610100900460ff1615610b2e5760405162461bcd60e51b815260040161085a906134f8565b600092835260126020526040909220600381019190915560040155565b610b553382611ebd565b610b715760405162461bcd60e51b815260040161085a90613569565b610ad7838383611fb4565b6000828152600b60209081526040808320805482518185028101850190935280835284938493929190849084015b82821015610bf957600084815260209081902060408051808201909152908401546001600160a01b0381168252600160a01b90046001600160601b031681830152825260019092019101610baa565b505050509050600081511115610c725780600081518110610c1c57610c1c6135ba565b60200260200101516000015161271082600081518110610c3e57610c3e6135ba565b6020026020010151602001516001600160601b031686610c5e91906135e6565b610c689190613605565b9250925050610c7b565b60008092509250505b9250929050565b6000610c8d8361124e565b8210610cef5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161085a565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610d425760405162461bcd60e51b815260040161085a906134c3565b8051610d5590600c906020840190612e95565b5050565b600a546001600160a01b03163314610d835760405162461bcd60e51b815260040161085a906134c3565b600f54610100900460ff1615610dab5760405162461bcd60e51b815260040161085a906134f8565b600f805461ff001916610100179055565b610ad7838383604051806020016040528060008152506115dd565b600a546001600160a01b03163314610e015760405162461bcd60e51b815260040161085a906134c3565b600460005260126020527fb4fcd034df3d20faa1c133b66d862ce92732727d40916b48ffb4020cb00fe05654421015610e7c5760405162461bcd60e51b815260206004820152601d60248201527f554e445733204c61636f7374653a206e6f742061637469766520796574000000604482015260640161085a565b612bcc8151610e8a60085490565b610e949190613627565b1115610eb25760405162461bcd60e51b815260040161085a9061363f565b6004600052601260205260008051602061386a83398151915254815160008051602061384a83398151915254610ee89190613627565b1115610f065760405162461bcd60e51b815260040161085a906136ac565b60005b8151811015610d5557610f32610f1e60085490565b6014546001600160a01b031661019061215b565b610f5d828281518110610f4757610f476135ba565b6020026020010151610f5860085490565b612209565b60046000908152601260205260008051602061384a833981519152805460019290610f89908490613627565b90915550819050610f9981613709565b915050610f09565b600a546001600160a01b03163314610fcb5760405162461bcd60e51b815260040161085a906134c3565b6013546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611018576040519150601f19603f3d011682016040523d82523d6000602084013e61101d565b606091505b505090508061107a5760405162461bcd60e51b815260206004820152602360248201527f554e445733204c61636f7374653a204661696c656420746f2073656e642045746044820152623432b960e91b606482015260840161085a565b50565b600061108860085490565b82106110eb5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161085a565b600882815481106110fe576110fe6135ba565b90600052602060002001549050919050565b600a546001600160a01b0316331461113a5760405162461bcd60e51b815260040161085a906134c3565b600f805460ff19166001179055565b6000818152600260205260408120546001600160a01b03168061082a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161085a565b600c80546111cd9061352f565b80601f01602080910402602001604051908101604052809291908181526020018280546111f99061352f565b80156112465780601f1061121b57610100808354040283529160200191611246565b820191906000526020600020905b81548152906001019060200180831161122957829003601f168201915b505050505081565b60006001600160a01b0382166112b95760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161085a565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146112ff5760405162461bcd60e51b815260040161085a906134c3565b6113096000612223565b565b6060600180546108af9061352f565b600081815b845181101561144c57600085828151811061133c5761133c6135ba565b602002602001015190508083116113c557604080516020810185905290810182905260029060600160408051601f198184030181529082905261137e91613722565b602060405180830381855afa15801561139b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906113be919061373e565b9250611439565b604080516020810183905290810184905260029060600160408051601f19818403018152908290526113f691613722565b602060405180830381855afa158015611413573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611436919061373e565b92505b508061144481613709565b91505061131f565b50601054149392505050565b610d55338383612275565b600a546001600160a01b0316331461148d5760405162461bcd60e51b815260040161085a906134c3565b600460005260126020527fb4fcd034df3d20faa1c133b66d862ce92732727d40916b48ffb4020cb00fe056544210156115085760405162461bcd60e51b815260206004820152601d60248201527f554e445733204c61636f7374653a206e6f742061637469766520796574000000604482015260640161085a565b612bcc61151460085490565b61151f906001613627565b111561153d5760405162461bcd60e51b815260040161085a9061363f565b6004600052601260205260008051602061386a8339815191525460008051602061384a83398151915254611572906001613627565b11156115905760405162461bcd60e51b815260040161085a906136ac565b61159c610f1e60085490565b6115a981610f5860085490565b60046000908152601260205260008051602061384a8339815191528054600192906115d5908490613627565b909155505050565b6115e73383611ebd565b6116035760405162461bcd60e51b815260040161085a90613569565b61160f84848484612343565b50505050565b6000818152600260205260409020546060906001600160a01b03166116935760405162461bcd60e51b815260206004820152602e60248201527f554e445733204c61636f7374653a2055524920717565727920666f72206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161085a565b600f5460ff1661172f57600d80546116aa9061352f565b80601f01602080910402602001604051908101604052809291908181526020018280546116d69061352f565b80156117235780601f106116f857610100808354040283529160200191611723565b820191906000526020600020905b81548152906001019060200180831161170657829003601f168201915b50505050509050919050565b600c80546116aa9061352f565b919050565b6060600b6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156117c557600084815260209081902060408051808201909152908401546001600160a01b0381168252600160a01b90046001600160601b031681830152825260019092019101611776565b505050509050919050565b600f54610100900460ff16156117f85760405162461bcd60e51b815260040161085a906134f8565b600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a65442101561186e5760405162461bcd60e51b8152602060048201526018602482015277554e445733204c61636f7374653a20746f6f206561726c7960401b604482015260640161085a565b6004600052601260205260008051602061386a8339815191525461189490612bcc613757565b8261189e60085490565b6118a89190613627565b11156118c65760405162461bcd60e51b815260040161085a9061363f565b600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a654421080159061192c5750600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a7544211155b1561193e57610d558282600133612376565b600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b55442108015906119a45750600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b6544211155b156119b657610d558282600233612376565b600360005260126020527f0f36ad39aee03e7108cc48f54934702a5f0d4066f10344cebf8198978d86976d544210611aa557601260205260008051602061386a833981519152547f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b45460016000527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a554611a5290612bcc613757565b611a5c9190613757565b611a669190613757565b6003600081905260126020527f0f36ad39aee03e7108cc48f54934702a5f0d4066f10344cebf8198978d86976b91909155610d55908390839033612376565b600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a75442118015611b095750600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b55442105b80611b735750600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b65442118015611b735750600360005260126020527f0f36ad39aee03e7108cc48f54934702a5f0d4066f10344cebf8198978d86976d5442105b15610d555760405162461bcd60e51b815260206004820152602860248201527f554e445733204c61636f7374653a20736d61727420636f6e74726163742064696044820152677361626c6564202160c01b606482015260840161085a565b611c066040518060a00160405280600060ff168152602001600081526020016000815260200160008152602001600081525090565b50600090815260126020908152604091829020825160a081018452815460ff16815260018201549281019290925260028101549282019290925260038201546060820152600490910154608082015290565b600d80546111cd9061352f565b600a546001600160a01b03163314611c8f5760405162461bcd60e51b815260040161085a906134c3565b6010819055600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a75442118015611cf85750600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b55442105b1561107a57600160005260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a5547f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a454611d559190613757565b6002600090815260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b380549091906115d5908490613627565b600a546001600160a01b03163314611dbc5760405162461bcd60e51b815260040161085a906134c3565b6001600160a01b038116611e215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161085a565b61107a81612223565b60006001600160e01b0319821663780e9d6360e01b148061082a575061082a826126b7565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611e8482611149565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611f365760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161085a565b6000611f4183611149565b9050806001600160a01b0316846001600160a01b03161480611f8857506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80611fac5750836001600160a01b0316611fa184610932565b6001600160a01b0316145b949350505050565b826001600160a01b0316611fc782611149565b6001600160a01b03161461202b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161085a565b6001600160a01b03821661208d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161085a565b612098838383612707565b6120a3600082611e4f565b6001600160a01b03831660009081526003602052604081208054600192906120cc908490613757565b90915550506001600160a01b03821660009081526003602052604081208054600192906120fa908490613627565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080516001808252818301909252600091816020015b604080518082019091526000808252602082015281526020019060019003908161217257905050905081816000815181106121af576121af6135ba565b6020026020010151602001906001600160601b031690816001600160601b03168152505082816000815181106121e7576121e76135ba565b60209081029190910101516001600160a01b03909116905261160f8482612712565b610d5582826040518060200160405280600081525061292b565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036122d65760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161085a565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61234e848484611fb4565b61235a8484848461295e565b61160f5760405162461bcd60e51b815260040161085a9061376e565b6000828152601260205260409020600301544210156123d25760405162461bcd60e51b8152602060048201526018602482015277554e445733204c61636f7374653a20746f6f206561726c7960401b604482015260640161085a565b81600114806123e15750816002145b15612445576123f9836001600160a01b03831661131a565b6124455760405162461bcd60e51b815260206004820152601e60248201527f554e445733204c61636f7374653a204e6f742077686974656c69737465640000604482015260640161085a565b60008281526012602052604090205460ff168411156124b55760405162461bcd60e51b815260206004820152602660248201527f554e445733204c61636f7374653a2043616e6e6f74206d696e742061626f7665604482015265081b1a5b5a5d60d21b606482015260840161085a565b60008281526012602052604090205460ff16846124f284846001600160a01b03166000908152601160209081526040808320938352929052205490565b6124fc9190613627565b11156125695760405162461bcd60e51b815260206004820152603660248201527f554e445733204c61636f7374653a2043616e6e6f74206d696e742061626f7665604482015275206c696d697420666f72206f6e65206164647265737360501b606482015260840161085a565b6000828152601260205260409020600181015460029091015461258d908690613627565b11156126015760405162461bcd60e51b815260206004820152603e60248201527f554e445733204c61636f7374653a20507572636861736520776f756c6420657860448201527f63656564206d6178207075626c696320737570706c79206f66204e4654730000606482015260840161085a565b83600e5461260f91906135e6565b3410156126755760405162461bcd60e51b815260206004820152602e60248201527f554e445733204c61636f7374653a2045746865722076616c75652073656e742060448201526d1a5cc81b9bdd0818dbdc9c9958dd60921b606482015260840161085a565b60005b848110156126ab5761268c610f1e60085490565b61269982610f5860085490565b806126a381613709565b915050612678565b5061160f828286612a5f565b60006001600160e01b031982166380ac58cd60e01b14806126e857506001600160e01b03198216635b5e139f60e01b145b8061082a57506301ffc9a760e01b6001600160e01b031983161461082a565b610ad7838383612ac2565b6000805b82518110156128c15760006001600160a01b031683828151811061273c5761273c6135ba565b6020026020010151600001516001600160a01b03160361279e5760405162461bcd60e51b815260206004820152601b60248201527f526563697069656e742073686f756c642062652070726573656e740000000000604482015260640161085a565b8281815181106127b0576127b06135ba565b6020026020010151602001516001600160601b03166000036128145760405162461bcd60e51b815260206004820181905260248201527f526f79616c74792076616c75652073686f756c6420626520706f736974697665604482015260640161085a565b828181518110612826576128266135ba565b6020026020010151602001516001600160601b0316826128469190613627565b9150600b600085815260200190815260200160002083828151811061286d5761286d6135ba565b6020908102919091018101518254600181018455600093845292829020815191909201516001600160601b0316600160a01b026001600160a01b0390911617910155806128b981613709565b915050612716565b5061271081106129215760405162461bcd60e51b815260206004820152602560248201527f526f79616c747920746f74616c2076616c75652073686f756c64206265203c20604482015264031303030360dc1b606482015260840161085a565b610ad78383612b7a565b6129358383612bb7565b612942600084848461295e565b610ad75760405162461bcd60e51b815260040161085a9061376e565b60006001600160a01b0384163b15612a5457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906129a29033908990889088906004016137c0565b6020604051808303816000875af19250505080156129dd575060408051601f3d908101601f191682019092526129da918101906137fd565b60015b612a3a573d808015612a0b576040519150601f19603f3d011682016040523d82523d6000602084013e612a10565b606091505b508051600003612a325760405162461bcd60e51b815260040161085a9061376e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611fac565b506001949350505050565b6001600160a01b038216600090815260116020908152604080832086845290915281208054839290612a92908490613627565b909155505060008381526012602052604081206002018054839290612ab8908490613627565b9091555050505050565b6001600160a01b038316612b1d57612b1881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b612b40565b816001600160a01b0316836001600160a01b031614612b4057612b408382612d05565b6001600160a01b038216612b5757610ad781612da2565b826001600160a01b0316826001600160a01b031614610ad757610ad78282612e51565b7f3fa96d7b6bcbfe71ef171666d84db3cf52fa2d1c8afdb1cc8e486177f208b7df8282604051612bab92919061381a565b60405180910390a15050565b6001600160a01b038216612c0d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161085a565b6000818152600260205260409020546001600160a01b031615612c725760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161085a565b612c7e60008383612707565b6001600160a01b0382166000908152600360205260408120805460019290612ca7908490613627565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001612d128461124e565b612d1c9190613757565b600083815260076020526040902054909150808214612d6f576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090612db490600190613757565b60008381526009602052604081205460088054939450909284908110612ddc57612ddc6135ba565b906000526020600020015490508060088381548110612dfd57612dfd6135ba565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480612e3557612e35613833565b6001900381819060005260206000200160009055905550505050565b6000612e5c8361124e565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b828054612ea19061352f565b90600052602060002090601f016020900481019282612ec35760008555612f09565b82601f10612edc57805160ff1916838001178555612f09565b82800160010185558215612f09579182015b82811115612f09578251825591602001919060010190612eee565b50612f15929150612f19565b5090565b5b80821115612f155760008155600101612f1a565b6001600160e01b03198116811461107a57600080fd5b600060208284031215612f5657600080fd5b8135612f6181612f2e565b9392505050565b60008060408385031215612f7b57600080fd5b50508035926020909101359150565b60005b83811015612fa5578181015183820152602001612f8d565b8381111561160f5750506000910152565b60008151808452612fce816020860160208601612f8a565b601f01601f19169290920160200192915050565b602081526000612f616020830184612fb6565b60006020828403121561300757600080fd5b5035919050565b80356001600160a01b038116811461173c57600080fd5b6000806040838503121561303857600080fd5b6130418361300e565b946020939093013593505050565b60008060006060848603121561306457600080fd5b505081359360208301359350604090920135919050565b60008060006060848603121561309057600080fd5b6130998461300e565b92506130a76020850161300e565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156130f6576130f66130b7565b604052919050565b600067ffffffffffffffff831115613118576131186130b7565b61312b601f8401601f19166020016130cd565b905082815283838301111561313f57600080fd5b828260208301376000602084830101529392505050565b60006020828403121561316857600080fd5b813567ffffffffffffffff81111561317f57600080fd5b8201601f8101841361319057600080fd5b611fac848235602084016130fe565b600067ffffffffffffffff8211156131b9576131b96130b7565b5060051b60200190565b600060208083850312156131d657600080fd5b823567ffffffffffffffff8111156131ed57600080fd5b8301601f810185136131fe57600080fd5b803561321161320c8261319f565b6130cd565b81815260059190911b8201830190838101908783111561323057600080fd5b928401925b82841015613255576132468461300e565b82529284019290840190613235565b979650505050505050565b60006020828403121561327257600080fd5b612f618261300e565b600082601f83011261328c57600080fd5b8135602061329c61320c8361319f565b82815260059290921b840181019181810190868411156132bb57600080fd5b8286015b848110156132d657803583529183019183016132bf565b509695505050505050565b600080604083850312156132f457600080fd5b823567ffffffffffffffff81111561330b57600080fd5b6133178582860161327b565b95602094909401359450505050565b6000806040838503121561333957600080fd5b6133428361300e565b91506020830135801515811461335757600080fd5b809150509250929050565b6000806000806080858703121561337857600080fd5b6133818561300e565b935061338f6020860161300e565b925060408501359150606085013567ffffffffffffffff8111156133b257600080fd5b8501601f810187136133c357600080fd5b6133d2878235602084016130fe565b91505092959194509250565b600081518084526020808501945080840160005b8381101561342b57815180516001600160a01b031688528301516001600160601b031683880152604090960195908201906001016133f2565b509495945050505050565b602081526000612f6160208301846133de565b6000806040838503121561345c57600080fd5b82359150602083013567ffffffffffffffff81111561347a57600080fd5b6134868582860161327b565b9150509250929050565b600080604083850312156134a357600080fd5b6134ac8361300e565b91506134ba6020840161300e565b90509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526017908201527f554e445733204c61636f7374653a2066726f7a656e2021000000000000000000604082015260600190565b600181811c9082168061354357607f821691505b60208210810361356357634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613600576136006135d0565b500290565b60008261362257634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561363a5761363a6135d0565b500190565b60208082526047908201527f554e445733204c61636f7374653a20546f6b656e73206e756d62657220746f2060408201527f6d696e742063616e6e6f7420657863656564206e756d626572206f66204d415860608201526620746f6b656e7360c81b608082015260a00190565b6020808252603b908201527f554e445733204c61636f7374653a2067697665776179206e756d62657220636160408201527f6e6e6f742065786365656420746865204d41585f474956455741590000000000606082015260800190565b60006001820161371b5761371b6135d0565b5060010190565b60008251613734818460208701612f8a565b9190910192915050565b60006020828403121561375057600080fd5b5051919050565b600082821015613769576137696135d0565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906137f390830184612fb6565b9695505050505050565b60006020828403121561380f57600080fd5b8151612f6181612f2e565b828152604060208201526000611fac60408301846133de565b634e487b7160e01b600052603160045260246000fdfeb4fcd034df3d20faa1c133b66d862ce92732727d40916b48ffb4020cb00fe055b4fcd034df3d20faa1c133b66d862ce92732727d40916b48ffb4020cb00fe054a164736f6c634300080d000a
Verified Source Code Partial Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (200 runs)
LCCollection.sol 426 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
/// @title Lacoste UNDW3 Collection
/// @author UNBLOCKED (https://unblocked-group.com/)
/// @Reviewed by Pinky and the Brain
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
//the rarible dependency files are needed to setup sales royalties on LooksRare
import "./rarible/royalties/contracts/impl/RoyaltiesV2Impl.sol";
import "./rarible/royalties/contracts/LibPart.sol";
import "./rarible/royalties/contracts/LibRoyaltiesV2.sol";
contract UNDW3Collection is ERC721Enumerable, Ownable, RoyaltiesV2Impl {
using Strings for uint256;
// Epochs details for Lacoste UNDW3 sales
struct EpochDetails {
uint8 maxPerWallet;
uint256 maxTotal;
uint256 supply;
uint256 startDate;
uint256 endDate;
}
// Base URI before for metadata
string public baseURI;
// Blind URI before reveal
string public blindURI;
// Max NFTs to mint
uint256 public constant MAX_NFT = 11212;
// NFT price
uint256 public NFTPrice = 0.08 ether;
// Reveal enable/disable
bool public reveal;
// Freeze the mint
bool public freeze;
// Royalties interface
bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
// Root of the whitelist
bytes32 public root;
// Mapping to store the number of claims per epoch
mapping (address => mapping (uint256 => uint256)) nftClaimed;
// Mapping to store epochs
mapping(uint256 => EpochDetails) epochs;
// To claim ethers
address payable public escrow = payable(0x826FE181baAf7464ee58ccFA2a2514D0F86a96b6);
// To get royalties
address payable public secondary = payable(0xDC4bCa7958000EF99e8C3dC5A63707D3c2a1C39e);
/********************/
/** MODIFIERS **/
/********************/
// This means that if the smart contract is frozen by the owner, the
// function is executed an exception is thrown
modifier onlyWhenNotFreeze() {
require(!freeze, 'UNDW3 Lacoste: frozen !');
_;
}
/********************/
/** CONSTRUCTOR **/
/********************/
constructor(
string memory _blindURI
) ERC721("UNDW3 Lacoste", "UNDW3") {
blindURI = _blindURI;
// Init epochs
// TODO check epochs
epochs[1] = EpochDetails(2,4924,0,1655201520,1655283600);
epochs[2] = EpochDetails(1,5838,0,1655302320,1655373600);
epochs[3] = EpochDetails(3,11212,0,1655400780,0);
epochs[4] = EpochDetails(1,450,0,1655287920,0);
}
/******************************/
/** ONLYOWNER Functions **/
/******************************/
/// @notice reveal now, called only by owner
/// @dev reveal metadata for NFTs
function revealNow()
external
onlyOwner
{
reveal = true;
}
/// @notice freeze now, called only by owner
/// @dev freeze minting
function freezeNow()
external
onlyOwner
onlyWhenNotFreeze
{
freeze = true;
}
/// @notice setURIs, called only by owner
/// @dev set Base and Blind URI
function setURIs(
string memory _URI
)
external
onlyOwner
{
baseURI = _URI;
}
/// @notice updateEpochs, called only by owner and when smart contract is activated
/// @dev update epochs
/// @param _index, index of the epoch (1 : Lacoste List, 2: Premint, 3: Public, 4: FreeMint)
/// @param _start, starting date of the epoch
/// @param _end, ending date of the epoch
function updateEpochs(uint256 _index, uint256 _start, uint256 _end)
external
onlyOwner
onlyWhenNotFreeze
{
epochs[_index].startDate = _start;
epochs[_index].endDate = _end;
}
/// @notice updateRemainingSupplyByEpoch, called only by owner and when smart contract is activated
/// @dev to update the remaining supply for a specidic epoch
/// @param _index, index of the epoch (1 : Lacoste List, 2: Premint, 3: Public, 4: FreeMint)
/// @param _supply, remaining supply
function updateRemainingSupplyByEpoch(uint256 _index, uint256 _supply)
external
onlyOwner
onlyWhenNotFreeze
{
epochs[_index].maxTotal = _supply;
}
/// @notice mintByOwner, called only by owner
/// @dev mint one NFT for a given address (for giveaway and partnerships)
/// @param _to, address to mint NFT
function mintByOwner(
address _to
)
external
onlyOwner
{
require(block.timestamp >= epochs[4].startDate, "UNDW3 Lacoste: not active yet");
require(totalSupply() + 1 <= MAX_NFT, "UNDW3 Lacoste: Tokens number to mint cannot exceed number of MAX tokens");
require(epochs[4].supply + 1 <= epochs[4].maxTotal, "UNDW3 Lacoste: giveway number cannot exceed the MAX_GIVEWAY");
_setRoyalties(totalSupply(), secondary, 400);
_safeMint(_to, totalSupply());
epochs[4].supply += 1;
}
/// @notice mintByOwner, called only by owner
/// @dev mint multiple NFTs for a set of addresses (for giveaway and partnerships)
/// @param _to, list of addresses to mint NFT
function mintMultipleByOwner(
address[] memory _to
)
external
onlyOwner
{
require(block.timestamp >= epochs[4].startDate, "UNDW3 Lacoste: not active yet");
require(totalSupply() + _to.length <= MAX_NFT, "UNDW3 Lacoste: Tokens number to mint cannot exceed number of MAX tokens");
require(epochs[4].supply + _to.length <= epochs[4].maxTotal, "UNDW3 Lacoste: giveway number cannot exceed the MAX_GIVEWAY");
for(uint256 i = 0; i < _to.length; i++){
_setRoyalties(totalSupply(), secondary, 400);
_safeMint(_to[i], totalSupply());
epochs[4].supply += 1;
}
}
/// @notice setRoot, called only by owner
/// @dev set the root of merkle tree to check the whitelist
/// @param _root, root of merkle tree
function setRoot(uint256 _root)
onlyOwner
public
{
root = bytes32(_root);
if(block.timestamp > epochs[1].endDate && block.timestamp < epochs[2].startDate){
epochs[2].maxTotal += epochs[1].maxTotal - epochs[1].supply;
}
}
/// @notice claim, called only by owner
/// @dev claim the raised funds and send it to the escrow wallet
// https://solidity-by-example.org/sending-ether
function claim()
external
onlyOwner
{
// Send returns a boolean value indicating success or failure.
(bool sent, ) = escrow.call{value: address(this).balance}("");
require(sent, "UNDW3 Lacoste: Failed to send Ether");
}
/******************************/
/** Public Functions **/
/******************************/
/// @notice mintNFT, called only by owner
/// @dev mint new NFTs, it is payable. Amount is caulated as per (NFTPrice.mul(_numOfTokens))
/// @param _numOfTokens, number of NFT a mint
/// @param _proof, proof of whitelisting
function mintNFT(
uint256 _numOfTokens,
bytes32[] memory _proof
)
public
payable
onlyWhenNotFreeze
{
require(block.timestamp >= epochs[1].startDate, "UNDW3 Lacoste: too early");
require(totalSupply() + _numOfTokens <= MAX_NFT - epochs[4].maxTotal, "UNDW3 Lacoste: Tokens number to mint cannot exceed number of MAX tokens");
// Epoch 1
if (block.timestamp >= epochs[1].startDate && block.timestamp <= epochs[1].endDate) _mintNFT(_numOfTokens, _proof, 1, msg.sender);
// Epoch 2
else if (block.timestamp >= epochs[2].startDate && block.timestamp <= epochs[2].endDate) {
_mintNFT(_numOfTokens, _proof, 2, msg.sender);
}
// Epoch 3
else if (block.timestamp >= epochs[3].startDate) {
epochs[3].maxTotal = MAX_NFT - epochs[1].supply - epochs[2].supply - epochs[4].maxTotal;
_mintNFT(_numOfTokens, _proof, 3, msg.sender);
}
else if((block.timestamp > epochs[1].endDate && block.timestamp < epochs[2].startDate)
|| block.timestamp > epochs[2].endDate && block.timestamp < epochs[3].startDate) {
revert("UNDW3 Lacoste: smart contract disabled !");
}
}
/// @notice tokenURI
/// @dev get token URI of given token ID. URI will be blank untill totalSupply reaches MAX_NFT_PUBLIC
/// @param _tokenId, token ID NFT
/// @return URI
function tokenURI(
uint256 _tokenId
)
public
view
virtual
override
returns (string memory)
{
require(_exists(_tokenId), "UNDW3 Lacoste: URI query for nonexistent token");
if (!reveal) {
return blindURI;
} else {
return baseURI;
}
}
/// @notice verify (openzeppelin)
/// @dev get token URI of given token ID. URI will be blank untill totalSupply reaches MAX_NFT_PUBLIC
/// @param proof, proof of whitelisting
/// @param leaf, leaf of merkle tree
/// @return boolean, true or false
function verify(bytes32[] memory proof, bytes32 leaf)
public
view
returns (bool)
{
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = sha256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = sha256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
/// @notice getEpochsInfo
/// @dev get epochs details
/// @param _index, index of the epoch (1 : Lacoste List, 2: Premint, 3: Public, 4: FreeMint)
/// @return epochs details
function getEpochsInfo(uint256 _index)
public
view
returns (EpochDetails memory) {
return epochs[_index];
}
/// @notice royaltyInfo
/// @dev get royalties for Mintable using the ERC2981 standard
/// @param _tokenId, token ID NFT
/// returns receiver address, address (secondary wallet)
/// returns royaltyAmount, royality amount to send to the owner
function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
external
view
returns (address receiver, uint256 royaltyAmount)
{
//use the same royalties that were saved for LooksRare
LibPart.Part[] memory _royalties = royalties[_tokenId];
if (_royalties.length > 0) {
return (
_royalties[0].account,
(_salePrice * _royalties[0].value) / 10000
);
}
return (address(0), 0);
}
/// @notice supportsInterface
/// @dev used to use the ERC2981 standard
/// @param interfaceId, ERC2981 interface
/// @return bool, true or false
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721Enumerable)
returns (bool)
{
if (interfaceId == LibRoyaltiesV2._INTERFACE_ID_ROYALTIES) {
return true;
}
if (interfaceId == _INTERFACE_ID_ERC2981) {
return true;
}
return super.supportsInterface(interfaceId);
}
/******************************/
/** Internal Functions **/
/******************************/
// Standard functions to be overridden (openzeppelin)
function _beforeTokenTransfer(
address _from,
address _to,
uint256 _tokenId
)
internal
override(ERC721Enumerable)
{
super._beforeTokenTransfer(_from, _to, _tokenId);
}
/// @notice _mintNFT, internal function
/// @dev mint new NFTs and verify all epochs and conditions
/// @param _numOfTokens, number of NFT a mint
/// @param _proof, proof of whitelisting
/// @param _index, index of the epoch (1 : Lacoste List, 2: Premint, 3: Public, 4: FreeMint)
/// @param _claimer, connected wallet
function _mintNFT(
uint256 _numOfTokens,
bytes32[] memory _proof,
uint256 _index,
address _claimer
)
internal
{
require(block.timestamp >= epochs[_index].startDate, "UNDW3 Lacoste: too early");
if(_index == 1 || _index == 2) require(verify(_proof, bytes32(uint256(uint160(_claimer)))), "UNDW3 Lacoste: Not whitelisted");
require(_numOfTokens <= epochs[_index].maxPerWallet , "UNDW3 Lacoste: Cannot mint above limit");
require(_getClaimedNFT(_index, _claimer) + _numOfTokens<= epochs[_index].maxPerWallet , "UNDW3 Lacoste: Cannot mint above limit for one address");
require(epochs[_index].supply + _numOfTokens <= epochs[_index].maxTotal, "UNDW3 Lacoste: Purchase would exceed max public supply of NFTs");
require(msg.value >= NFTPrice * _numOfTokens, "UNDW3 Lacoste: Ether value sent is not correct");
for (uint256 i = 0; i < _numOfTokens; i++) {
_setRoyalties(totalSupply(), secondary, 400);
_safeMint(_claimer, totalSupply());
}
_updateClaimedNFT(_index, _claimer, _numOfTokens);
}
/// @notice _getClaimedNFT, internal function
/// @dev get the number of NFT minted by a specific address by epoch
/// @param _claimer, connected wallet
function _getClaimedNFT(
uint256 _index,
address _claimer
)
internal
view
returns (uint256 _num)
{
return nftClaimed [_claimer][_index];
}
/// @notice _updateClaimedNFT, internal function
/// @dev update the supply and the claimed NFTs after minting (for each epoch/claimer)
/// @param _numOfTokens, number of NFT a mint
function _updateClaimedNFT(
uint256 _index,
address _claimer,
uint256 _numOfTokens
)
internal
{
nftClaimed [_claimer][_index] += _numOfTokens;
epochs[_index].supply += _numOfTokens;
}
/// @notice _setRoyalties, internal function
/// @dev configure royalties details for each NFT minted (secondary market)
/// @param _tokenId, token ID
/// @param _royaltiesRecipientAddress, the secondary wallet to collect royalities (secondary wallet)
/// @param _percentageBasisPoints, percentage for the secondary wallet
function _setRoyalties(
uint256 _tokenId,
address payable _royaltiesRecipientAddress,
uint96 _percentageBasisPoints)
internal
{
LibPart.Part[] memory _royalties = new LibPart.Part[](1);
_royalties[0].value = _percentageBasisPoints;
_royalties[0].account = _royaltiesRecipientAddress;
_saveRoyalties(_tokenId, _royalties);
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
LibPart.sol 16 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Needed for Rarible secondary sales royalties
library LibPart {
bytes32 public constant TYPE_HASH = keccak256("Part(address account,uint96 value)");
struct Part {
address payable account;
uint96 value;
}
function hash(Part memory part) internal pure returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, part.account, part.value));
}
}
RoyaltiesV2.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma abicoder v2;
import "./LibPart.sol";
// Needed for Rarible secondary sales royalties
interface RoyaltiesV2 {
event RoyaltiesSet(uint256 tokenId, LibPart.Part[] royalties);
function getRaribleV2Royalties(uint256 id) external view returns (LibPart.Part[] memory);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
LibRoyaltiesV2.sol 11 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//Needed for Rarible secondary sales royalties
library LibRoyaltiesV2 {
/*
* bytes4(keccak256('getRaribleV2Royalties(uint256)')) == 0xcad96cca
*/
bytes4 constant _INTERFACE_ID_ROYALTIES = 0xcad96cca;
}
RoyaltiesV2Impl.sol 17 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./AbstractRoyalties.sol";
import "../RoyaltiesV2.sol";
contract RoyaltiesV2Impl is AbstractRoyalties, RoyaltiesV2 {
function getRaribleV2Royalties(uint256 id) override external view returns (LibPart.Part[] memory) {
return royalties[id];
}
function _onRoyaltiesSet(uint256 id, LibPart.Part[] memory _royalties) override internal {
emit RoyaltiesSet(id, _royalties);
}
}
AbstractRoyalties.sol 33 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../LibPart.sol";
//Needed for Rarible secondary sales royalties
abstract contract AbstractRoyalties {
mapping (uint256 => LibPart.Part[]) internal royalties;
function _saveRoyalties(uint256 id, LibPart.Part[] memory _royalties) internal {
uint256 totalValue;
for (uint i = 0; i < _royalties.length; i++) {
require(_royalties[i].account != address(0x0), "Recipient should be present");
require(_royalties[i].value != 0, "Royalty value should be positive");
totalValue += _royalties[i].value;
royalties[id].push(_royalties[i]);
}
require(totalValue < 10000, "Royalty total value should be < 10000");
_onRoyaltiesSet(id, _royalties);
}
function _updateAccount(uint256 _id, address _from, address _to) internal {
uint length = royalties[_id].length;
for(uint i = 0; i < length; i++) {
if (royalties[_id][i].account == _from) {
royalties[_id][i].account = payable(address(uint160(_to)));
}
}
}
function _onRoyaltiesSet(uint256 id, LibPart.Part[] memory _royalties) virtual internal;
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 163 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @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 override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
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);
/**
* @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
MAX_NFT 0x6fdaddf1 → uint256
NFTPrice 0xa38bffda → uint256
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
blindURI 0xeff95537 → string
escrow 0xe2fdcc17 → address
freeze 0x62a5af3b → bool
getApproved 0x081812fc → address
getEpochsInfo 0xe9ffdfd7 → tuple
getRaribleV2Royalties 0xcad96cca → tuple[]
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
reveal 0xa475b5dd → bool
root 0xebf0c717 → bytes32
royaltyInfo 0x2a55205a → address, uint256
secondary 0x9d3c8cc4 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
verify 0x972a2a62 → bool
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
claim 0x4e71d92d
No parameters
freezeNow 0x3d443782
No parameters
mintByOwner 0xb533731d
address _to
mintMultipleByOwner 0x4cdb4400
address[] _to
mintNFT 0xd62fd296
uint256 _numOfTokens
bytes32[] _proof
renounceOwnership 0x715018a6
No parameters
revealNow 0x5f0f45b2
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setRoot 0xf2f5a7e5
uint256 _root
setURIs 0x3031fa1a
string _URI
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateEpochs 0x11f8d07e
uint256 _index
uint256 _start
uint256 _end
updateRemainingSupplyByEpoch 0x06614295
uint256 _index
uint256 _supply
Recent Transactions
No transactions found for this address