Address Contract Partially Verified
Address
0x6e0bAaa0d1C11DC160143C0C7213df76acdF4E17
Balance
0 ETH
Nonce
2
Code Size
23622 bytes
Creator
0x262655a6...8218 at tx 0x99566f8a...806c63
Indexed Transactions
0
Contract Bytecode
23622 bytes
0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c8063610231fe11610182578063b164bf5e116100e9578063d1b288b6116100a2578063f2fde38b1161007c578063f2fde38b1461082e578063f79b803f1461084a578063fc7239671461087a578063ffe630b514610884576102bb565b8063d1b288b6146107c2578063e8a5dc87146107e0578063e985e9c5146107fe576102bb565b8063b164bf5e14610714578063b88d4fde14610732578063c87b56dd1461074e578063cc567e7b1461077e578063cd85cdb51461079c578063cff9a51e146107a6576102bb565b8063715018a61161013b578063715018a6146106645780638462151c1461066e5780638da5cb5b1461069e57806395d89b41146106bc578063a22cb465146106da578063ad3c38d6146106f6576102bb565b8063610231fe146105a05780636352211e146105aa578063668e2117146105da57806367768ceb146105f85780636c0360eb1461061657806370a0823114610634576102bb565b806323b872dd1161022657806342842e0e116101df57806342842e0e146104cc5780634d3d4457146104e85780634f558e79146105065780634f6ccce71461053657806355f804b314610566578063580208a414610582576102bb565b806323b872dd146104205780632b1255d71461043c5780632be095611461045a5780632f745c59146104645780633beb9327146104945780633dccb61f146104b0576102bb565b80631406d68e116102785780631406d68e1461039657806318160ddd146103b4578063191beda5146103d25780631fa9aaa3146103f057806320a27900146103fa5780632207bb5d14610404576102bb565b806301ffc9a7146102c057806306fdde03146102f0578063081812fc1461030e578063095ea7b31461033e5780630d6fa22b1461035a578063101c778c14610378575b600080fd5b6102da60048036038101906102d59190614383565b6108a0565b6040516102e79190614b94565b60405180910390f35b6102f8610907565b6040516103059190614c00565b60405180910390f35b6103286004803603810190610323919061443f565b610999565b6040516103359190614ae2565b60405180910390f35b6103586004803603810190610353919061431e565b610a1e565b005b610362610b36565b60405161036f9190614f7d565b60405180910390f35b610380610b3c565b60405161038d9190614bca565b60405180910390f35b61039e610b62565b6040516103ab9190614f7d565b60405180910390f35b6103bc610b68565b6040516103c99190614f7d565b60405180910390f35b6103da610b79565b6040516103e79190614c00565b60405180910390f35b6103f8610c07565b005b610402610d4a565b005b61041e6004803603810190610419919061443f565b610e8d565b005b61043a60048036038101906104359190614218565b610f1d565b005b610444610f7d565b6040516104519190614f7d565b60405180910390f35b610462610f83565b005b61047e6004803603810190610479919061431e565b611095565b60405161048b9190614f7d565b60405180910390f35b6104ae60048036038101906104a9919061443f565b6110f0565b005b6104ca60048036038101906104c59190614416565b611750565b005b6104e660048036038101906104e19190614218565b611909565b005b6104f0611929565b6040516104fd9190614be5565b60405180910390f35b610520600480360381019061051b919061443f565b61194f565b60405161052d9190614b94565b60405180910390f35b610550600480360381019061054b919061443f565b611961565b60405161055d9190614f7d565b60405180910390f35b610580600480360381019061057b91906143d5565b611984565b005b61058a611a0c565b6040516105979190614f62565b60405180910390f35b6105a8611a20565b005b6105c460048036038101906105bf919061443f565b611d12565b6040516105d19190614ae2565b60405180910390f35b6105e2611d49565b6040516105ef9190614b94565b60405180910390f35b610600611d5c565b60405161060d9190614b94565b60405180910390f35b61061e611d6f565b60405161062b9190614c00565b60405180910390f35b61064e6004803603810190610649919061418a565b611e01565b60405161065b9190614f7d565b60405180910390f35b61066c611ec0565b005b6106886004803603810190610683919061418a565b611ffd565b6040516106959190614b72565b60405180910390f35b6106a6612179565b6040516106b39190614ae2565b60405180910390f35b6106c46121a3565b6040516106d19190614c00565b60405180910390f35b6106f460048036038101906106ef91906142e2565b612235565b005b6106fe6123b6565b60405161070b9190614b94565b60405180910390f35b61071c6123c9565b6040516107299190614f7d565b60405180910390f35b61074c60048036038101906107479190614267565b6123cf565b005b6107686004803603810190610763919061443f565b612431565b6040516107759190614c00565b60405180910390f35b6107866125a4565b6040516107939190614f62565b60405180910390f35b6107a46125b8565b005b6107c060048036038101906107bb9190614416565b612651565b005b6107ca61280a565b6040516107d79190614f7d565b60405180910390f35b6107e8612810565b6040516107f59190614baf565b60405180910390f35b610818600480360381019061081391906141dc565b612836565b6040516108259190614b94565b60405180910390f35b6108486004803603810190610843919061418a565b6128ca565b005b610864600480360381019061085f919061443f565b612a76565b6040516108719190614b94565b60405180910390f35b610882612a96565b005b61089e600480360381019061089991906143d5565b612d47565b005b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b606060078054610916906152d3565b80601f0160208091040260200160405190810160405280929190818152602001828054610942906152d3565b801561098f5780601f106109645761010080835404028352916020019161098f565b820191906000526020600020905b81548152906001019060200180831161097257829003601f168201915b5050505050905090565b60006109a482612ddd565b6109e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109da90614e02565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610a2982611d12565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9190614ea2565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610ab9612dfa565b73ffffffffffffffffffffffffffffffffffffffff161480610ae85750610ae781610ae2612dfa565b612836565b5b610b27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1e90614d62565b60405180910390fd5b610b318383612e02565b505050565b60105481565b601360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d5481565b6000610b746002612ebb565b905090565b60128054610b86906152d3565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb2906152d3565b8015610bff5780601f10610bd457610100808354040283529160200191610bff565b820191906000526020600020905b815481529060010190602001808311610be257829003601f168201915b505050505081565b610c0f612dfa565b73ffffffffffffffffffffffffffffffffffffffff16610c2d612179565b73ffffffffffffffffffffffffffffffffffffffff1614610c83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7a90614e22565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b37217a4600d546040518263ffffffff1660e01b8152600401610ce09190614f7d565b602060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d32919061435a565b506001600d54610d4291906150de565b600d81905550565b610d52612dfa565b73ffffffffffffffffffffffffffffffffffffffff16610d70612179565b73ffffffffffffffffffffffffffffffffffffffff1614610dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbd90614e22565b60405180910390fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b37217a4600d546040518263ffffffff1660e01b8152600401610e239190614f7d565b602060405180830381600087803b158015610e3d57600080fd5b505af1158015610e51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e75919061435a565b506001600d54610e8591906150de565b600d81905550565b610e95612dfa565b73ffffffffffffffffffffffffffffffffffffffff16610eb3612179565b73ffffffffffffffffffffffffffffffffffffffff1614610f09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0090614e22565b60405180910390fd5b610f1a610f14612179565b82612ed0565b50565b610f2e610f28612dfa565b82612ff4565b610f6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6490614ee2565b60405180910390fd5b610f788383836130d2565b505050565b60115481565b610f8b612dfa565b73ffffffffffffffffffffffffffffffffffffffff16610fa9612179565b73ffffffffffffffffffffffffffffffffffffffff1614610fff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff690614e22565b60405180910390fd5b611900601660009054906101000a900461ffff1661ffff161480156110395750610190601660029054906101000a900461ffff1661ffff16145b611078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106f90614d42565b60405180910390fd5b6001601360006101000a81548160ff021916908315150217905550565b60006110e882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206132e990919063ffffffff16565b905092915050565b601360009054906101000a900460ff1661113f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113690614dc2565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16601360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016111b19190614f7d565b60206040518083038186803b1580156111c957600080fd5b505afa1580156111dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120191906141b3565b73ffffffffffffffffffffffffffffffffffffffff1614611257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124e90614f22565b60405180910390fd5b6017600082815260200190815260200160002060009054906101000a900460ff16156112b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112af90614f42565b60405180910390fd5b60016017600083815260200190815260200160002060006101000a81548160ff021916908315150217905550601360159054906101000a900460ff16158061130d5750601360169054906101000a900460ff16155b1561173657600061131c613303565b9050601360159054906101000a900460ff1661152157600061134c6014805490508361334d90919063ffffffff16565b9050600f546014828154811061138b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1614156113e1576113c533611c27612ed0565b6001601360156101000a81548160ff0219169083151502179055505b601460016014805490506113f59190615165565b8154811061142c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff166014828154811061148a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555060148054806114f1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002090601091828204019190066002026101000a81549061ffff02191690559055505b601360169054906101000a900460ff1615801561154057506117708210155b1561173457600061155f6015805490508361334d90919063ffffffff16565b90506010546015828154811061159e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1614156115f4576115d833611b5e612ed0565b6001601360166101000a81548160ff0219169083151502179055505b601560016015805490506116089190615165565b8154811061163f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090601091828204019190066002029054906101000a900461ffff166015828154811061169d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055506015805480611704577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002090601091828204019190066002026101000a81549061ffff02191690559055505b505b6000611740610b68565b905061174c3382613363565b5050565b611758612dfa565b73ffffffffffffffffffffffffffffffffffffffff16611776612179565b73ffffffffffffffffffffffffffffffffffffffff16146117cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c390614e22565b60405180910390fd5b60008161ffff1611611813576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180a90614c42565b60405180910390fd5b600061019082601660029054906101000a900461ffff1661183491906150a6565b61ffff161161185e5781601660029054906101000a900461ffff1661185991906150a6565b611862565b6101905b90506000601660029054906101000a900461ffff1690505b8161ffff168161ffff1610156118e75760158190806001815401808255809150506001900390600052602060002090601091828204019190066002029091909190916101000a81548161ffff021916908361ffff16021790555080806118df90615336565b91505061187a565b5080601660026101000a81548161ffff021916908361ffff1602179055505050565b611924838383604051806020016040528060008152506123cf565b505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061195a82612ddd565b9050919050565b60008061197883600261338190919063ffffffff16565b50905080915050919050565b61198c612dfa565b73ffffffffffffffffffffffffffffffffffffffff166119aa612179565b73ffffffffffffffffffffffffffffffffffffffff1614611a00576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f790614e22565b60405180910390fd5b611a09816133ad565b50565b601660029054906101000a900461ffff1681565b611a28612dfa565b73ffffffffffffffffffffffffffffffffffffffff16611a46612179565b73ffffffffffffffffffffffffffffffffffffffff1614611a9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9390614e22565b60405180910390fd5b611964600f541480611ab15750611964601054145b611af0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae790614de2565b60405180910390fd5b600d54600e541415611b37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2e90614e42565b60405180910390fd5b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d31cf1866040518163ffffffff1660e01b815260040160206040518083038186803b158015611ba157600080fd5b505afa158015611bb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd99190614468565b1415611c1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1190614f02565b60405180910390fd5b600d54600e819055506000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d31cf1866040518163ffffffff1660e01b815260040160206040518083038186803b158015611c8d57600080fd5b505afa158015611ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc59190614468565b9050611964600f541415611cf357611ce86119008261334d90919063ffffffff16565b600f81905550611d0f565b611d086101908261334d90919063ffffffff16565b6010819055505b50565b6000611d4282604051806060016040528060298152602001615be86029913960026133c79092919063ffffffff16565b9050919050565b601360169054906101000a900460ff1681565b601360009054906101000a900460ff1681565b6060600a8054611d7e906152d3565b80601f0160208091040260200160405190810160405280929190818152602001828054611daa906152d3565b8015611df75780601f10611dcc57610100808354040283529160200191611df7565b820191906000526020600020905b815481529060010190602001808311611dda57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611e72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6990614d82565b60405180910390fd5b611eb9600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206133e6565b9050919050565b611ec8612dfa565b73ffffffffffffffffffffffffffffffffffffffff16611ee6612179565b73ffffffffffffffffffffffffffffffffffffffff1614611f3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f3390614e22565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6060600061200a83611e01565b9050600081141561208d57600067ffffffffffffffff811115612056577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120845781602001602082028036833780820191505090505b50915050612174565b60008167ffffffffffffffff8111156120cf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120fd5781602001602082028036833780820191505090505b50905060005b8281101561216d576121158582611095565b82828151811061214e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001018181525050808061216590615361565b915050612103565b5080925050505b919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600880546121b2906152d3565b80601f01602080910402602001604051908101604052809291908181526020018280546121de906152d3565b801561222b5780601f106122005761010080835404028352916020019161222b565b820191906000526020600020905b81548152906001019060200180831161220e57829003601f168201915b5050505050905090565b61223d612dfa565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156122ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a290614ce2565b60405180910390fd5b80600660006122b8612dfa565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16612365612dfa565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516123aa9190614b94565b60405180910390a35050565b601360159054906101000a900460ff1681565b600e5481565b6123e06123da612dfa565b83612ff4565b61241f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161241690614ee2565b60405180910390fd5b61242b848484846133fb565b50505050565b606061243c82612ddd565b61247b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247290614e82565b60405180910390fd5b600060096000848152602001908152602001600020805461249b906152d3565b80601f01602080910402602001604051908101604052809291908181526020018280546124c7906152d3565b80156125145780601f106124e957610100808354040283529160200191612514565b820191906000526020600020905b8154815290600101906020018083116124f757829003601f168201915b505050505090506000612525611d6f565b905060008151141561253b57819250505061259f565b600082511115612570578082604051602001612558929190614abe565b6040516020818303038152906040529250505061259f565b8061257a85613457565b60405160200161258b929190614abe565b604051602081830303815290604052925050505b919050565b601660009054906101000a900461ffff1681565b6125c0612dfa565b73ffffffffffffffffffffffffffffffffffffffff166125de612179565b73ffffffffffffffffffffffffffffffffffffffff1614612634576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262b90614e22565b60405180910390fd5b6000601360006101000a81548160ff021916908315150217905550565b612659612dfa565b73ffffffffffffffffffffffffffffffffffffffff16612677612179565b73ffffffffffffffffffffffffffffffffffffffff16146126cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c490614e22565b60405180910390fd5b60008161ffff1611612714576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270b90614c42565b60405180910390fd5b600061190082601660009054906101000a900461ffff1661273591906150a6565b61ffff161161275f5781601660009054906101000a900461ffff1661275a91906150a6565b612763565b6119005b90506000601660009054906101000a900461ffff1690505b8161ffff168161ffff1610156127e85760148190806001815401808255809150506001900390600052602060002090601091828204019190066002029091909190916101000a81548161ffff021916908361ffff16021790555080806127e090615336565b91505061277b565b5080601660006101000a81548161ffff021916908361ffff1602179055505050565b600f5481565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6128d2612dfa565b73ffffffffffffffffffffffffffffffffffffffff166128f0612179565b73ffffffffffffffffffffffffffffffffffffffff1614612946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293d90614e22565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156129b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ad90614c82565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60176020528060005260406000206000915054906101000a900460ff1681565b612a9e612dfa565b73ffffffffffffffffffffffffffffffffffffffff16612abc612179565b73ffffffffffffffffffffffffffffffffffffffff1614612b12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b0990614e22565b60405180910390fd5b61196460115414612b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4f90614d02565b60405180910390fd5b600d54600e541415612b9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b9690614e42565b60405180910390fd5b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d31cf1866040518163ffffffff1660e01b815260040160206040518083038186803b158015612c0957600080fd5b505afa158015612c1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c419190614468565b1415612c82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c7990614f02565b60405180910390fd5b600d54600e81905550612d3f611900600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d31cf1866040518163ffffffff1660e01b815260040160206040518083038186803b158015612cf957600080fd5b505afa158015612d0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d319190614468565b61334d90919063ffffffff16565b601181905550565b612d4f612dfa565b73ffffffffffffffffffffffffffffffffffffffff16612d6d612179565b73ffffffffffffffffffffffffffffffffffffffff1614612dc3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dba90614e22565b60405180910390fd5b8060129080519060200190612dd9929190613f5a565b5050565b6000612df382600261360490919063ffffffff16565b9050919050565b600033905090565b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612e7583611d12565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612ec98260000161361e565b9050919050565b60008111612f13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f0a90614ec2565b60405180910390fd5b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638b72a2ec83836040518363ffffffff1660e01b8152600401612f70929190614b49565b600060405180830381600087803b158015612f8a57600080fd5b505af1158015612f9e573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff167fda1a6ce12dffcebdb813f46b35bb45a3e21df8ad38b0ba2d93772eb8e5175eea82604051612fe89190614f7d565b60405180910390a25050565b6000612fff82612ddd565b61303e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161303590614d22565b60405180910390fd5b600061304983611d12565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806130b857508373ffffffffffffffffffffffffffffffffffffffff166130a084610999565b73ffffffffffffffffffffffffffffffffffffffff16145b806130c957506130c88185612836565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166130f282611d12565b73ffffffffffffffffffffffffffffffffffffffff1614613148576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161313f90614e62565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156131b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131af90614cc2565b60405180910390fd5b6131c3838383613633565b6131ce600082612e02565b61321f81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061363890919063ffffffff16565b5061327181600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061365290919063ffffffff16565b506132888183600261366c9092919063ffffffff16565b50808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006132f883600001836136a1565b60001c905092915050565b60008043404243444533613315610b68565b60405160200161332b9796959493929190614a26565b6040516020818303038152906040528051906020012060001c90508091505090565b6000818361335b91906153e2565b905092915050565b61337d82826040518060200160405280600081525061373b565b5050565b6000806000806133948660000186613796565b915091508160001c8160001c9350935050509250929050565b80600a90805190602001906133c3929190613f5a565b5050565b60006133da846000018460001b846137d6565b60001c90509392505050565b60006133f482600001613857565b9050919050565b6134068484846130d2565b61341284848484613868565b613451576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161344890614c62565b60405180910390fd5b50505050565b6060600082141561349f576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506135ff565b600082905060005b600082146134d15780806134ba90615361565b915050600a826134ca9190615134565b91506134a7565b60008167ffffffffffffffff811115613513577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156135455781602001600182028036833780820191505090505b5090505b600085146135f85760018261355e9190615165565b9150600a8561356d91906153e2565b603061357991906150de565b60f81b8183815181106135b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856135f19190615134565b9450613549565b8093505050505b919050565b6000613616836000018360001b6139cc565b905092915050565b600061362c826000016139ec565b9050919050565b505050565b600061364a836000018360001b613a01565b905092915050565b6000613664836000018360001b613b7f565b905092915050565b6000613698846000018460001b8473ffffffffffffffffffffffffffffffffffffffff1660001b613bef565b90509392505050565b6000818360000180549050116136ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136e390614c22565b60405180910390fd5b826000018281548110613728577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6137458383613c2a565b6137526000848484613868565b613791576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161378890614c62565b60405180910390fd5b505050565b60008060006137b18486600001613db890919063ffffffff16565b9050808560020160008381526020019081526020016000205492509250509250929050565b6000808460020160008581526020019081526020016000205490506000801b81141580613809575061380885856139cc565b5b839061384b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138429190614c00565b60405180910390fd5b50809150509392505050565b600081600001805490509050919050565b60006138898473ffffffffffffffffffffffffffffffffffffffff16613dcf565b61389657600190506139c4565b600061395d63150b7a0260e01b6138ab612dfa565b8887876040516024016138c19493929190614afd565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001615bb6603291398773ffffffffffffffffffffffffffffffffffffffff16613de29092919063ffffffff16565b905060008180602001905181019061397591906143ac565b905063150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614925050505b949350505050565b60006139e48284600001613dfa90919063ffffffff16565b905092915050565b60006139fa82600001613857565b9050919050565b60008083600101600084815260200190815260200160002054905060008114613b73576000600182613a339190615165565b9050600060018660000180549050613a4b9190615165565b90506000866000018281548110613a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110613ad5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550838760010160008381526020019081526020016000208190555086600001805480613b37577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050613b79565b60009150505b92915050565b6000613b8b8383613e11565b613be4578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050613be9565b600090505b92915050565b60008184600201600085815260200190815260200160002081905550613c218385600001613e3490919063ffffffff16565b90509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613c9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613c9190614da2565b60405180910390fd5b613ca381612ddd565b15613ce3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613cda90614ca2565b60405180910390fd5b613cef60008383613633565b613d4081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061365290919063ffffffff16565b50613d578183600261366c9092919063ffffffff16565b50808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6000613dc783600001836136a1565b905092915050565b600080823b905060008111915050919050565b6060613df18484600085613e4b565b90509392505050565b6000613e098360000183613e11565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000613e438360000183613b7f565b905092915050565b606082471015613e5a57600080fd5b613e6385613dcf565b613e6c57600080fd5b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613e959190614aa7565b60006040518083038185875af1925050503d8060008114613ed2576040519150601f19603f3d011682016040523d82523d6000602084013e613ed7565b606091505b5091509150613ee7828286613ef3565b92505050949350505050565b60608315613f0357829050613f53565b600083511115613f165782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f4a9190614c00565b60405180910390fd5b9392505050565b828054613f66906152d3565b90600052602060002090601f016020900481019282613f885760008555613fcf565b82601f10613fa157805160ff1916838001178555613fcf565b82800160010185558215613fcf579182015b82811115613fce578251825591602001919060010190613fb3565b5b509050613fdc9190613fe0565b5090565b5b80821115613ff9576000816000905550600101613fe1565b5090565b600061401061400b84614fbd565b614f98565b90508281526020810184848401111561402857600080fd5b614033848285615291565b509392505050565b600061404e61404984614fee565b614f98565b90508281526020810184848401111561406657600080fd5b614071848285615291565b509392505050565b60008135905061408881615b2b565b92915050565b60008151905061409d81615b2b565b92915050565b6000813590506140b281615b42565b92915050565b6000815190506140c781615b59565b92915050565b6000813590506140dc81615b70565b92915050565b6000815190506140f181615b70565b92915050565b600082601f83011261410857600080fd5b8135614118848260208601613ffd565b91505092915050565b600082601f83011261413257600080fd5b813561414284826020860161403b565b91505092915050565b60008135905061415a81615b87565b92915050565b60008135905061416f81615b9e565b92915050565b60008151905061418481615b9e565b92915050565b60006020828403121561419c57600080fd5b60006141aa84828501614079565b91505092915050565b6000602082840312156141c557600080fd5b60006141d38482850161408e565b91505092915050565b600080604083850312156141ef57600080fd5b60006141fd85828601614079565b925050602061420e85828601614079565b9150509250929050565b60008060006060848603121561422d57600080fd5b600061423b86828701614079565b935050602061424c86828701614079565b925050604061425d86828701614160565b9150509250925092565b6000806000806080858703121561427d57600080fd5b600061428b87828801614079565b945050602061429c87828801614079565b93505060406142ad87828801614160565b925050606085013567ffffffffffffffff8111156142ca57600080fd5b6142d6878288016140f7565b91505092959194509250565b600080604083850312156142f557600080fd5b600061430385828601614079565b9250506020614314858286016140a3565b9150509250929050565b6000806040838503121561433157600080fd5b600061433f85828601614079565b925050602061435085828601614160565b9150509250929050565b60006020828403121561436c57600080fd5b600061437a848285016140b8565b91505092915050565b60006020828403121561439557600080fd5b60006143a3848285016140cd565b91505092915050565b6000602082840312156143be57600080fd5b60006143cc848285016140e2565b91505092915050565b6000602082840312156143e757600080fd5b600082013567ffffffffffffffff81111561440157600080fd5b61440d84828501614121565b91505092915050565b60006020828403121561442857600080fd5b60006144368482850161414b565b91505092915050565b60006020828403121561445157600080fd5b600061445f84828501614160565b91505092915050565b60006020828403121561447a57600080fd5b600061448884828501614175565b91505092915050565b600061449d83836149f1565b60208301905092915050565b6144b281615199565b82525050565b6144c96144c482615199565b6153aa565b82525050565b60006144da8261502f565b6144e4818561505d565b93506144ef8361501f565b8060005b838110156145205781516145078882614491565b975061451283615050565b9250506001810190506144f3565b5085935050505092915050565b614536816151ab565b82525050565b61454d614548826151b7565b6153bc565b82525050565b600061455e8261503a565b614568818561506e565b93506145788185602086016152a0565b614581816154cf565b840191505092915050565b60006145978261503a565b6145a1818561507f565b93506145b18185602086016152a0565b80840191505092915050565b6145c681615225565b82525050565b6145d581615249565b82525050565b6145e48161526d565b82525050565b60006145f582615045565b6145ff818561508a565b935061460f8185602086016152a0565b614618816154cf565b840191505092915050565b600061462e82615045565b614638818561509b565b93506146488185602086016152a0565b80840191505092915050565b600061466160228361508a565b915061466c826154ed565b604082019050919050565b6000614684601f8361508a565b915061468f8261553c565b602082019050919050565b60006146a760328361508a565b91506146b282615565565b604082019050919050565b60006146ca60268361508a565b91506146d5826155b4565b604082019050919050565b60006146ed601c8361508a565b91506146f882615603565b602082019050919050565b600061471060248361508a565b915061471b8261562c565b604082019050919050565b600061473360198361508a565b915061473e8261567b565b602082019050919050565b6000614756601c8361508a565b9150614761826156a4565b602082019050919050565b6000614779602c8361508a565b9150614784826156cd565b604082019050919050565b600061479c60168361508a565b91506147a78261571c565b602082019050919050565b60006147bf60388361508a565b91506147ca82615745565b604082019050919050565b60006147e2602a8361508a565b91506147ed82615794565b604082019050919050565b600061480560208361508a565b9150614810826157e3565b602082019050919050565b600061482860178361508a565b91506148338261580c565b602082019050919050565b600061484b60298361508a565b915061485682615835565b604082019050919050565b600061486e602c8361508a565b915061487982615884565b604082019050919050565b600061489160208361508a565b915061489c826158d3565b602082019050919050565b60006148b4601e8361508a565b91506148bf826158fc565b602082019050919050565b60006148d760298361508a565b91506148e282615925565b604082019050919050565b60006148fa602f8361508a565b915061490582615974565b604082019050919050565b600061491d60218361508a565b9150614928826159c3565b604082019050919050565b6000614940600f8361508a565b915061494b82615a12565b602082019050919050565b600061496360318361508a565b915061496e82615a3b565b604082019050919050565b6000614986602a8361508a565b915061499182615a8a565b604082019050919050565b60006149a9600f8361508a565b91506149b482615ad9565b602082019050919050565b60006149cc601f8361508a565b91506149d782615b02565b602082019050919050565b6149eb816151ed565b82525050565b6149fa8161521b565b82525050565b614a098161521b565b82525050565b614a20614a1b8261521b565b6153d8565b82525050565b6000614a32828a61453c565b602082019150614a428289614a0f565b602082019150614a528288614a0f565b602082019150614a628287614a0f565b602082019150614a728286614a0f565b602082019150614a8282856144b8565b601482019150614a928284614a0f565b60208201915081905098975050505050505050565b6000614ab3828461458c565b915081905092915050565b6000614aca8285614623565b9150614ad68284614623565b91508190509392505050565b6000602082019050614af760008301846144a9565b92915050565b6000608082019050614b1260008301876144a9565b614b1f60208301866144a9565b614b2c6040830185614a00565b8181036060830152614b3e8184614553565b905095945050505050565b6000604082019050614b5e60008301856144a9565b614b6b6020830184614a00565b9392505050565b60006020820190508181036000830152614b8c81846144cf565b905092915050565b6000602082019050614ba9600083018461452d565b92915050565b6000602082019050614bc460008301846145bd565b92915050565b6000602082019050614bdf60008301846145cc565b92915050565b6000602082019050614bfa60008301846145db565b92915050565b60006020820190508181036000830152614c1a81846145ea565b905092915050565b60006020820190508181036000830152614c3b81614654565b9050919050565b60006020820190508181036000830152614c5b81614677565b9050919050565b60006020820190508181036000830152614c7b8161469a565b9050919050565b60006020820190508181036000830152614c9b816146bd565b9050919050565b60006020820190508181036000830152614cbb816146e0565b9050919050565b60006020820190508181036000830152614cdb81614703565b9050919050565b60006020820190508181036000830152614cfb81614726565b9050919050565b60006020820190508181036000830152614d1b81614749565b9050919050565b60006020820190508181036000830152614d3b8161476c565b9050919050565b60006020820190508181036000830152614d5b8161478f565b9050919050565b60006020820190508181036000830152614d7b816147b2565b9050919050565b60006020820190508181036000830152614d9b816147d5565b9050919050565b60006020820190508181036000830152614dbb816147f8565b9050919050565b60006020820190508181036000830152614ddb8161481b565b9050919050565b60006020820190508181036000830152614dfb8161483e565b9050919050565b60006020820190508181036000830152614e1b81614861565b9050919050565b60006020820190508181036000830152614e3b81614884565b9050919050565b60006020820190508181036000830152614e5b816148a7565b9050919050565b60006020820190508181036000830152614e7b816148ca565b9050919050565b60006020820190508181036000830152614e9b816148ed565b9050919050565b60006020820190508181036000830152614ebb81614910565b9050919050565b60006020820190508181036000830152614edb81614933565b9050919050565b60006020820190508181036000830152614efb81614956565b9050919050565b60006020820190508181036000830152614f1b81614979565b9050919050565b60006020820190508181036000830152614f3b8161499c565b9050919050565b60006020820190508181036000830152614f5b816149bf565b9050919050565b6000602082019050614f7760008301846149e2565b92915050565b6000602082019050614f926000830184614a00565b92915050565b6000614fa2614fb3565b9050614fae8282615305565b919050565b6000604051905090565b600067ffffffffffffffff821115614fd857614fd76154a0565b5b614fe1826154cf565b9050602081019050919050565b600067ffffffffffffffff821115615009576150086154a0565b5b615012826154cf565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006150b1826151ed565b91506150bc836151ed565b92508261ffff038211156150d3576150d2615413565b5b828201905092915050565b60006150e98261521b565b91506150f48361521b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561512957615128615413565b5b828201905092915050565b600061513f8261521b565b915061514a8361521b565b92508261515a57615159615442565b5b828204905092915050565b60006151708261521b565b915061517b8361521b565b92508282101561518e5761518d615413565b5b828203905092915050565b60006151a4826151fb565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061523082615237565b9050919050565b6000615242826151fb565b9050919050565b60006152548261525b565b9050919050565b6000615266826151fb565b9050919050565b60006152788261527f565b9050919050565b600061528a826151fb565b9050919050565b82818337600083830152505050565b60005b838110156152be5780820151818401526020810190506152a3565b838111156152cd576000848401525b50505050565b600060028204905060018216806152eb57607f821691505b602082108114156152ff576152fe615471565b5b50919050565b61530e826154cf565b810181811067ffffffffffffffff8211171561532d5761532c6154a0565b5b80604052505050565b6000615341826151ed565b915061ffff82141561535657615355615413565b5b600182019050919050565b600061536c8261521b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561539f5761539e615413565b5b600182019050919050565b60006153b5826153c6565b9050919050565b6000819050919050565b60006153d1826154e0565b9050919050565b6000819050919050565b60006153ed8261521b565b91506153f88361521b565b92508261540857615407615442565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f636f756e742073686f756c642062652067726561746572207468616e20302e00600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f737461727420696e6465782077617320616c7265616479207365742e00000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f506c6561736520696e697469616c697a6520616c6c2e00000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4d696e74696e67206861736e277420737461727465642e000000000000000000600082015250565b7f596f7520616c7265616479207069636b656420616c6c2070756e6b2072616e6460008201527f6f6d20696e6465782e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f506c656173652067656e65726174652072616e646f6d206e756d6265722e0000600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f496e76616c69642070756e6b2069640000000000000000000000000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f506c65617365207761697420756e74696c2072616e646f6d206e756d6265722060008201527f67656e6572617465642e00000000000000000000000000000000000000000000602082015250565b7f496e76616c6964206d696e7465722e0000000000000000000000000000000000600082015250565b7f416c7265616479206d696e74656420666f722074686973206567672069642e00600082015250565b615b3481615199565b8114615b3f57600080fd5b50565b615b4b816151ab565b8114615b5657600080fd5b50565b615b62816151b7565b8114615b6d57600080fd5b50565b615b79816151c1565b8114615b8457600080fd5b50565b615b90816151ed565b8114615b9b57600080fd5b50565b615ba78161521b565b8114615bb257600080fd5b5056fe4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656ea2646970667358221220d85b14b29cf6954f310a11a5d4960033f2dbd7db8db6d8f0994dc9fc5cd6a07964736f6c63430008010033
Verified Source Code Partial Match
Compiler: v0.8.1+commit.df193b15
EVM: istanbul
Optimization: No
ERC165.sol 62 lines
// SPDX-License-Identifier: MIT
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 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
/**
* @dev Mapping of interface ids to whether or not it's supported.
*/
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () {
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See {IERC165-supportsInterface}.
*
* Time complexity O(1), guaranteed to always use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return _supportedInterfaces[interfaceId];
}
/**
* @dev Registers the contract as an implementer of the interface defined by
* `interfaceId`. Support of the actual ERC165 interface is automatic and
* registering its interface id is not required.
*
* See {IERC165-supportsInterface}.
*
* Requirements:
*
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
*/
function _registerInterface(bytes4 interfaceId) internal virtual {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
ERC721.sol 473 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721Receiver.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./Address.sol";
import "./Strings.sol";
import "./EnumerableSet.sol";
import "./EnumerableMap.sol";
import "./SafeMath.sol";
import "./Context.sol";
import "./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, IERC721Enumerable {
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableMap for EnumerableMap.UintToAddressMap;
using Strings for uint256;
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
// Mapping from holder address to their (enumerable) set of owned tokens
mapping (address => EnumerableSet.UintSet) private _holderTokens;
// Enumerable mapping from token ids to their owners
EnumerableMap.UintToAddressMap private _tokenOwners;
// 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;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Optional mapping for token URIs
mapping (uint256 => string) private _tokenURIs;
// Base URI
string private _baseURI;
/*
* bytes4(keccak256('balanceOf(address)')) == 0x70a08231
* bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
* bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
* bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
* bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
* bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
* bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
*
* => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
* 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
/*
* bytes4(keccak256('name()')) == 0x06fdde03
* bytes4(keccak256('symbol()')) == 0x95d89b41
* bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
*
* => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
*/
bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
/*
* bytes4(keccak256('totalSupply()')) == 0x18160ddd
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
* bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
*
* => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
*/
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
/**
* @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_;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
/**
* @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 _holderTokens[owner].length();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
}
/**
* @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 _tokenURI = _tokenURIs[tokenId];
string memory base = baseURI();
// If there is no base URI, return the token URI.
if (bytes(base).length == 0) {
return _tokenURI;
}
// If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
if (bytes(_tokenURI).length > 0) {
return string(abi.encodePacked(base, _tokenURI));
}
// If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
return string(abi.encodePacked(base, tokenId.toString()));
}
/**
* @dev Returns the base URI set via {_setBaseURI}. This will be
* automatically added as a prefix in {tokenURI} to each token's URI, or
* to the token ID if no specific URI is set for that token ID.
*/
function baseURI() public view virtual returns (string memory) {
return _baseURI;
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
return _holderTokens[owner].at(index);
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
// _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
return _tokenOwners.length();
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
(uint256 tokenId, ) = _tokenOwners.at(index);
return tokenId;
}
/**
* @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 || ERC721.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 {
require(operator != _msgSender(), "ERC721: 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 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 _tokenOwners.contains(tokenId);
}
/**
* @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 || ERC721.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);
_holderTokens[to].add(tokenId);
_tokenOwners.set(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); // internal owner
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
// Clear metadata (if any)
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
_holderTokens[owner].remove(tokenId);
_tokenOwners.remove(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"); // internal owner
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_holderTokens[from].remove(tokenId);
_holderTokens[to].add(tokenId);
_tokenOwners.set(tokenId, to);
emit Transfer(from, to, tokenId);
}
/**
* @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
/**
* @dev Internal function to set the base URI for all token IDs. It is
* automatically added as a prefix to the value returned in {tokenURI},
* or to the token ID if {tokenURI} is empty.
*/
function _setBaseURI(string memory baseURI_) internal virtual {
_baseURI = baseURI_;
}
/**
* @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()) {
return true;
}
bytes memory returndata = to.functionCall(abi.encodeWithSelector(
IERC721Receiver(to).onERC721Received.selector,
_msgSender(),
from,
tokenId,
_data
), "ERC721: transfer to non ERC721Receiver implementer");
bytes4 retval = abi.decode(returndata, (bytes4));
return (retval == _ERC721_RECEIVED);
}
function _approve(address to, uint256 tokenId) private {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
}
/**
* @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` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}
IERC20.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
Address.sol 117 lines
// SPDX-License-Identifier: MIT
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;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @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);
}
/**
* @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);
}
/**
* @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);
require(isContract(target));
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
IERC165.sol 24 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);
}
IERC721.sol 129 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./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;
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./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 () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = 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");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
Strings.sol 33 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
/**
* @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);
}
}
Creature.sol 421 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "./ERC721.sol";
import "./Ownable.sol";
import "./IERC20.sol";
interface IEGG {
function ownerOf(uint256 tokenId) external view returns (address owner);
}
interface ICryptoPunk {
function transferPunk(address to, uint256 punkIndex) external;
}
interface ILink is IERC20 {
function transferAndCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success);
}
contract VRFRequestIDBase {
function makeVRFInputSeed(
bytes32 _keyHash,
uint256 _userSeed,
address _requester,
uint256 _nonce
) internal pure returns (uint256) {
return
uint256(
keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce))
);
}
function makeRequestId(bytes32 _keyHash, uint256 _vRFInputSeed)
internal
pure
returns (bytes32)
{
return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
}
}
interface LinkTokenInterface {
function allowance(address owner, address spender)
external
view
returns (uint256 remaining);
function approve(address spender, uint256 value)
external
returns (bool success);
function balanceOf(address owner) external view returns (uint256 balance);
function decimals() external view returns (uint8 decimalPlaces);
function decreaseApproval(address spender, uint256 addedValue)
external
returns (bool success);
function increaseApproval(address spender, uint256 subtractedValue)
external;
function name() external view returns (string memory tokenName);
function symbol() external view returns (string memory tokenSymbol);
function totalSupply() external view returns (uint256 totalTokensIssued);
function transfer(address to, uint256 value)
external
returns (bool success);
function transferAndCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool success);
}
abstract contract VRFConsumerBase is VRFRequestIDBase {
using SafeMath for uint256;
function fulfillRandomness(bytes32 requestId, uint256 randomness)
internal
virtual;
function requestRandomness(
bytes32 _keyHash,
uint256 _fee,
uint256 _seed
) internal returns (bytes32 requestId) {
LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, _seed));
uint256 vRFSeed =
makeVRFInputSeed(_keyHash, _seed, address(this), nonces[_keyHash]);
nonces[_keyHash] = nonces[_keyHash].add(1);
return makeRequestId(_keyHash, vRFSeed);
}
LinkTokenInterface internal immutable LINK;
address private immutable vrfCoordinator;
/* keyHash */
/* nonce */
mapping(bytes32 => uint256) private nonces;
constructor(address _vrfCoordinator, address _link) {
vrfCoordinator = _vrfCoordinator;
LINK = LinkTokenInterface(_link);
}
function rawFulfillRandomness(bytes32 requestId, uint256 randomness)
external
{
require(
msg.sender == vrfCoordinator,
"Only VRFCoordinator can fulfill"
);
fulfillRandomness(requestId, randomness);
}
}
contract RandomNumberConsumer is VRFConsumerBase {
bytes32 internal keyHash;
uint256 internal fee;
bool private progress = false;
uint256 private randomNumber = 0;
address private distributer;
modifier onlyDistributer() {
require(distributer == msg.sender, "Ownable: caller is not the owner");
_;
}
/**
* Constructor inherits VRFConsumerBase
*
* Network: Mainnet
* Chainlink VRF Coordinator address: 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
* LINK token address: 0x514910771AF9Ca656af840dff83E8264EcF986CA
* Key Hash: 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445
*/
constructor(address _distributer)
VRFConsumerBase(
0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator
0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token
)
{
keyHash = 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445;
fee = 2 * 10**18; // 2 LINK
distributer = _distributer;
}
/**
* Requests randomness from a user-provided seed
*/
function getRandomNumber(uint256 userProvidedSeed)
public
onlyDistributer
returns (bytes32 requestId)
{
require(
LINK.balanceOf(address(this)) >= fee,
"Not enough LINK"
);
require(!progress, "now getting an random number.");
randomNumber = 0;
progress = true;
return requestRandomness(keyHash, fee, userProvidedSeed);
}
/**
* Callback function used by VRF Coordinator
*/
function fulfillRandomness(bytes32 requestId, uint256 randomness)
internal
override
{
requestId = 0;
progress = false;
randomNumber = randomness;
}
function checkRandomNumber()
external
view
onlyDistributer
returns (uint256)
{
if (progress) return 0;
return randomNumber;
}
}
contract Creature is ERC721, Ownable {
using SafeMath for uint256;
RandomNumberConsumer public rnGenerator;
uint256 public _randomCallCount = 0;
uint256 public _prevRandomCallCount = 0;
uint256 public _punkRandomIndex1 = 6500;
uint256 public _punkRandomIndex2 = 6500;
uint256 public _creatureStartIndex = 6500;
string public APYMON_MONSTER_PROVENANCE = "";
bool public hasMintStarted = false;
IEGG public _iEgg;
bool public _punkDistributed1 = false;
bool public _punkDistributed2 = false;
uint16[] private _indexArray1;
uint16[] private _indexArray2;
uint16 public _initializedCount1 = 0;
uint16 public _initializedCount2 = 0;
// Mapping from egg ID -> minted
mapping(uint256 => bool) public _minted;
event WithdrawPunk(address indexed owner, uint256 id);
ICryptoPunk public _cryptoPunk =
ICryptoPunk(0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB);
constructor() ERC721("Apymon Monsters", "APYM") {
rnGenerator = new RandomNumberConsumer(address(this));
_iEgg = IEGG(0x9C008A22D71B6182029b694B0311486e4C0e53DB);
}
function initialize1(uint16 count) external onlyOwner {
require(count > 0, "count should be greater than 0.");
uint16 endIndex =
_initializedCount1 + count > 6400
? 6400
: _initializedCount1 + count;
for (uint16 i = _initializedCount1; i < endIndex; i++)
_indexArray1.push(i);
_initializedCount1 = endIndex;
}
function initialize2(uint16 count) external onlyOwner {
require(count > 0, "count should be greater than 0.");
uint16 endIndex =
_initializedCount2 + count > 400 ? 400 : _initializedCount2 + count;
for (uint16 i = _initializedCount2; i < endIndex; i++)
_indexArray2.push(i);
_initializedCount2 = endIndex;
}
function getCreatureStartIndexByVRF() external onlyOwner {
rnGenerator.getRandomNumber(_randomCallCount);
_randomCallCount = _randomCallCount + 1;
}
function setCreatureStartIndex() external onlyOwner {
require(_creatureStartIndex == 6500, "start index was already set.");
require(
_prevRandomCallCount != _randomCallCount,
"Please generate random number."
);
require(
rnGenerator.checkRandomNumber() != 0,
"Please wait until random number generated."
);
_prevRandomCallCount = _randomCallCount;
_creatureStartIndex = rnGenerator.checkRandomNumber().mod(6400);
}
function getRandomNumberByVRF() external onlyOwner {
rnGenerator.getRandomNumber(_randomCallCount);
_randomCallCount = _randomCallCount + 1;
}
function pickPunkRandomIndex() external onlyOwner {
require(
_punkRandomIndex1 == 6500 || _punkRandomIndex2 == 6500,
"You already picked all punk random index."
);
require(
_prevRandomCallCount != _randomCallCount,
"Please generate random number."
);
require(
rnGenerator.checkRandomNumber() != 0,
"Please wait until random number generated."
);
_prevRandomCallCount = _randomCallCount;
uint256 randomNumber = rnGenerator.checkRandomNumber();
if (_punkRandomIndex1 == 6500)
_punkRandomIndex1 = randomNumber.mod(6400);
else _punkRandomIndex2 = randomNumber.mod(400);
}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
}
function tokensOfOwner(address _owner)
external
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
for (uint256 index; index < tokenCount; index++) {
result[index] = tokenOfOwnerByIndex(_owner, index);
}
return result;
}
}
/**
* @dev Changes the base URI if we want to move things in the future (Callable by owner only)
*/
function setBaseURI(string memory baseURI) external onlyOwner {
_setBaseURI(baseURI);
}
function setProvenance(string memory _provenance) external onlyOwner {
APYMON_MONSTER_PROVENANCE = _provenance;
}
function givePunk(address to, uint256 punkId) internal {
require(punkId > 0, "Invalid punk id");
_cryptoPunk.transferPunk(to, punkId);
emit WithdrawPunk(to, punkId);
}
function getRandomNumber() private view returns (uint256) {
uint256 randomNumber =
uint256(
keccak256(
abi.encodePacked(
blockhash(block.number),
block.timestamp,
block.number,
block.difficulty,
block.gaslimit,
msg.sender,
totalSupply()
)
)
);
return randomNumber;
}
function mintCreature(uint256 eggId) external {
require(hasMintStarted, "Minting hasn't started.");
require(_iEgg.ownerOf(eggId) == msg.sender, "Invalid minter.");
require(!_minted[eggId], "Already minted for this egg id.");
_minted[eggId] = true;
if (!_punkDistributed1 || !_punkDistributed2) {
uint256 randomNumber = getRandomNumber();
if (!_punkDistributed1) {
uint256 index1 = randomNumber.mod(_indexArray1.length);
if (_indexArray1[index1] == _punkRandomIndex1) {
givePunk(msg.sender, 7207);
_punkDistributed1 = true;
}
_indexArray1[index1] = _indexArray1[_indexArray1.length - 1];
_indexArray1.pop();
}
if (!_punkDistributed2 && eggId >= 6000) {
uint256 index2 = randomNumber.mod(_indexArray2.length);
if (_indexArray2[index2] == _punkRandomIndex2) {
givePunk(msg.sender, 7006);
_punkDistributed2 = true;
}
_indexArray2[index2] = _indexArray2[_indexArray2.length - 1];
_indexArray2.pop();
}
}
uint256 mintIndex = totalSupply();
_safeMint(msg.sender, mintIndex);
}
function startMint() public onlyOwner {
require(
_initializedCount1 == 6400 && _initializedCount2 == 400,
"Please initialize all."
);
hasMintStarted = true;
}
function pauseMint() public onlyOwner {
hasMintStarted = false;
}
function withdrawPunkToOwner(uint256 id) external onlyOwner {
givePunk(owner(), id);
}
}
SafeMath.sol 152 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
EnumerableMap.sol 224 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./EnumerableSet.sol";
/**
* @dev Library for managing an enumerable variant of Solidity's
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
* type.
*
* Maps have the following properties:
*
* - Entries are added, removed, and checked for existence in constant time
* (O(1)).
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableMap for EnumerableMap.UintToAddressMap;
*
* // Declare a set state variable
* EnumerableMap.UintToAddressMap private myMap;
* }
* ```
*
* As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
* supported.
*/
library EnumerableMap {
using EnumerableSet for EnumerableSet.Bytes32Set;
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAddressMap) are just wrappers around
// the underlying Map.
// This means that we can only create new EnumerableMaps for types that fit
// in bytes32.
struct Map {
// Storage of keys
EnumerableSet.Bytes32Set _keys;
mapping (bytes32 => bytes32) _values;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
map._values[key] = value;
return map._keys.add(key);
}
/**
* @dev Removes a key-value pair from a map. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function _remove(Map storage map, bytes32 key) private returns (bool) {
delete map._values[key];
return map._keys.remove(key);
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function _contains(Map storage map, bytes32 key) private view returns (bool) {
return map._keys.contains(key);
}
/**
* @dev Returns the number of key-value pairs in the map. O(1).
*/
function _length(Map storage map) private view returns (uint256) {
return map._keys.length();
}
/**
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
*
* Note that there are no guarantees on the ordering of entries inside the
* array, and it may change when more entries are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
bytes32 key = map._keys.at(index);
return (key, map._values[key]);
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*/
function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
bytes32 value = map._values[key];
if (value == bytes32(0)) {
return (_contains(map, key), bytes32(0));
} else {
return (true, value);
}
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function _get(Map storage map, bytes32 key) private view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || _contains(map, key), "EnumerableMap: nonexistent key");
return value;
}
/**
* @dev Same as {_get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {_tryGet}.
*/
function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
bytes32 value = map._values[key];
require(value != 0 || _contains(map, key), errorMessage);
return value;
}
// UintToAddressMap
struct UintToAddressMap {
Map _inner;
}
/**
* @dev Adds a key-value pair to a map, or updates the value for an existing
* key. O(1).
*
* Returns true if the key was added to the map, that is if it was not
* already present.
*/
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the key was removed from the map, that is if it was present.
*/
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
return _remove(map._inner, bytes32(key));
}
/**
* @dev Returns true if the key is in the map. O(1).
*/
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
return _contains(map._inner, bytes32(key));
}
/**
* @dev Returns the number of elements in the map. O(1).
*/
function length(UintToAddressMap storage map) internal view returns (uint256) {
return _length(map._inner);
}
/**
* @dev Returns the element stored at position `index` in the set. O(1).
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
(bytes32 key, bytes32 value) = _at(map._inner, index);
return (uint256(key), address(uint160(uint256(value))));
}
/**
* @dev Tries to returns the value associated with `key`. O(1).
* Does not revert if `key` is not in the map.
*
* _Available since v3.4._
*/
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
(bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
return (success, address(uint160(uint256(value))));
}
/**
* @dev Returns the value associated with `key`. O(1).
*
* Requirements:
*
* - `key` must be in the map.
*/
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
return address(uint160(uint256(_get(map._inner, bytes32(key)))));
}
/**
* @dev Same as {get}, with a custom error message when `key` is not in the map.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryGet}.
*/
function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
}
}
EnumerableSet.sol 297 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
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);
}
IERC721Receiver.sol 21 lines
// SPDX-License-Identifier: MIT
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);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @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);
}
Read Contract
APYMON_MONSTER_PROVENANCE 0x191beda5 → string
_creatureStartIndex 0x2b1255d7 → uint256
_cryptoPunk 0xe8a5dc87 → address
_iEgg 0x101c778c → address
_initializedCount1 0xcc567e7b → uint16
_initializedCount2 0x580208a4 → uint16
_minted 0xf79b803f → bool
_prevRandomCallCount 0xb164bf5e → uint256
_punkDistributed1 0xad3c38d6 → bool
_punkDistributed2 0x668e2117 → bool
_punkRandomIndex1 0xd1b288b6 → uint256
_punkRandomIndex2 0x0d6fa22b → uint256
_randomCallCount 0x1406d68e → uint256
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
exists 0x4f558e79 → bool
getApproved 0x081812fc → address
hasMintStarted 0x67768ceb → bool
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
rnGenerator 0x4d3d4457 → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
tokensOfOwner 0x8462151c → uint256[]
totalSupply 0x18160ddd → uint256
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
getCreatureStartIndexByVRF 0x1fa9aaa3
No parameters
getRandomNumberByVRF 0x20a27900
No parameters
initialize1 0xcff9a51e
uint16 count
initialize2 0x3dccb61f
uint16 count
mintCreature 0x3beb9327
uint256 eggId
pauseMint 0xcd85cdb5
No parameters
pickPunkRandomIndex 0x610231fe
No parameters
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
setCreatureStartIndex 0xfc723967
No parameters
setProvenance 0xffe630b5
string _provenance
startMint 0x2be09561
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawPunkToOwner 0x2207bb5d
uint256 id
Recent Transactions
No transactions found for this address