Address Contract Verified
Address
0xB136A0c66240499520918aEE57eC907fa6e72021
Balance
0 ETH
Nonce
1
Code Size
10631 bytes
Creator
0x7055A6fc...acFD at tx 0x12f00f9f...3b58c3
Indexed Transactions
0
Contract Bytecode
10631 bytes
0x608060405234801561001057600080fd5b50600436106102ad5760003560e01c80638da5cb5b1161017b578063bb3bafd6116100d8578063d5abeb011161008c578063e985e9c511610071578063e985e9c514610607578063ecba222a14610635578063f2fde38b1461064957600080fd5b8063d5abeb01146105d8578063e8a3d485146105ff57600080fd5b8063c87b56dd116100bd578063c87b56dd1461058b578063d53913931461059e578063d547741f146105c557600080fd5b8063bb3bafd614610557578063c57cdcfe1461057857600080fd5b8063a22cb4651161012f578063b88d4fde11610114578063b88d4fde14610511578063b8d1e53214610524578063b9c4d9fb1461053757600080fd5b8063a22cb465146104eb578063b0ccc31e146104fe57600080fd5b8063938e3d7b11610160578063938e3d7b146104c857806395d89b41146104db578063a217fddf146104e357600080fd5b80638da5cb5b1461048757806391d148541461048f57600080fd5b80632f2ff15d116102295780635ef9432a116101dd578063706f6937116101c2578063706f69371461045957806370a082311461046c578063715018a61461047f57600080fd5b80635ef9432a1461043e5780636352211e1461044657600080fd5b806342842e0e1161020e57806342842e0e1461040557806342966c681461041857806355f804b31461042b57600080fd5b80632f2ff15d146103df57806336568abe146103f257600080fd5b80630ebd4c7f1161028057806323b872dd1161026557806323b872dd14610377578063248a9ca31461038a5780632a55205a146103ad57600080fd5b80630ebd4c7f1461034557806318160ddd1461036557600080fd5b806301ffc9a7146102b257806306fdde03146102da578063081812fc146102ef578063095ea7b314610330575b600080fd5b6102c56102c03660046120c9565b61065c565b60405190151581526020015b60405180910390f35b6102e261068b565b6040516102d1919061210a565b6103186102fd36600461213d565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102d1565b61034361033e36600461216d565b610719565b005b61035861035336600461213d565b610732565b6040516102d191906121d2565b600e545b6040519081526020016102d1565b6103436103853660046121e5565b61078e565b61036961039836600461213d565b60009081526007602052604090206001015490565b6103c06103bb366004612221565b6107b9565b604080516001600160a01b0390931683526020830191909152016102d1565b6103436103ed366004612243565b6107f4565b610343610400366004612243565b610819565b6103436104133660046121e5565b6108aa565b61034361042636600461213d565b6108cf565b6103436104393660046122b1565b61097c565b6103436109cc565b61031861045436600461213d565b610a89565b6103436104673660046123c9565b610adb565b61036961047a366004612489565b610c5f565b610343610cd3565b610318610ce7565b6102c561049d366004612243565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6103436104d63660046122b1565b610d00565b6102e2610d50565b610369600081565b6103436104f93660046124b2565b610d5d565b600b54610318906001600160a01b031681565b61034361051f3660046124e9565b610d71565b610343610532366004612489565b610da0565b61054a61054536600461213d565b610e58565b6040516102d19190612591565b61056a61056536600461213d565b610ed1565b6040516102d19291906125a4565b61034361058636600461216d565b610f85565b6102e261059936600461213d565b611011565b6103697f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103436105d3366004612243565b6110ba565b6103697f00000000000000000000000000000000000000000000000000000000000001c281565b6102e26110df565b6102c56106153660046125d2565b600560209081526000928352604080842090915290825290205460ff1681565b600b546102c590600160a01b900460ff1681565b610343610657366004612489565b611171565b600061066782611201565b80610676575061067682611281565b806106855750610685826112cf565b92915050565b60008054610698906125fc565b80601f01602080910402602001604051908101604052809291908181526020018280546106c4906125fc565b80156107115780601f106106e657610100808354040283529160200191610711565b820191906000526020600020905b8154815290600101906020018083116106f457829003601f168201915b505050505081565b8161072381611341565b61072d8383611435565b505050565b600a546060906001600160a01b0316156107895760408051600180825281830190925290602080830190803683370190505090506009548160008151811061077c5761077c612636565b6020026020010181815250505b919050565b826001600160a01b03811633146107a8576107a833611341565b6107b3848484611526565b50505050565b600a5460095460009182916001600160a01b0390911690612710906107de9086612662565b6107e8919061268f565b915091505b9250929050565b60008281526007602052604090206001015461080f8161171b565b61072d8383611725565b6001600160a01b038116331461089c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6108a682826117c7565b5050565b826001600160a01b03811633146108c4576108c433611341565b6107b384848461184a565b60006108da82610a89565b9050336001600160a01b0382161480159061091957506001600160a01b038116600090815260056020908152604080832033845290915290205460ff16155b801561093c57506000828152600460205260409020546001600160a01b03163314155b15610973576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108a68261194a565b610984611a17565b60008190036109bf576040517fcc52148300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c61072d8284836126e9565b6109d4610ce7565b6001600160a01b0316336001600160a01b031614610a0557604051635fc483c560e01b815260040160405180910390fd5b600b54600160a01b900460ff1615610a3057604051631551a48f60e11b815260040160405180910390fd5b600b80547fffffffffffffffffffffff00000000000000000000000000000000000000000016600160a01b1790556040517f51e2d870cc2e10853e38dc06fcdae46ad3c3f588f326608803dac6204541ad1690600090a1565b6000818152600260205260409020546001600160a01b0316806107895760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610893565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610b058161171b565b600654600003610b41576040517f6f5ffb7e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600655825182518114610b82576040517f389d872000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610c4b576000848281518110610ba157610ba1612636565b602002602001015190507f00000000000000000000000000000000000000000000000000000000000001c2811180610bd7575080155b15610c0e576040517f7945132000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000868381518110610c2257610c22612636565b60200260200101519050610c368183611a76565b50508080610c43906127a9565b915050610b85565b50600e805490910190555050600160065550565b60006001600160a01b038216610cb75760405162461bcd60e51b815260206004820152600c60248201527f5a45524f5f4144445245535300000000000000000000000000000000000000006044820152606401610893565b506001600160a01b031660009081526003602052604090205490565b610cdb611a17565b610ce56000611b9c565b565b6000610cfb6008546001600160a01b031690565b905090565b610d08611a17565b6000819003610d43576040517f03a886fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d61072d8284836126e9565b60018054610698906125fc565b81610d6781611341565b61072d8383611bee565b846001600160a01b0381163314610d8b57610d8b33611341565b610d988686868686611c5a565b505050505050565b610da8610ce7565b6001600160a01b0316336001600160a01b031614610dd957604051635fc483c560e01b815260040160405180910390fd5b600b54600160a01b900460ff1615610e0457604051631551a48f60e11b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f9f513fe86dc42fdbac355fa4d9b1d5be7b5e6cd2df67e30db8003766568de4769060200160405180910390a150565b600a546060906001600160a01b0316156107895760408051600180825281830190925290602080830190803683375050600a5482519293506001600160a01b031691839150600090610eac57610eac612636565b60200260200101906001600160a01b031690816001600160a01b031681525050919050565b600a5460609081906001600160a01b031615610f805760408051600180825281830190925290602080830190803683375050600a5482519294506001600160a01b031691849150600090610f2757610f27612636565b6001600160a01b039290921660209283029190910182015260408051600180825281830190925291828101908036833701905050905060095481600081518110610f7357610f73612636565b6020026020010181815250505b915091565b610f8d610ce7565b6001600160a01b0316336001600160a01b031614610fed5760405162461bcd60e51b815260206004820152601d60248201527f6f6e6c79206f776e65722063616e207365747570526f79616c746965730000006044820152606401610893565b600a80546001600160a01b0319166001600160a01b03841617905560098190555050565b6060600061101e83610a89565b6001600160a01b03160361105e576040517fceea21b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611068611d4f565b9050600081511161108857604051806020016040528060008152506110b3565b8061109284611d5e565b6040516020016110a39291906127c2565b6040516020818303038152906040525b9392505050565b6000828152600760205260409020600101546110d58161171b565b61072d83836117c7565b6060600d80546110ee906125fc565b80601f016020809104026020016040519081016040528092919081815260200182805461111a906125fc565b80156111675780601f1061113c57610100808354040283529160200191611167565b820191906000526020600020905b81548152906001019060200180831161114a57829003601f168201915b5050505050905090565b611179611a17565b6001600160a01b0381166111f55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610893565b6111fe81611b9c565b50565b60006301ffc9a760e01b6001600160e01b03198316148061124b57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b806106855750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60006001600160e01b031982167f7965db0b00000000000000000000000000000000000000000000000000000000148061068557506301ffc9a760e01b6001600160e01b0319831614610685565b60006001600160e01b031982167fb779958400000000000000000000000000000000000000000000000000000000148061133257506001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000145b80610685575061068582611281565b600b546001600160a01b0316801580159061136657506000816001600160a01b03163b115b156108a6576040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa1580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f491906127f1565b6108a6576040517fede71dcc0000000000000000000000000000000000000000000000000000000081526001600160a01b0383166004820152602401610893565b6000818152600260205260409020546001600160a01b03163381148061147e57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b6114ca5760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a45440000000000000000000000000000000000006044820152606401610893565b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000818152600260205260409020546001600160a01b0384811691161461158f5760405162461bcd60e51b815260206004820152600a60248201527f57524f4e475f46524f4d000000000000000000000000000000000000000000006044820152606401610893565b6001600160a01b0382166115e55760405162461bcd60e51b815260206004820152601160248201527f494e56414c49445f524543495049454e540000000000000000000000000000006044820152606401610893565b336001600160a01b038416148061161f57506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b8061164057506000818152600460205260409020546001600160a01b031633145b61168c5760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a45440000000000000000000000000000000000006044820152606401610893565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526002825284832080546001600160a01b03199081168317909155600490925284832080549092169091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6111fe8133611e67565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166108a65760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790556117833390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff16156108a65760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61185583838361078e565b6001600160a01b0382163b15806118fe5750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af11580156118ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f2919061280e565b6001600160e01b031916145b61072d5760405162461bcd60e51b815260206004820152601060248201527f554e534146455f524543495049454e54000000000000000000000000000000006044820152606401610893565b6000818152600260205260409020546001600160a01b03168061199c5760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b6044820152606401610893565b6001600160a01b038116600081815260036020908152604080832080546000190190558583526002825280832080546001600160a01b031990811690915560049092528083208054909216909155518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b33611a20610ce7565b6001600160a01b031614610ce55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610893565b6001600160a01b038216611acc5760405162461bcd60e51b815260206004820152601160248201527f494e56414c49445f524543495049454e540000000000000000000000000000006044820152606401610893565b6000818152600260205260409020546001600160a01b031615611b315760405162461bcd60e51b815260206004820152600e60248201527f414c52454144595f4d494e5445440000000000000000000000000000000000006044820152606401610893565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611c6585858561078e565b6001600160a01b0384163b1580611cfc5750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a0290611cad9033908a9089908990899060040161282b565b6020604051808303816000875af1158015611ccc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf0919061280e565b6001600160e01b031916145b611d485760405162461bcd60e51b815260206004820152601060248201527f554e534146455f524543495049454e54000000000000000000000000000000006044820152606401610893565b5050505050565b6060600c80546110ee906125fc565b606081600003611d855750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611daf5780611d99816127a9565b9150611da89050600a8361268f565b9150611d89565b60008167ffffffffffffffff811115611dca57611dca6122f3565b6040519080825280601f01601f191660200182016040528015611df4576020820181803683370190505b5090505b8415611e5f57611e0960018361287f565b9150611e16600a86612892565b611e219060306128a6565b60f81b818381518110611e3657611e36612636565b60200101906001600160f81b031916908160001a905350611e58600a8661268f565b9450611df8565b949350505050565b60008281526007602090815260408083206001600160a01b038516845290915290205460ff166108a657611e9a81611edc565b611ea5836020611eee565b604051602001611eb69291906128b9565b60408051601f198184030181529082905262461bcd60e51b82526108939160040161210a565b60606106856001600160a01b03831660145b60606000611efd836002612662565b611f089060026128a6565b67ffffffffffffffff811115611f2057611f206122f3565b6040519080825280601f01601f191660200182016040528015611f4a576020820181803683370190505b509050600360fc1b81600081518110611f6557611f65612636565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611fb057611fb0612636565b60200101906001600160f81b031916908160001a9053506000611fd4846002612662565b611fdf9060016128a6565b90505b6001811115612064577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061202057612020612636565b1a60f81b82828151811061203657612036612636565b60200101906001600160f81b031916908160001a90535060049490941c9361205d8161293a565b9050611fe2565b5083156110b35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610893565b6001600160e01b0319811681146111fe57600080fd5b6000602082840312156120db57600080fd5b81356110b3816120b3565b60005b838110156121015781810151838201526020016120e9565b50506000910152565b60208152600082518060208401526121298160408501602087016120e6565b601f01601f19169190910160400192915050565b60006020828403121561214f57600080fd5b5035919050565b80356001600160a01b038116811461078957600080fd5b6000806040838503121561218057600080fd5b61218983612156565b946020939093013593505050565b600081518084526020808501945080840160005b838110156121c7578151875295820195908201906001016121ab565b509495945050505050565b6020815260006110b36020830184612197565b6000806000606084860312156121fa57600080fd5b61220384612156565b925061221160208501612156565b9150604084013590509250925092565b6000806040838503121561223457600080fd5b50508035926020909101359150565b6000806040838503121561225657600080fd5b8235915061226660208401612156565b90509250929050565b60008083601f84011261228157600080fd5b50813567ffffffffffffffff81111561229957600080fd5b6020830191508360208285010111156107ed57600080fd5b600080602083850312156122c457600080fd5b823567ffffffffffffffff8111156122db57600080fd5b6122e78582860161226f565b90969095509350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612332576123326122f3565b604052919050565b600067ffffffffffffffff821115612354576123546122f3565b5060051b60200190565b600082601f83011261236f57600080fd5b8135602061238461237f8361233a565b612309565b82815260059290921b840181019181810190868411156123a357600080fd5b8286015b848110156123be57803583529183019183016123a7565b509695505050505050565b600080604083850312156123dc57600080fd5b823567ffffffffffffffff808211156123f457600080fd5b818501915085601f83011261240857600080fd5b8135602061241861237f8361233a565b82815260059290921b8401810191818101908984111561243757600080fd5b948201945b8386101561245c5761244d86612156565b8252948201949082019061243c565b9650508601359250508082111561247257600080fd5b5061247f8582860161235e565b9150509250929050565b60006020828403121561249b57600080fd5b6110b382612156565b80151581146111fe57600080fd5b600080604083850312156124c557600080fd5b6124ce83612156565b915060208301356124de816124a4565b809150509250929050565b60008060008060006080868803121561250157600080fd5b61250a86612156565b945061251860208701612156565b935060408601359250606086013567ffffffffffffffff81111561253b57600080fd5b6125478882890161226f565b969995985093965092949392505050565b600081518084526020808501945080840160005b838110156121c75781516001600160a01b03168752958201959082019060010161256c565b6020815260006110b36020830184612558565b6040815260006125b76040830185612558565b82810360208401526125c98185612197565b95945050505050565b600080604083850312156125e557600080fd5b6125ee83612156565b915061226660208401612156565b600181811c9082168061261057607f821691505b60208210810361263057634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176106855761068561264c565b634e487b7160e01b600052601260045260246000fd5b60008261269e5761269e612679565b500490565b601f82111561072d57600081815260208120601f850160051c810160208610156126ca5750805b601f850160051c820191505b81811015610d98578281556001016126d6565b67ffffffffffffffff831115612701576127016122f3565b6127158361270f83546125fc565b836126a3565b6000601f84116001811461274957600085156127315750838201355b600019600387901b1c1916600186901b178355611d48565b600083815260209020601f19861690835b8281101561277a578685013582556020948501946001909201910161275a565b50868210156127975760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000600182016127bb576127bb61264c565b5060010190565b600083516127d48184602088016120e6565b8351908301906127e88183602088016120e6565b01949350505050565b60006020828403121561280357600080fd5b81516110b3816124a4565b60006020828403121561282057600080fd5b81516110b3816120b3565b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b818103818111156106855761068561264c565b6000826128a1576128a1612679565b500690565b808201808211156106855761068561264c565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516128f18160178501602088016120e6565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161292e8160288401602088016120e6565b01602801949350505050565b6000816129495761294961264c565b50600019019056fea264697066735822122077ab647a86ebfdb76df86dbc792446dfe24cdf3dba030bcb7cc910102881343464736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (1000 runs)
Helpers.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
library Helpers {
function uint2string(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);
}
}
Constants.sol 5 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
RevokableDefaultOperatorFilterer.sol 18 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {RevokableOperatorFilterer} from "./RevokableOperatorFilterer.sol";
import {CANONICAL_CORI_SUBSCRIPTION, CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol";
/**
* @title RevokableDefaultOperatorFilterer
* @notice Inherits from RevokableOperatorFilterer and automatically subscribes to the default OpenSea subscription.
* Note that OpenSea will disable creator earnings enforcement if filtered operators begin fulfilling orders
* on-chain, eg, if the registry is revoked or bypassed.
*/
abstract contract RevokableDefaultOperatorFilterer is RevokableOperatorFilterer {
/// @dev The constructor that is called when the contract is being deployed.
constructor()
RevokableOperatorFilterer(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS, CANONICAL_CORI_SUBSCRIPTION, true)
{}
}
AccessControl.sol 247 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
IAccessControl.sol 88 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
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);
}
genR5CVAirdrop.sol 157 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.17;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ERC721} from "solmate/src/tokens/ERC721.sol";
import "./Errors.sol";
import "./ReentrancyGuard.sol";
import "./Helpers.sol";
import "./RENRoyalties.sol";
import "operator-filter-registry/src/UpdatableOperatorFilterer.sol";
import "operator-filter-registry/src/RevokableDefaultOperatorFilterer.sol";
contract genR5CVAirdrop is ERC721, ReentrancyGuard, AccessControl, Ownable, RENRoyalties, RevokableDefaultOperatorFilterer {
// We have role for multiple accounts in case a transaction of one minter will stack (because of gas price)
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
// Constants
// Maximum number of NFTs can be allocated
uint256 public immutable maxSupply;
// Base token and contract URI
string private baseTokenURI;
string private baseContractURI;
// Current supply
uint256 private _currentSupply;
constructor(
uint256 _maxSupply,
string memory _baseTokenURI,
string memory _baseContractURI,
string memory _name,
string memory _symbol,
uint256 bps
) ERC721(_name, _symbol) RENRoyalties(bps){
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, msg.sender);
maxSupply = _maxSupply;
baseTokenURI = _baseTokenURI;
baseContractURI = _baseContractURI;
}
//Setup Royalties
function setupRoyalties(address addr, uint256 bps) public {
require(msg.sender == owner(), "only owner can setupRoyalties");
super.setRoyalties(addr, bps);
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, AccessControl, RENRoyalties) returns (bool) {
return ERC721.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId) || RENRoyalties.supportsInterface(interfaceId);
}
// Accounts with MINTER_ROLE can call this function to mint `tokens` into `addresses`
function airdropTokens(address[] memory addresses, uint256[] memory tokens) external onlyRole(MINTER_ROLE) lock {
uint256 length = addresses.length;
if (length != tokens.length)
revert Errors.WrongInputSize();
for (uint i; i < length; i++) {
uint256 tokenId = tokens[i];
if (tokenId > maxSupply || tokenId == 0)
revert Errors.IdBeyondSupplyLimit();
address mintAddress = addresses[i];
_mint(mintAddress, tokenId);
}
unchecked {
_currentSupply += length;
}
}
function burn(uint256 id) external {
address tokenOwner = ownerOf(id);
if (msg.sender != tokenOwner && !isApprovedForAll[tokenOwner][msg.sender] && getApproved[id] != msg.sender)
revert Errors.NotAuthorized();
_burn(id);
}
function setContractURI(string calldata baseContractURI_)
external
onlyOwner
{
if (bytes(baseContractURI_).length == 0)
revert Errors.InvalidBaseContractURL();
baseContractURI = baseContractURI_;
}
function setBaseURI(string calldata baseURI_) external onlyOwner {
if (bytes(baseURI_).length == 0) revert Errors.InvalidBaseURI();
baseTokenURI = baseURI_;
}
function totalSupply() external view returns (uint256) {
return _currentSupply;
}
function contractURI() external view returns (string memory) {
return baseContractURI;
}
function _baseURI() internal view virtual returns (string memory) {
return baseTokenURI;
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
if (ownerOf(tokenId) == address(0)) revert Errors.TokenDoesNotExist();
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(
abi.encodePacked(baseURI, Helpers.uint2string(tokenId))
)
: "";
}
function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
super.setApprovalForAll(operator, approved);
}
function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
super.approve(operator, tokenId);
}
function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data)
public
override
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId, data);
}
function owner() public view virtual override (Ownable, UpdatableOperatorFilterer) returns (address) {
return Ownable.owner();
}
}
Math.sol 345 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}
ReentrancyGuard.sol 16 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "./Errors.sol";
abstract contract ReentrancyGuard {
uint256 private unlocked = 1;
modifier lock() {
if (unlocked == 0) revert Errors.ContractLocked();
unlocked = 0;
_;
unlocked = 1;
}
}
RENRoyalties.sol 68 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
contract RENRoyalties is ERC165 {
//Royalties info
uint256 private _royaltyBps; // Divided per 10000
address payable private _royaltyRecipient;
//EIP-2981 royalties
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
//Rarible royalties
bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;
//Constructor
constructor(uint256 bps) {
_royaltyRecipient = payable(msg.sender); // sender must be a payable address
_royaltyBps = bps; // bps=1000 means 10% (1000 / 10000)
}
//Subclass can call this
function setRoyalties(address addr, uint256 bps) internal {
_royaltyRecipient = payable(addr);
_royaltyBps = bps;
}
//Rarible royalties impl
function getRoyalties(uint256) external view returns (address payable[] memory recipients, uint256[] memory bps) {
if (_royaltyRecipient != address(0x0)) {
recipients = new address payable[](1);
recipients[0] = _royaltyRecipient;
bps = new uint256[](1);
bps[0] = _royaltyBps;
}
return (recipients, bps);
}
function getFeeRecipients(uint256) external view returns (address payable[] memory recipients) {
if (_royaltyRecipient != address(0x0)) {
recipients = new address payable[](1);
recipients[0] = _royaltyRecipient;
}
return recipients;
}
function getFeeBps(uint256) external view returns (uint[] memory bps) {
if (_royaltyRecipient != address(0x0)) {
bps = new uint256[](1);
bps[0] = _royaltyBps;
}
return bps;
}
//EIP-2981 royalties impl
function royaltyInfo(uint256, uint256 value) external view returns (address, uint256) {
return (_royaltyRecipient, value*_royaltyBps/10000);
}
// IERC165-supportsInterface.
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE || interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981 || super.supportsInterface(interfaceId);
}
}
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;
}
}
Errors.sol 20 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
library Errors {
error IdBeyondSupplyLimit();
error WrongInputSize();
error TokenDoesNotExist();
error NotOwner();
error NotAuthorized();
error InvalidBaseContractURL();
error InvalidBaseURI();
error NewSignerCantBeZero();
error InvalidOwner();
error InvalidOwnerSignature();
/* ReentrancyGuard.sol */
error ContractLocked();
}
IOperatorFilterRegistry.sol 139 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IOperatorFilterRegistry {
/**
* @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
* true if supplied registrant address is not registered.
*/
function isOperatorAllowed(address registrant, address operator) external view returns (bool);
/**
* @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
*/
function register(address registrant) external;
/**
* @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
*/
function registerAndSubscribe(address registrant, address subscription) external;
/**
* @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
* address without subscribing.
*/
function registerAndCopyEntries(address registrant, address registrantToCopy) external;
/**
* @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
* Note that this does not remove any filtered addresses or codeHashes.
* Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
*/
function unregister(address addr) external;
/**
* @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
*/
function updateOperator(address registrant, address operator, bool filtered) external;
/**
* @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
*/
function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
/**
* @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
*/
function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
/**
* @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
*/
function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
/**
* @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
* subscription if present.
* Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
* subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
* used.
*/
function subscribe(address registrant, address registrantToSubscribe) external;
/**
* @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
*/
function unsubscribe(address registrant, bool copyExistingEntries) external;
/**
* @notice Get the subscription address of a given registrant, if any.
*/
function subscriptionOf(address addr) external returns (address registrant);
/**
* @notice Get the set of addresses subscribed to a given registrant.
* Note that order is not guaranteed as updates are made.
*/
function subscribers(address registrant) external returns (address[] memory);
/**
* @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
* Note that order is not guaranteed as updates are made.
*/
function subscriberAt(address registrant, uint256 index) external returns (address);
/**
* @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
*/
function copyEntriesOf(address registrant, address registrantToCopy) external;
/**
* @notice Returns true if operator is filtered by a given address or its subscription.
*/
function isOperatorFiltered(address registrant, address operator) external returns (bool);
/**
* @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
*/
function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
/**
* @notice Returns true if a codeHash is filtered by a given address or its subscription.
*/
function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
/**
* @notice Returns a list of filtered operators for a given address or its subscription.
*/
function filteredOperators(address addr) external returns (address[] memory);
/**
* @notice Returns the set of filtered codeHashes for a given address or its subscription.
* Note that order is not guaranteed as updates are made.
*/
function filteredCodeHashes(address addr) external returns (bytes32[] memory);
/**
* @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
* its subscription.
* Note that order is not guaranteed as updates are made.
*/
function filteredOperatorAt(address registrant, uint256 index) external returns (address);
/**
* @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
* its subscription.
* Note that order is not guaranteed as updates are made.
*/
function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
/**
* @notice Returns true if an address has registered
*/
function isRegistered(address addr) external returns (bool);
/**
* @dev Convenience method to compute the code hash of an arbitrary contract
*/
function codeHashOf(address addr) external returns (bytes32);
}
RevokableOperatorFilterer.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {UpdatableOperatorFilterer} from "./UpdatableOperatorFilterer.sol";
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
/**
* @title RevokableOperatorFilterer
* @notice This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. The
* Registry itself has an "unregister" function, but if the contract is ownable, the owner can re-register at
* any point. As implemented, this abstract contract allows the contract owner to permanently skip the
* OperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registry
* address cannot be further updated.
* Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
* on-chain, eg, if the registry is revoked or bypassed.
*/
abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer {
/// @dev Emitted when the registry has already been revoked.
error RegistryHasBeenRevoked();
/// @dev Emitted when the initial registry address is attempted to be set to the zero address.
error InitialRegistryAddressCannotBeZeroAddress();
event OperatorFilterRegistryRevoked();
bool public isOperatorFilterRegistryRevoked;
/// @dev The constructor that is called when the contract is being deployed.
constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe)
UpdatableOperatorFilterer(_registry, subscriptionOrRegistrantToCopy, subscribe)
{
// don't allow creating a contract with a permanently revoked registry
if (_registry == address(0)) {
revert InitialRegistryAddressCannotBeZeroAddress();
}
}
/**
* @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
* address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner.
*/
function updateOperatorFilterRegistryAddress(address newRegistry) public override {
if (msg.sender != owner()) {
revert OnlyOwner();
}
// if registry has been revoked, do not allow further updates
if (isOperatorFilterRegistryRevoked) {
revert RegistryHasBeenRevoked();
}
operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
emit OperatorFilterRegistryAddressUpdated(newRegistry);
}
/**
* @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner.
*/
function revokeOperatorFilterRegistry() public {
if (msg.sender != owner()) {
revert OnlyOwner();
}
// if registry has been revoked, do not allow further updates
if (isOperatorFilterRegistryRevoked) {
revert RegistryHasBeenRevoked();
}
// set to zero address to bypass checks
operatorFilterRegistry = IOperatorFilterRegistry(address(0));
isOperatorFilterRegistryRevoked = true;
emit OperatorFilterRegistryRevoked();
}
}
ERC721.sol 231 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 indexed id);
event Approval(address indexed owner, address indexed spender, uint256 indexed id);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE/LOGIC
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
function tokenURI(uint256 id) public view virtual returns (string memory);
/*//////////////////////////////////////////////////////////////
ERC721 BALANCE/OWNER STORAGE
//////////////////////////////////////////////////////////////*/
mapping(uint256 => address) internal _ownerOf;
mapping(address => uint256) internal _balanceOf;
function ownerOf(uint256 id) public view virtual returns (address owner) {
require((owner = _ownerOf[id]) != address(0), "NOT_MINTED");
}
function balanceOf(address owner) public view virtual returns (uint256) {
require(owner != address(0), "ZERO_ADDRESS");
return _balanceOf[owner];
}
/*//////////////////////////////////////////////////////////////
ERC721 APPROVAL STORAGE
//////////////////////////////////////////////////////////////*/
mapping(uint256 => address) public getApproved;
mapping(address => mapping(address => bool)) public isApprovedForAll;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
}
/*//////////////////////////////////////////////////////////////
ERC721 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 id) public virtual {
address owner = _ownerOf[id];
require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED");
getApproved[id] = spender;
emit Approval(owner, spender, id);
}
function setApprovalForAll(address operator, bool approved) public virtual {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function transferFrom(
address from,
address to,
uint256 id
) public virtual {
require(from == _ownerOf[id], "WRONG_FROM");
require(to != address(0), "INVALID_RECIPIENT");
require(
msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id],
"NOT_AUTHORIZED"
);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
unchecked {
_balanceOf[from]--;
_balanceOf[to]++;
}
_ownerOf[id] = to;
delete getApproved[id];
emit Transfer(from, to, id);
}
function safeTransferFrom(
address from,
address to,
uint256 id
) public virtual {
transferFrom(from, to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
function safeTransferFrom(
address from,
address to,
uint256 id,
bytes calldata data
) public virtual {
transferFrom(from, to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
/*//////////////////////////////////////////////////////////////
ERC165 LOGIC
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 id) internal virtual {
require(to != address(0), "INVALID_RECIPIENT");
require(_ownerOf[id] == address(0), "ALREADY_MINTED");
// Counter overflow is incredibly unrealistic.
unchecked {
_balanceOf[to]++;
}
_ownerOf[id] = to;
emit Transfer(address(0), to, id);
}
function _burn(uint256 id) internal virtual {
address owner = _ownerOf[id];
require(owner != address(0), "NOT_MINTED");
// Ownership check above ensures no underflow.
unchecked {
_balanceOf[owner]--;
}
delete _ownerOf[id];
delete getApproved[id];
emit Transfer(owner, address(0), id);
}
/*//////////////////////////////////////////////////////////////
INTERNAL SAFE MINT LOGIC
//////////////////////////////////////////////////////////////*/
function _safeMint(address to, uint256 id) internal virtual {
_mint(to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
function _safeMint(
address to,
uint256 id,
bytes memory data
) internal virtual {
_mint(to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
}
/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver {
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external virtual returns (bytes4) {
return ERC721TokenReceiver.onERC721Received.selector;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
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);
}
}
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 70 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
UpdatableOperatorFilterer.sol 100 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
/**
* @title UpdatableOperatorFilterer
* @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
* registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
* OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
* which will bypass registry checks.
* Note that OpenSea will still disable creator earnings enforcement if filtered operators begin fulfilling orders
* on-chain, eg, if the registry is revoked or bypassed.
* @dev This smart contract is meant to be inherited by token contracts so they can use the following:
* - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
* - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
*/
abstract contract UpdatableOperatorFilterer {
/// @dev Emitted when an operator is not allowed.
error OperatorNotAllowed(address operator);
/// @dev Emitted when someone other than the owner is trying to call an only owner function.
error OnlyOwner();
event OperatorFilterRegistryAddressUpdated(address newRegistry);
IOperatorFilterRegistry public operatorFilterRegistry;
/// @dev The constructor that is called when the contract is being deployed.
constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) {
IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
operatorFilterRegistry = registry;
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(registry).code.length > 0) {
if (subscribe) {
registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
registry.register(address(this));
}
}
}
}
/**
* @dev A helper function to check if the operator is allowed.
*/
modifier onlyAllowedOperator(address from) virtual {
// Allow spending tokens from addresses with balance
// Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
// from an EOA.
if (from != msg.sender) {
_checkFilterOperator(msg.sender);
}
_;
}
/**
* @dev A helper function to check if the operator approval is allowed.
*/
modifier onlyAllowedOperatorApproval(address operator) virtual {
_checkFilterOperator(operator);
_;
}
/**
* @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
* address, checks will be bypassed. OnlyOwner.
*/
function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
if (msg.sender != owner()) {
revert OnlyOwner();
}
operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
emit OperatorFilterRegistryAddressUpdated(newRegistry);
}
/**
* @dev Assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract.
*/
function owner() public view virtual returns (address);
/**
* @dev A helper function to check if the operator is allowed.
*/
function _checkFilterOperator(address operator) internal view virtual {
IOperatorFilterRegistry registry = operatorFilterRegistry;
// Check registry code length to facilitate testing in environments without a deployed registry.
if (address(registry) != address(0) && address(registry).code.length > 0) {
// under normal circumstances, this function will revert rather than return false, but inheriting contracts
// may specify their own OperatorFilterRegistry implementations, which may behave differently
if (!registry.isOperatorAllowed(address(this), operator)) {
revert OperatorNotAllowed(operator);
}
}
}
}
Read Contract
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
MINTER_ROLE 0xd5391393 → bytes32
balanceOf 0x70a08231 → uint256
contractURI 0xe8a3d485 → string
getApproved 0x081812fc → address
getFeeBps 0x0ebd4c7f → uint256[]
getFeeRecipients 0xb9c4d9fb → address[]
getRoleAdmin 0x248a9ca3 → bytes32
getRoyalties 0xbb3bafd6 → address[], uint256[]
hasRole 0x91d14854 → bool
isApprovedForAll 0xe985e9c5 → bool
isOperatorFilterRegistryRevoked 0xecba222a → bool
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
operatorFilterRegistry 0xb0ccc31e → address
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
airdropTokens 0x706f6937
address[] addresses
uint256[] tokens
approve 0x095ea7b3
address operator
uint256 tokenId
burn 0x42966c68
uint256 id
grantRole 0x2f2ff15d
bytes32 role
address account
renounceOwnership 0x715018a6
No parameters
renounceRole 0x36568abe
bytes32 role
address account
revokeOperatorFilterRegistry 0x5ef9432a
No parameters
revokeRole 0xd547741f
bytes32 role
address account
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI_
setContractURI 0x938e3d7b
string baseContractURI_
setupRoyalties 0xc57cdcfe
address addr
uint256 bps
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateOperatorFilterRegistryAddress 0xb8d1e532
address newRegistry
Recent Transactions
No transactions found for this address