Address Contract Partially Verified
Address
0x0119fC0f4369A8B4D899A2C24D2705Eac40b469B
Balance
0 ETH
Nonce
1
Code Size
11742 bytes
Creator
0x1C0ff332...Da27 at tx 0xf39385eb...5b9615
Indexed Transactions
0
Contract Bytecode
11742 bytes
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80638456cb5911610130578063ca628c78116100b8578063dc33e6811161007c578063dc33e68114610444578063e7c00f6e14610457578063e985e9c51461045f578063e9ae8eab14610472578063f2fde38b1461048557610232565b8063ca628c7814610411578063cd7c032614610419578063d14bb9d814610421578063d26ea6c014610429578063d7224ba01461043c57610232565b80639d76ea58116100ff5780639d76ea58146103c8578063a22cb465146103d0578063ac446002146103e3578063b88d4fde146103eb578063c87b56dd146103fe57610232565b80638456cb591461039d5780638da5cb5b146103a557806391bd0026146103ad57806395d89b41146103c057610232565b806342842e0e116101be5780635c975abb116101825780635c975abb14610354578063619be5451461035c5780636352211e1461036f57806370a0823114610382578063715018a61461039557610232565b806342842e0e146103005780634bdfb2ef146103135780634f6ccce71461031b578063555b1b941461032e57806355f804b31461034157610232565b806318160ddd1161020557806318160ddd146102aa57806323b872dd146102bf5780632b26a6bf146102d25780632f745c59146102e55780633f4ba83a146102f857610232565b806301ffc9a71461023757806306fdde0314610260578063081812fc14610275578063095ea7b314610295575b600080fd5b61024a6102453660046121ae565b610498565b604051610257919061233d565b60405180910390f35b6102686104fb565b6040516102579190612348565b610288610283366004612248565b61058d565b60405161025791906122d3565b6102a86102a3366004612124565b6105d9565b005b6102b2610672565b6040516102579190612bab565b6102a86102cd36600461203a565b610678565b6102a86102e0366004612248565b610683565b6102b26102f3366004612124565b6106c7565b6102a86107c3565b6102a861030e36600461203a565b61080c565b6102b2610827565b6102b2610329366004612248565b61084b565b6102a861033c366004612124565b610877565b6102a861034f366004612202565b6108dc565b61024a610932565b6102a861036a36600461214f565b61093b565b61028861037d366004612248565b6109a9565b6102b2610390366004611fe6565b6109bb565b6102a8610a08565b6102a8610a51565b610288610a98565b6102b26103bb366004611fe6565b610aa7565b610268610ab9565b610288610ac8565b6102a86103de3660046120f7565b610ad7565b6102a8610ba5565b6102a86103f936600461207a565b610c40565b61026861040c366004612248565b610c79565b6102a8610cfc565b610288610e4b565b6102b2610e5a565b6102a8610437366004611fe6565b610e60565b6102b2610ec1565b6102b2610452366004611fe6565b610ec7565b6102b2610ed2565b61024a61046d366004612002565b610ed8565b6102a861048036600461214f565b610f06565b6102a8610493366004611fe6565b610fc2565b60006001600160e01b031982166380ac58cd60e01b14806104c957506001600160e01b03198216635b5e139f60e01b145b806104e457506001600160e01b0319821663780e9d6360e01b145b806104f357506104f382611030565b90505b919050565b60606003805461050a90612ca3565b80601f016020809104026020016040519081016040528092919081815260200182805461053690612ca3565b80156105835780601f1061055857610100808354040283529160200191610583565b820191906000526020600020905b81548152906001019060200180831161056657829003601f168201915b5050505050905090565b600061059882611049565b6105bd5760405162461bcd60e51b81526004016105b490612b1c565b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b60006105e4826109a9565b9050806001600160a01b0316836001600160a01b031614156106185760405162461bcd60e51b81526004016105b4906128f0565b806001600160a01b031661062a611050565b6001600160a01b0316148061064657506106468161046d611050565b6106625760405162461bcd60e51b81526004016105b49061263e565b61066d838383611054565b505050565b60015490565b61066d8383836110b0565b61068b611050565b6001600160a01b031661069c610a98565b6001600160a01b0316146106c25760405162461bcd60e51b81526004016105b490612785565b600255565b60006106d2836109bb565b82106106f05760405162461bcd60e51b81526004016105b49061235b565b60006106fa610672565b905060008060005b838110156107a4576000818152600560209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff16918301919091521561075557805192505b876001600160a01b0316836001600160a01b031614156107915786841415610783575093506107bd92505050565b8361078d81612cde565b9450505b508061079c81612cde565b915050610702565b5060405162461bcd60e51b81526004016105b490612a48565b92915050565b6107cb611050565b6001600160a01b03166107dc610a98565b6001600160a01b0316146108025760405162461bcd60e51b81526004016105b490612785565b61080a6113c4565b565b61066d83838360405180602001604052806000815250610c40565b7f000000000000000000000000000000000000000000000000000000000000138890565b6000610855610672565b82106108735760405162461bcd60e51b81526004016105b49061245b565b5090565b61087f611050565b6001600160a01b0316610890610a98565b6001600160a01b0316146108b65760405162461bcd60e51b81526004016105b490612785565b600f80546001600160a01b0319166001600160a01b039390931692909217909155601055565b6108e4611050565b6001600160a01b03166108f5610a98565b6001600160a01b03161461091b5760405162461bcd60e51b81526004016105b490612785565b805161092e90600c906020840190611eca565b5050565b600b5460ff1690565b61094b610946611050565b611432565b6109675760405162461bcd60e51b81526004016105b490612892565b61096f610932565b1561098c5760405162461bcd60e51b81526004016105b490612614565b6109a2858561099a88610ec7565b868686611467565b5050505050565b60006109b4826115bd565b5192915050565b60006001600160a01b0382166109e35760405162461bcd60e51b81526004016105b4906126f4565b506001600160a01b03166000908152600660205260409020546001600160801b031690565b610a10611050565b6001600160a01b0316610a21610a98565b6001600160a01b031614610a475760405162461bcd60e51b81526004016105b490612785565b61080a6000611695565b610a59611050565b6001600160a01b0316610a6a610a98565b6001600160a01b031614610a905760405162461bcd60e51b81526004016105b490612785565b61080a6116e5565b6000546001600160a01b031690565b600e6020526000908152604090205481565b60606004805461050a90612ca3565b600f546001600160a01b031681565b610adf611050565b6001600160a01b0316826001600160a01b03161415610b105760405162461bcd60e51b81526004016105b490612809565b8060086000610b1d611050565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610b61611050565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610b99919061233d565b60405180910390a35050565b610bad611050565b6001600160a01b0316610bbe610a98565b6001600160a01b031614610be45760405162461bcd60e51b81526004016105b490612785565b6002600a541415610c075760405162461bcd60e51b81526004016105b490612a96565b6002600a5560405133904780156108fc02916000818181858888f19350505050158015610c38573d6000803e3d6000fd5b506001600a55565b610c4b8484846110b0565b610c5784848484611740565b610c735760405162461bcd60e51b81526004016105b49061297d565b50505050565b6060610c8482611049565b610ca05760405162461bcd60e51b81526004016105b4906127ba565b6000610caa61185c565b90506000815111610cca5760405180602001604052806000815250610cf5565b80610cd48461186b565b604051602001610ce59291906122a4565b6040516020818303038152906040525b9392505050565b610d04611050565b6001600160a01b0316610d15610a98565b6001600160a01b031614610d3b5760405162461bcd60e51b81526004016105b490612785565b600f546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610d6c9030906004016122d3565b60206040518083038186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbc9190612260565b90508015610e4857600f5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610df69033908590600401612324565b602060405180830381600087803b158015610e1057600080fd5b505af1158015610e24573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092e9190612192565b50565b600d546001600160a01b031681565b60105481565b610e68611050565b6001600160a01b0316610e79610a98565b6001600160a01b031614610e9f5760405162461bcd60e51b81526004016105b490612785565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b60095481565b60006104f382611986565b60025490565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b610f11610946611050565b610f2d5760405162461bcd60e51b81526004016105b490612892565b610f35610932565b15610f525760405162461bcd60e51b81526004016105b490612614565b6001600160a01b0385166000908152600e6020526040902054610f7b9086908690868686611467565b6001600160a01b0385166000908152600e6020526040902054610f9f908290612bd6565b6001600160a01b039095166000908152600e602052604090209490945550505050565b610fca611050565b6001600160a01b0316610fdb610a98565b6001600160a01b0316146110015760405162461bcd60e51b81526004016105b490612785565b6001600160a01b0381166110275760405162461bcd60e51b81526004016105b4906123cb565b610e4881611695565b6001600160e01b031981166301ffc9a760e01b14919050565b6001541190565b3390565b60008281526007602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60006110bb826115bd565b9050600081600001516001600160a01b03166110d5611050565b6001600160a01b0316148061110a57506110ed611050565b6001600160a01b03166110ff8461058d565b6001600160a01b0316145b8061111e5750815161111e9061046d611050565b90508061113d5760405162461bcd60e51b81526004016105b490612840565b846001600160a01b031682600001516001600160a01b0316146111725760405162461bcd60e51b81526004016105b49061273f565b6001600160a01b0384166111985760405162461bcd60e51b81526004016105b49061249e565b6111a58585856001610c73565b6111b56000848460000151611054565b6001600160a01b03851660009081526006602052604081208054600192906111e79084906001600160801b0316612c21565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b0386166000908152600660205260408120805460019450909261123391859116612bb4565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b03808716825267ffffffffffffffff428116602080850191825260008981526005909152948520935184549151909216600160a01b0267ffffffffffffffff60a01b19929093166001600160a01b031990911617161790556112c9846001612bd6565b6000818152600560205260409020549091506001600160a01b031661136e576112f181611049565b1561136e5760408051808201825284516001600160a01b03908116825260208087015167ffffffffffffffff90811682850190815260008781526005909352949091209251835494516001600160a01b031990951692169190911767ffffffffffffffff60a01b1916600160a01b93909116929092029190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46113bc8686866001610c73565b505050505050565b6113cc610932565b6113e85760405162461bcd60e51b81526004016105b49061239d565b600b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61141b611050565b60405161142891906122d3565b60405180910390a1565b6000816001600160a01b0316611446610a98565b6001600160a01b031614806104f357506104f3611461610a98565b836119da565b600081116114875760405162461bcd60e51b81526004016105b49061269b565b7f0000000000000000000000000000000000000000000000000000000000001388156114ff577f0000000000000000000000000000000000000000000000000000000000001388816114d7610672565b6114e19190612bd6565b11156114ff5760405162461bcd60e51b81526004016105b490612932565b811561152e57816115108286612bd6565b111561152e5760405162461bcd60e51b81526004016105b4906125bc565b821561159a5761153c610672565b851115801561157e5750600181611551610672565b61155b9190612bd6565b6115659190612c49565b60016115718588612bd6565b61157b9190612c49565b10155b61159a5760405162461bcd60e51b81526004016105b490612534565b6115a660008783611a00565b6113bc86826010546115b89190612c02565b611a1b565b6115c5611f4a565b6115ce82611049565b6115ea5760405162461bcd60e51b81526004016105b490612411565b60006002548310611610576002546116029084612c49565b61160d906001612bd6565b90505b825b81811061167c576000818152600560209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff1691830191909152156116695792506104f6915050565b508061167481612c8c565b915050611612565b5060405162461bcd60e51b81526004016105b490612acd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6116ed610932565b1561170a5760405162461bcd60e51b81526004016105b490612614565b600b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861141b611050565b6000611754846001600160a01b0316611bd9565b1561185057836001600160a01b031663150b7a02611770611050565b8786866040518563ffffffff1660e01b815260040161179294939291906122e7565b602060405180830381600087803b1580156117ac57600080fd5b505af19250505080156117dc575060408051601f3d908101601f191682019092526117d9918101906121ca565b60015b611836573d80801561180a576040519150601f19603f3d011682016040523d82523d6000602084013e61180f565b606091505b50805161182e5760405162461bcd60e51b81526004016105b49061297d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611854565b5060015b949350505050565b6060600c805461050a90612ca3565b60608161189057506040805180820190915260018152600360fc1b60208201526104f6565b8160005b81156118ba57806118a481612cde565b91506118b39050600a83612bee565b9150611894565b60008167ffffffffffffffff8111156118e357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561190d576020820181803683370190505b5090505b841561185457611922600183612c49565b915061192f600a86612cf9565b61193a906030612bd6565b60f81b81838151811061195d57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535061197f600a86612bee565b9450611911565b60006001600160a01b0382166119ae5760405162461bcd60e51b81526004016105b4906124e3565b506001600160a01b0316600090815260066020526040902054600160801b90046001600160801b031690565b6000816001600160a01b03166119ef84611bdf565b6001600160a01b0316149392505050565b61066d83838360405180602001604052806000815250611c62565b600f546001600160a01b031615801590611a355750600081115b1561092e57600f546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611a6b9030906004016122d3565b60206040518083038186803b158015611a8357600080fd5b505afa158015611a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611abb9190612260565b9050801561066d5780821115611b5557600f5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90611afd9086908590600401612324565b602060405180830381600087803b158015611b1757600080fd5b505af1158015611b2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b4f9190612192565b5061066d565b600f5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90611b879086908690600401612324565b602060405180830381600087803b158015611ba157600080fd5b505af1158015611bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c739190612192565b3b151590565b600d5460405163c455279160e01b81526000916001600160a01b031690819063c455279190611c129086906004016122d3565b60206040518083038186803b158015611c2a57600080fd5b505afa158015611c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf591906121e6565b6001546001600160a01b038416611c8b5760405162461bcd60e51b81526004016105b490612a07565b611c9481611049565b15611cb15760405162461bcd60e51b81526004016105b4906129d0565b600254831115611cd35760405162461bcd60e51b81526004016105b490612b69565b611ce06000858386610c73565b6001600160a01b0384166000908152600660209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190611d3c908790612bb4565b6001600160801b03168152602001858360200151611d5a9190612bb4565b6001600160801b039081169091526001600160a01b03808816600081815260066020908152604080832087518154988401518816600160801b029088166fffffffffffffffffffffffffffffffff1990991698909817909616969096179094558451808601865291825267ffffffffffffffff4281168386019081528883526005909552948120915182549451909516600160a01b0267ffffffffffffffff60a01b19959093166001600160a01b031990941693909317939093161790915582905b85811015611eae5781876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4611e726000888488611740565b611e8e5760405162461bcd60e51b81526004016105b49061297d565b81611e9881612cde565b9250508080611ea690612cde565b915050611e1c565b506001819055611ec16000878588610c73565b50505050505050565b828054611ed690612ca3565b90600052602060002090601f016020900481019282611ef85760008555611f3e565b82601f10611f1157805160ff1916838001178555611f3e565b82800160010185558215611f3e579182015b82811115611f3e578251825591602001919060010190611f23565b50610873929150611f61565b604080518082019091526000808252602082015290565b5b808211156108735760008155600101611f62565b600067ffffffffffffffff80841115611f9157611f91612d39565b604051601f8501601f191681016020018281118282101715611fb557611fb5612d39565b604052848152915081838501861015611fcd57600080fd5b8484602083013760006020868301015250509392505050565b600060208284031215611ff7578081fd5b8135610cf581612d4f565b60008060408385031215612014578081fd5b823561201f81612d4f565b9150602083013561202f81612d4f565b809150509250929050565b60008060006060848603121561204e578081fd5b833561205981612d4f565b9250602084013561206981612d4f565b929592945050506040919091013590565b6000806000806080858703121561208f578081fd5b843561209a81612d4f565b935060208501356120aa81612d4f565b925060408501359150606085013567ffffffffffffffff8111156120cc578182fd5b8501601f810187136120dc578182fd5b6120eb87823560208401611f76565b91505092959194509250565b60008060408385031215612109578182fd5b823561211481612d4f565b9150602083013561202f81612d64565b60008060408385031215612136578182fd5b823561214181612d4f565b946020939093013593505050565b600080600080600060a08688031215612166578081fd5b853561217181612d4f565b97602087013597506040870135966060810135965060800135945092505050565b6000602082840312156121a3578081fd5b8151610cf581612d64565b6000602082840312156121bf578081fd5b8135610cf581612d72565b6000602082840312156121db578081fd5b8151610cf581612d72565b6000602082840312156121f7578081fd5b8151610cf581612d4f565b600060208284031215612213578081fd5b813567ffffffffffffffff811115612229578182fd5b8201601f81018413612239578182fd5b61185484823560208401611f76565b600060208284031215612259578081fd5b5035919050565b600060208284031215612271578081fd5b5051919050565b60008151808452612290816020860160208601612c60565b601f01601f19169290920160200192915050565b600083516122b6818460208801612c60565b8351908301906122ca818360208801612c60565b01949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061231a90830184612278565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b600060208252610cf56020830184612278565b60208082526022908201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252602a908201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736040820152693a32b73a103a37b5b2b760b11b606082015260800190565b60208082526023908201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756040820152626e647360e81b606082015260800190565b60208082526025908201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526031908201527f455243373231413a206e756d626572206d696e74656420717565727920666f7260408201527020746865207a65726f206164647265737360781b606082015260800190565b6020808252606e90820152600080516020612d8983398151915260408201527f7373657473206d696e7420746f6b656e4964206265747765656e2066726f6d5460608201527f6f6b656e49645f20616e64202866726f6d546f6b656e49645f202b2073616c6560808201526d5175616e746974795f202d20312960901b60a082015260c00190565b6020808252604490820152600080516020612d8983398151915260408201527f73736574732072656163686564207065722061646472657373206d617820737560608201526370706c7960e01b608082015260a00190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526039908201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60408201527f776e6572206e6f7220617070726f76656420666f7220616c6c00000000000000606082015260800190565b6020808252604590820152600080516020612d8983398151915260408201527f7373657473207175616e74697479206d7573742067726561746572207468616e606082015264207a65726f60d81b608082015260a00190565b6020808252602b908201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60408201526a65726f206164647265737360a81b606082015260800190565b60208082526026908201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746040820152651037bbb732b960d11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602f908201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60408201526e3732bc34b9ba32b73a103a37b5b2b760891b606082015260800190565b6020808252601a908201527f455243373231413a20617070726f766520746f2063616c6c6572000000000000604082015260600190565b60208082526032908201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206040820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606082015260800190565b602080825260409082018190527f53746172426c6f636b43726561746f72436f6c6c656374696f6e236f6e6c794f908201527f776e65724f7250726f78793a2043414c4c45525f49535f4e4f545f4f574e4552606082015260800190565b60208082526022908201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60408201526132b960f11b606082015260800190565b6020808252603890820152600080516020612d8983398151915260408201527f73736574732072656163686564206d617820737570706c790000000000000000606082015260800190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b6020808252601d908201527f455243373231413a20746f6b656e20616c7265616479206d696e746564000000604082015260600190565b60208082526021908201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6020808252602e908201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060408201526d0deeedccae440c4f240d2dcc8caf60931b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602f908201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560408201526e1037bbb732b91037b3103a37b5b2b760891b606082015260800190565b6020808252602d908201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560408201526c3c34b9ba32b73a103a37b5b2b760991b606082015260800190565b60208082526022908201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696040820152610ced60f31b606082015260800190565b90815260200190565b60006001600160801b038083168185168083038211156122ca576122ca612d0d565b60008219821115612be957612be9612d0d565b500190565b600082612bfd57612bfd612d23565b500490565b6000816000190483118215151615612c1c57612c1c612d0d565b500290565b60006001600160801b0383811690831681811015612c4157612c41612d0d565b039392505050565b600082821015612c5b57612c5b612d0d565b500390565b60005b83811015612c7b578181015183820152602001612c63565b83811115610c735750506000910152565b600081612c9b57612c9b612d0d565b506000190190565b600281046001821680612cb757607f821691505b60208210811415612cd857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612cf257612cf2612d0d565b5060010190565b600082612d0857612d08612d23565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e4857600080fd5b8015158114610e4857600080fd5b6001600160e01b031981168114610e4857600080fdfe53746172426c6f636b43726561746f72436f6c6c656374696f6e236d696e7441a2646970667358221220dd6473e94a22e892e9b59b2de646094aa038384377e6fbd3397d180850430a5a64736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: Yes (200 runs)
StarBlockBaseCollection.sol 1368 lines
// SPDX-License-Identifier: MIT
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);
}
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
/*
* @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;
}
}
/**
* @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());
}
}
/**
* @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);
}
}
/**
* @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);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private 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);
}
}
}
}
/**
* @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);
}
/**
* @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;
}
/**
* @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);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
*
* Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
*
* Does not support burning tokens to address(0).
*/
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 private currentIndex = 0;
uint256 internal immutable collectionSize;
uint256 internal maxBatchSize;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) private _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// 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
* `maxBatchSize` refers to how much a minter can mint at a time.
* `collectionSize_` refers to how many tokens are in the collection.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
) {
require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
_name = name_;
_symbol = symbol_;
maxBatchSize = maxBatchSize_;
collectionSize = collectionSize_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return currentIndex;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
/**
* @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 ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
require(owner != address(0), "ERC721A: balance query for the zero address");
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @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 override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721A: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_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 override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: 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`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address from, address to, uint256 quantity) internal {
_safeMint(from, to, quantity, "");
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - there must be `quantity` tokens remaining unminted in the total collection.
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address from,
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(from, to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = updatedIndex;
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (collectionSize > 0) {
if (endIndex > collectionSize - 1) {
endIndex = collectionSize - 1;
}
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @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(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721A: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* 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`.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
/**
* @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 make 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;
}
}
/**
* @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() {
_setOwner(_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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract OwnableDelegateProxy {}
/**
* Used to delegate ownership of a contract to another address, to save on unneeded transactions to approve contract use for users
*/
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
contract StarBlockBaseCollection is Ownable, ERC721A, ReentrancyGuard, Pausable {
string private _baseTokenURI;
/* Proxy registry address. */
address public proxyRegistryAddress;
constructor(
string memory name_,
string memory symbol_,
address proxyRegistryAddress_,
uint256 maxBatchSize_,
uint256 collectionSize_,
string memory baseURI_
) ERC721A(name_, symbol_, maxBatchSize_, collectionSize_) {
proxyRegistryAddress = proxyRegistryAddress_;
if (bytes(baseURI_).length > 0) {
setBaseURI(baseURI_);
}
}
// PROXY HELPER METHODS
function _isProxyForUser(address _user, address _address)
internal
view
returns (bool)
{
return _proxy(_user) == _address;
}
function _proxy(address _address) internal view returns (address) {
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
return address(proxyRegistry.proxies(_address));
}
function _baseURI() internal view override returns (string memory) {
return _baseTokenURI;
}
function setBaseURI(string memory baseURI) public onlyOwner {
_baseTokenURI = baseURI;
}
function setMaxBatchSize(uint256 _maxBatchSize) public onlyOwner {
maxBatchSize = _maxBatchSize;
}
function setProxyRegistryAddress(address _address) public onlyOwner {
proxyRegistryAddress = _address;
}
function getMaxBatchSize() public view returns (uint256) {
return maxBatchSize;
}
function collectionMaxSize() public view returns (uint256) {
return collectionSize;
}
function withdrawMoney() external onlyOwner nonReentrant {
(payable(msg.sender)).transfer(address(this).balance);
}
function numberMinted(address owner) public view returns (uint256) {
return _numberMinted(owner);
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
}
StarBlockCreatorCollection.sol 156 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./StarBlockBaseCollection.sol";
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
}
contract StarBlockCreatorCollection is StarBlockBaseCollection {
/* whiteList number minted. */
mapping(address => uint256) public whiteListNumberMinted;
/* ERC20 Token address */
IERC20 public tokenAddress;
uint public mintTokenAmount;
constructor(
string memory name_,
string memory symbol_,
address proxyRegistryAddress_,
uint256 maxBatchSize_,
uint256 collectionSize_,
string memory baseURI_
) StarBlockBaseCollection(name_, symbol_, proxyRegistryAddress_, maxBatchSize_, collectionSize_, baseURI_) {
}
/**
* @dev Throws if called by any account other than the owner or their proxy
*/
modifier onlyOwnerOrProxy() {
require(
_isOwnerOrProxy(_msgSender()),
"StarBlockCreatorCollection#onlyOwnerOrProxy: CALLER_IS_NOT_OWNER"
);
_;
}
function _isOwnerOrProxy(address _address) internal view returns (bool) {
return owner() == _address || _isProxyForUser(owner(), _address);
}
/**
* @dev mint asstes functionality
* @param to_ Address of to
* @param fromTokenId_ tokenId
* @param numberMinted_ has mint number
* @param saleQuantity_ collection max sale quantity
* @param maxPerAddressDuringMint_ each to can mint max quantity
* @param quantity_ to current mint quantity
*/
function _mintAssets(
address to_,
uint256 fromTokenId_,
uint256 numberMinted_,
uint256 saleQuantity_,
uint256 maxPerAddressDuringMint_,
uint256 quantity_
) internal {
require(quantity_ > 0, "StarBlockCreatorCollection#mintAssets quantity must greater than zero");
if (collectionSize > 0) {
require((totalSupply() + quantity_) <= collectionSize, "StarBlockCreatorCollection#mintAssets reached max supply");
}
if (maxPerAddressDuringMint_ > 0) {
require(
(numberMinted_ + quantity_) <= maxPerAddressDuringMint_,
"StarBlockCreatorCollection#mintAssets reached per address max supply"
);
}
if (saleQuantity_ > 0) {
require(
(fromTokenId_ <= totalSupply()) && ((fromTokenId_ + saleQuantity_ - 1) >= (totalSupply() + quantity_ - 1)),
"StarBlockCreatorCollection#mintAssets mint tokenId between fromTokenId_ and (fromTokenId_ + saleQuantity_ - 1)"
);
}
_safeMint(address(0), to_, quantity_);
safeTransferToken(to_, mintTokenAmount * quantity_);
}
function publicMint(
address to_,
uint256 fromTokenId_,
uint256 saleQuantity_,
uint256 maxPerAddressDuringMint_,
uint256 quantity_
) public onlyOwnerOrProxy whenNotPaused {
_mintAssets(to_, fromTokenId_, numberMinted(to_), saleQuantity_, maxPerAddressDuringMint_, quantity_);
}
/**
* @dev whitelists whiteListMint functionality
* @param to_ Address of reciver
* @param fromTokenId_ tokenId
* @param saleQuantity_ max sale quantity
* @param maxPerAddressDuringMint_ each reciver can mint max quantity
* @param quantity_ reciver current mint quantity
*/
function whiteListMint(
address to_,
uint256 fromTokenId_,
uint256 saleQuantity_,
uint256 maxPerAddressDuringMint_,
uint256 quantity_
) public onlyOwnerOrProxy whenNotPaused {
_mintAssets(to_, fromTokenId_, whiteListNumberMinted[to_], saleQuantity_, maxPerAddressDuringMint_, quantity_);
whiteListNumberMinted[to_] = whiteListNumberMinted[to_] + quantity_;
}
function setTokenAddressAndMintTokenAmount(IERC20 tokenAddress_, uint256 mintTokenAmount_) external onlyOwner {
tokenAddress = tokenAddress_;
mintTokenAmount = mintTokenAmount_;
}
function safeTransferToken(address to_, uint256 amount_) internal {
if(address(tokenAddress) != address(0) && amount_ > 0){
uint256 bal = tokenAddress.balanceOf(address(this));
if(bal > 0) {
if (amount_ > bal) {
tokenAddress.transfer(to_, bal);
} else {
tokenAddress.transfer(to_, amount_);
}
}
}
}
function withdrawToken() external onlyOwner {
uint256 bal = tokenAddress.balanceOf(address(this));
if(bal > 0) {
tokenAddress.transfer(msg.sender, bal);
}
}
}
Read Contract
balanceOf 0x70a08231 → uint256
collectionMaxSize 0x4bdfb2ef → uint256
getApproved 0x081812fc → address
getMaxBatchSize 0xe7c00f6e → uint256
isApprovedForAll 0xe985e9c5 → bool
mintTokenAmount 0xd14bb9d8 → uint256
name 0x06fdde03 → string
nextOwnerToExplicitlySet 0xd7224ba0 → uint256
numberMinted 0xdc33e681 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
proxyRegistryAddress 0xcd7c0326 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenAddress 0x9d76ea58 → address
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
whiteListNumberMinted 0x91bd0026 → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
pause 0x8456cb59
No parameters
publicMint 0x619be545
address to_
uint256 fromTokenId_
uint256 saleQuantity_
uint256 maxPerAddressDuringMint_
uint256 quantity_
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 baseURI
setMaxBatchSize 0x2b26a6bf
uint256 _maxBatchSize
setProxyRegistryAddress 0xd26ea6c0
address _address
setTokenAddressAndMintTokenAmount 0x555b1b94
address tokenAddress_
uint256 mintTokenAmount_
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
whiteListMint 0xe9ae8eab
address to_
uint256 fromTokenId_
uint256 saleQuantity_
uint256 maxPerAddressDuringMint_
uint256 quantity_
withdrawMoney 0xac446002
No parameters
withdrawToken 0xca628c78
No parameters
Recent Transactions
No transactions found for this address