Address Contract Verified
Address
0xDcbf49BDB92B2Aa84de4e428fd5b2C9C58412Bc5
ENS Name
..eth
Balance
0.218400 ETH
Nonce
4
Code Size
24462 bytes
Creator
0x082Fc177...d77b at tx 0xa2b4cad5...779db7
Indexed Transactions
0
Contract Bytecode
24462 bytes
0x6080604052600436106103df5760003560e01c806301ffc9a7146104105780630442bfa81461044557806306fdde031461046757806307b5c38514610489578063081812fc146104b7578063095ea7b3146104e45780630b5ee00614610504578063100367581461052457806310f13a8c14610544578063150b7a0214610564578063179642081461059d57806318160ddd146105bd5780631a5a1c8e146105d25780631b486d40146105f25780631fa4c4861461061257806323b872dd1461063257806325d0f90f146106525780632628c0ab146106725780632a55205a146106a85780632f745c59146106d65780633a95aa1e146106f65780633b3b57de146107235780633c6961b41461074357806340f1f7461461077057806342842e0e14610790578063463de928146107b05780634d8c333a146107d05780634f6ccce7146108005780635004ddf614610820578063519994ef146108415780635809fd8e1461086e5780635881f62c1461088e57806359d1d43c146108ae57806360b10c62146108ce578063610732fc146108ee5780636352211e1461090e578063691f34311461092e5780636ac4ef5b1461094e5780636b4494001461097b5780636ba7d18d1461099157806370a08231146109b1578063715018a6146109d157806374358d56146109e6578063795e351114610a065780637d5781e114610a265780637e309bfb14610a4657806383c664b314610a66578063866a6b5614610a86578063886574b214610a9c5780638da309d214610acc5780638da5cb5b14610adf5780638e96a13414610af45780639196537414610b215780639281ae6014610b365780639573b45714610b4b57806395d89b4114610b8157806396f92f0f14610b96578063a22cb46514610bb6578063aab39f7614610bd6578063b346cbfc14610bf6578063b51203e014610c23578063b6fdace014610c43578063b83e012d14610c63578063b88d4fde14610c79578063bb890aaf14610c99578063bde28a0d14610cac578063bfab169614610cc1578063c158746d14610cee578063c28bfe8f14610d0e578063c3457e4e14610d3b578063c44fb60014610d5b578063c705b88414610d7b578063c822059f14610dbc578063c87b56dd14610ddc578063d177c0ba14610dfc578063d60ba8f214610e12578063d7b3b44c14610e48578063e3147f6414610e75578063e5187f4314610e95578063e536161114610eb5578063e985e9c514610eca578063ea5822c614610eea578063ec47b34214610f0a578063ed7c53b614610f2a578063f2fde38b14610f3d578063f35e0eda14610f5d578063fad9d9d714610f7d578063feb1748c14610f9d576103fe565b366103fe5734602660008282546103f69190614dc1565b925050819055005b34602660008282546103f69190614dc1565b34801561041c57600080fd5b5061043061042b366004614def565b610fbd565b60405190151581526020015b60405180910390f35b34801561045157600080fd5b50610465610460366004614e0c565b611055565b005b34801561047357600080fd5b5061047c61113b565b60405161043c9190614e86565b34801561049557600080fd5b506104a96104a4366004614f5c565b6111cd565b60405190815260200161043c565b3480156104c357600080fd5b506104d76104d2366004614f90565b61128b565b60405161043c9190614fb6565b3480156104f057600080fd5b506104656104ff366004614fdf565b611313565b34801561051057600080fd5b5061046561051f36600461504c565b611423565b34801561053057600080fd5b5061046561053f36600461508d565b6114ba565b34801561055057600080fd5b5061046561055f3660046150dc565b611601565b34801561057057600080fd5b5061058461057f366004615155565b6116f5565b6040516001600160e01b0319909116815260200161043c565b3480156105a957600080fd5b5061047c6105b8366004614f90565b611786565b3480156105c957600080fd5b506014546104a9565b3480156105de57600080fd5b506104656105ed366004614e0c565b611820565b3480156105fe57600080fd5b5061046561060d366004614f90565b6118e1565b34801561061e57600080fd5b50600d546104d7906001600160a01b031681565b34801561063e57600080fd5b5061046561064d3660046151b6565b611a6b565b34801561065e57600080fd5b5061046561066d3660046151f7565b611a9c565b34801561067e57600080fd5b506104a961068d366004615227565b6001600160a01b03166000908152600b602052604090205490565b3480156106b457600080fd5b506106c86106c3366004614e0c565b611b72565b60405161043c929190615244565b3480156106e257600080fd5b506104a96106f1366004614fdf565b611bcb565b34801561070257600080fd5b506104a9610711366004614f90565b60246020526000908152604090205481565b34801561072f57600080fd5b506104d761073e366004614f90565b611c6c565b34801561074f57600080fd5b506104a961075e366004614f90565b60196020526000908152604090205481565b34801561077c57600080fd5b5061046561078b3660046152af565b611d5c565b34801561079c57600080fd5b506104656107ab3660046151b6565b611f14565b3480156107bc57600080fd5b506104656107cb366004614f90565b611f2f565b3480156107dc57600080fd5b506104306107eb366004614f90565b601e6020526000908152604090205460ff1681565b34801561080c57600080fd5b506104a961081b366004614f90565b611f63565b34801561082c57600080fd5b5060125461043090600160a01b900460ff1681565b34801561084d57600080fd5b506104a961085c366004614f90565b601a6020526000908152604090205481565b34801561087a57600080fd5b50610465610889366004615305565b611ff3565b34801561089a57600080fd5b506104656108a9366004615367565b61207e565b3480156108ba57600080fd5b5061047c6108c93660046153ad565b61213f565b3480156108da57600080fd5b5061047c6108e9366004614f90565b6121fb565b3480156108fa57600080fd5b50600c546104d7906001600160a01b031681565b34801561091a57600080fd5b506104d7610929366004614f90565b612214565b34801561093a57600080fd5b5061047c610949366004614f90565b61228b565b34801561095a57600080fd5b506104a9610969366004615227565b600b6020526000908152604090205481565b34801561098757600080fd5b506104a960275481565b34801561099d57600080fd5b506011546104d7906001600160a01b031681565b3480156109bd57600080fd5b506104a96109cc366004615227565b61249a565b3480156109dd57600080fd5b50610465612521565b3480156109f257600080fd5b5061047c610a01366004614f90565b61255c565b348015610a1257600080fd5b50600e546104d7906001600160a01b031681565b348015610a3257600080fd5b50610465610a41366004614f90565b612575565b348015610a5257600080fd5b506013546104d7906001600160a01b031681565b348015610a7257600080fd5b506104a9610a813660046153f8565b612608565b348015610a9257600080fd5b506104a960155481565b348015610aa857600080fd5b50610430610ab7366004614f90565b60186020526000908152604090205460ff1681565b610465610ada366004615485565b612733565b348015610aeb57600080fd5b506104d76128a9565b348015610b0057600080fd5b506104a9610b0f366004614f90565b60226020526000908152604090205481565b348015610b2d57600080fd5b506104656128b8565b348015610b4257600080fd5b5061046561295e565b348015610b5757600080fd5b506104d7610b66366004614f90565b6017602052600090815260409020546001600160a01b031681565b348015610b8d57600080fd5b5061047c6129cc565b348015610ba257600080fd5b50610465610bb13660046151f7565b6129db565b348015610bc257600080fd5b50610465610bd13660046154ed565b612a63565b348015610be257600080fd5b50610465610bf13660046153ad565b612a72565b348015610c0257600080fd5b50610c16610c1136600461551b565b612b0e565b60405161043c9190615550565b348015610c2f57600080fd5b50610465610c3e366004614f90565b612bbf565b348015610c4f57600080fd5b506104a9610c5e36600461504c565b612c34565b348015610c6f57600080fd5b506104a960265481565b348015610c8557600080fd5b50610465610c94366004615643565b612c6a565b610465610ca73660046156ae565b612c9c565b348015610cb857600080fd5b506009546104a9565b348015610ccd57600080fd5b506104a9610cdc366004614f90565b601b6020526000908152604090205481565b348015610cfa57600080fd5b506010546104d7906001600160a01b031681565b348015610d1a57600080fd5b506104a9610d29366004615227565b60256020526000908152604090205481565b348015610d4757600080fd5b5061047c610d563660046153ad565b6132fa565b348015610d6757600080fd5b50610465610d76366004615227565b6134cc565b348015610d8757600080fd5b506104d7610d96366004614fdf565b601f6020908152600092835260408084209091529082529020546001600160a01b031681565b348015610dc857600080fd5b506012546104d7906001600160a01b031681565b348015610de857600080fd5b5061047c610df7366004614f90565b61351d565b348015610e0857600080fd5b506104a960165481565b348015610e1e57600080fd5b506104d7610e2d366004614f90565b601d602052600090815260409020546001600160a01b031681565b348015610e5457600080fd5b50610e68610e63366004615756565b6135b5565b60405161043c919061578b565b348015610e8157600080fd5b50610465610e903660046151f7565b6136af565b348015610ea157600080fd5b50610465610eb0366004615227565b61375a565b348015610ec157600080fd5b506104656137ab565b348015610ed657600080fd5b50610430610ee53660046157cf565b613834565b348015610ef657600080fd5b5061047c610f05366004615367565b613862565b348015610f1657600080fd5b50610465610f25366004615227565b613895565b610465610f383660046157fd565b613910565b348015610f4957600080fd5b50610465610f58366004615227565b613936565b348015610f6957600080fd5b50610465610f78366004614f90565b6139d3565b348015610f8957600080fd5b506104a9610f98366004614f90565b613b3b565b348015610fa957600080fd5b50610465610fb836600461586d565b613b67565b6000610fc882613c5a565b80610fe35750631d9dabef60e11b6001600160e01b03198316145b80610ffe5750631674750f60e21b6001600160e01b03198316145b80611019575063691f343160e01b6001600160e01b03198316145b80611034575063152a902d60e11b6001600160e01b03198316145b8061104f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60008281526017602052604090205482906001600160a01b031633146110965760405162461bcd60e51b815260040161108d906158b8565b60405180910390fd5b662386f26fc10000821015806110aa575081155b6110e75760405162461bcd60e51b815260206004820152600e60248201526d36b4b710181718189032ba3432b960911b604482015260640161108d565b6000838152602460205260409081902083905551839033907f1b3c0e060bdd19c67bc8c172ce8f4cda87bb99e6ebe524c5918356cc858873a29061112e9086815260200190565b60405180910390a3505050565b60606001805461114a906158de565b80601f0160208091040260200160405190810160405280929190818152602001828054611176906158de565b80156111c35780601f10611198576101008083540402835291602001916111c3565b820191906000526020600020905b8154815290600101906020018083116111a657829003601f168201915b5050505050905090565b604051620cae8d60eb1b6020820152600090819060230160405160208183030381529060405280519060200120604051602001611214929190918252602082015260400190565b604051602081830303815290604052805190602001209050808260405160200161123e9190615912565b6040516020818303038152906040528051906020012060405160200161126e929190918252602082015260400190565b604051602081830303815290604052805190602001209050919050565b600061129682613caa565b6112f75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161108d565b506000908152600560205260409020546001600160a01b031690565b600061131e82612214565b9050806001600160a01b0316836001600160a01b03160361138b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161108d565b336001600160a01b03821614806113a757506113a78133613834565b6114145760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b606482015260840161108d565b61141e8383613cc7565b505050565b3361142c6128a9565b6001600160a01b0316146114525760405162461bcd60e51b815260040161108d9061592e565b600c5460405163c47f002760e01b81526001600160a01b039091169063c47f002790611484908590859060040161598c565b600060405180830381600087803b15801561149e57600080fd5b505af11580156114b2573d6000803e3d6000fd5b505050505050565b60008381526017602052604090205483906001600160a01b031633146114f25760405162461bcd60e51b815260040161108d906158b8565b600084815260216020526040812080546115939190611510906158de565b80601f016020809104026020016040519081016040528092919081815260200182805461153c906158de565b80156115895780601f1061155e57610100808354040283529160200191611589565b820191906000526020600020905b81548152906001019060200180831161156c57829003601f168201915b50505050506111cd565b600d54604051638b95dd7160e01b81529192506001600160a01b031690638b95dd71906115c8908490889088906004016159a0565b600060405180830381600087803b1580156115e257600080fd5b505af11580156115f6573d6000803e3d6000fd5b505050505050505050565b60008581526019602052604090205461161981613caa565b6116355760405162461bcd60e51b815260040161108d906159bf565b61163f3382613d35565b61165b5760405162461bcd60e51b815260040161108d906159ed565b8282602060008981526020019081526020016000208787604051611680929190615a13565b90815260405190819003602001902061169a929091614c34565b5084846040516116ab929190615a13565b6040518091039020867fd8c9334b1a9c2f9da342a0a2b32629c1a229b6445dad78947f674b44444a755087876040516116e592919061598c565b60405180910390a3505050505050565b6000306001600160a01b0387161461175b5760405162461bcd60e51b815260206004820152602360248201527f6f6e6c79207472616e736665722066726f6d20636f6e7472616374206164647260448201526265737360e81b606482015260840161108d565b507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f95945050505050565b601c602052600090815260409020805461179f906158de565b80601f01602080910402602001604051908101604052809291908181526020018280546117cb906158de565b80156118185780601f106117ed57610100808354040283529160200191611818565b820191906000526020600020905b8154815290600101906020018083116117fb57829003601f168201915b505050505081565b60008281526017602052604090205482906001600160a01b031633146118585760405162461bcd60e51b815260040161108d906158b8565b600a82111561189a5760405162461bcd60e51b815260206004820152600e60248201526d1b585e080c4c081c195c98d95b9d60921b604482015260640161108d565b6000838152602260205260409081902083905551839033907fa804aa2d695b3e4ce42e3fe68691a57c9199d83349be1c08e25ac4e9ddaf44fc9061112e9086815260200190565b60008181526017602052604090205481906001600160a01b031633146119195760405162461bcd60e51b815260040161108d906158b8565b60008281526018602052604090205460ff161561196a5760405162461bcd60e51b815260206004820152600f60248201526e1d1bdad95b881a5cc81b1bd8dad959608a1b604482015260640161108d565b600e54604051632142170760e11b81526001600160a01b03909116906342842e0e9061199e90309033908790600401615a23565b600060405180830381600087803b1580156119b857600080fd5b505af11580156119cc573d6000803e3d6000fd5b5050601054604051630852cd8d60e31b8152600481018690526001600160a01b0390911692506342966c689150602401600060405180830381600087803b158015611a1657600080fd5b505af1158015611a2a573d6000803e3d6000fd5b50505050611a3a33600084613dfe565b604051829033907fa78f690a63e26fce4d4934f16c865908816c7410d4315e183b5294ab2c1b60ac90600090a35050565b611a753382613d35565b611a915760405162461bcd60e51b815260040161108d90615a47565b61141e838383613eb6565b6010546001600160a01b03163314611af65760405162461bcd60e51b815260206004820181905260248201527f6f6e6c79207468726f75676820456e7357726170706572207472616e73666572604482015260640161108d565b600082815260176020526040902080546001600160a01b038381166001600160a01b031983161790925516611b2c818385613dfe565b82826001600160a01b0316826001600160a01b03167f3ba9ca5ee943775d4a751b5bc9c8753756ddff45fa5e89c4a3e70e8c80de6b8360405160405180910390a4505050565b6000828152601b6020908152604080832054808452601783528184205460229093529083205483926001600160a01b03169083611bba82611bb4896064614046565b90614052565b9295509193505050505b9250929050565b6001600160a01b0382166000908152600b60205260408120548210611c435760405162461bcd60e51b815260206004820152602860248201527f454e53456e756d657261626c653a206f776e657220696e646578206f7574206f6044820152676620626f756e647360c01b606482015260840161108d565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b600081815260196020908152604080832054808452601b909252822054611c929061405e565b15611d0b57601254604051631d9dabef60e11b8152600481018590526001600160a01b0390911690633b3b57de90602401602060405180830381865afa158015611ce0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d049190615a98565b9392505050565b6000611d1682612214565b6001600160a01b038082166000908152601f60209081526040808320878452909152902054919250168015611d4b5780611d4d565b815b95945050505050565b50919050565b6012546001600160a01b0316611dac5760405162461bcd60e51b815260206004820152601560248201527418d8da5c081c995cdbdb1d995c881b9bdd081cd95d605a1b604482015260640161108d565b60005b82811015611f0e573360176000868685818110611dce57611dce615ab5565b60209081029290920135835250810191909152604001600020546001600160a01b031614611e0e5760405162461bcd60e51b815260040161108d90615acb565b81601e6000868685818110611e2557611e25615ab5565b602090810292909201358352508101919091526040016000908120805460ff191692151592909217909155600f546001600160a01b031690631896f70a90611e9c90602190888887818110611e7c57611e7c615ab5565b9050602002013581526020019081526020016000208054611510906158de565b84611eb257600d546001600160a01b0316611eb4565b305b6040518363ffffffff1660e01b8152600401611ed1929190615aee565b600060405180830381600087803b158015611eeb57600080fd5b505af1158015611eff573d6000803e3d6000fd5b50505050806001019050611daf565b50505050565b61141e83838360405180602001604052806000815250612c6a565b33611f386128a9565b6001600160a01b031614611f5e5760405162461bcd60e51b815260040161108d9061592e565b602755565b6000611f6e60095490565b8210611fce5760405162461bcd60e51b815260206004820152602960248201527f454e53456e756d657261626c653a20676c6f62616c20696e646578206f7574206044820152686f6620626f756e647360b81b606482015260840161108d565b60098281548110611fe157611fe1615ab5565b90600052602060002001549050919050565b60008381526017602052604090205483906001600160a01b0316331461202b5760405162461bcd60e51b815260040161108d906158b8565b600084815260216020526040812080546120499190611510906158de565b600d5460405163043c4ea360e21b81529192506001600160a01b0316906310f13a8c906115c890849088908890600401615b05565b60008281526017602052604090205482906001600160a01b031633146120b65760405162461bcd60e51b815260040161108d906158b8565b600083815260216020526040812080546120d49190611510906158de565b600d54604051630af179d760e01b81529192506001600160a01b031690630af179d7906121079084908790600401615b3a565b600060405180830381600087803b15801561212157600080fd5b505af1158015612135573d6000803e3d6000fd5b5050505050505050565b600083815260196020908152604080832054808452601b909252909120546060919061216a9061405e565b156121f057601254604051631674750f60e21b81526001600160a01b03909116906359d1d43c906121a390889088908890600401615b53565b600060405180830381865afa1580156121c0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526121e89190810190615b6d565b915050611d04565b6121e88585856132fa565b6023602052600090815260409020805461179f906158de565b6000818152600360205260408120546001600160a01b03168061104f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161108d565b600081815260196020908152604080832054808452601b90925290912054606091906122b68161405e565b156123345760125460405163691f343160e01b8152600481018690526001600160a01b039091169063691f343190602401600060405180830381865afa158015612304573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261232c9190810190615b6d565b949350505050565b6000818152602160205260408120805461234d906158de565b80601f0160208091040260200160405190810160405280929190818152602001828054612379906158de565b80156123c65780601f1061239b576101008083540402835291602001916123c6565b820191906000526020600020905b8154815290600101906020018083116123a957829003601f168201915b505050505090506000601c600085815260200190815260200160002080546123ed906158de565b80601f0160208091040260200160405190810160405280929190818152602001828054612419906158de565b80156124665780601f1061243b57610100808354040283529160200191612466565b820191906000526020600020905b81548152906001019060200180831161244957829003601f168201915b505050505090508082604051602001612480929190615bda565b604051602081830303815290604052945050505050919050565b60006001600160a01b0382166125055760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161108d565b506001600160a01b031660009081526004602052604090205490565b3361252a6128a9565b6001600160a01b0316146125505760405162461bcd60e51b815260040161108d9061592e565b61255a6000614094565b565b6021602052600090815260409020805461179f906158de565b3361257e6128a9565b6001600160a01b0316146125a45760405162461bcd60e51b815260040161108d9061592e565b6125b18162015180615c27565b601681905562278d0011156126055760405162461bcd60e51b815260206004820152601a6024820152796d757374206265206d696e696d756d206f66203330206461797360301b604482015260640161108d565b50565b600e546040516331a9108f60e11b81526004810188905260009130916001600160a01b0390911690636352211e90602401602060405180830381865afa158015612656573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267a9190615a98565b6001600160a01b0316146126a05760405162461bcd60e51b815260040161108d90615c46565b6000878152601d6020526040908190205490516373dc23fd60e11b81526001600160a01b039091169063e7b847fa906126e7908a908a908a908a908a908a90600401615cab565b602060405180830381865afa158015612704573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127289190615cf4565b979650505050505050565b6000858152601760205260409020546001600160a01b03163381146127e5576000868152601d60205260409081902054905163d3e6e26760e01b81526001600160a01b039091169063d3e6e2679061279b90899089908990339034908b908b90600401615d0d565b602060405180830381865afa1580156127b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127dc9190615d5e565b6127e557600080fd5b6000341561285e576015546127fb606434615d7b565b6128059190615c27565b60265490915061281590826140e4565b6026556128446128258234615d9d565b6001600160a01b038416600090815260256020526040902054906140e4565b6001600160a01b0383166000908152602560205260409020555b6128a08787878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152503392506140f0915050565b50505050505050565b6000546001600160a01b031690565b336000908152602560205260409020546128e45760405162461bcd60e51b815260040161108d90615db4565b33600081815260256020526040808220805490839055905190929183156108fc02918491818181858888f19350505050158015612925573d6000803e3d6000fd5b5060405181815233907f21901fa892c430ea8bd38b9390225ac8e67eac75ee10ffba16feefc539a288f99060200160405180910390a250565b336129676128a9565b6001600160a01b03161461298d5760405162461bcd60e51b815260040161108d9061592e565b601254600160a01b900460ff16156129b75760405162461bcd60e51b815260040161108d90615ddf565b6012805460ff60a01b1916600160a01b179055565b60606002805461114a906158de565b60008281526017602052604090205482906001600160a01b03163314612a135760405162461bcd60e51b815260040161108d906158b8565b60008381526021602052604081208054612a319190611510906158de565b600d5460405162d5fa2b60e81b81529192506001600160a01b03169063d5fa2b00906121079084908790600401615aee565b612a6e3383836143d8565b5050565b60008381526017602052604090205483906001600160a01b03163314612aaa5760405162461bcd60e51b815260040161108d906158b8565b6000848152602360205260409020612ac3908484614c34565b5083336001600160a01b03167f8108821133e68e1837bba88bf0c6ca1d5dad62a817c3dc97ada83159dcf8f9838585604051612b0092919061598c565b60405180910390a350505050565b60606000826001600160401b03811115612b2a57612b2a614e99565b604051908082528060200260200182016040528015612b6357816020015b612b50614cb8565b815260200190600190039081612b485790505b50905060005b83811015612bb757612b92858583818110612b8657612b86615ab5565b9050602002013561449a565b828281518110612ba457612ba4615ab5565b6020908102919091010152600101612b69565b509392505050565b33612bc86128a9565b6001600160a01b031614612bee5760405162461bcd60e51b815260040161108d9061592e565b6005811115612c2f5760405162461bcd60e51b815260206004820152600d60248201526c1b585e080d481c195c98d95b9d609a1b604482015260640161108d565b601555565b6000808383604051602001612c4a929190615a13565b60408051601f198184030181529190528051602090910120949350505050565b612c743383613d35565b612c905760405162461bcd60e51b815260040161108d90615a47565b611f0e84848484614738565b6000612ca88989612c34565b9050612cb381613b3b565b3414612cf35760405162461bcd60e51b815260206004820152600f60248201526e34b731b7b93932b1ba1032ba3432b960891b604482015260640161108d565b601654612d019042906140e4565b600e54604051636b727d4360e11b8152600481018490526001600160a01b039091169063d6e4fa8690602401602060405180830381865afa158015612d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d6e9190615cf4565b11612db65760405162461bcd60e51b8152602060048201526018602482015277646f6d61696e206578706972657320746f6f206561726c7960401b604482015260640161108d565b600e54604051630a3b53db60e21b81526001600160a01b03909116906328ed4f6c90612de89084903090600401615aee565b600060405180830381600087803b158015612e0257600080fd5b505af1158015612e16573d6000803e3d6000fd5b505050506000612e5b8a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111cd92505050565b600d54600f54604051630178b8bf60e01b8152600481018490529293506001600160a01b0391821692911690630178b8bf90602401602060405180830381865afa158015612ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ed19190615a98565b6001600160a01b031614158015612ef95750821580612ef957506012546001600160a01b0316155b15612f6857600f54600d54604051630c4b7b8560e11b81526001600160a01b0392831692631896f70a92612f3592869290911690600401615aee565b600060405180830381600087803b158015612f4f57600080fd5b505af1158015612f63573d6000803e3d6000fd5b505050505b828015612f7f57506012546001600160a01b031615155b1561300257600f54604051630c4b7b8560e11b81526001600160a01b0390911690631896f70a90612fb69084903090600401615aee565b600060405180830381600087803b158015612fd057600080fd5b505af1158015612fe4573d6000803e3d6000fd5b5050506000838152601e60205260409020805460ff19166001179055505b600e54604051632142170760e11b81526001600160a01b03909116906342842e0e9061303690339030908790600401615a23565b600060405180830381600087803b15801561305057600080fd5b505af1158015613064573d6000803e3d6000fd5b505050600083815260176020908152604080832080546001600160a01b031916331790556021909152902061309b91508b8b614c34565b506000828152601d6020526040902080546001600160a01b0319166001600160a01b0386161790556026546130d090346140e4565b60265587156130e3576130e38289611820565b86156130f3576130f38288611055565b841561310457613104828787612a72565b6000828152601d602052604080822080546001600160a01b0319166001600160a01b0388169081179091559051909184913391600080516020615ef983398151915291a481336001600160a01b03167f27f8090f694b057d01445469d328e18e608be6524dd0db6ddd212ea41f27d70d8c8c60405161318492919061598c565b60405180910390a3601054604051634f558e7960e01b8152600481018490526001600160a01b0390911690634f558e7990602401602060405180830381865afa1580156131d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131f99190615d5e565b1561327e57601054604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561324457600080fd5b505af1158015613258573d6000803e3d6000fd5b5050506000838152601860205260408120805460ff1916905561327e9150339084613dfe565b6010546040516340c10f1960e01b81526001600160a01b03909116906340c10f19906132b09033908690600401615244565b600060405180830381600087803b1580156132ca57600080fd5b505af11580156132de573d6000803e3d6000fd5b505050506132ee60003384613dfe565b50505050505050505050565b60008381526020805260408082209051606092919061331c9086908690615a13565b90815260200160405180910390208054613335906158de565b80601f0160208091040260200160405190810160405280929190818152602001828054613361906158de565b80156133ae5780601f10613383576101008083540402835291602001916133ae565b820191906000526020600020905b81548152906001019060200180831161339157829003601f168201915b505050505090507fd1f86c93d831119ad98fe983e643a7431e4ac992e3ead6e3007f4dd1adf6634384846040516020016133e9929190615a13565b6040516020818303038152906040528051906020012014801561340b57508051155b1561232c57600085815260196020908152604080832054808452601b835281842054808552602390935292208054613442906158de565b80601f016020809104026020016040519081016040528092919081815260200182805461346e906158de565b80156134bb5780601f10613490576101008083540402835291602001916134bb565b820191906000526020600020905b81548152906001019060200180831161349e57829003601f168201915b505050505092505050949350505050565b336134d56128a9565b6001600160a01b0316146134fb5760405162461bcd60e51b815260040161108d9061592e565b601180546001600160a01b0319166001600160a01b0392909216919091179055565b606061352882613caa565b6135445760405162461bcd60e51b815260040161108d906159bf565b60135460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa15801561358d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261104f9190810190615b6d565b6001600160a01b0383166000908152600b60205260408120546060916135db8583615d9d565b6135e58686614dc1565b116135f057836135fa565b6135fa8583615d9d565b90506000816001600160401b0381111561361657613616614e99565b60405190808252806020026020018201604052801561363f578160200160208202803683370190505b50905060005b828110156136a4576001600160a01b038816600090815260076020526040812090613670838a614dc1565b81526020019081526020016000205482828151811061369157613691615ab5565b6020908102919091010152600101613645565b509695505050505050565b6136b93383613d35565b6136d55760405162461bcd60e51b815260040161108d906159ed565b60006136e083612214565b6001600160a01b038181166000908152601f60209081526040808320888452825280832080546001600160a01b0319169488169485179055601a909152902054919250600080516020615f19833981519152901561373e5783613740565b825b60405161374d9190614fb6565b60405180910390a2505050565b336137636128a9565b6001600160a01b0316146137895760405162461bcd60e51b815260040161108d9061592e565b601380546001600160a01b0319166001600160a01b0392909216919091179055565b336137b46128a9565b6001600160a01b0316146137da5760405162461bcd60e51b815260040161108d9061592e565b6000602654116137fc5760405162461bcd60e51b815260040161108d90615db4565b602680546000918290556040519091339183156108fc0291849190818181858888f19350505050158015612a6e573d6000803e3d6000fd5b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b60208080526000928352604090922081518083018401805192815290840192909301919091209152805461179f906158de565b3361389e6128a9565b6001600160a01b0316146138c45760405162461bcd60e51b815260040161108d9061592e565b601254600160a01b900460ff16156138ee5760405162461bcd60e51b815260040161108d90615ddf565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6114b2868686868686601160009054906101000a90046001600160a01b03166000612c9c565b3361393f6128a9565b6001600160a01b0316146139655760405162461bcd60e51b815260040161108d9061592e565b6001600160a01b0381166139ca5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161108d565b61260581614094565b60008181526017602052604090205481906001600160a01b03163314613a0b5760405162461bcd60e51b815260040161108d906158b8565b600e546040516331a9108f60e11b81526004810184905230916001600160a01b031690636352211e90602401602060405180830381865afa158015613a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a789190615a98565b6001600160a01b031614613a9e5760405162461bcd60e51b815260040161108d90615c46565b60008281526018602052604090205460ff1615613af45760405162461bcd60e51b81526020600482015260146024820152731d1bdad95b88185b1c9958591e481b1bd8dad95960621b604482015260640161108d565b600082815260186020526040808220805460ff1916600117905551839133917f76c8c0250a7ceeb05fdd65de50a85867a7b848d87e645fd0eb1ec8b0022f131e9190a35050565b6000818152601760205260408120546001600160a01b031615613b5f57600061104f565b505060275490565b60005b82811015611f0e573360176000868685818110613b8957613b89615ab5565b60209081029290920135835250810191909152604001600020546001600160a01b031614613bc95760405162461bcd60e51b815260040161108d90615acb565b81601d6000868685818110613be057613be0615ab5565b6020908102929092013583525081019190915260400160002080546001600160a01b0319166001600160a01b039283161790558216848483818110613c2757613c27615ab5565b90506020020135336001600160a01b0316600080516020615ef983398151915260405160405180910390a4600101613b6a565b60006001600160e01b031982166380ac58cd60e01b1480613c8b57506001600160e01b03198216635b5e139f60e01b145b8061104f57506301ffc9a760e01b6001600160e01b031983161461104f565b6000908152600360205260409020546001600160a01b0316151590565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613cfc82612214565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000613d4082613caa565b613da15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161108d565b6000613dac83612214565b9050806001600160a01b0316846001600160a01b03161480613dd35750613dd38185613834565b8061232c5750836001600160a01b0316613dec8461128b565b6001600160a01b031614949350505050565b6001600160a01b038316613e5957613e5481600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b613e7c565b816001600160a01b0316836001600160a01b031614613e7c57613e7c838261476b565b6001600160a01b038216613e935761141e81614837565b826001600160a01b0316826001600160a01b03161461141e5761141e82826148e6565b826001600160a01b0316613ec982612214565b6001600160a01b031614613f2d5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161108d565b6001600160a01b038216613f8f5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161108d565b613f9a600082613cc7565b6001600160a01b0383166000908152600460205260408120805460019290613fc3908490615d9d565b90915550506001600160a01b0382166000908152600460205260408120805460019290613ff1908490614dc1565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615f3983398151915291a461141e838383614940565b6000611d048284615d7b565b6000611d048284615c27565b6000818152601e602052604081205460ff1680614079575081155b801561104f57506012546001600160a01b0316151592915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611d048284614dc1565b6000826040516020016141039190615912565b604051602081830303815290604052805190602001209050600061413e602160008781526020019081526020016000208054611510906158de565b90506000818360405160200161415e929190918252602082015260400190565b60408051601f19818403018152918152815160209283012060008181526019909352912054909150156141cf5760405162461bcd60e51b81526020600482015260196024820152787375622d646f6d61696e20616c72656164792065786973747360381b604482015260640161108d565b600f54604051631ef3fca760e31b8152600481018390526001600160a01b039091169063f79fe53890602401602060405180830381865afa158015614218573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061423c9190615d5e565b1561429e5760405162461bcd60e51b815260206004820152602c60248201527f7375622d646f6d61696e20616c726561647920657869737473206f757473696460448201526b0ca40decc40cae6cc5ccae8d60a31b606482015260840161108d565b60006014600081546142af90615e10565b91829055506000818152601a602090815260408083208690558583526019909152902081905590506142e185826149be565b6000818152601b602090815260408083208a9055601c8252909120875161430a92890190614d22565b50600f546040516305ef2c7f60e41b8152600481018590526024810186905230604482018190526064820152600060848201526001600160a01b0390911690635ef2c7f09060a401600060405180830381600087803b15801561436c57600080fd5b505af1158015614380573d6000803e3d6000fd5b505050508087866001600160a01b03167fec210fd1577de9c696717517071d966a307a0564edaef59a3147ca5572e7fdab6143ba8661228b565b6040516143c79190614e86565b60405180910390a450505050505050565b816001600160a01b0316836001600160a01b0316036144355760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161108d565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910161112e565b6144a2614cb8565b6144aa614cb8565b828152600083815260216020526040902080546144c6906158de565b80601f01602080910402602001604051908101604052809291908181526020018280546144f2906158de565b801561453f5780601f106145145761010080835404028352916020019161453f565b820191906000526020600020905b81548152906001019060200180831161452257829003601f168201915b50505050602080840192909252506000848152602282526040808220548185015285825260178352808220546001600160a01b03166060850152858252601883528082205460ff1615156080850152858252602483528082205460a085015285825260239092522080546145b2906158de565b80601f01602080910402602001604051908101604052809291908181526020018280546145de906158de565b801561462b5780601f106146005761010080835404028352916020019161462b565b820191906000526020600020905b81548152906001019060200180831161460e57829003601f168201915b50505050508160c0018190525061464581602001516111cd565b60e0820152600e546040516331a9108f60e11b8152600481018590526001600160a01b0390911690636352211e90602401602060405180830381865afa158015614693573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146b79190615a98565b6001600160a01b03908116610100830152600e54604051636b727d4360e11b81526004810186905291169063d6e4fa8690602401602060405180830381865afa158015614708573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061472c9190615cf4565b61012082015292915050565b614743848484613eb6565b61474f848484846149d8565b611f0e5760405162461bcd60e51b815260040161108d90615e29565b6001600160a01b0382166000908152600b602052604081205461479090600190615d9d565b6000838152600860205260409020549091508082146147e3576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b60008381526008602090815260408083208390556001600160a01b0387168084526007835281842086855283528184208490558352600b9091528120805490919061482d90615e7b565b9091555050505050565b60095460009061484990600190615d9d565b6000838152600a60205260408120546009805493945090928490811061487157614871615ab5565b90600052602060002001549050806009838154811061489257614892615ab5565b6000918252602080832090910192909255828152600a909152604080822084905585825281205560098054806148ca576148ca615e92565b6001900381819060005260206000200160009055905550505050565b6001600160a01b0382166000818152600b6020818152604080842080546007845282862081875284528286208890558786526008845291852082905594845291905282549092919061493790615e10565b90915550505050565b6000818152601a60209081526040808320546001600160a01b038681168552601f8452828520868652909352922054600080516020615f198339815191529116156149b0576001600160a01b038085166000908152601f6020908152604080832087845290915290205416613740565b8360405161374d9190614fb6565b612a6e828260405180602001604052806000815250614ad9565b60006001600160a01b0384163b15614ace57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614a1c903390899088908890600401615ea8565b6020604051808303816000875af1925050508015614a57575060408051601f3d908101601f19168201909252614a5491810190615edb565b60015b614ab4573d808015614a85576040519150601f19603f3d011682016040523d82523d6000602084013e614a8a565b606091505b508051600003614aac5760405162461bcd60e51b815260040161108d90615e29565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061232c565b506001949350505050565b614ae38383614b0c565b614af060008484846149d8565b61141e5760405162461bcd60e51b815260040161108d90615e29565b6001600160a01b038216614b625760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161108d565b614b6b81613caa565b15614bb75760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604482015260640161108d565b6001600160a01b0382166000908152600460205260408120805460019290614be0908490614dc1565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615f39833981519152908290a4612a6e60008383614940565b828054614c40906158de565b90600052602060002090601f016020900481019282614c625760008555614ca8565b82601f10614c7b5782800160ff19823516178555614ca8565b82800160010185558215614ca8579182015b82811115614ca8578235825591602001919060010190614c8d565b50614cb4929150614d96565b5090565b60405180610140016040528060008152602001606081526020016000815260200160006001600160a01b0316815260200160001515815260200160008152602001606081526020016000801916815260200160006001600160a01b03168152602001600081525090565b828054614d2e906158de565b90600052602060002090601f016020900481019282614d505760008555614ca8565b82601f10614d6957805160ff1916838001178555614ca8565b82800160010185558215614ca8579182015b82811115614ca8578251825591602001919060010190614d7b565b5b80821115614cb45760008155600101614d97565b634e487b7160e01b600052601160045260246000fd5b60008219821115614dd457614dd4614dab565b500190565b6001600160e01b03198116811461260557600080fd5b600060208284031215614e0157600080fd5b8135611d0481614dd9565b60008060408385031215614e1f57600080fd5b50508035926020909101359150565b60005b83811015614e49578181015183820152602001614e31565b83811115611f0e5750506000910152565b60008151808452614e72816020860160208601614e2e565b601f01601f19169290920160200192915050565b602081526000611d046020830184614e5a565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614ed757614ed7614e99565b604052919050565b60006001600160401b03821115614ef857614ef8614e99565b50601f01601f191660200190565b600082601f830112614f1757600080fd5b8135614f2a614f2582614edf565b614eaf565b818152846020838601011115614f3f57600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215614f6e57600080fd5b81356001600160401b03811115614f8457600080fd5b61232c84828501614f06565b600060208284031215614fa257600080fd5b5035919050565b6001600160a01b03169052565b6001600160a01b0391909116815260200190565b6001600160a01b038116811461260557600080fd5b60008060408385031215614ff257600080fd5b8235614ffd81614fca565b946020939093013593505050565b60008083601f84011261501d57600080fd5b5081356001600160401b0381111561503457600080fd5b602083019150836020828501011115611bc457600080fd5b6000806020838503121561505f57600080fd5b82356001600160401b0381111561507557600080fd5b6150818582860161500b565b90969095509350505050565b6000806000606084860312156150a257600080fd5b833592506020840135915060408401356001600160401b038111156150c657600080fd5b6150d286828701614f06565b9150509250925092565b6000806000806000606086880312156150f457600080fd5b8535945060208601356001600160401b038082111561511257600080fd5b61511e89838a0161500b565b9096509450604088013591508082111561513757600080fd5b506151448882890161500b565b969995985093965092949392505050565b60008060008060006080868803121561516d57600080fd5b853561517881614fca565b9450602086013561518881614fca565b93506040860135925060608601356001600160401b038111156151aa57600080fd5b6151448882890161500b565b6000806000606084860312156151cb57600080fd5b83356151d681614fca565b925060208401356151e681614fca565b929592945050506040919091013590565b6000806040838503121561520a57600080fd5b82359150602083013561521c81614fca565b809150509250929050565b60006020828403121561523957600080fd5b8135611d0481614fca565b6001600160a01b03929092168252602082015260400190565b60008083601f84011261526f57600080fd5b5081356001600160401b0381111561528657600080fd5b6020830191508360208260051b8501011115611bc457600080fd5b801515811461260557600080fd5b6000806000604084860312156152c457600080fd5b83356001600160401b038111156152da57600080fd5b6152e68682870161525d565b90945092505060208401356152fa816152a1565b809150509250925092565b60008060006060848603121561531a57600080fd5b8335925060208401356001600160401b038082111561533857600080fd5b61534487838801614f06565b9350604086013591508082111561535a57600080fd5b506150d286828701614f06565b6000806040838503121561537a57600080fd5b8235915060208301356001600160401b0381111561539757600080fd5b6153a385828601614f06565b9150509250929050565b6000806000604084860312156153c257600080fd5b8335925060208401356001600160401b038111156153df57600080fd5b6153eb8682870161500b565b9497909650939450505050565b6000806000806000806080878903121561541157600080fd5b8635955060208701356001600160401b038082111561542f57600080fd5b61543b8a838b0161500b565b90975095506040890135915061545082614fca565b9093506060880135908082111561546657600080fd5b5061547389828a0161525d565b979a9699509497509295939492505050565b60008060008060006060868803121561549d57600080fd5b8535945060208601356001600160401b03808211156154bb57600080fd5b6154c789838a0161500b565b909650945060408801359150808211156154e057600080fd5b506151448882890161525d565b6000806040838503121561550057600080fd5b823561550b81614fca565b9150602083013561521c816152a1565b6000806020838503121561552e57600080fd5b82356001600160401b0381111561554457600080fd5b6150818582860161525d565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561563557603f1989840301855281516101408151855288820151818a8701526155a682870182614e5a565b91505087820151888601526060808301516155c382880182614fa9565b505060808281015115159086015260a0808301519086015260c080830151868303828801526155f28382614e5a565b9250505060e08083015181870152506101008083015161561482880182614fa9565b50506101209182015194909101939093529386019390860190600101615577565b509098975050505050505050565b6000806000806080858703121561565957600080fd5b843561566481614fca565b9350602085013561567481614fca565b92506040850135915060608501356001600160401b0381111561569657600080fd5b6156a287828801614f06565b91505092959194509250565b60008060008060008060008060c0898b0312156156ca57600080fd5b88356001600160401b03808211156156e157600080fd5b6156ed8c838d0161500b565b909a50985060208b0135975060408b0135965060608b013591508082111561571457600080fd5b506157218b828c0161500b565b909550935050608089013561573581614fca565b915060a0890135615745816152a1565b809150509295985092959890939650565b60008060006060848603121561576b57600080fd5b833561577681614fca565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b818110156157c3578351835292840192918401916001016157a7565b50909695505050505050565b600080604083850312156157e257600080fd5b82356157ed81614fca565b9150602083013561521c81614fca565b6000806000806000806080878903121561581657600080fd5b86356001600160401b038082111561582d57600080fd5b6158398a838b0161500b565b90985096506020890135955060408901359450606089013591508082111561586057600080fd5b5061547389828a0161500b565b60008060006040848603121561588257600080fd5b83356001600160401b0381111561589857600080fd5b6158a48682870161525d565b90945092505060208401356152fa81614fca565b6020808252600c908201526b34b9903737ba1037bbb732b960a11b604082015260600190565b600181811c908216806158f257607f821691505b602082108103611d5657634e487b7160e01b600052602260045260246000fd5b60008251615924818460208701614e2e565b9190910192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208152600061232c602083018486615963565b838152826020820152606060408201526000611d4d6060830184614e5a565b6020808252601490820152731d1bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604082015260600190565b6020808252600c908201526b1b9bdd08185c1c1c9bdd995960a21b604082015260600190565b8183823760009101908152919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600060208284031215615aaa57600080fd5b8151611d0481614fca565b634e487b7160e01b600052603260045260246000fd5b6020808252600990820152683737ba1037bbb732b960b91b604082015260600190565b9182526001600160a01b0316602082015260400190565b838152606060208201526000615b1e6060830185614e5a565b8281036040840152615b308185614e5a565b9695505050505050565b82815260406020820152600061232c6040830184614e5a565b838152604060208201526000611d4d604083018486615963565b600060208284031215615b7f57600080fd5b81516001600160401b03811115615b9557600080fd5b8201601f81018413615ba657600080fd5b8051615bb4614f2582614edf565b818152856020838501011115615bc957600080fd5b611d4d826020830160208601614e2e565b60008351615bec818460208801614e2e565b601760f91b9083019081528351615c0a816001840160208801614e2e565b6305ccae8d60e31b60019290910191820152600501949350505050565b6000816000190483118215151615615c4157615c41614dab565b500290565b6020808252601590820152741d1bdad95b881b9bdd081a5b8818dbdb9d1c9858dd605a1b604082015260600190565b81835260006001600160fb1b03831115615c8e57600080fd5b8260051b8083602087013760009401602001938452509192915050565b868152608060208201526000615cc5608083018789615963565b6001600160a01b03861660408401528281036060840152615ce7818587615c75565b9998505050505050505050565b600060208284031215615d0657600080fd5b5051919050565b87815260a060208201526000615d2760a08301888a615963565b6001600160a01b0387166040840152606083018690528281036080840152615d50818587615c75565b9a9950505050505050505050565b600060208284031215615d7057600080fd5b8151611d04816152a1565b600082615d9857634e487b7160e01b600052601260045260246000fd5b500490565b600082821015615daf57615daf614dab565b500390565b6020808252601190820152706e6f2066756e647320746f20636c61696d60781b604082015260600190565b6020808252601790820152761c995cdbdb1d995c88185b1c9958591e481b1bd8dad959604a1b604082015260600190565b600060018201615e2257615e22614dab565b5060010190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600081615e8a57615e8a614dab565b506000190190565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615b3090830184614e5a565b600060208284031215615eed57600080fd5b8151611d0481614dd956feb77ba91ddde5fdf14997b1c5ef2323ad306de6e5f60d085d1f9021278e4f34e552d7d861f09ab3d26239d492e8968629f95e9e318cf0b73bfddc441522a15fd2ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212202f585c0a760b8cf36a294661053f86e14648988160e81d0b53b62c585f9c297764736f6c634300080d0033
Verified Source Code Full Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (1 runs)
ENSEnumerable.sol 171 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
/**
* @dev Adapted this from the ERC721Enumerable extension
*/
abstract contract ENSEnumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
mapping(address => uint256) public TLDBalances;
/**
* @dev
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
require(index < TLDBalances[owner], "ENSEnumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev
*/
function totalTLDCount() public view virtual returns (uint256) {
return _allTokens.length;
}
/**
* @dev
*/
function tokenByIndex(uint256 index) public view virtual returns (uint256) {
require(index < totalTLDCount(), "ENSEnumerable: global index out of bounds");
return _allTokens[index];
}
/**
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTLDTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = TLDBalances[to];
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
++TLDBalances[to];
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = TLDBalances[from] - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
--TLDBalances[from];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
function getTokenOwnerArray(address _addr, uint256 _start, uint256 _count) view external returns(uint256[] memory){
uint256 balance = TLDBalances[_addr];
uint256 num = (_count + _start) > (balance - _start) ? (balance - _start) : _count;
uint256[] memory arr = new uint256[](num);
for(uint256 i; i < num;){
arr[i] = _ownedTokens[_addr][_start + i];
unchecked { ++i; }
}
return arr;
}
}
EnsTldWrapper.sol 65 lines
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/IENSToken.sol";
import "./interfaces/IManager.sol";
pragma solidity ^0.8.13;
contract EnsTldWrapper is ERC721, Ownable {
address constant ENS_TOKEN_ADDRESS = 0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85;
IENSToken public EnsToken = IENSToken(ENS_TOKEN_ADDRESS);
IManager public DomainManager;
string public BaseUri = 'https://esf.tools/api/wrapped-ens-metadata/';
uint256 public totalSupply;
constructor(IManager _manager) ERC721("Wrapped ENS", "WENS"){
DomainManager = _manager;
}
function mint(address _addr, uint256 _tokenId) public isDomainManager {
_safeMint(_addr, _tokenId);
unchecked { ++totalSupply; }
}
function burn(uint256 _tokenId) public isDomainManager {
_burn(_tokenId);
unchecked { --totalSupply; } //this is only used for display generally.
}
function exists(uint256 _tokenId) public view returns(bool) {
return _exists(_tokenId);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override {
if (from != address(0) && to != address(0)){
//the token could expire and then this token would not be bound to it and could be sold independently.
//this should stop that from happening.
require(EnsToken.ownerOf(tokenId) == address(DomainManager)
&& EnsToken.nameExpires(tokenId) > block.timestamp
, "cannot transfer if expired or not in contract");
DomainManager.transferDomainOwnership(tokenId, to);
}
}
function setBaseUri(string calldata _uri) public onlyOwner {
BaseUri = _uri;
}
function _baseURI() internal view override returns (string memory) {
return BaseUri;
}
modifier isDomainManager() {
require(address(DomainManager) == msg.sender, "is not domain manager");
_;
}
}
SubdomainFactory.sol 631 lines
//SPDX-License-Identifier: MIT
//Author: @hodl_pcc << twitter
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./registration-rules.sol";
import "./interfaces/IERC2981.sol";
import "./interfaces/IENSToken.sol";
import "./interfaces/IManager.sol";
import "./interfaces/IMetadata.sol";
import "./interfaces/IRegister.sol";
import "./interfaces/IENSAdmin.sol";
import "./interfaces/IReverseResolver.sol";
import "./interfaces/ICCIPResolver.sol";
import "./metadata-provider.sol";
import "./ENSEnumerable.sol";
import "./EnsTldWrapper.sol";
pragma solidity ^0.8.13;
struct EnsInfo {
uint256 id;
string domain;
uint256 royalty;
address owner;
bool locked;
uint256 price;
string image;
bytes32 domainHash;
address currentLocation;
uint256 expiry;
}
contract SubdomainFactory is IManager, IERC721Receiver, Ownable, ERC165, ERC721, IERC2981, ENSEnumerable {
using SafeMath for uint256;
using Strings for uint256;
event DepositEns(address indexed _from, uint256 indexed _id, string _domainLabel);
event TransferEnsOwnership(address indexed _from, address indexed _to, uint256 indexed _id);
event WithdrawEns(address indexed _to, uint256 indexed _id);
event WithdrawFunds(address indexed _addr, uint256 _funds);
event UpdateDomainDefaultImage(address indexed _addr, uint256 indexed _id, string _image);
event UpdateDomainDefaultMintPrice(address indexed _addr, uint256 indexed _id, uint256 _defaultPriceInWei);
event UpdateDomainRoyaltyPercentage(address indexed _addr, uint256 indexed _id, uint256 _percentage);
event UpdateDomainRegistrationRules(address indexed _addr, uint256 indexed _id, address indexed _registrationStrategy);
event LockEnsDomain(address indexed _addr, uint256 indexed _id);
event SubdomainRegistered(address indexed _addr, uint256 indexed _id, uint256 indexed _subdomainId, string _subDomain);
event AddrChanged(bytes32 indexed node, address a);
address constant ENS_ADDRESS = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e;
address constant PUBLIC_RESOLVER_ADDRESS = 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41;
address constant REVERSE_RESOLVER_ADDRESS = 0x084b1c3C81545d370f3634392De611CaaBFf8148;
address constant ENS_TOKEN_ADDRESS = 0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85;
IReverseResolver public ReverseResolver = IReverseResolver(REVERSE_RESOLVER_ADDRESS);
IENSAdmin public PublicResolver = IENSAdmin(PUBLIC_RESOLVER_ADDRESS);
IENSToken public EnsToken = IENSToken(ENS_TOKEN_ADDRESS);
ENS private ens = ENS(ENS_ADDRESS);
EnsTldWrapper public EnsWrapper;
IRegister public DefaultRegister;
ICCIPResolver public CCIPResolver;
bool public CCIPResolverLocked;
IMetadata public MetaData;
uint256 private currentId;
uint256 public ContractOwnerPrimaryRoyalties = 2;
uint256 public MinDomainExpiry = 90 days;
mapping(uint256 => address) public TokenOwnerMap;
mapping(uint256 => bool) public TokenLocked;
mapping(bytes32 => uint256) public HashToIdMap;
mapping(uint256 => bytes32) public IdToHashMap;
mapping(uint256 => uint256) public IdToOwnerId;
mapping(uint256 => string) public IdToLabelMap;
mapping(uint256 => IRegister) public IdToRegisterMap;
mapping(uint256 => bool) public IdToUseCCIPMap;
mapping(address => mapping(uint256 => address)) public RedirectAddress;
mapping(bytes32 => mapping(string => string)) public texts;
mapping(uint256 => string) public IdToDomain;
mapping(uint256 => uint256) public IdRoyaltyMap;
mapping(uint256 => string) public IdImageMap;
mapping(uint256 => uint256) public DefaultMintPrice;
mapping(address => uint256) public OwnerFunds;
uint256 public ContractOwnerFunds;
event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);
uint256 public DepositCost = 0.1 ether;
constructor() ERC721("ENS sub-domains", "ESF"){
MetaData = new MetadataProviderV1(this);
DefaultRegister = new RegistrationRulesV1(this);
EnsWrapper = new EnsTldWrapper(this);
EnsWrapper.transferOwnership(msg.sender); //just so can update metadata link
}
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4){
require(address(this) == operator, "only transfer from contract address");
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
fallback() payable external {
ContractOwnerFunds += msg.value;
}
receive() payable external {
ContractOwnerFunds += msg.value;
}
function withdrawEns(uint256 _id) external tokenOwner(_id) {
require(!TokenLocked[_id], "token is locked");
EnsToken.safeTransferFrom(address(this), msg.sender, _id);
EnsWrapper.burn(_id);
_beforeTLDTransfer(msg.sender, address(0), _id);
emit WithdrawEns(msg.sender, _id);
}
function depositEns(string calldata _label, uint256 _royalty, uint256 _mintPrice, string calldata _defaultImageUri) payable external {
depositEns(_label, _royalty, _mintPrice, _defaultImageUri, DefaultRegister, false);
}
//only pay for the first deposit of a token.
function getDepositCost(uint256 _id) public view returns(uint256) {
return TokenOwnerMap[_id] == address(0) ? DepositCost : 0;
}
function getSubdomainCost(uint256 _tokenId, string calldata _label, address _addr, bytes32[] calldata _proofs) external view returns (uint256){
require(EnsToken.ownerOf(_tokenId) == address(this), "token not in contract");
return IdToRegisterMap[_tokenId].mintPrice(_tokenId, _label, _addr, _proofs);
}
///Deposit the ENS token and register it for sub-domain creation
///This costs the fixed amount that is set by the contract owner
///@param _label label of the .eth domain that is being deposited
// the id is worked out from the text
///@param _royalty Royalty % should be integer 0 - 10
///@param _mintPrice should be more than 0.01 ether
function depositEns(string calldata _label, uint256 _royalty, uint256 _mintPrice, string calldata _defaultImageUri, IRegister _registrationStrategy, bool _useCCIP) payable public {
uint256 id = getIdFromLabel(_label);
require(msg.value == getDepositCost(id), "incorrect ether");
require(EnsToken.nameExpires(id) > (block.timestamp.add(MinDomainExpiry)), "domain expires too early");
EnsToken.reclaim(id, address(this));
bytes32 domainHash = getDomainHash(_label);
if (ens.resolver(domainHash) != address(PublicResolver)
&& (!_useCCIP || address(CCIPResolver) == address(0))){
ens.setResolver(domainHash, address(PublicResolver));
}
//if resolver is already set to public and _useCCIP is false then do nothing
if (_useCCIP && address(CCIPResolver) != address(0)){
ens.setResolver(domainHash, address(this));
IdToUseCCIPMap[id] = true;
}
EnsToken.safeTransferFrom(msg.sender, address(this), id);
TokenOwnerMap[id] = msg.sender;
IdToDomain[id] = _label;
IdToRegisterMap[id] = _registrationStrategy;
ContractOwnerFunds = ContractOwnerFunds.add(msg.value);
if(_royalty > 0){
setRoyaltyPercent(id, _royalty);
}
if(_mintPrice > 0){
setMintPrice(id, _mintPrice);
}
if(bytes(_defaultImageUri).length > 0){
setSubdomainImageUri(id, _defaultImageUri);
}
IdToRegisterMap[id] = _registrationStrategy;
emit UpdateDomainRegistrationRules(msg.sender, id, address(_registrationStrategy));
emit DepositEns(msg.sender, id, _label);
//if the token has expired then it may be redeposited
if(EnsWrapper.exists(id)){
EnsWrapper.burn(id);
TokenLocked[id] = false;
_beforeTLDTransfer(msg.sender, address(0), id);
}
EnsWrapper.mint(msg.sender, id);
_beforeTLDTransfer(address(0), msg.sender, id);
}
///helper method for getting ens id from the domain label
function getIdFromLabel(string calldata _label) public pure returns(uint256 id) {
bytes32 labelHash = keccak256(abi.encodePacked(_label));
id = uint256(labelHash);
}
///function to register sub-domain
///@param _id token id of the parent ens domain
///@param _label label for the subdomain, should be lower-case, numeric not uppercase
function registerSubdomain(uint256 _id, string calldata _label, bytes32[] calldata _proofs) payable public {
address owner = TokenOwnerMap[_id];
//owner can always mint sub-domains of their TLD
if (msg.sender != owner){
//use ID specific registration strategy
//can be used for whitelist minting / payment strategy / label exclusion etc
require(IdToRegisterMap[_id].canRegister(_id, _label, msg.sender, msg.value, _proofs));
}
uint256 ownerCut;
if (msg.value > 0){
//owner primary cut is maximum 5% (set at 2% for contract deployment, unlikely to change)
ownerCut = (msg.value / 100) * ContractOwnerPrimaryRoyalties;
ContractOwnerFunds = ContractOwnerFunds.add(ownerCut);
OwnerFunds[owner] = OwnerFunds[owner].add(msg.value - ownerCut);
}
register(_id, _label, msg.sender);
}
function register(uint256 _tokenId, string memory _label, address _addr) private {
bytes32 encoded_label = keccak256(abi.encodePacked(_label));
bytes32 domainHash = getDomainHash(IdToDomain[_tokenId]);
bytes32 hashed = keccak256(abi.encodePacked(domainHash, encoded_label));
//we only check this contract for minted sub-domains. If you wish to protect sub-domains
//registered externally then these will require specifying in some custom registration rules
require(HashToIdMap[hashed] == 0, "sub-domain already exists");
require(!ens.recordExists(hashed), "sub-domain already exists outside of esf.eth");
//start from ID 1, this is because of the above check ^^
uint256 id = ++currentId;
IdToHashMap[id] = hashed;
HashToIdMap[hashed] = id;
_safeMint(_addr, id);
IdToOwnerId[id] = _tokenId; //_tokenId is the parent ens id
IdToLabelMap[id] = _label;
ens.setSubnodeRecord(domainHash, encoded_label, address(this), address(this), 0);
emit SubdomainRegistered(_addr, _tokenId, id, name(hashed));
}
///@param node nodes representaion of the full domain
///@param key key of the key:value pair to return
///@return value of the key. avatar is default but it can be overridden
function rawText(bytes32 node, string calldata key) public view returns (string memory) {
string memory value = texts[node][key];
if(keccak256(abi.encodePacked(key)) == keccak256("avatar") && bytes(value).length == 0){
uint256 id = HashToIdMap[node];
uint256 owner = IdToOwnerId[id];
value = IdImageMap[owner];
}
return value;
}
///interface method
///@param node nodes representaion of the full domain
///@param key key of the key:value pair to return
///@return value of the key. avatar is default but it can be overridden
function text(bytes32 node, string calldata key) external view returns (string memory) {
uint256 id = HashToIdMap[node];
//added ccip proxy resolver to "future proof"
if (shouldUseCcipResolver(IdToOwnerId[id])) {
return CCIPResolver.text(node, key);
}
else {
return rawText(node, key);
}
}
//standard interface method
function addr(bytes32 nodeID) public view returns (address) {
uint256 id = HashToIdMap[nodeID];
//added in ccip resolver to "future proof"
if (shouldUseCcipResolver(IdToOwnerId[id])) {
return CCIPResolver.addr(nodeID);
}
else {
address owner = ownerOf(id);
address redirect = RedirectAddress[owner][id];
return (redirect == address(0)) ? owner : redirect;
}
}
function shouldUseCcipResolver(uint256 _id) private view returns(bool){
//0 for wildcard entries.. will need to add extra logic inside of registration
//rules to stop off-chain sub-domains being reregistered
return (IdToUseCCIPMap[_id] || _id == 0)
&& address(CCIPResolver) != address(0);
}
function name(bytes32 node) view public returns (string memory){
uint256 id = HashToIdMap[node];
uint256 owner = IdToOwnerId[id];
//added in ccip resolver to "future proof"
if (shouldUseCcipResolver(owner)) {
return CCIPResolver.name(node);
}
else {
string memory domain = IdToDomain[owner];
string memory label = IdToLabelMap[id];
return string(abi.encodePacked(label,".",domain,".eth"));
}
}
function supportsInterface(bytes4 interfaceId) public view override(IERC165, ERC165, ERC721) returns(bool){
return super.supportsInterface(interfaceId)
|| interfaceId == 0x3b3b57de //addr
|| interfaceId == 0x59d1d43c //text
|| interfaceId == 0x691f3431 //name
|| interfaceId == 0x2a55205a //royalties
|| interfaceId == 0x01ffc9a7; //supportsInterface << [inception];
}
///this is the correct method for creating a 2 level ENS namehash
function getDomainHash(string memory _domain) public pure returns (bytes32 namehash) {
namehash = 0x0;
namehash = keccak256(abi.encodePacked(namehash, keccak256(abi.encodePacked('eth'))));
namehash = keccak256(abi.encodePacked(namehash, keccak256(abi.encodePacked(_domain))));
}
function tokenURI(uint256 tokenId) public view override(ERC721) returns(string memory){
require(_exists(tokenId), "token does not exist");
return MetaData.tokenURI(tokenId);
}
//user can set an address redirect for any delegated address. The redirect is only active
//whilst the NFT is in the wallet that set it. Set to `0x0000000000000000000000000000000000000000`
//to remove redirect
function setRedirect(uint256 _id, address _to) external {
//token checked if it exists in _isApprovedOrOwner method
require(_isApprovedOrOwner(msg.sender, _id), "not approved");
address owner = ownerOf(_id);
RedirectAddress[owner][_id] = _to;
emit AddrChanged(IdToHashMap[_id], _to == address(0) ? owner : _to);
}
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal override {
emit AddrChanged(IdToHashMap[tokenId], RedirectAddress[to][tokenId] == address(0) ? to : RedirectAddress[to][tokenId]);
}
function setText(bytes32 node, string calldata key, string calldata value) external {
uint256 token_id = HashToIdMap[node];
require(_exists(token_id), "token does not exist");
require(_isApprovedOrOwner(msg.sender, token_id), "not approved");
texts[node][key] = value;
emit TextChanged(node, key, key);
}
///token owner functions
///This is the royalty percentage for secondary sales. It's set per sub-domain
///owner of the TLD can set this 0-10%, this works on all marketplaces that support
///on-chain royalties :-)
function setRoyaltyPercent(uint256 _id, uint256 _percent) public tokenOwner(_id) {
require(_percent <= 10, "max 10 percent");
IdRoyaltyMap[_id] = _percent;
emit UpdateDomainRoyaltyPercentage(msg.sender, _id, _percent);
}
///token owner can set mint price. 0 mint price means that it is not for minting by
///anyone apart from the token owner. Additional logic for mint price can be applied
///in custom registration-rules that can be applied to any ENS domain. eg. you want to charge
///more for shorter labels / give certain wallets reduced price, many other ideas
function setMintPrice(uint256 _id, uint256 _price) public tokenOwner(_id) {
require(_price >= 0.01 ether || _price == 0, "min 0.01 ether");
DefaultMintPrice[_id] = _price;
emit UpdateDomainDefaultMintPrice(msg.sender, _id, _price);
}
///this is the default image that will display when users mint a sub-domain. This can be overridden
///by the user setting a value for the 'avatar' key in their text mappings
function setSubdomainImageUri(uint256 _id, string calldata _uri) tokenOwner(_id) public {
IdImageMap[_id] = _uri;
emit UpdateDomainDefaultImage(msg.sender, _id, _uri);
}
///proxy method so that the TLD owner can still manage various public resolver
///functions for their token despite it being contained in this contract
function setTldAddr(uint256 _id, uint256 coinType, bytes memory a) tokenOwner(_id) public {
bytes32 node = getDomainHash(IdToDomain[_id]);
PublicResolver.setAddr(node, coinType, a);
}
function setTldAddr(uint256 _id, address a) tokenOwner(_id) public {
bytes32 node = getDomainHash(IdToDomain[_id]);
PublicResolver.setAddr(node, a);
}
function setTldDNSRecords(uint256 _id, bytes memory data) tokenOwner(_id) public {
bytes32 node = getDomainHash(IdToDomain[_id]);
PublicResolver.setDNSRecords(node, data);
}
function setTldText(uint256 _id, string memory key, string memory value) tokenOwner(_id) public {
bytes32 node = getDomainHash(IdToDomain[_id]);
PublicResolver.setText(node, key, value);
}
///use this method to update the registration stategy for any ENS domains. Can only be called by the
///account that owns the tokens. Can update multiple at the same time.
function updateRegistrationStrategy(uint256[] calldata _ids, IRegister _registrationStrategy) public {
for(uint256 i; i < _ids.length;){
require(TokenOwnerMap[_ids[i]] == msg.sender, "not owner");
IdToRegisterMap[_ids[i]] = _registrationStrategy;
emit UpdateDomainRegistrationRules(msg.sender, _ids[i], address(_registrationStrategy));
//we do this because it's the most gas efficient way of doing the loop
unchecked { ++i; }
}
}
///I don't really like ccip, but need to make sure we provide a way of updating this in the future if it
///matures to a usable state.
function updateUseCCIPResolver(uint256[] calldata _ids, bool _shouldUse) public {
require(address(CCIPResolver) != address(0), "ccip resolver not set");
for(uint256 i; i < _ids.length;){
require(TokenOwnerMap[_ids[i]] == msg.sender, "not owner");
IdToUseCCIPMap[_ids[i]] = _shouldUse;
ens.setResolver(getDomainHash(IdToDomain[_ids[i]])
, _shouldUse ? address(this) : address(PublicResolver)
);
//we do this because it's the most gas efficient way of doing the loop
unchecked { ++i; }
}
}
///this action cannot be undone. locked domain will remain permenantly locked in the contract unless
///it expires (remember that anyone can renew a domain, so it is our intention that project funds could be
///redirected to fund renewals for popular domains)
function lockDomain(uint256 _id) tokenOwner(_id) public {
require(EnsToken.ownerOf(_id) == address(this), "token not in contract");
require(!TokenLocked[_id], "token already locked");
TokenLocked[_id] = true;
emit LockEnsDomain(msg.sender, _id);
}
///end token owner functions
//
// ------------------------------------
///if the "wrapped" ens domain is transferred then this method is called which will change the ownership
///of the domain for admin and payout purposes. We can't just link to the owner of this token because
///it is burned when the ENS is withdrawn.
function transferDomainOwnership(uint256 _id, address _newOwner) external {
require(address(EnsWrapper) == msg.sender, "only through EnsWrapper transfer");
address currentOwner = TokenOwnerMap[_id];
TokenOwnerMap[_id] = _newOwner;
_beforeTLDTransfer(currentOwner, _newOwner, _id);
emit TransferEnsOwnership(currentOwner, _newOwner, _id);
}
///this is for the ENS owners to withdraw primary sales. It's collected by wallet not by ID
///so that only 1 withdrawal is required and if a domain is sold then previous sales can still be
///claimed by the original owner.
function withdrawPrimarySalesFunds() external {
require(OwnerFunds[msg.sender] > 0, "no funds to claim");
//we do this like this to prevent re-entrency
uint256 balance = OwnerFunds[msg.sender];
OwnerFunds[msg.sender] = 0;
payable(msg.sender).transfer(balance);
emit WithdrawFunds(msg.sender, balance);
}
///contract owner functions
///contract owner to set default registration strategy. This will not alter any exsting domains that
///are using the current default strategy only future registered ones. currently the default
///registration strategy is quite basic so there is lots of room to be able to improve this in the future
function updateDefaultRegister(IRegister _registrationStrategy) external onlyOwner {
DefaultRegister = _registrationStrategy;
}
///contract owner withdraw for any primary sale commission /
function contractOwnerWithdrawFunds() external onlyOwner {
require(ContractOwnerFunds > 0, "no funds to claim");
//we do this like this to prevent re-entrency
uint256 balance = ContractOwnerFunds;
ContractOwnerFunds = 0;
payable(msg.sender).transfer(balance);
}
function setCCIPResolver(ICCIPResolver _ccip) onlyOwner external {
require(!CCIPResolverLocked, "resolver already locked");
CCIPResolver = _ccip;
}
function setCCIPLocked() onlyOwner external {
require(!CCIPResolverLocked, "resolver already locked");
CCIPResolverLocked = true;
}
function setMetadataContract(IMetadata _metadata) onlyOwner external {
MetaData = _metadata;
}
function setDepositCost(uint256 _priceInWei) onlyOwner external {
DepositCost = _priceInWei;
}
///contract owner percentage for primary sales. this cannot be set to higher than 5%
///probably set to 2% when the contract is initially deployed
function setContractOwnerPrimaryRoyalty(uint256 _percent) onlyOwner external {
require(_percent <= 5, "max 5 percent");
ContractOwnerPrimaryRoyalties = _percent;
}
//set the minimum requirement for a deposited domain to expire. 30 days seems low, default is 90 days
function setMinDomainExpiryForDeposit(uint256 _minNumberOfDays) onlyOwner external {
MinDomainExpiry = (_minNumberOfDays * 1 days);
require(MinDomainExpiry >= 30 days, "must be minimum of 30 days");
}
///underutilised ENS functionality. Naming a contract using the reverse registrar
function setContractName(string calldata _name) onlyOwner external {
ReverseResolver.setName(_name);
}
/// <end> contract owner functions
//
// ------------------------------------
///IERC2981 interface method for on-chain royalty. This is so we can charge different royalty %
///per ENS domain and also pay out to the contract owner. This standard is only supported by good reputable
///ethereum marketplaces
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (
address receiver,
uint256 royaltyAmount
){
uint256 parentId = IdToOwnerId[_tokenId];
address owner = TokenOwnerMap[parentId];
uint256 percent = IdRoyaltyMap[parentId];
uint256 royalty = _salePrice.div(100).mul(percent);
return (owner, royalty);
}
///read method to get some information for the UI
function getTokenInfo(uint256[] calldata _ids) external view returns(EnsInfo[] memory){
EnsInfo[] memory infos = new EnsInfo[](_ids.length);
for(uint256 i; i < _ids.length;){
infos[i] = getInfo(_ids[i]);
unchecked { ++i; }
}
return infos;
}
function getInfo(uint256 _id) private view returns(EnsInfo memory){
EnsInfo memory info;
info.id = _id;
info.domain = IdToDomain[_id];
info.royalty = IdRoyaltyMap[_id];
info.owner = TokenOwnerMap[_id];
info.locked = TokenLocked[_id];
info.price = DefaultMintPrice[_id];
info.image = IdImageMap[_id];
info.domainHash = getDomainHash(info.domain);
info.currentLocation = EnsToken.ownerOf(_id);
info.expiry = EnsToken.nameExpires(_id);
return info;
}
function tldBalanceOf(address _addr) public view returns(uint256){
return TLDBalances[_addr];
}
function totalSupply() public view returns(uint256){
return currentId;
}
modifier tokenOwner(uint256 _id) {
require(TokenOwnerMap[_id] == msg.sender, "is not owner");
_;
}
}
metadata-provider.sol 65 lines
//SPDX-License-Identifier: MIT
import "@ensdomains/ens-contracts/contracts/registry/ENS.sol";
import "./interfaces/IENSToken.sol";
import "./interfaces/IManager.sol";
import "./interfaces/IMetadata.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
pragma solidity ^0.8.13;
contract MetadataProviderV1 is IMetadata {
using Strings for uint256;
IManager public Manager;
ENS private ens = ENS(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e);
IENSToken public ensToken = IENSToken(0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85);
string public DefaultImage = 'ipfs://QmYWSU93qnqDvAwHGEpJbEEghGa7w7RbsYo9mYYroQnr1D'; //QmaTFCsJ9jsPEQq9zgJt9F38TJ5Ys3KwVML3mN1sZLZbxE
constructor(IManager _manager){
Manager = _manager;
}
function tokenURI(uint256 tokenId) public view returns(string memory){
string memory label = Manager.IdToLabelMap(tokenId);
uint256 ownerId = Manager.IdToOwnerId(tokenId);
string memory parentName = Manager.IdToDomain(ownerId);
string memory ensName = string(abi.encodePacked(label, ".", parentName, ".eth"));
string memory locked = (ensToken.ownerOf(ownerId) == address(Manager)) && (Manager.TokenLocked(ownerId)) ? "True" : "False";
string memory image = Manager.IdImageMap(ownerId);
bytes32 hashed = Manager.IdToHashMap(tokenId);
string memory avatar = Manager.text(hashed, "avatar");
address resolver = ens.resolver(hashed);
string memory active = resolver == address(Manager) ? "True" : "False";
uint256 expiry = ensToken.nameExpires(ownerId);
return string(
abi.encodePacked(
'data:application/json;utf8,{"name": "'
, ensName
, '","description": "Transferable '
, parentName
, '.eth sub-domain","image":"'
, bytes(avatar).length == 0 ?
(bytes(image).length == 0 ? DefaultImage : image)
: avatar
, '","attributes":[{"trait_type" : "parent name", "value" : "'
, parentName
, '.eth"},{"trait_type" : "parent locked", "value" : "'
, locked
, '"},{"trait_type" : "active", "value" : "'
, active
, '" },{"trait_type" : "parent expiry", "display_type": "date","value": ', expiry.toString(), '}]}'
)
);
}
}
registration-rules.sol 29 lines
// SPDX-License-Identifier: MIT
import "./interfaces/IManager.sol";
import "./interfaces/IRegister.sol";
pragma solidity ^0.8.13;
contract RegistrationRulesV1 is IRegister {
IManager public DomainManager;
constructor(IManager _manager){
DomainManager = _manager;
}
function canRegister(uint256 _tokenId, string calldata _label, address _addr, uint256 _priceInWei, bytes32[] calldata _proofs) external view returns(bool){
uint256 price = DomainManager.DefaultMintPrice(_tokenId);
require(price == _priceInWei, "incorrect ether");
require(price != 0, "not for primary sale");
return true;
}
function mintPrice(uint256 _tokenId, string calldata _label, address _addr, bytes32[] calldata _proofs) external view returns(uint256){
uint256 price = DomainManager.DefaultMintPrice(_tokenId);
address owner = DomainManager.TokenOwnerMap(_tokenId);
return owner == _addr ? 0 : price;
}
}
IERC2981.sol 27 lines
//SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
pragma solidity ^0.8.13;
interface IERC2981 is IERC165 {
/// ERC165 bytes to add to interface array - set in parent contract
/// implementing this standard
///
/// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
/// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
/// _registerInterface(_INTERFACE_ID_ERC2981);
/// @notice Called with the sale price to determine how much royalty
// is owed and to whom.
/// @param _tokenId - the NFT asset queried for royalty information
/// @param _salePrice - the sale price of the NFT asset specified by _tokenId
/// @return receiver - address of who should be sent the royalty payment
/// @return royaltyAmount - the royalty payment amount for _salePrice
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) external view returns (
address receiver,
uint256 royaltyAmount
);
}
IManager.sol 18 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IManager {
function IdToLabelMap( uint256 _tokenId) external view returns (string memory label);
function IdToOwnerId( uint256 _tokenId) external view returns (uint256 ownerId);
function IdToDomain( uint256 _tokenId) external view returns (string memory domain);
function TokenLocked( uint256 _tokenId) external view returns (bool locked);
function IdImageMap( uint256 _tokenId) external view returns (string memory image);
function IdToHashMap(uint256 _tokenId) external view returns (bytes32 _hash);
function text(bytes32 node, string calldata key) external view returns (string memory _value);
function DefaultMintPrice(uint256 _tokenId) external view returns (uint256 _priceInWei);
function transferDomainOwnership(uint256 _id, address _newOwner) external;
function TokenOwnerMap(uint256 _id) external view returns(address);
}
IENSAdmin.sol 12 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IENSAdmin {
function setAddr(bytes32 node, uint256 coinType, bytes memory a) external;
function setAddr(bytes32 node, address a) external;
function setDNSRecords(bytes32 node, bytes memory data) external;
function setText(bytes32 node, string memory key, string memory value) external;
}
IENSToken.sol 12 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IENSToken {
function nameExpires(uint256 id) external view returns(uint256);
function reclaim(uint256 id, address addr) external;
function setResolver(address _resolverAddress) external;
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
}
IMetadata.sol 7 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IMetadata {
function tokenURI(uint256 tokenId) external view returns(string memory);
}
IRegister.sol 9 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IRegister {
function canRegister(uint256 _tokenId, string memory _label, address _addr, uint256 _priceInWei, bytes32[] calldata _proofs) external view returns(bool);
function mintPrice(uint256 _tokenId, string calldata _label, address _addr, bytes32[] calldata _proofs) external view returns(uint256);
}
ICCIPResolver.sol 10 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface ICCIPResolver {
function text(bytes32 _node, string calldata _key) external view returns(string memory _value);
function addr(bytes32 _node) external view returns(address _addr);
function name(bytes32 node) external view returns (string memory);
}
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);
}
}
IReverseResolver.sol 7 lines
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IReverseResolver {
function setName(string memory name) external;
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
ENS.sol 32 lines
pragma solidity >=0.8.4;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
// Logged when the resolver for a node changes.
event NewResolver(bytes32 indexed node, address resolver);
// Logged when the TTL of a node changes
event NewTTL(bytes32 indexed node, uint64 ttl);
// Logged when an operator is added or removed.
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;
function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;
function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);
function setResolver(bytes32 node, address resolver) external virtual;
function setOwner(bytes32 node, address owner) external virtual;
function setTTL(bytes32 node, uint64 ttl) external virtual;
function setApprovalForAll(address operator, bool approved) external virtual;
function owner(bytes32 node) external virtual view returns (address);
function resolver(bytes32 node) external virtual view returns (address);
function ttl(bytes32 node) external virtual view returns (uint64);
function recordExists(bytes32 node) external virtual view returns (bool);
function isApprovedForAll(address owner, address operator) external virtual view returns (bool);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Read Contract
CCIPResolver 0xc822059f → address
CCIPResolverLocked 0x5004ddf6 → bool
ContractOwnerFunds 0xb83e012d → uint256
ContractOwnerPrimaryRoyalties 0x866a6b56 → uint256
DefaultMintPrice 0x3a95aa1e → uint256
DefaultRegister 0x6ba7d18d → address
DepositCost 0x6b449400 → uint256
EnsToken 0x795e3511 → address
EnsWrapper 0xc158746d → address
HashToIdMap 0x3c6961b4 → uint256
IdImageMap 0x60b10c62 → string
IdRoyaltyMap 0x8e96a134 → uint256
IdToDomain 0x74358d56 → string
IdToHashMap 0x519994ef → bytes32
IdToLabelMap 0x17964208 → string
IdToOwnerId 0xbfab1696 → uint256
IdToRegisterMap 0xd60ba8f2 → address
IdToUseCCIPMap 0x4d8c333a → bool
MetaData 0x7e309bfb → address
MinDomainExpiry 0xd177c0ba → uint256
OwnerFunds 0xc28bfe8f → uint256
PublicResolver 0x1fa4c486 → address
RedirectAddress 0xc705b884 → address
ReverseResolver 0x610732fc → address
TLDBalances 0x6ac4ef5b → uint256
TokenLocked 0x886574b2 → bool
TokenOwnerMap 0x9573b457 → address
addr 0x3b3b57de → address
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getDepositCost 0xfad9d9d7 → uint256
getDomainHash 0x07b5c385 → bytes32
getIdFromLabel 0xb6fdace0 → uint256
getSubdomainCost 0x83c664b3 → uint256
getTokenInfo 0xb346cbfc → tuple[]
getTokenOwnerArray 0xd7b3b44c → uint256[]
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
name 0x691f3431 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
rawText 0xc3457e4e → string
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
text 0x59d1d43c → string
texts 0xea5822c6 → string
tldBalanceOf 0x2628c0ab → uint256
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
totalTLDCount 0xbde28a0d → uint256
Write Contract 35 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
contractOwnerWithdrawFunds 0xe5361611
No parameters
depositEns 0xbb890aaf
string _label
uint256 _royalty
uint256 _mintPrice
string _defaultImageUri
address _registrationStrategy
bool _useCCIP
depositEns 0xed7c53b6
string _label
uint256 _royalty
uint256 _mintPrice
string _defaultImageUri
lockDomain 0xf35e0eda
uint256 _id
onERC721Received 0x150b7a02
address operator
address from
uint256 tokenId
bytes data
returns: bytes4
registerSubdomain 0x8da309d2
uint256 _id
string _label
bytes32[] _proofs
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setCCIPLocked 0x9281ae60
No parameters
setCCIPResolver 0xec47b342
address _ccip
setContractName 0x0b5ee006
string _name
setContractOwnerPrimaryRoyalty 0xb51203e0
uint256 _percent
setDepositCost 0x463de928
uint256 _priceInWei
setMetadataContract 0xe5187f43
address _metadata
setMinDomainExpiryForDeposit 0x7d5781e1
uint256 _minNumberOfDays
setMintPrice 0x0442bfa8
uint256 _id
uint256 _price
setRedirect 0xe3147f64
uint256 _id
address _to
setRoyaltyPercent 0x1a5a1c8e
uint256 _id
uint256 _percent
setSubdomainImageUri 0xaab39f76
uint256 _id
string _uri
setText 0x10f13a8c
bytes32 node
string key
string value
setTldAddr 0x10036758
uint256 _id
uint256 coinType
bytes a
setTldAddr 0x96f92f0f
uint256 _id
address a
setTldDNSRecords 0x5881f62c
uint256 _id
bytes data
setTldText 0x5809fd8e
uint256 _id
string key
string value
transferDomainOwnership 0x25d0f90f
uint256 _id
address _newOwner
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateDefaultRegister 0xc44fb600
address _registrationStrategy
updateRegistrationStrategy 0xfeb1748c
uint256[] _ids
address _registrationStrategy
updateUseCCIPResolver 0x40f1f746
uint256[] _ids
bool _shouldUse
withdrawEns 0x1b486d40
uint256 _id
withdrawPrimarySalesFunds 0x91965374
No parameters
Recent Transactions
No transactions found for this address