Address Contract Partially Verified
Address
0xD8CC0EFbd1c7B0BE32b5F4b3613FF3cc4D2AF5F2
Balance
0 ETH
Nonce
1
Code Size
13749 bytes
Creator
0x42327eD1...d36c at tx 0xd0aae123...d5be49
Indexed Transactions
0
Contract Bytecode
13749 bytes
0x608060405234801561001057600080fd5b50600436106102415760003560e01c806370a0823111610145578063a72b923e116100bd578063c87b56dd1161008c578063e985e9c511610071578063e985e9c514610506578063f2fcde2914610542578063f2fde38b1461054f57600080fd5b8063c87b56dd146104ea578063db4af1c6146104fd57600080fd5b8063a72b923e146104a8578063a97dd786146104bb578063b88d4fde146104ce578063bf424e7e146104e157600080fd5b80638da5cb5b116101145780639a6acf20116100f95780639a6acf201461046f578063a22cb46514610482578063a3bcae581461049557600080fd5b80638da5cb5b1461045657806395d89b411461046757600080fd5b806370a08231146103e5578063715018a6146104065780637632514c1461040e5780638d6cc56d1461044357600080fd5b80632cd29564116101d857806355f804b3116101a75780636352211e1161018c5780636352211e146103ac5780636c19e783146103bf5780636d84deb6146103d257600080fd5b806355f804b3146103875780635c975abb1461039a57600080fd5b80632cd295641461030f57806331b4562e146103225780633ccfd60b1461036c57806342842e0e1461037457600080fd5b806316c38b3c1161021457806316c38b3c146102c3578063176fc4d3146102d657806317b8df27146102e957806323b872dd146102fc57600080fd5b806301ffc9a71461024657806306fdde031461026e578063081812fc14610283578063095ea7b3146102ae575b600080fd5b610259610254366004613098565b610562565b60405190151581526020015b60405180910390f35b610276610647565b60405161026591906133a6565b6102966102913660046131de565b6106d9565b6040516001600160a01b039091168152602001610265565b6102c16102bc366004613053565b610784565b005b6102c16102d136600461307d565b6108d4565b6102c16102e4366004613160565b610946565b6102c16102f736600461307d565b610dc6565b6102c161030a366004612f85565b610e33565b6102c161031d3660046131de565b610eba565b6103516103303660046130d2565b600d6020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610265565b6102c1610f19565b6102c1610382366004612f85565b611016565b6102c16103953660046131a9565b611031565b600654600160a01b900460ff16610259565b6102966103ba3660046131de565b6110a2565b6102c16103cd366004612f30565b61112d565b6102c16103e0366004613210565b6111c6565b6103f86103f3366004612f30565b6113ba565b604051908152602001610265565b6102c1611454565b61042161041c3660046130d2565b6114ba565b6040805182518152602080840151908201529181015190820152606001610265565b6102c16104513660046131de565b611543565b6006546001600160a01b0316610296565b6102766115a2565b6102c161047d366004612f30565b6115b1565b6102c1610490366004613029565b61163a565b6102c16104a3366004613144565b611645565b600c54610296906001600160a01b031681565b6102c16104c93660046130ed565b611888565b6102c16104dc366004612fc1565b611bc7565b6103f860085481565b6102766104f83660046131de565b611c55565b6103f860095481565b610259610514366004612f52565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600b546102599060ff1681565b6102c161055d366004612f30565b611d14565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806105f557507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061064157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60606000805461065690613479565b80601f016020809104026020016040519081016040528092919081815260200182805461068290613479565b80156106cf5780601f106106a4576101008083540402835291602001916106cf565b820191906000526020600020905b8154815290600101906020018083116106b257829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107685760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061078f826110a2565b9050806001600160a01b0316836001600160a01b031614156108195760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f7200000000000000000000000000000000000000000000000000000000000000606482015260840161075f565b336001600160a01b038216148061085357506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b6108c55760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161075f565b6108cf8383611df3565b505050565b6006546001600160a01b0316331461092e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b8061093e5761093b611e6e565b50565b61093b611f2f565b600260075414156109995760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600755600654600160a01b900460ff16156109f85760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161075f565b8181610a048282611fdf565b610a505760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964205369676e6174757265000000000000000000000000000000604482015260640161075f565b84600854610a5e9190613417565b600c546040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906370a0823190602401602060405180830381600087803b158015610abc57600080fd5b505af1158015610ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af491906131f7565b1015610b425760405162461bcd60e51b815260206004820152601060248201527f4e6f7420456e6f7567682024544f595300000000000000000000000000000000604482015260640161075f565b600d6000876003811115610b5857610b5861350f565b6003811115610b6957610b6961350f565b81526020019081526020016000206001015485600d6000896003811115610b9257610b9261350f565b6003811115610ba357610ba361350f565b815260200190815260200160002060020154610bbf91906133eb565b1115610c0d5760405162461bcd60e51b815260206004820181905260248201527f5175616e746974792065786565647320617661696c61626c6520737570706c79604482015260640161075f565b60005b85811015610cd057600081600d60008a6003811115610c3157610c3161350f565b6003811115610c4257610c4261350f565b815260200190815260200160002060020154600d60008b6003811115610c6a57610c6a61350f565b6003811115610c7b57610c7b61350f565b815260200190815260200160002060000154610c9791906133eb565b610ca191906133eb565b9050610cbd3382604051806020016040528060008152506120c5565b5080610cc8816134b4565b915050610c10565b5084600d6000886003811115610ce857610ce861350f565b6003811115610cf957610cf961350f565b81526020019081526020016000206002016000828254610d1991906133eb565b9091555050600c546008546001600160a01b039091169063af7d6ca3903390610d43908990613417565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610da157600080fd5b505af1158015610db5573d6000803e3d6000fd5b505060016007555050505050505050565b6006546001600160a01b03163314610e205760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600b805460ff1916911515919091179055565b610e3d338261214e565b610eaf5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161075f565b6108cf838383612256565b6006546001600160a01b03163314610f145760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600955565b6006546001600160a01b03163314610f735760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600e546040516000916001600160a01b03169047908381818185875af1925050503d8060008114610fc0576040519150601f19603f3d011682016040523d82523d6000602084013e610fc5565b606091505b505090508061093b5760405162461bcd60e51b815260206004820152601860248201527f4661696c656420746f2073656e6420746f207661756c742e0000000000000000604482015260640161075f565b6108cf83838360405180602001604052806000815250611bc7565b6006546001600160a01b0316331461108b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b805161109e90600a906020840190612dcf565b5050565b6000818152600260205260408120546001600160a01b0316806106415760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e0000000000000000000000000000000000000000000000606482015260840161075f565b6006546001600160a01b031633146111875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600b80546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b81816111d28282611fdf565b61121e5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964205369676e6174757265000000000000000000000000000000604482015260640161075f565b600b5460ff166112705760405162461bcd60e51b815260206004820152601160248201527f4e616d696e672020697320436c6f736564000000000000000000000000000000604482015260640161075f565b3361127a876110a2565b6001600160a01b0316146112f65760405162461bcd60e51b815260206004820152602860248201527f4f6e6c79207468652062616279277320706172656e742063616e206e616d652060448201527f7468652062616279000000000000000000000000000000000000000000000000606482015260840161075f565b600c546009546040517faf7d6ca300000000000000000000000000000000000000000000000000000000815233600482015260248101919091526001600160a01b039091169063af7d6ca390604401600060405180830381600087803b15801561135f57600080fd5b505af1158015611373573d6000803e3d6000fd5b505050507fb51cde3c6995aa2a3b889d975e49bd3c3cc7850957a7abf9aa17c6b7b8aad4f28686336040516113aa939291906133b9565b60405180910390a1505050505050565b60006001600160a01b0382166114385760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f206164647265737300000000000000000000000000000000000000000000606482015260840161075f565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b031633146114ae5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b6114b86000612430565b565b6114de60405180606001604052806000815260200160008152602001600081525090565b600d60008360038111156114f4576114f461350f565b60038111156115055761150561350f565b815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820154815250509050919050565b6006546001600160a01b0316331461159d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600855565b60606001805461065690613479565b6006546001600160a01b0316331461160b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61109e33838361248f565b6006546001600160a01b0316331461169f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b600d60008360038111156116b5576116b561350f565b60038111156116c6576116c661350f565b81526020019081526020016000206001015481116117265760405162461bcd60e51b815260206004820152601760248201527f537570706c792063616e206e6f74206465637261657365000000000000000000604482015260640161075f565b600082600381111561173a5761173a61350f565b6003141561174b5750614e206117b4565b600d60008460038111156117615761176161350f565b61176c9060016133eb565b600381111561177d5761177d61350f565b600381111561178e5761178e61350f565b600381111561179f5761179f61350f565b81526020019081526020016000206000015490505b8082600d60008660038111156117cc576117cc61350f565b60038111156117dd576117dd61350f565b8152602001908152602001600020600001546117f991906133eb565b11156118475760405162461bcd60e51b815260206004820152601360248201527f41626f766520746f6b656e206365696c696e6700000000000000000000000000604482015260640161075f565b81600d600085600381111561185e5761185e61350f565b600381111561186f5761186f61350f565b8152602081019190915260400160002060010155505050565b600260075414156118db5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161075f565b6002600755600654600160a01b900460ff161561193a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161075f565b81816119468282611fdf565b6119925760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964205369676e6174757265000000000000000000000000000000604482015260640161075f565b600d60008660038111156119a8576119a861350f565b60038111156119b9576119b961350f565b815260200190815260200160002060010154600d60008760038111156119e1576119e161350f565b60038111156119f2576119f261350f565b81526020019081526020016000206002015410611a515760405162461bcd60e51b815260206004820152601b60248201527f4e6f20546f6b656e7320617661696c61626c6520696e20726f6f6d0000000000604482015260640161075f565b600c546008546040517faf7d6ca300000000000000000000000000000000000000000000000000000000815233600482015260248101919091526001600160a01b039091169063af7d6ca390604401600060405180830381600087803b158015611aba57600080fd5b505af1158015611ace573d6000803e3d6000fd5b505050506000600d6000876003811115611aea57611aea61350f565b6003811115611afb57611afb61350f565b815260200190815260200160002060020154600d6000886003811115611b2357611b2361350f565b6003811115611b3457611b3461350f565b815260200190815260200160002060000154611b5091906133eb565b9050600d6000876003811115611b6857611b6861350f565b6003811115611b7957611b7961350f565b81526020019081526020016000206002016000815480929190611b9b906134b4565b9190505550611bba3382604051806020016040528060008152506120c5565b5050600160075550505050565b611bd1338361214e565b611c435760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f766564000000000000000000000000000000606482015260840161075f565b611c4f8484848461255e565b50505050565b6000818152600260205260409020546060906001600160a01b0316611ce25760405162461bcd60e51b815260206004820152602860248201527f224552433732314d657461646174613a20746f6b656e496420646f6573206e6f60448201527f7420657869737422000000000000000000000000000000000000000000000000606482015260840161075f565b600a611ced836125e7565b604051602001611cfe9291906132c3565b6040516020818303038152906040529050919050565b6006546001600160a01b03163314611d6e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161075f565b6001600160a01b038116611dea5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161075f565b61093b81612430565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190611e35826110a2565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600654600160a01b900460ff16611ec75760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161075f565b600680547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600654600160a01b900460ff1615611f895760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161075f565b600680547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f123390565b6000806120856040805130606090811b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081166020808501919091523390921b166034830152825160288184030181526048830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060688401526084808401919091528351808403909101815260a4909201909252805191012090565b9050838114612098576000915050610641565b600b5461010090046001600160a01b03166120b38585612719565b6001600160a01b031614949350505050565b6120cf838361273d565b6120dc600084848461288c565b6108cf5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161075f565b6000818152600260205260408120546001600160a01b03166121d85760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e0000000000000000000000000000000000000000606482015260840161075f565b60006121e3836110a2565b9050806001600160a01b0316846001600160a01b0316148061221e5750836001600160a01b0316612213846106d9565b6001600160a01b0316145b8061224e57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316612269826110a2565b6001600160a01b0316146122e55760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e0000000000000000000000000000000000000000000000606482015260840161075f565b6001600160a01b0382166123605760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161075f565b61236b600082611df3565b6001600160a01b0383166000908152600360205260408120805460019290612394908490613436565b90915550506001600160a01b03821660009081526003602052604081208054600192906123c29084906133eb565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600680546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156124f15760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161075f565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612569848484612256565b6125758484848461288c565b611c4f5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161075f565b60608161262757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612651578061263b816134b4565b915061264a9050600a83613403565b915061262b565b60008167ffffffffffffffff81111561266c5761266c61353b565b6040519080825280601f01601f191660200182016040528015612696576020820181803683370190505b5090505b841561224e576126ab600183613436565b91506126b8600a866134cf565b6126c39060306133eb565b60f81b8183815181106126d8576126d8613525565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612712600a86613403565b945061269a565b60008060006127288585612a39565b9150915061273581612aa9565b509392505050565b6001600160a01b0382166127935760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161075f565b6000818152600260205260409020546001600160a01b0316156127f85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161075f565b6001600160a01b03821660009081526003602052604081208054600192906128219084906133eb565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001600160a01b0384163b15612a2e576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a02906128e990339089908890889060040161336a565b602060405180830381600087803b15801561290357600080fd5b505af1925050508015612933575060408051601f3d908101601f19168201909252612930918101906130b5565b60015b6129e3573d808015612961576040519150601f19603f3d011682016040523d82523d6000602084013e612966565b606091505b5080516129db5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e7465720000000000000000000000000000606482015260840161075f565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a020000000000000000000000000000000000000000000000000000000014905061224e565b506001949350505050565b600080825160411415612a705760208301516040840151606085015160001a612a6487828585612c9a565b94509450505050612aa2565b825160401415612a9a5760208301516040840151612a8f868383612d87565b935093505050612aa2565b506000905060025b9250929050565b6000816004811115612abd57612abd61350f565b1415612ac65750565b6001816004811115612ada57612ada61350f565b1415612b285760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161075f565b6002816004811115612b3c57612b3c61350f565b1415612b8a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161075f565b6003816004811115612b9e57612b9e61350f565b1415612c125760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161075f565b6004816004811115612c2657612c2661350f565b141561093b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161075f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612cd15750600090506003612d7e565b8460ff16601b14158015612ce957508460ff16601c14155b15612cfa5750600090506004612d7e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612d4e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612d7757600060019250925050612d7e565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b01612dc187828885612c9a565b935093505050935093915050565b828054612ddb90613479565b90600052602060002090601f016020900481019282612dfd5760008555612e43565b82601f10612e1657805160ff1916838001178555612e43565b82800160010185558215612e43579182015b82811115612e43578251825591602001919060010190612e28565b50612e4f929150612e53565b5090565b5b80821115612e4f5760008155600101612e54565b80356001600160a01b0381168114612e7f57600080fd5b919050565b80358015158114612e7f57600080fd5b600082601f830112612ea557600080fd5b813567ffffffffffffffff80821115612ec057612ec061353b565b604051601f8301601f19908116603f01168101908282118183101715612ee857612ee861353b565b81604052838152866020858801011115612f0157600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560048110612e7f57600080fd5b600060208284031215612f4257600080fd5b612f4b82612e68565b9392505050565b60008060408385031215612f6557600080fd5b612f6e83612e68565b9150612f7c60208401612e68565b90509250929050565b600080600060608486031215612f9a57600080fd5b612fa384612e68565b9250612fb160208501612e68565b9150604084013590509250925092565b60008060008060808587031215612fd757600080fd5b612fe085612e68565b9350612fee60208601612e68565b925060408501359150606085013567ffffffffffffffff81111561301157600080fd5b61301d87828801612e94565b91505092959194509250565b6000806040838503121561303c57600080fd5b61304583612e68565b9150612f7c60208401612e84565b6000806040838503121561306657600080fd5b61306f83612e68565b946020939093013593505050565b60006020828403121561308f57600080fd5b612f4b82612e84565b6000602082840312156130aa57600080fd5b8135612f4b81613551565b6000602082840312156130c757600080fd5b8151612f4b81613551565b6000602082840312156130e457600080fd5b612f4b82612f21565b60008060006060848603121561310257600080fd5b61310b84612f21565b925060208401359150604084013567ffffffffffffffff81111561312e57600080fd5b61313a86828701612e94565b9150509250925092565b6000806040838503121561315757600080fd5b61306f83612f21565b6000806000806080858703121561317657600080fd5b61317f85612f21565b93506020850135925060408501359150606085013567ffffffffffffffff81111561301157600080fd5b6000602082840312156131bb57600080fd5b813567ffffffffffffffff8111156131d257600080fd5b61224e84828501612e94565b6000602082840312156131f057600080fd5b5035919050565b60006020828403121561320957600080fd5b5051919050565b6000806000806080858703121561322657600080fd5b84359350602085013567ffffffffffffffff8082111561324557600080fd5b61325188838901612e94565b945060408701359350606087013591508082111561326e57600080fd5b5061301d87828801612e94565b6000815180845261329381602086016020860161344d565b601f01601f19169290920160200192915050565b600081516132b981856020860161344d565b9290920192915050565b600080845481600182811c9150808316806132df57607f831692505b60208084108214156132ff57634e487b7160e01b86526022600452602486fd5b818015613313576001811461332457613351565b60ff19861689528489019650613351565b60008b81526020902060005b868110156133495781548b820152908501908301613330565b505084890196505b50505050505061336181856132a7565b95945050505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261339c608083018461327b565b9695505050505050565b602081526000612f4b602083018461327b565b8381526060602082015260006133d2606083018561327b565b90506001600160a01b0383166040830152949350505050565b600082198211156133fe576133fe6134e3565b500190565b600082613412576134126134f9565b500490565b6000816000190483118215151615613431576134316134e3565b500290565b600082821015613448576134486134e3565b500390565b60005b83811015613468578181015183820152602001613450565b83811115611c4f5750506000910152565b600181811c9082168061348d57607f821691505b602082108114156134ae57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156134c8576134c86134e3565b5060010190565b6000826134de576134de6134f9565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b7fffffffff000000000000000000000000000000000000000000000000000000008116811461093b57600080fdfea2646970667358221220c4f3f2b1716722bea2f754ef3276eda4b20ebf85cba119a59260694120ba8f8a64736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (2200 runs)
Breeding.sol 286 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// ,--------.,------.,------. ,------.,--. ,--.
// '--. .--'| .---'| .-. \ | .-. \\ `.' /
// | | | `--, | | \ :| | \ :'. /
// | | | `---.| '--' /| '--' / | |
// `--' `------'`-------' `-------' `--'
// ,-----. ,------. ,---. ,------.
// | |) /_| .---' / O \ | .--. '
// | .-. \ `--, | .-. || '--'.'
// | '--' / `---.| | | || |\ \
// `------'`------'`--' `--'`--' '--'
// ,---. ,-----. ,--. ,--. ,---. ,------.
// ' .-' ' .-. ' | | | | / O \ | .-. \
// `. `-. | | | | | | | || .-. || | \ :
// .-' |' '-' '-.' '-' '| | | || '--' /
// `-----' `-----'--' `-----' `--' `--'`-------'
// __
// [ |
// .---. __ _ | |.--. .--.
// / /'`\][ | | | | '/'`\ \( (`\]
// | \__. | \_/ |, | \__/ | `'.'.
// '.___.' '.__.'_/[__;.__.' [\__) )
// ( ˘▽˘)っ♨ cooked by @nftchef
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./rewardToken.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// ERC20 $TOYS Token Interface
interface IRewardToken {
function spend(address _from, uint256 _amount) external;
function balanceOf(address _address) external returns (uint256);
function getTotalClaimable(address _address) external;
function updateReward(
address _from,
address _to,
uint256 _qty
) external;
}
contract Offspring is ERC721, Ownable, Pausable, ReentrancyGuard {
using Strings for uint256;
using ECDSA for bytes32;
uint256 public BREED_PRICE = 400 ether; // 400 $TOYS
uint256 public NAMING_PRICE;
string internal baseTokenURI;
bool public NAMING_OPEN;
address internal _SIGNER;
IRewardToken public RewardToys;
enum ROOMS {
FIRE,
WATER,
EARTH,
AIR
}
struct Room {
uint256 startIndex;
uint256 supply;
uint256 count;
}
mapping(ROOMS => Room) public supply;
address private _treasury = 0x8fBc1fB5fd267aFefF5cc4e69b3ca6D41567dc01;
event BabyNamed(uint256 tokenId, string name, address parent);
modifier hasSignature(bytes32 _hash, bytes memory _signature) {
require(checkHash(_hash, _signature), "Invalid Signature");
_;
}
constructor(IRewardToken _rewardTokenAddress)
payable
ERC721("Teddy Bear Squad Cubs", "TBSC")
Pausable()
{
RewardToys = IRewardToken(_rewardTokenAddress);
baseTokenURI = "https://teddybearsquad.io/babydata/";
// Set the starting supply
// start init.supply mint counter
// \ ┃ /
// v v v
supply[ROOMS.FIRE] = Room(0, 500, 0);
supply[ROOMS.WATER] = Room(5000, 500, 0);
supply[ROOMS.EARTH] = Room(10000, 500, 0);
supply[ROOMS.AIR] = Room(15000, 500, 0);
}
/**
* @notice Retrieve a rooms current state.
* @param _room The Enum Index for a given room to return
*/
function getRoom(ROOMS _room) public view returns (Room memory room) {
return supply[_room];
}
/**
* @notice Multiple mint wrapper for breed(). Breeding from the contract
* is disabled.
*/
function breedMultiple(
ROOMS _room,
uint256 _quantity,
bytes32 _hash,
bytes memory _signature
) public nonReentrant whenNotPaused hasSignature(_hash, _signature) {
require(
RewardToys.balanceOf(msg.sender) >= BREED_PRICE * _quantity,
"Not Enough $TOYS"
);
require(
supply[_room].count + _quantity <= supply[_room].supply,
"Quantity exeeds available supply"
);
for (uint256 i = 0; i < _quantity; i++) {
uint256 tokenID = supply[_room].startIndex +
supply[_room].count +
i;
_safeMint(msg.sender, tokenID, "");
}
supply[_room].count += _quantity;
RewardToys.spend(msg.sender, BREED_PRICE * _quantity);
}
/**
* @notice breeding (minting) from the contract is disabled.
*/
function breed(
ROOMS _room,
bytes32 _hash,
bytes memory _signature
) public nonReentrant whenNotPaused hasSignature(_hash, _signature) {
require(
supply[_room].count < supply[_room].supply,
"No Tokens available in room"
);
// Will revert if msg.sender balance is below burn amount, totalPrice
RewardToys.spend(msg.sender, BREED_PRICE);
uint256 tokenID = supply[_room].startIndex + supply[_room].count;
supply[_room].count++;
_safeMint(msg.sender, tokenID, "");
}
/**
* @notice name a given baby. Naming from the contract is disabled
* @param _tokenId the Baby to name
* @param _name a String name to name the baby. Name limtations are controlled via the dapp.
* @param _hash valid hash
* @param _signature valid signature
*/
function nameBaby(
uint256 _tokenId,
string memory _name,
bytes32 _hash,
bytes memory _signature
) external hasSignature(_hash, _signature) {
require(NAMING_OPEN, "Naming is Closed");
require(
ownerOf(_tokenId) == msg.sender,
"Only the baby's parent can name the baby"
);
// Will revert if msg.sender balance is below burn amount, totalPrice
RewardToys.spend(msg.sender, NAMING_PRICE);
emit BabyNamed(_tokenId, _name, msg.sender);
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(_exists(tokenId), '"ERC721Metadata: tokenId does not exist"');
return string(abi.encodePacked(baseTokenURI, tokenId.toString()));
}
function senderMessageHash() internal view returns (bytes32) {
bytes32 message = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(address(this), msg.sender))
)
);
return message;
}
function checkHash(bytes32 _hash, bytes memory _signature)
internal
view
returns (bool)
{
bytes32 senderHash = senderMessageHash();
if (senderHash != _hash) {
return false;
}
return _hash.recover(_signature) == _SIGNER;
}
// 。☆✼★━━━━━━━━ ( ˘▽˘)っ♨ only owner ━━━━━━━━━━━━━★✼☆。
function setSigner(address _address) external onlyOwner {
_SIGNER = _address;
}
function setRewardTokenAddress(address _rAddress) external onlyOwner {
RewardToys = IRewardToken(_rAddress);
}
function setPaused(bool _state) external onlyOwner {
_state ? _pause() : _unpause();
}
function setBaseURI(string memory _URI) external onlyOwner {
baseTokenURI = _URI;
}
/**
* @dev Tokens have a hard coded maximum tokenID range. Given that a new supply
* number is <= the allocated range, the owner may increase the suppply for a
* given ROOM
* @param _room the ROOMS enum index to update
* @param _supply the new supply to set
*/
function updateRoomSupply(ROOMS _room, uint256 _supply) external onlyOwner {
require(_supply > supply[_room].supply, "Supply can not decraese");
// Calculate the poossible max
uint256 ceiling;
// 3 is the last room.
if (uint256(_room) == 3) {
ceiling = 20000;
} else {
ceiling = supply[ROOMS(uint256(_room) + 1)].startIndex;
}
require(
supply[_room].startIndex + _supply <= ceiling,
"Above token ceiling"
);
supply[_room].supply = _supply;
}
/**
* @notice Change the $TOYS price per/mint (breeding).
*/
function updatePrice(uint256 _price) external onlyOwner {
BREED_PRICE = _price;
}
function setNamingState(bool _state) external onlyOwner {
NAMING_OPEN = _state;
}
function setNamingPrice(uint256 _price) external onlyOwner {
NAMING_PRICE = _price;
}
/// Nobody should be sending any ether to this contract, but just in case..
function withdraw() external onlyOwner {
(bool success, ) = _treasury.call{value: address(this).balance}("");
require(success, "Failed to send to vault.");
}
}
rewardToken.sol 161 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// ,--------.,------.,------. ,------.,--. ,--.
// '--. .--'| .---'| .-. \ | .-. \\ `.' /
// | | | `--, | | \ :| | \ :'. /
// | | | `---.| '--' /| '--' / | |
// `--' `------'`-------' `-------' `--'
// ,-----. ,------. ,---. ,------.
// | |) /_ | .---' / O \ | .--. '
// | .-. \| `--, | .-. || '--'.'
// | '--' /| `---.| | | || |\ \
// `------' `------'`--' `--'`--' '--'
// ,---. ,-----. ,--. ,--. ,---. ,------.
// ' .-' ' .-. ' | | | | / O \ | .-. \
// `. `-. | | | | | | | || .-. || | \ :
// .-' |' '-' '-.' '-' '| | | || '--' /
// `-----' `-----'--' `-----' `--' `--'`-------'
//
// _ _______ ______ _______
// | |__ __/ __ \ \ / / ____|
// / __) | | | | | \ \_/ / (___
// \__ \ | | | | | |\ / \___ \
// ( / | | | |__| | | | ____) |
// |_| |_| \____/ |_| |_____/
// @nftchef
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
interface iCoreContract {
function balanceOf(address owner) external view returns (uint256);
}
contract RewardToken is ERC20, ERC20Pausable, ERC20Burnable, Ownable {
// @dev: deployed erc721 contract of NFT's earning rewards
iCoreContract public CoreToken;
uint256 public constant REWARD_RATE = 10 ether;
// 10 year supply
uint256 private immutable _cap = 365336530 ether;
mapping(address => uint256) public rewards;
mapping(address => uint256) public lastClaimed;
mapping(address => uint256) public balances;
mapping(address => bool) public accessAddresses;
event RewardClaimed(address indexed user, uint256 reward);
constructor(address _coreContractAddress)
ERC20("Teddy Bear Squad Toys", "TOYS")
{
/// @dev: Initialize the erc721 contract
CoreToken = iCoreContract(_coreContractAddress);
}
// Only callable by the erc721 contract on mint/transferFrom/safeTransferFrom.
// Updates reward amount and last claimed timestamp
function updateReward(
address from,
address to,
uint256 qty
) external {
require(msg.sender == address(CoreToken));
if (from != address(0)) {
rewards[from] += getPendingReward(from);
lastClaimed[from] = block.timestamp;
balances[from] -= qty;
}
if (to != address(0)) {
balances[to] += qty;
rewards[to] += getPendingReward(to);
lastClaimed[to] = block.timestamp;
}
}
function claimReward() external whenNotPaused {
uint256 claimable = rewards[msg.sender] + getPendingReward(msg.sender);
require(
ERC20.totalSupply() + claimable <= cap(),
"ERC20Capped: cap exceeded"
);
_mint(msg.sender, claimable);
emit RewardClaimed(msg.sender, claimable);
/// @dev: reset the state of a users claimed state and last claimed
rewards[msg.sender] = 0;
lastClaimed[msg.sender] = block.timestamp;
}
function getTotalClaimable(address user) external view returns (uint256) {
return rewards[user] + getPendingReward(user);
}
function blocktime() public returns (uint256) {
return block.timestamp;
}
function getPendingReward(address _user) internal view returns (uint256) {
return
(balances[_user] *
REWARD_RATE *
(block.timestamp -
(
lastClaimed[_user] > 0
? lastClaimed[_user]
: block.timestamp
))) / 1 days;
}
// @dev: Allow the main contract to burn tokens when 'spending'
function spend(address user, uint256 amount) external {
require(
accessAddresses[msg.sender] || msg.sender == address(CoreToken),
"Address does not have permission to burn"
);
_burn(user, amount);
}
/**
* @dev Required override
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal override(ERC20, ERC20Pausable) whenNotPaused {
super._beforeTokenTransfer(from, to, amount);
}
/**
* @dev Returns the cap on the token's total supply.
*/
function cap() public view virtual returns (uint256) {
return _cap;
}
// 。☆✼★━━━━━━━━ ( ˘▽˘)っ♨ only owner ━━━━━━━━━━━━━★✼☆。
function setAccessAddresses(address _address, bool _access)
external
onlyOwner
{
accessAddresses[_address] = _access;
}
function setCoreAddress(address _address) external onlyOwner {
CoreToken = iCoreContract(_address);
}
function togglePaused() external onlyOwner {
paused() ? _unpause() : _pause();
}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
ERC20.sol 356 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens 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 amount
) 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, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
ERC721.sol 424 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || 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 || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev 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 {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
ECDSA.sol 234 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
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 v4.4.1 (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 `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ERC20Burnable.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
unchecked {
_approve(account, _msgSender(), currentAllowance - amount);
}
_burn(account, amount);
}
}
ERC20Pausable.sol 33 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../security/Pausable.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
*
* Useful for scenarios such as preventing trades until the end of an evaluation
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
*/
abstract contract ERC20Pausable is ERC20, Pausable {
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - the contract must not be paused.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
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
BREED_PRICE 0xbf424e7e → uint256
NAMING_OPEN 0xf2fcde29 → bool
NAMING_PRICE 0xdb4af1c6 → uint256
RewardToys 0xa72b923e → address
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
getRoom 0x7632514c → tuple
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
supply 0x31b4562e → uint256, uint256, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
breed 0xa97dd786
uint8 _room
bytes32 _hash
bytes _signature
breedMultiple 0x176fc4d3
uint8 _room
uint256 _quantity
bytes32 _hash
bytes _signature
nameBaby 0x6d84deb6
uint256 _tokenId
string _name
bytes32 _hash
bytes _signature
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
setBaseURI 0x55f804b3
string _URI
setNamingPrice 0x2cd29564
uint256 _price
setNamingState 0x17b8df27
bool _state
setPaused 0x16c38b3c
bool _state
setRewardTokenAddress 0x9a6acf20
address _rAddress
setSigner 0x6c19e783
address _address
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updatePrice 0x8d6cc56d
uint256 _price
updateRoomSupply 0xa3bcae58
uint8 _room
uint256 _supply
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address