Address Contract Verified
Address
0x49D02b5F8Be84Df003203303a396bA597b0D6961
Balance
0 ETH
Nonce
1
Code Size
15249 bytes
Creator
0x5E7852b7...a557 at tx 0x84f336d4...92bd37
Indexed Transactions
0
Contract Bytecode
15249 bytes
0x6080604052600436106101b65760003560e01c8063894cadcb116100ec578063cd7c03261161008a578063f0c68e4311610064578063f0c68e43146104e8578063f242432a14610508578063f2fde38b14610528578063f94d05611461054857600080fd5b8063cd7c032614610488578063e985e9c5146104a8578063eff59aad146104c857600080fd5b806395d89b41116100c657806395d89b411461042057806396c5517514610435578063a22cb46514610448578063ca4b208b1461046857600080fd5b8063894cadcb146103cf5780638da5cb5b146103ef578063924e0df41461040d57600080fd5b80632eb2c2d6116101595780634e1273f4116101335780634e1273f4146103415780634f64b2be1461036e5780635b1d1c1f146103a5578063715018a6146103ba57600080fd5b80632eb2c2d6146102d45780633ccfd60b146102f45780634c00de821461030957600080fd5b806306fdde031161019557806306fdde03146102405780630e89341c146102625780632a55205a146102825780632d945cb9146102c157600080fd5b8062fdd58e146101bb57806301ffc9a7146101ee57806302fa7c471461021e575b600080fd5b3480156101c757600080fd5b506101db6101d6366004612fa2565b610568565b6040519081526020015b60405180910390f35b3480156101fa57600080fd5b5061020e610209366004612ffc565b610614565b60405190151581526020016101e5565b34801561022a57600080fd5b5061023e610239366004613020565b61061f565b005b34801561024c57600080fd5b50610255610687565b6040516101e591906130c2565b34801561026e57600080fd5b5061025561027d3660046130d5565b610715565b34801561028e57600080fd5b506102a261029d3660046130ee565b6107ba565b604080516001600160a01b0390931683526020830191909152016101e5565b61023e6102cf366004613110565b610897565b3480156102e057600080fd5b5061023e6102ef3660046132f8565b610c63565b34801561030057600080fd5b5061023e610cfe565b34801561031557600080fd5b50600a54610329906001600160a01b031681565b6040516001600160a01b0390911681526020016101e5565b34801561034d57600080fd5b5061036161035c3660046133a6565b610fc1565b6040516101e591906134ae565b34801561037a57600080fd5b5061038e6103893660046130d5565b6110ff565b6040516101e59b9a999897969594939291906134c1565b3480156103b157600080fd5b506102556111e1565b3480156103c657600080fd5b5061023e6111ee565b3480156103db57600080fd5b5061023e6103ea366004613527565b611254565b3480156103fb57600080fd5b506005546001600160a01b0316610329565b61023e61041b366004613110565b6113d8565b34801561042c57600080fd5b5061025561180e565b61023e610443366004613560565b61181b565b34801561045457600080fd5b5061023e61046336600461357d565b6119d1565b34801561047457600080fd5b50600954610329906001600160a01b031681565b34801561049457600080fd5b50600854610329906001600160a01b031681565b3480156104b457600080fd5b5061020e6104c33660046135b0565b6119dc565b3480156104d457600080fd5b5061023e6104e33660046135de565b611ab5565b3480156104f457600080fd5b5061023e610503366004613674565b611b98565b34801561051457600080fd5b5061023e610523366004613715565b611c5c565b34801561053457600080fd5b5061023e610543366004613560565b611cf7565b34801561055457600080fd5b5061023e61056336600461377e565b611dd9565b60006001600160a01b0383166105eb5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b600061060e82611e46565b6005546001600160a01b031633146106795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b6106838282611e9c565b5050565b600c8054610694906137b3565b80601f01602080910402602001604051908101604052809291908181526020018280546106c0906137b3565b801561070d5780601f106106e25761010080835404028352916020019161070d565b820191906000526020600020905b8154815290600101906020018083116106f057829003601f168201915b505050505081565b6000818152600760205260409020600901805460609190610735906137b3565b80601f0160208091040260200160405190810160405280929190818152602001828054610761906137b3565b80156107ae5780601f10610783576101008083540402835291602001916107ae565b820191906000526020600020905b81548152906001019060200180831161079157829003601f168201915b50505050509050919050565b60008281526004602090815260408083208151808301909252546001600160a01b038116808352740100000000000000000000000000000000000000009091046bffffffffffffffffffffffff1692820192909252829161085b5750604080518082019091526003546001600160a01b03811682527401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1660208201525b60208101516000906127109061087f906bffffffffffffffffffffffff1687613835565b61088991906138a1565b915196919550909350505050565b6006548411156108e95760405162461bcd60e51b815260206004820152601060248201527f696e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016105e2565b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b16602082015260009060340160408051601f1981840301815260208581028085018201909352858452909350610986929186918691829185019084908082843760009201829052508a8152600760205260409020600a01549250610981915061097b905089611fc7565b856120fc565b61212f565b6109d25760405162461bcd60e51b815260206004820152600d60248201527f696e76616c69642070726f6f660000000000000000000000000000000000000060448201526064016105e2565b60008581526007602052604090206006015442118015610a13575060008581526007602052604090206008810154600690910154610a1091906138b5565b42105b610a5f5760405162461bcd60e51b815260206004820152601060248201527f746f6b656e206e6f74206163746976650000000000000000000000000000000060448201526064016105e2565b60008581526007602052604090206003015415610af45760008581526007602090815260408083206003810154338552600b90910190925290912054610aa69086906138b5565b1115610af45760405162461bcd60e51b815260206004820152601b60248201527f6578636565647320616c6c6f776c69737420616c6c6f77616e6365000000000060448201526064016105e2565b60008581526007602052604090206004015415610b7d5760008581526007602052604090206004810154600590910154610b2f9086906138b5565b1115610b7d5760405162461bcd60e51b815260206004820152601460248201527f6578636565647320746f74616c20737570706c7900000000000000000000000060448201526064016105e2565b6000858152600760205260409020600201543490610b9b9086613835565b14610be85760405162461bcd60e51b815260206004820152600d60248201527f696e76616c69642076616c75650000000000000000000000000000000000000060448201526064016105e2565b6000858152600760209081526040808320338452600b0190915281208054869290610c149084906138b5565b909155505060008581526007602052604081206005018054869290610c3a9084906138b5565b92505081905550610c5c33868660405180602001604052806000815250612145565b5050505050565b6001600160a01b038516331480610c7f5750610c7f85336119dc565b610cf15760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f766564000000000000000000000000000060648201526084016105e2565b610c5c858585858561226b565b6005546001600160a01b03163314610d585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b4780610da65760405162461bcd60e51b815260206004820152601560248201527f6e6f20746f6b656e7320746f207769746864726177000000000000000000000060448201526064016105e2565b610271681b1ae4d6e2ef500000821115610dc35750610145610e23565b680d8d726b7177a800008210610ddc5750610177610e23565b68056bc75e2d631000008210610df557506101c2610e23565b68049b9ca9a6943400008210610e0e57506101fe610e23565b6802b5e3af16b18800008210610e2357506102265b6000612710610e328385613835565b610e3c91906138a1565b9050610e4881846138cd565b6009546040519194506000916001600160a01b039091169083908381818185875af1925050503d8060008114610e9a576040519150601f19603f3d011682016040523d82523d6000602084013e610e9f565b606091505b5050905080610f165760405162461bcd60e51b815260206004820152602160248201527f646576656c6f706572206661696c656420746f2072656365697665206574686560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084016105e2565b6005546040516001600160a01b03909116908590600081818185875af1925050503d8060008114610f63576040519150601f19603f3d011682016040523d82523d6000602084013e610f68565b606091505b50508091505080610fbb5760405162461bcd60e51b815260206004820152601760248201527f6661696c656420746f207265636569766520657468657200000000000000000060448201526064016105e2565b50505050565b6060815183511461103a5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d61746368000000000000000000000000000000000000000000000060648201526084016105e2565b6000835167ffffffffffffffff81111561105657611056613193565b60405190808252806020026020018201604052801561107f578160200160208202803683370190505b50905060005b84518110156110f7576110ca8582815181106110a3576110a36138e4565b60200260200101518583815181106110bd576110bd6138e4565b6020026020010151610568565b8282815181106110dc576110dc6138e4565b60209081029190910101526110f081613913565b9050611085565b509392505050565b6007602052806000526040600020600091509050806000015490806001015490806002015490806003015490806004015490806005015490806006015490806007015490806008015490806009018054611158906137b3565b80601f0160208091040260200160405190810160405280929190818152602001828054611184906137b3565b80156111d15780601f106111a6576101008083540402835291602001916111d1565b820191906000526020600020905b8154815290600101906020018083116111b457829003601f168201915b50505050509080600a015490508b565b600b8054610694906137b3565b6005546001600160a01b031633146112485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b6112526000612509565b565b6005546001600160a01b031633146112ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b600083815260076020526040902060065484111561130e5760405162461bcd60e51b815260206004820152601060248201527f696e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016105e2565b806004015483826005015461132391906138b5565b11156113715760405162461bcd60e51b815260206004820152601460248201527f6578636565647320746f74616c20737570706c7900000000000000000000000060448201526064016105e2565b6001600160a01b0382166000908152600b820160205260408120805485929061139b9084906138b5565b92505081905550828160050160008282546113b691906138b5565b92505081905550610fbb82858560405180602001604052806000815250612145565b60065484111561142a5760405162461bcd60e51b815260206004820152601060248201527f696e76616c696420746f6b656e2069640000000000000000000000000000000060448201526064016105e2565b6000848152600760205260409020600881015460069091015461144d91906138b5565b4211801561146c57506000848152600760208190526040909120015442105b6114b85760405162461bcd60e51b815260206004820152601060248201527f746f6b656e206e6f74206163746976650000000000000000000000000000000060448201526064016105e2565b600084815260076020526040902060010154156116a9576040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b16602082015260009060340160408051601f1981840301815260208581028085018201909352858452909350611561929186918691829185019084908082843760009201829052508a8152600760205260409020600a01549250610981915061097b905089611fc7565b15611629576000858152600760205260409020600381015460019091015461158991906138b5565b6000868152600760209081526040808320338452600b019091529020546115b19086906138b5565b11156116245760405162461bcd60e51b8152602060048201526024808201527f65786365656473207075626c6963202b20616c6c6f776c69737420616c6c6f7760448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016105e2565b6116a7565b60008581526007602090815260408083206001810154338552600b909101909252909120546116599086906138b5565b11156116a75760405162461bcd60e51b815260206004820152601860248201527f65786365656473207075626c696320616c6c6f77616e6365000000000000000060448201526064016105e2565b505b6000848152600760205260409020600401541561173257600084815260076020526040902060048101546005909101546116e49085906138b5565b11156117325760405162461bcd60e51b815260206004820152601460248201527f6578636565647320746f74616c20737570706c7900000000000000000000000060448201526064016105e2565b600084815260076020526040902054349061174d9085613835565b1461179a5760405162461bcd60e51b815260206004820152601360248201527f696e76616c69642065746865722076616c75650000000000000000000000000060448201526064016105e2565b6000848152600760209081526040808320338452600b01909152812080548592906117c69084906138b5565b9091555050600084815260076020526040812060050180548592906117ec9084906138b5565b92505081905550610fbb33858560405180602001604052806000815250612145565b600d8054610694906137b3565b6005546001600160a01b031633146118755760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b6000805b60065481116118d957600061188e8483610568565b905080156118c6576000828152600760205260409020546118af9082613835565b6118b990846138b5565b92506118c6848383612573565b50806118d181613913565b915050611879565b503481146119295760405162461bcd60e51b815260206004820152600e60248201527f696e76616c696420616d6f756e7400000000000000000000000000000000000060448201526064016105e2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611976576040519150601f19603f3d011682016040523d82523d6000602084013e61197b565b606091505b50509050806119cc5760405162461bcd60e51b815260206004820152601760248201527f6661696c656420746f207265636569766520657468657200000000000000000060448201526064016105e2565b505050565b610683338383612720565b6008546040517fc45527910000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260009281169190841690829063c455279190602401602060405180830381865afa158015611a47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6b919061394b565b6001600160a01b031603611a8357600191505061060e565b6001600160a01b0380851660009081526001602090815260408083209387168352929052205460ff165b949350505050565b6005546001600160a01b03163314611b0f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b6006805460009081526007602081815260409092208d8155600181018d9055600281018c9055600381018b9055600481018a90559283018890558201869055600882018590558351611b6991600984019190860190612ef4565b508181600a0181905550600160066000828254611b8691906138b5565b90915550505050505050505050505050565b6005546001600160a01b03163314611bf25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b60008b81526007602081815260409092208c8155600181018c9055600281018b9055600381018a905560048101899055600681018890559081018690556008810185905583519091611c4b916009840191860190612ef4565b50600a015550505050505050505050565b6001600160a01b038516331480611c785750611c7885336119dc565b611cea5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f766564000000000000000000000000000000000000000000000060648201526084016105e2565b610c5c8585858585612832565b6005546001600160a01b03163314611d515760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b6001600160a01b038116611dcd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105e2565b611dd681612509565b50565b6005546001600160a01b03163314611e335760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105e2565b805161068390600b906020840190612ef4565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f2a55205a00000000000000000000000000000000000000000000000000000000148061060e575061060e826129fb565b6127106bffffffffffffffffffffffff82161115611f225760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c2065786365656460448201527f2073616c6550726963650000000000000000000000000000000000000000000060648201526084016105e2565b6001600160a01b038216611f785760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016105e2565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff90911660209092018290527401000000000000000000000000000000000000000090910217600355565b60608160000361200a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612034578061201e81613913565b915061202d9050600a836138a1565b915061200e565b60008167ffffffffffffffff81111561204f5761204f613193565b6040519080825280601f01601f191660200182016040528015612079576020820181803683370190505b5090505b8415611aad5761208e6001836138cd565b915061209b600a86613968565b6120a69060306138b5565b60f81b8183815181106120bb576120bb6138e4565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506120f5600a866138a1565b945061207d565b6000818360405160200161211192919061397c565b60405160208183030381529060405280519060200120905092915050565b60008261213c8584612ade565b14949350505050565b6001600160a01b0384166121c15760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016105e2565b336121db816000876121d288612b4a565b610c5c88612b4a565b6000848152602081815260408083206001600160a01b03891684529091528120805485929061220b9084906138b5565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610c5c81600087878787612b95565b81518351146122e25760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d6174636800000000000000000000000000000000000000000000000060648201526084016105e2565b6001600160a01b03841661235e5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105e2565b3360005b845181101561249b57600085828151811061237f5761237f6138e4565b60200260200101519050600085838151811061239d5761239d6138e4565b602090810291909101810151600084815280835260408082206001600160a01b038e1683529093529190912054909150818110156124435760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016105e2565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906124809084906138b5565b925050819055505050508061249490613913565b9050612362565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516124eb9291906139ab565b60405180910390a4612501818787878787612d99565b505050505050565b600580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0383166125ef5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016105e2565b3361261f8185600061260087612b4a565b61260987612b4a565b5050604080516020810190915260009052505050565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156126b55760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e63650000000000000000000000000000000000000000000000000000000060648201526084016105e2565b6000848152602081815260408083206001600160a01b03898116808652918452828520888703905582518981529384018890529092908616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b816001600160a01b0316836001600160a01b0316036127a75760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c66000000000000000000000000000000000000000000000060648201526084016105e2565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166128ae5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016105e2565b336128be8187876121d288612b4a565b6000848152602081815260408083206001600160a01b038a168452909152902054838110156129555760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e736665720000000000000000000000000000000000000000000060648201526084016105e2565b6000858152602081815260408083206001600160a01b038b81168552925280832087850390559088168252812080548692906129929084906138b5565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46129f2828888888888612b95565b50505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fd9b67a26000000000000000000000000000000000000000000000000000000001480612a8e57507fffffffff0000000000000000000000000000000000000000000000000000000082167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061060e57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161461060e565b600081815b84518110156110f7576000858281518110612b0057612b006138e4565b60200260200101519050808311612b265760008381526020829052604090209250612b37565b600081815260208490526040902092505b5080612b4281613913565b915050612ae3565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612b8457612b846138e4565b602090810291909101015292915050565b6001600160a01b0384163b15612501576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190612bf290899089908890889088906004016139d9565b6020604051808303816000875af1925050508015612c2d575060408051601f3d908101601f19168201909252612c2a91810190613a1c565b60015b612ce257612c39613a39565b806308c379a003612c725750612c4d613a55565b80612c585750612c74565b8060405162461bcd60e51b81526004016105e291906130c2565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e74657200000000000000000000000060648201526084016105e2565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e6100000000000000000000000000000000000000000000000000000000146129f25760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016105e2565b6001600160a01b0384163b15612501576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c8190612df69089908990889088908890600401613afd565b6020604051808303816000875af1925050508015612e31575060408051601f3d908101601f19168201909252612e2e91810190613a1c565b60015b612e3d57612c39613a39565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c8100000000000000000000000000000000000000000000000000000000146129f25760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e7300000000000000000000000000000000000000000000000060648201526084016105e2565b828054612f00906137b3565b90600052602060002090601f016020900481019282612f225760008555612f68565b82601f10612f3b57805160ff1916838001178555612f68565b82800160010185558215612f68579182015b82811115612f68578251825591602001919060010190612f4d565b50612f74929150612f78565b5090565b5b80821115612f745760008155600101612f79565b6001600160a01b0381168114611dd657600080fd5b60008060408385031215612fb557600080fd5b8235612fc081612f8d565b946020939093013593505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611dd657600080fd5b60006020828403121561300e57600080fd5b813561301981612fce565b9392505050565b6000806040838503121561303357600080fd5b823561303e81612f8d565b915060208301356bffffffffffffffffffffffff8116811461305f57600080fd5b809150509250929050565b60005b8381101561308557818101518382015260200161306d565b83811115610fbb5750506000910152565b600081518084526130ae81602086016020860161306a565b601f01601f19169290920160200192915050565b6020815260006130196020830184613096565b6000602082840312156130e757600080fd5b5035919050565b6000806040838503121561310157600080fd5b50508035926020909101359150565b6000806000806060858703121561312657600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561314c57600080fd5b818701915087601f83011261316057600080fd5b81358181111561316f57600080fd5b8860208260051b850101111561318457600080fd5b95989497505060200194505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156131e8576131e8613193565b6040525050565b600067ffffffffffffffff82111561320957613209613193565b5060051b60200190565b600082601f83011261322457600080fd5b81356020613231826131ef565b60405161323e82826131c2565b83815260059390931b850182019282810191508684111561325e57600080fd5b8286015b848110156132795780358352918301918301613262565b509695505050505050565b600082601f83011261329557600080fd5b813567ffffffffffffffff8111156132af576132af613193565b6040516132c66020601f19601f85011601826131c2565b8181528460208386010111156132db57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561331057600080fd5b853561331b81612f8d565b9450602086013561332b81612f8d565b9350604086013567ffffffffffffffff8082111561334857600080fd5b61335489838a01613213565b9450606088013591508082111561336a57600080fd5b61337689838a01613213565b9350608088013591508082111561338c57600080fd5b5061339988828901613284565b9150509295509295909350565b600080604083850312156133b957600080fd5b823567ffffffffffffffff808211156133d157600080fd5b818501915085601f8301126133e557600080fd5b813560206133f2826131ef565b6040516133ff82826131c2565b83815260059390931b850182019282810191508984111561341f57600080fd5b948201945b8386101561344657853561343781612f8d565b82529482019490820190613424565b9650508601359250508082111561345c57600080fd5b5061346985828601613213565b9150509250929050565b600081518084526020808501945080840160005b838110156134a357815187529582019590820190600101613487565b509495945050505050565b6020815260006130196020830184613473565b60006101608d83528c60208401528b60408401528a60608401528960808401528860a08401528760c08401528660e0840152856101008401528061012084015261350d81840186613096565b915050826101408301529c9b505050505050505050505050565b60008060006060848603121561353c57600080fd5b8335925060208401359150604084013561355581612f8d565b809150509250925092565b60006020828403121561357257600080fd5b813561301981612f8d565b6000806040838503121561359057600080fd5b823561359b81612f8d565b91506020830135801515811461305f57600080fd5b600080604083850312156135c357600080fd5b82356135ce81612f8d565b9150602083013561305f81612f8d565b6000806000806000806000806000806101408b8d0312156135fe57600080fd5b8a35995060208b0135985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013567ffffffffffffffff81111561364e57600080fd5b61365a8d828e01613284565b9250506101208b013590509295989b9194979a5092959850565b60008060008060008060008060008060006101608c8e03121561369657600080fd5b8b359a5060208c0135995060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c013593506101008c013592506101208c013567ffffffffffffffff8111156136ee57600080fd5b6136fa8e828f01613284565b9250506101408c013590509295989b509295989b9093969950565b600080600080600060a0868803121561372d57600080fd5b853561373881612f8d565b9450602086013561374881612f8d565b93506040860135925060608601359150608086013567ffffffffffffffff81111561377257600080fd5b61339988828901613284565b60006020828403121561379057600080fd5b813567ffffffffffffffff8111156137a757600080fd5b611aad84828501613284565b600181811c908216806137c757607f821691505b602082108103613800577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561386d5761386d613806565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826138b0576138b0613872565b500490565b600082198211156138c8576138c8613806565b500190565b6000828210156138df576138df613806565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361394457613944613806565b5060010190565b60006020828403121561395d57600080fd5b815161301981612f8d565b60008261397757613977613872565b500690565b6000835161398e81846020880161306a565b8351908301906139a281836020880161306a565b01949350505050565b6040815260006139be6040830185613473565b82810360208401526139d08185613473565b95945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613a1160a0830184613096565b979650505050505050565b600060208284031215613a2e57600080fd5b815161301981612fce565b600060033d1115613a525760046000803e5060005160e01c5b90565b600060443d1015613a635790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715613ab157505050505090565b8285019150815181811115613ac95750505050505090565b843d8701016020828501011115613ae35750505050505090565b613af2602082860101876131c2565b509095945050505050565b60006001600160a01b03808816835280871660208401525060a06040830152613b2960a0830186613473565b8281036060840152613b3b8186613473565b90508281036080840152613b4f8185613096565b9897505050505050505056fea26469706673582212205c363627aad9050317299118e85f240433ff950c1d06dbe9da4531deed02aed764736f6c634300080d0033
Verified Source Code Full Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (10000 runs)
RickhouseDAO.sol 309 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
contract RickhouseDAO is ERC1155, ERC2981, Ownable {
uint256 numTokens = 0;
mapping(uint256 => Token) public tokens;
address public proxyRegistryAddress;
address public developer;
address public royaltyRecipient;
string public docs;
string public name;
string public symbol;
struct Token {
uint256 publicPrice;
uint256 publicAllowance;
uint256 allowlistPrice;
uint256 allowlistAllowance;
uint256 totalSupply;
uint256 minted;
uint256 startTime;
uint256 endTime;
uint256 allowlistDuration;
string uri;
bytes32 merkleRoot;
mapping(address => uint256) addressToMinted;
}
constructor(
address _developer,
address _proxyRegistryAddress,
address payable _royaltyReceiver,
string memory _name,
string memory _symbol,
string memory _docs
) ERC1155("") {
developer = _developer;
proxyRegistryAddress = _proxyRegistryAddress;
docs = _docs;
name = _name;
symbol = _symbol;
_setDefaultRoyalty(_royaltyReceiver, 1000);
}
function _leaf(string memory tokenId, string memory payload)
internal
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(payload, tokenId));
}
function allowlistMint(
uint256 tokenId,
uint256 count,
bytes32[] calldata proof
) external payable {
require(tokenId <= numTokens, "invalid token id");
string memory payload = string(abi.encodePacked(msg.sender));
require(
MerkleProof.verify(
proof,
tokens[tokenId].merkleRoot,
_leaf(Strings.toString(tokenId), payload)
),
"invalid proof"
);
require(
block.timestamp > tokens[tokenId].startTime &&
block.timestamp <
tokens[tokenId].startTime + tokens[tokenId].allowlistDuration,
"token not active"
);
if (tokens[tokenId].allowlistAllowance > 0) {
require(
tokens[tokenId].addressToMinted[msg.sender] + count <=
tokens[tokenId].allowlistAllowance,
"exceeds allowlist allowance"
);
}
if (tokens[tokenId].totalSupply > 0) {
require(
tokens[tokenId].minted + count <= tokens[tokenId].totalSupply,
"exceeds total supply"
);
}
require(
count * tokens[tokenId].allowlistPrice == msg.value,
"invalid value"
);
tokens[tokenId].addressToMinted[msg.sender] += count;
tokens[tokenId].minted += count;
_mint(msg.sender, tokenId, count, "");
}
function publicMint(
uint256 tokenId,
uint256 count,
bytes32[] calldata proof
) external payable {
require(tokenId <= numTokens, "invalid token id");
require(
block.timestamp >
tokens[tokenId].startTime + tokens[tokenId].allowlistDuration &&
block.timestamp < tokens[tokenId].endTime,
"token not active"
);
if (tokens[tokenId].publicAllowance > 0) {
string memory payload = string(abi.encodePacked(msg.sender));
if (
MerkleProof.verify(
proof,
tokens[tokenId].merkleRoot,
_leaf(Strings.toString(tokenId), payload)
)
) {
require(
tokens[tokenId].addressToMinted[msg.sender] + count <=
tokens[tokenId].publicAllowance +
tokens[tokenId].allowlistAllowance,
"exceeds public + allowlist allowance"
);
} else {
require(
tokens[tokenId].addressToMinted[msg.sender] + count <=
tokens[tokenId].publicAllowance,
"exceeds public allowance"
);
}
}
if (tokens[tokenId].totalSupply > 0) {
require(
tokens[tokenId].minted + count <= tokens[tokenId].totalSupply,
"exceeds total supply"
);
}
require(
count * tokens[tokenId].publicPrice == msg.value,
"invalid ether value"
);
tokens[tokenId].addressToMinted[msg.sender] += count;
tokens[tokenId].minted += count;
_mint(msg.sender, tokenId, count, "");
}
function freeMint(
uint256 tokenId,
uint256 count,
address to
) public onlyOwner {
Token storage token = tokens[tokenId];
require(tokenId <= numTokens, "invalid token id");
require(
token.minted + count <= token.totalSupply,
"exceeds total supply"
);
token.addressToMinted[to] += count;
token.minted += count;
_mint(to, tokenId, count, "");
}
function addToken(
uint256 _publicPrice,
uint256 _publicAllowance,
uint256 _allowlistPrice,
uint256 _allowlistAllowance,
uint256 _totalSupply,
uint256 _startTime,
uint256 _endTime,
uint256 _allowlistDuration,
string memory _uri,
bytes32 _merkleRoot
) public onlyOwner {
Token storage token = tokens[numTokens];
token.publicPrice = _publicPrice;
token.publicAllowance = _publicAllowance;
token.allowlistPrice = _allowlistPrice;
token.allowlistAllowance = _allowlistAllowance;
token.totalSupply = _totalSupply;
token.startTime = _startTime;
token.endTime = _endTime;
token.allowlistDuration = _allowlistDuration;
token.uri = _uri;
token.merkleRoot = _merkleRoot;
numTokens += 1;
}
function editToken(
uint256 tokenId,
uint256 _publicPrice,
uint256 _publicAllowance,
uint256 _allowlistPrice,
uint256 _allowlistAllowance,
uint256 _totalSupply,
uint256 _startTime,
uint256 _endTime,
uint256 _allowlistDuration,
string memory _uri,
bytes32 _merkleRoot
) public onlyOwner {
Token storage token = tokens[tokenId];
token.publicPrice = _publicPrice;
token.publicAllowance = _publicAllowance;
token.allowlistPrice = _allowlistPrice;
token.allowlistAllowance = _allowlistAllowance;
token.totalSupply = _totalSupply;
token.startTime = _startTime;
token.endTime = _endTime;
token.allowlistDuration = _allowlistDuration;
token.uri = _uri;
token.merkleRoot = _merkleRoot;
}
function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "no tokens to withdraw");
uint256 rate = 625;
if (balance > 500 ether) {
rate = 325;
} else if (balance >= 250 ether) {
rate = 375;
} else if (balance >= 100 ether) {
rate = 450;
} else if (balance >= 85 ether) {
rate = 510;
} else if (balance >= 50 ether) {
rate = 550;
}
uint256 developerFee = (balance * rate) / 10000;
balance -= developerFee;
(bool success, ) = developer.call{value: developerFee}("");
require(success, "developer failed to receive ether");
(success, ) = owner().call{value: balance}("");
require(success, "failed to receive ether");
}
function kick(address to) external payable onlyOwner {
uint256 etherToReturn = 0;
for (uint256 i = 0; i <= numTokens; i++) {
uint256 balance = balanceOf(to, i);
if (balance > 0) {
etherToReturn += balance * tokens[i].publicPrice;
_burn(to, i, balance);
}
}
require(etherToReturn == msg.value, "invalid amount");
(bool success, ) = to.call{value: etherToReturn}("");
require(success, "failed to receive ether");
}
function setDocs(string memory _docs) external onlyOwner {
docs = _docs;
}
function setRoyaltyInfo(address receiver, uint96 feeBasisPoints)
external
onlyOwner
{
_setDefaultRoyalty(receiver, feeBasisPoints);
}
function isApprovedForAll(address _owner, address operator)
public
view
override
returns (bool)
{
OpenSeaProxyRegistry proxyRegistry = OpenSeaProxyRegistry(
proxyRegistryAddress
);
if (address(proxyRegistry.proxies(_owner)) == operator) return true;
return super.isApprovedForAll(_owner, operator);
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155, ERC2981)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
function uri(uint256 id) public view override returns (string memory) {
return tokens[id].uri;
}
}
contract OwnableDelegateProxy {}
contract OpenSeaProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
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);
}
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
ERC2981.sol 118 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol)
pragma solidity ^0.8.0;
import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
external
view
virtual
override
returns (address, uint256)
{
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `tokenId` must be already minted.
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
ERC1155.sol 464 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
}
/**
* @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, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
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);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
MerkleProof.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
developer 0xca4b208b → address
docs 0x5b1d1c1f → string
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
proxyRegistryAddress 0xcd7c0326 → address
royaltyInfo 0x2a55205a → address, uint256
royaltyRecipient 0x4c00de82 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokens 0x4f64b2be → uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, string, bytes32
uri 0x0e89341c → string
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
addToken 0xeff59aad
uint256 _publicPrice
uint256 _publicAllowance
uint256 _allowlistPrice
uint256 _allowlistAllowance
uint256 _totalSupply
uint256 _startTime
uint256 _endTime
uint256 _allowlistDuration
string _uri
bytes32 _merkleRoot
allowlistMint 0x2d945cb9
uint256 tokenId
uint256 count
bytes32[] proof
editToken 0xf0c68e43
uint256 tokenId
uint256 _publicPrice
uint256 _publicAllowance
uint256 _allowlistPrice
uint256 _allowlistAllowance
uint256 _totalSupply
uint256 _startTime
uint256 _endTime
uint256 _allowlistDuration
string _uri
bytes32 _merkleRoot
freeMint 0x894cadcb
uint256 tokenId
uint256 count
address to
kick 0x96c55175
address to
publicMint 0x924e0df4
uint256 tokenId
uint256 count
bytes32[] proof
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setDocs 0xf94d0561
string _docs
setRoyaltyInfo 0x02fa7c47
address receiver
uint96 feeBasisPoints
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address