Address Contract Partially Verified
Address
0x34ed0Aa248f60F54DD32fBc9883d6137A491f4f3
Balance
0 ETH
Nonce
1
Code Size
18825 bytes
Creator
0x93A7C464...5d3A at tx 0xfdc92deb...5e32f7
Indexed Transactions
0
Contract Bytecode
18825 bytes
0x608060405234801561001057600080fd5b50600436106102325760003560e01c806370a0823111610130578063b88d4fde116100b8578063e181ff331161007c578063e181ff3314611297578063e985e9c5146112d9578063f2fde38b14611355578063f3993d1114611399578063f59d9e3f1461145257610232565b8063b88d4fde1461102f578063c59a138b14611134578063c87b56dd14611176578063d63a8e111461121d578063d8b416471461127957610232565b80638f32d59b116100ff5780638f32d59b14610e7157806395d89b4114610e93578063a22cb46514610f16578063b2fa1c9e14610f66578063b416cfd714610f8857610232565b806370a0823114610cf6578063715018a614610d4e578063823bfc3f14610d585780638da5cb5b14610e2757610232565b80632f745c59116101be5780634f6ccce7116101825780634f6ccce714610a6f57806355f804b314610ab15780635669c94f14610b6c5780636352211e14610c055780636c0360eb14610c7357610232565b80632f745c59146107bc5780633fb1d1cf1461081e57806340bd647e146108e357806342842e0e146109b15780634697f05d14610a1f57610232565b8063095ea7b311610205578063095ea7b314610485578063105f7b7c146104d357806318160ddd146105a157806323b872dd146105bf57806328cfbd461461062d57610232565b806301ffc9a714610237578063034601ec1461029c57806306fdde0314610394578063081812fc14610417575b600080fd5b6102826004803603602081101561024d57600080fd5b8101908080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019092919050505061145c565b604051808215151515815260200191505060405180910390f35b610392600480360360608110156102b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561030f57600080fd5b82018360208201111561032157600080fd5b8035906020019184602083028401116401000000008311171561034357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506114c4565b005b61039c6114e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103dc5780820151818401526020810190506103c1565b50505050905090810190601f1680156104095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104436004803603602081101561042d57600080fd5b8101908080359060200190929190505050611586565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104d16004803603604081101561049b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611621565b005b61059f600480360360408110156104e957600080fd5b810190808035906020019064010000000081111561050657600080fd5b82018360208201111561051857600080fd5b8035906020019184602083028401116401000000008311171561053a57600080fd5b90919293919293908035906020019064010000000081111561055b57600080fd5b82018360208201111561056d57600080fd5b8035906020019184602083028401116401000000008311171561058f57600080fd5b90919293919293905050506117fa565b005b6105a961196b565b6040518082815260200191505060405180910390f35b61062b600480360360608110156105d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611978565b005b6107ba6004803603608081101561064357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156106a057600080fd5b8201836020820111156106b257600080fd5b803590602001918460208302840111640100000000831117156106d457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561073457600080fd5b82018360208201111561074657600080fd5b8035906020019184600183028401116401000000008311171561076857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506119e7565b005b610808600480360360408110156107d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a29565b6040518082815260200191505060405180910390f35b6108e16004803603604081101561083457600080fd5b810190808035906020019064010000000081111561085157600080fd5b82018360208201111561086357600080fd5b8035906020019184600183028401116401000000008311171561088557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050611ae8565b005b6109af600480360360408110156108f957600080fd5b810190808035906020019064010000000081111561091657600080fd5b82018360208201111561092857600080fd5b8035906020019184602083028401116401000000008311171561094a57600080fd5b90919293919293908035906020019064010000000081111561096b57600080fd5b82018360208201111561097d57600080fd5b8035906020019184602083028401116401000000008311171561099f57600080fd5b9091929391929390505050611db8565b005b610a1d600480360360608110156109c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611eeb565b005b610a6d60048036036040811015610a3557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611f0b565b005b610a9b60048036036020811015610a8557600080fd5b810190808035906020019092919050505061219b565b6040518082815260200191505060405180910390f35b610b6a60048036036020811015610ac757600080fd5b8101908080359060200190640100000000811115610ae457600080fd5b820183602082011115610af657600080fd5b80359060200191846001830284011164010000000083111715610b1857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061221b565b005b610c0360048036036040811015610b8257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610bbf57600080fd5b820183602082011115610bd157600080fd5b80359060200191846001830284011164010000000083111715610bf357600080fd5b90919293919293905050506123d6565b005b610c3160048036036020811015610c1b57600080fd5b81019080803590602001909291905050506124cb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610c7b612593565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cbb578082015181840152602081019050610ca0565b50505050905090810190601f168015610ce85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610d3860048036036020811015610d0c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612631565b6040518082815260200191505060405180910390f35b610d56612706565b005b610e1160048036036020811015610d6e57600080fd5b8101908080359060200190640100000000811115610d8b57600080fd5b820183602082011115610d9d57600080fd5b80359060200191846001830284011164010000000083111715610dbf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061283f565b6040518082815260200191505060405180910390f35b610e2f6128ba565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610e796128e3565b604051808215151515815260200191505060405180910390f35b610e9b61293a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610edb578082015181840152602081019050610ec0565b50505050905090810190601f168015610f085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610f6460048036036040811015610f2c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506129dc565b005b610f6e612b7f565b604051808215151515815260200191505060405180910390f35b610fb460048036036020811015610f9e57600080fd5b8101908080359060200190929190505050612b92565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ff4578082015181840152602081019050610fd9565b50505050905090810190601f1680156110215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6111326004803603608081101561104557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156110ac57600080fd5b8201836020820111156110be57600080fd5b803590602001918460018302840111640100000000831117156110e057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612c4b565b005b6111606004803603602081101561114a57600080fd5b8101908080359060200190929190505050612cbd565b6040518082815260200191505060405180910390f35b6111a26004803603602081101561118c57600080fd5b8101908080359060200190929190505050612cd5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156111e25780820151818401526020810190506111c7565b50505050905090810190601f16801561120f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61125f6004803603602081101561123357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e1d565b604051808215151515815260200191505060405180910390f35b611281612e3d565b6040518082815260200191505060405180910390f35b6112c3600480360360208110156112ad57600080fd5b8101908080359060200190929190505050612e4a565b6040518082815260200191505060405180910390f35b61133b600480360360408110156112ef57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e62565b604051808215151515815260200191505060405180910390f35b6113976004803603602081101561136b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ef6565b005b611450600480360360608110156113af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561140c57600080fd5b82018360208201111561141e57600080fd5b8035906020019184602083028401116401000000008311171561144057600080fd5b9091929391929390505050612f7c565b005b61145a612fbe565b005b600060016000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b6114df838383604051806020016040528060008152506119e7565b505050565b6060600a8054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561157c5780601f106115515761010080835404028352916020019161157c565b820191906000526020600020905b81548152906001019060200180831161155f57829003601f168201915b5050505050905090565b6000611591826130e7565b6115e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c81526020018061483a602c913960400191505060405180910390fd5b6003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061162c826124cb565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806148b26021913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806116f357506116f28133612e62565b5b611748576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806147af6038913960400191505060405180910390fd5b826003600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550818373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661189c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614653602a913960400191505060405180910390fd5b8181905084849050146118fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061462d6026913960400191505060405180910390fd5b60008090505b828290508110156119645761195785858381811061191a57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1661195285858581811061194657fe5b90506020020135613159565b6132ec565b8080600101915050611900565b5050505050565b6000600880549050905090565b61198233826134a4565b6119d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260318152602001806148d36031913960400191505060405180910390fd5b6119e2838383613598565b505050565b60008090505b8251811015611a2257611a158585858481518110611a0757fe5b602002602001015185612c4b565b80806001019150506119ed565b5050505050565b6000611a3483612631565b8210611a8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b8152602001806146a0602b913960400191505060405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208281548110611ad557fe5b9060005260206000200154905092915050565b611af06128e3565b611b62576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360009054906101000a900460ff1615611be5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f54686520636f6c6c656374696f6e20697320636f6d706c65746500000000000081525060200191505060405180910390fd5b6000611bf08361283f565b90506000600d60008381526020019081526020016000205414611c5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061488f6023913960400191505060405180910390fd5b60008211611cb7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806149306025913960400191505060405180910390fd5b81600d6000838152602001908152602001600020819055506011839080600181540180825580915050906001820390600052602060002001600090919290919091509080519060200190611d0c92919061455b565b5050807fd66ffba7549a71baea1f584e21468a80de63cd42daffe0e665e23f22d655200d84846040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015611d78578082015181840152602081019050611d5d565b50505050905090810190601f168015611da55780820380516001836020036101000a031916815260200191505b50935050505060405180910390a2505050565b611dc06128e3565b611e32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b818190508484905014611e90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061462d6026913960400191505060405180910390fd5b60008090505b84849050811015611ee457611ed7611ebf868684818110611eb357fe5b90506020020135613159565b848484818110611ecb57fe5b90506020020135611ae8565b8080600101915050611e96565b5050505050565b611f0683838360405180602001604052806000815250612c4b565b505050565b611f136128e3565b611f85576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612028576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e76616c69642061646472657373000000000000000000000000000000000081525060200191505060405180910390fd5b801515601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156120ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f596f752073686f756c6420736574206120646966666572656e742076616c756581525060200191505060405180910390fd5b80601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f64966f3fe2ac8cae5e6f7e4196d1315efafdb78a4377de3887c56fa3b9ac47cb82604051808215151515815260200191505060405180910390a25050565b60006121a561196b565b82106121fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614904602c913960400191505060405180910390fd5b6008828154811061220957fe5b90600052602060002001549050919050565b6122236128e3565b612295576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b7fb8fdf10126d507f6daf46465ec25a2bbc08449cf6c944c98219264161391040a6012826040518080602001806020018381038352858181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156123465780601f1061231b57610100808354040283529160200191612346565b820191906000526020600020905b81548152906001019060200180831161232957829003601f168201915b5050838103825284818151815260200191508051906020019080838360005b83811015612380578082015181840152602081019050612365565b50505050905090810190601f1680156123ad5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a180601290805190602001906123d292919061455b565b5050565b601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614653602a913960400191505060405180910390fd5b6124c68383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506132ec565b505050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561258a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806148116029913960400191505060405180910390fd5b80915050919050565b60128054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156126295780601f106125fe57610100808354040283529160200191612629565b820191906000526020600020905b81548152906001019060200180831161260c57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806147e7602a913960400191505060405180910390fd5b6126ff600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206135bc565b9050919050565b61270e6128e3565b612780576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000816040516020018082805190602001908083835b602083106128785780518252602082019150602081019050602083039250612855565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001209050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156129d25780601f106129a7576101008083540402835291602001916129d2565b820191906000526020600020905b8154815290600101906020018083116129b557829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f4552433732313a20617070726f766520746f2063616c6c65720000000000000081525060200191505060405180910390fd5b80600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051808215151515815260200191505060405180910390a35050565b601360009054906101000a900460ff1681565b60118181548110612b9f57fe5b906000526020600020016000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612c435780601f10612c1857610100808354040283529160200191612c43565b820191906000526020600020905b815481529060010190602001808311612c2657829003601f168201915b505050505081565b612c56848484611978565b612c62848484846135ca565b612cb7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806146cb6032913960400191505060405180910390fd5b50505050565b600e6020528060005260406000206000915090505481565b6060612ce0826130e7565b612d35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c815260200180614747603c913960400191505060405180910390fd5b6012600f60008481526020019081526020016000206040516020018083805460018160011615610100020316600290048015612da85780601f10612d86576101008083540402835291820191612da8565b820191906000526020600020905b815481529060010190602001808311612d94575b505082805460018160011615610100020316600290048015612e015780601f10612ddf576101008083540402835291820191612e01565b820191906000526020600020905b815481529060010190602001808311612ded575b5050925050506040516020818303038152906040529050919050565b60106020528060005260406000206000915054906101000a900460ff1681565b6000601180549050905090565b600d6020528060005260406000206000915090505481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612efe6128e3565b612f70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b612f79816137b3565b50565b60008090505b82829050811015612fb757612faa8585858585818110612f9e57fe5b90506020020135611978565b8080600101915050612f82565b5050505050565b612fc66128e3565b613038576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360009054906101000a900460ff161561309e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061467d6023913960400191505060405180910390fd5b6001601360006101000a81548160ff0219169083151502179055507f01b7dcb42d49142a99e4c98da755263c600213a33b780986779405b9823501d360405160405180910390a1565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415915050919050565b60608060206040519080825280601f01601f1916602001820160405280156131905781602001600182028038833980820191505090505b509050600080905060008090505b602081101561323a5760008160080260020a8660001c0260001b9050600060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461322c57808484815181106131f457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350505b50808060010191505061319e565b506060816040519080825280601f01601f1916602001820160405280156132705781602001600182028038833980820191505090505b50905060008090505b828110156132e05783818151811061328d57fe5b602001015160f81c60f81b8282815181106132a457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050613279565b50809350505050919050565b60006132f78261283f565b905060006001600e60008481526020019081526020016000205401905060003073ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561335c57600080fd5b505afa158015613370573d6000803e3d6000fd5b505050506040513d602081101561338657600080fd5b810190808051906020019092919050505090506133a685828587866138f7565b61349d81856133b485613b23565b6040516020018083805190602001908083835b602083106133ea57805182526020820191506020810190506020830392506133c7565b6001836020036101000a038019825116818451168082178552505050505050905001807f2f0000000000000000000000000000000000000000000000000000000000000081525060010182805190602001908083835b602083106134635780518252602082019150602081019050602083039250613440565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052613c57565b5050505050565b60006134af826130e7565b613504576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180614783602c913960400191505060405180910390fd5b600061350f836124cb565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061357e57508373ffffffffffffffffffffffffffffffffffffffff1661356684611586565b73ffffffffffffffffffffffffffffffffffffffff16145b8061358f575061358e8185612e62565b5b91505092915050565b6135a3838383613c83565b6135ad8382613ede565b6135b7828261407c565b505050565b600081600001549050919050565b60006135eb8473ffffffffffffffffffffffffffffffffffffffff16614143565b6135f857600190506137ab565b60008473ffffffffffffffffffffffffffffffffffffffff1663150b7a02338887876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156136d35780820151818401526020810190506136b8565b50505050905090810190601f1680156137005780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15801561372257600080fd5b505af1158015613736573d6000803e3d6000fd5b505050506040513d602081101561374c57600080fd5b8101908080519060200190929190505050905063150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613839576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806146fd6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008111801561391a5750600d6000848152602001908152602001600020548111155b61398c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f496e76616c69642069737375656420696400000000000000000000000000000081525060200191505060405180910390fd5b600d600084815260200190815260200160002054600e60008581526020019081526020016000205410613a27576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f4f7074696f6e206578686175737465640000000000000000000000000000000081525060200191505060405180910390fd5b613a318585614156565b6001600e60008581526020019081526020016000205401600e60008581526020019081526020016000208190555082848673ffffffffffffffffffffffffffffffffffffffff167fdb78fb3a605c85b40cf64f4ddff503d984ed442e5ae01282bd60137db494f80b85856040518080602001838152602001828103825284818151815260200191508051906020019080838360005b83811015613ae1578082015181840152602081019050613ac6565b50505050905090810190601f168015613b0e5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a45050505050565b606060008290506000811415613b71576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250915050613c52565b600081905060005b60008214613b9b578080600101915050600a8281613b9357fe5b049150613b79565b6060816040519080825280601f01601f191660200182016040528015613bd05781602001600182028038833980820191505090505b50905060006001830390505b60008514613c4957600a8581613bee57fe5b0660300160f81b82828060019003935081518110613c0857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8581613c4157fe5b049450613bdc565b81955050505050505b919050565b80600f60008481526020019081526020016000209080519060200190613c7e92919061455b565b505050565b8273ffffffffffffffffffffffffffffffffffffffff16613ca3826124cb565b73ffffffffffffffffffffffffffffffffffffffff1614613d0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806148666029913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613d95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806147236024913960400191505060405180910390fd5b613d9e81614177565b613de5600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614235565b613e2c600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614258565b816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000613f366001600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905061426e90919063ffffffff16565b9050600060076000848152602001908152602001600020549050818114614023576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110613fa357fe5b9060005260206000200154905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110613ffb57fe5b9060005260206000200181905550816007600083815260200190815260200160002081905550505b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548091906001900361407591906145db565b5050505050565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506007600083815260200190815260200160002081905550600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190915055505050565b600080823b905060008111915050919050565b61416082826142f7565b61416a828261407c565b6141738161450f565b5050565b600073ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146142325760006003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b61424d6001826000015461426e90919063ffffffff16565b816000018190555050565b6001816000016000828254019250508190555050565b6000828211156142e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561439a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4552433732313a206d696e7420746f20746865207a65726f206164647265737381525060200191505060405180910390fd5b6143a3816130e7565b15614416576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000081525060200191505060405180910390fd5b816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506144af600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020614258565b808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505090600182039060005260206000200160009091929091909150555050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061459c57805160ff19168380011785556145ca565b828001600101855582156145ca579182015b828111156145c95782518255916020019190600101906145ae565b5b5090506145d79190614607565b5090565b815481835581811115614602578183600052602060002091820191016146019190614607565b5b505050565b61462991905b8082111561462557600081600090555060010161460d565b5090565b9056fe506172616d65746572732073686f756c642068617665207468652073616d65206c656e6774684f6e6c7920616e2060616c6c6f7765646020616464726573732063616e20697373756520746f6b656e7354686520636f6c6c656374696f6e20697320616c726561647920636f6d706c65746564455243373231456e756d657261626c653a206f776e657220696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732314d657461646174613a20726563656976656420612055524920717565727920666f722061206e6f6e6578697374656e7420746f6b656e4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e43616e206e6f74206d6f6469667920616e206578697374696e67207765617261626c654552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243373231456e756d657261626c653a20676c6f62616c20696e646578206f7574206f6620626f756e64734d61782069737375616e63652073686f756c642062652067726561746572207468616e2030a265627a7a7231582046832d0b5f3d9638148b3383c856c3314f89b534b6997f8937a081c9f39eb1b664736f6c634300050b0032
Verified Source Code Partial Match
Compiler: v0.5.11+commit.c082d0b4
EVM: petersburg
Optimization: No
ERC721Collection.sol 1426 lines
// File: @openzeppelin/contracts/ownership/Ownable.sol
pragma solidity ^0.5.0;
/**
* @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.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _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 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 onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: @openzeppelin/contracts/introspection/IERC165.sol
pragma solidity ^0.5.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
*
* 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
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* 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);
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
pragma solidity ^0.5.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) public view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) public view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either `approve` or `setApproveForAll`.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either `approve` or `setApproveForAll`.
*/
function transferFrom(address from, address to, uint256 tokenId) public;
function approve(address to, uint256 tokenId) public;
function getApproved(uint256 tokenId) public view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public;
function isApprovedForAll(address owner, address operator) public view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public;
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
pragma solidity ^0.5.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
contract IERC721Receiver {
/**
* @notice Handle the receipt of an NFT
* @dev The ERC721 smart contract calls this function on the recipient
* after a `safeTransfer`. This function MUST return the function selector,
* otherwise the caller will revert the transaction. The selector to be
* returned can be obtained as `this.onERC721Received.selector`. This
* function MAY throw to revert and reject the transfer.
* Note: the ERC721 contract address is always the message sender.
* @param operator The address which called `safeTransferFrom` function
* @param from The address which previously owned the token
* @param tokenId The NFT identifier which is being transferred
* @param data Additional data with no specified format
* @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public returns (bytes4);
}
// File: @openzeppelin/contracts/math/SafeMath.sol
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
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) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @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) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts 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) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
// File: @openzeppelin/contracts/utils/Address.sol
pragma solidity ^0.5.0;
/**
* @dev Collection of functions related to the address type,
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* > It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in 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;
}
}
// File: @openzeppelin/contracts/drafts/Counters.sol
pragma solidity ^0.5.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
* Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the SafeMath
* overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
* directly accessed.
*/
library Counters {
using SafeMath for uint256;
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
counter._value += 1;
}
function decrement(Counter storage counter) internal {
counter._value = counter._value.sub(1);
}
}
// File: @openzeppelin/contracts/introspection/ERC165.sol
pragma solidity ^0.5.0;
/**
* @dev Implementation of the `IERC165` interface.
*
* Contracts may inherit from this and call `_registerInterface` to declare
* their support of an interface.
*/
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 () internal {
// 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) external view 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 {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
pragma solidity ^0.5.0;
/**
* @title ERC721 Non-Fungible Token Standard basic implementation
* @dev see https://eips.ethereum.org/EIPS/eip-721
*/
contract ERC721 is ERC165, IERC721 {
using SafeMath for uint256;
using Address for address;
using Counters for Counters.Counter;
// 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 token ID to owner
mapping (uint256 => address) private _tokenOwner;
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
// Mapping from owner to number of owned token
mapping (address => Counters.Counter) private _ownedTokensCount;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
/*
* 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)')) == 0xe985e9c
* 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 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
*/
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
constructor () public {
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721);
}
/**
* @dev Gets the balance of the specified address.
* @param owner address to query the balance of
* @return uint256 representing the amount owned by the passed address
*/
function balanceOf(address owner) public view returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _ownedTokensCount[owner].current();
}
/**
* @dev Gets the owner of the specified token ID.
* @param tokenId uint256 ID of the token to query the owner of
* @return address currently marked as the owner of the given token ID
*/
function ownerOf(uint256 tokenId) public view returns (address) {
address owner = _tokenOwner[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev Approves another address to transfer the given token ID
* The zero address indicates there is no approved address.
* There can only be one approved address per token at a given time.
* Can only be called by the token owner or an approved operator.
* @param to address to be approved for the given token ID
* @param tokenId uint256 ID of the token to be approved
*/
function approve(address to, uint256 tokenId) public {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all"
);
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Gets the approved address for a token ID, or zero if no address set
* Reverts if the token ID does not exist.
* @param tokenId uint256 ID of the token to query the approval of
* @return address currently approved for the given token ID
*/
function getApproved(uint256 tokenId) public view returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf.
* @param to operator address to set the approval
* @param approved representing the status of the approval to be set
*/
function setApprovalForAll(address to, bool approved) public {
require(to != msg.sender, "ERC721: approve to caller");
_operatorApprovals[msg.sender][to] = approved;
emit ApprovalForAll(msg.sender, to, approved);
}
/**
* @dev Tells whether an operator is approved by a given owner.
* @param owner owner address which you want to query the approval of
* @param operator operator address which you want to query the approval of
* @return bool whether the given operator is approved by the given owner
*/
function isApprovedForAll(address owner, address operator) public view returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Transfers the ownership of a given token ID to another address.
* Usage of this method is discouraged, use `safeTransferFrom` whenever possible.
* Requires the msg.sender to be the owner, approved, or operator.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function transferFrom(address from, address to, uint256 tokenId) public {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved");
_transferFrom(from, to, tokenId);
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public {
transferFrom(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether the specified token exists.
* @param tokenId uint256 ID of the token to query the existence of
* @return bool whether the token exists
*/
function _exists(uint256 tokenId) internal view returns (bool) {
address owner = _tokenOwner[tokenId];
return owner != address(0);
}
/**
* @dev Returns whether the given spender can transfer a given token ID.
* @param spender address of the spender to query
* @param tokenId uint256 ID of the token to be transferred
* @return bool whether the msg.sender is approved for the given token ID,
* is an operator of the owner, or is the owner of the token
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Internal function to mint a new token.
* Reverts if the given token ID already exists.
* @param to The address that will own the minted token
* @param tokenId uint256 ID of the token to be minted
*/
function _mint(address to, uint256 tokenId) internal {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_tokenOwner[tokenId] = to;
_ownedTokensCount[to].increment();
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* Deprecated, use _burn(uint256) instead.
* @param owner owner of the token to burn
* @param tokenId uint256 ID of the token being burned
*/
function _burn(address owner, uint256 tokenId) internal {
require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own");
_clearApproval(tokenId);
_ownedTokensCount[owner].decrement();
_tokenOwner[tokenId] = address(0);
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* @param tokenId uint256 ID of the token being burned
*/
function _burn(uint256 tokenId) internal {
_burn(ownerOf(tokenId), tokenId);
}
/**
* @dev Internal function to transfer ownership of a given token ID to another address.
* As opposed to transferFrom, this imposes no restrictions on msg.sender.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function _transferFrom(address from, address to, uint256 tokenId) internal {
require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_clearApproval(tokenId);
_ownedTokensCount[from].decrement();
_ownedTokensCount[to].increment();
_tokenOwner[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Internal function to invoke `onERC721Received` on a target address.
* The call is not executed if the target address is not a contract.
*
* This function is deprecated.
* @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)
internal returns (bool)
{
if (!to.isContract()) {
return true;
}
bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data);
return (retval == _ERC721_RECEIVED);
}
/**
* @dev Private function to clear current approval of a given token ID.
* @param tokenId uint256 ID of the token to be transferred
*/
function _clearApproval(uint256 tokenId) private {
if (_tokenApprovals[tokenId] != address(0)) {
_tokenApprovals[tokenId] = address(0);
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol
pragma solidity ^0.5.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
contract IERC721Enumerable is IERC721 {
function totalSupply() public view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId);
function tokenByIndex(uint256 index) public view returns (uint256);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721Enumerable.sol
pragma solidity ^0.5.0;
/**
* @title ERC-721 Non-Fungible Token with optional enumeration extension logic
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => uint256[]) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/*
* 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 Constructor function.
*/
constructor () public {
// register the supported interface to conform to ERC721Enumerable via ERC165
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
/**
* @dev Gets the token ID at a given index of the tokens list of the requested owner.
* @param owner address owning the tokens list to be accessed
* @param index uint256 representing the index to be accessed of the requested tokens list
* @return uint256 token ID at the given index of the tokens list owned by the requested address
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev Gets the total amount of tokens stored by the contract.
* @return uint256 representing the total amount of tokens
*/
function totalSupply() public view returns (uint256) {
return _allTokens.length;
}
/**
* @dev Gets the token ID at a given index of all the tokens in this contract
* Reverts if the index is greater or equal to the total number of tokens.
* @param index uint256 representing the index to be accessed of the tokens list
* @return uint256 token ID at the given index of the tokens list
*/
function tokenByIndex(uint256 index) public view returns (uint256) {
require(index < totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @dev Internal function to transfer ownership of a given token ID to another address.
* As opposed to transferFrom, this imposes no restrictions on msg.sender.
* @param from current owner of the token
* @param to address to receive the ownership of the given token ID
* @param tokenId uint256 ID of the token to be transferred
*/
function _transferFrom(address from, address to, uint256 tokenId) internal {
super._transferFrom(from, to, tokenId);
_removeTokenFromOwnerEnumeration(from, tokenId);
_addTokenToOwnerEnumeration(to, tokenId);
}
/**
* @dev Internal function to mint a new token.
* Reverts if the given token ID already exists.
* @param to address the beneficiary that will own the minted token
* @param tokenId uint256 ID of the token to be minted
*/
function _mint(address to, uint256 tokenId) internal {
super._mint(to, tokenId);
_addTokenToOwnerEnumeration(to, tokenId);
_addTokenToAllTokensEnumeration(tokenId);
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* Deprecated, use _burn(uint256) instead.
* @param owner owner of the token to burn
* @param tokenId uint256 ID of the token being burned
*/
function _burn(address owner, uint256 tokenId) internal {
super._burn(owner, tokenId);
_removeTokenFromOwnerEnumeration(owner, tokenId);
// Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
_ownedTokensIndex[tokenId] = 0;
_removeTokenFromAllTokensEnumeration(tokenId);
}
/**
* @dev Gets the list of token IDs of the requested owner.
* @param owner address owning the tokens
* @return uint256[] List of token IDs owned by the requested address
*/
function _tokensOfOwner(address owner) internal view returns (uint256[] storage) {
return _ownedTokens[owner];
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
_ownedTokensIndex[tokenId] = _ownedTokens[to].length;
_ownedTokens[to].push(tokenId);
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the _ownedTokensIndex mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _ownedTokens[from].length.sub(1);
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
_ownedTokens[from].length--;
// Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by
// lastTokenId, or just over the end of the array if the token was the last one).
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length.sub(1);
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
_allTokens.length--;
_allTokensIndex[tokenId] = 0;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Metadata.sol
pragma solidity ^0.5.0;
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
contract IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721Metadata.sol
pragma solidity ^0.5.0;
contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
// Token name
string private _name;
// Token symbol
string private _symbol;
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
/*
* 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;
/**
* @dev Constructor function
*/
constructor (string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
}
/**
* @dev Gets the token name.
* @return string representing the token name
*/
function name() external view returns (string memory) {
return _name;
}
/**
* @dev Gets the token symbol.
* @return string representing the token symbol
*/
function symbol() external view returns (string memory) {
return _symbol;
}
/**
* @dev Returns an URI for a given token ID.
* Throws if the token ID does not exist. May return an empty string.
* @param tokenId uint256 ID of the token to query
*/
function tokenURI(uint256 tokenId) external view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
return _tokenURIs[tokenId];
}
/**
* @dev Internal function to set the token URI for a given token.
* Reverts if the token ID does not exist.
* @param tokenId uint256 ID of the token to set its URI
* @param uri string URI to assign
*/
function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Internal function to burn a specific token.
* Reverts if the token does not exist.
* Deprecated, use _burn(uint256) instead.
* @param owner owner of the token to burn
* @param tokenId uint256 ID of the token being burned by the msg.sender
*/
function _burn(address owner, uint256 tokenId) internal {
super._burn(owner, tokenId);
// Clear metadata (if any)
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
}
// File: @openzeppelin/contracts/token/ERC721/ERC721Full.sol
pragma solidity ^0.5.0;
/**
* @title Full ERC721 Token
* This implementation includes all the required and some optional functionality of the ERC721 standard
* Moreover, it includes approve all functionality using operator terminology
* @dev see https://eips.ethereum.org/EIPS/eip-721
*/
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) {
// solhint-disable-previous-line no-empty-blocks
}
}
// File: contracts/libs/String.sol
pragma solidity ^0.5.11;
library String {
/**
* @dev Convert bytes32 to string.
* @param _x - to be converted to string.
* @return string
*/
function bytes32ToString(bytes32 _x) internal pure returns (string memory) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(_x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (uint j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
/**
* @dev Convert uint to string.
* @param _i - uint256 to be converted to string.
* @return uint in string
*/
function uintToString(uint _i) internal pure returns (string memory _uintAsString) {
uint i = _i;
if (i == 0) {
return "0";
}
uint j = i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (i != 0) {
bstr[k--] = byte(uint8(48 + i % 10));
i /= 10;
}
return string(bstr);
}
}
// File: contracts/ERC721BaseCollection.sol
pragma solidity ^0.5.11;
contract ERC721BaseCollection is Ownable, ERC721Full {
using String for bytes32;
using String for uint256;
mapping(bytes32 => uint256) public maxIssuance;
mapping(bytes32 => uint) public issued;
mapping(uint256 => string) internal _tokenPaths;
mapping(address => bool) public allowed;
string[] public wearables;
string public baseURI;
bool public isComplete;
event BaseURI(string _oldBaseURI, string _newBaseURI);
event Allowed(address indexed _operator, bool _allowed);
event AddWearable(bytes32 indexed _wearableIdKey, string _wearableId, uint256 _maxIssuance);
event Issue(address indexed _beneficiary, uint256 indexed _tokenId, bytes32 indexed _wearableIdKey, string _wearableId, uint256 _issuedId);
event Complete();
/**
* @dev Create the contract.
* @param _name - name of the contract
* @param _symbol - symbol of the contract
* @param _operator - Address allowed to mint tokens
* @param _baseURI - base URI for token URIs
*/
constructor(string memory _name, string memory _symbol, address _operator, string memory _baseURI) public ERC721Full(_name, _symbol) {
setAllowed(_operator, true);
setBaseURI(_baseURI);
}
modifier onlyAllowed() {
require(allowed[msg.sender], "Only an `allowed` address can issue tokens");
_;
}
/**
* @dev Set Base URI.
* @param _baseURI - base URI for token URIs
*/
function setBaseURI(string memory _baseURI) public onlyOwner {
emit BaseURI(baseURI, _baseURI);
baseURI = _baseURI;
}
/**
* @dev Set allowed account to issue tokens.
* @param _operator - Address allowed to issue tokens
* @param _allowed - Whether is allowed or not
*/
function setAllowed(address _operator, bool _allowed) public onlyOwner {
require(_operator != address(0), "Invalid address");
require(allowed[_operator] != _allowed, "You should set a different value");
allowed[_operator] = _allowed;
emit Allowed(_operator, _allowed);
}
/**
* @dev Returns an URI for a given token ID.
* Throws if the token ID does not exist. May return an empty string.
* @param _tokenId - uint256 ID of the token queried
* @return token URI
*/
function tokenURI(uint256 _tokenId) external view returns (string memory) {
require(_exists(_tokenId), "ERC721Metadata: received a URI query for a nonexistent token");
return string(abi.encodePacked(baseURI, _tokenPaths[_tokenId]));
}
/**
* @dev Transfers the ownership of given tokens ID to another address.
* Usage of this method is discouraged, use {safeBatchTransferFrom} whenever possible.
* Requires the msg.sender to be the owner, approved, or operator.
* @param _from current owner of the token
* @param _to address to receive the ownership of the given token ID
* @param _tokenIds uint256 ID of the token to be transferred
*/
function batchTransferFrom(address _from, address _to, uint256[] calldata _tokenIds) external {
for (uint256 i = 0; i < _tokenIds.length; i++) {
transferFrom(_from, _to, _tokenIds[i]);
}
}
/**
* @dev Returns the wearables length.
* @return wearable length
*/
function wearablesCount() external view returns (uint256) {
return wearables.length;
}
/**
* @dev Complete the collection.
* @notice that it will only prevent for adding more wearables.
* The issuance is still allowed.
*/
function completeCollection() external onlyOwner {
require(!isComplete, "The collection is already completed");
isComplete = true;
emit Complete();
}
/**
* @dev Add a new wearable to the collection.
* @notice that this method should only allow wearableIds less than or equal to 32 bytes
* @param _wearableIds - wearable ids
* @param _maxIssuances - total supply for the wearables
*/
function addWearables(bytes32[] calldata _wearableIds, uint256[] calldata _maxIssuances) external onlyOwner {
require(_wearableIds.length == _maxIssuances.length, "Parameters should have the same length");
for (uint256 i = 0; i < _wearableIds.length; i++) {
addWearable(_wearableIds[i].bytes32ToString(), _maxIssuances[i]);
}
}
/**
* @dev Add a new wearable to the collection.
* @notice that this method allows wearableIds of any size. It should be used
* if a wearableId is greater than 32 bytes
* @param _wearableId - wearable id
* @param _maxIssuance - total supply for the wearable
*/
function addWearable(string memory _wearableId, uint256 _maxIssuance) public onlyOwner {
require(!isComplete, "The collection is complete");
bytes32 key = getWearableKey(_wearableId);
require(maxIssuance[key] == 0, "Can not modify an existing wearable");
require(_maxIssuance > 0, "Max issuance should be greater than 0");
maxIssuance[key] = _maxIssuance;
wearables.push(_wearableId);
emit AddWearable(key, _wearableId, _maxIssuance);
}
/**
* @dev Safely transfers the ownership of given token IDs to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param _from - current owner of the token
* @param _to - address to receive the ownership of the given token ID
* @param _tokenIds - uint256 IDs of the tokens to be transferred
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] memory _tokenIds) public {
safeBatchTransferFrom(_from, _to, _tokenIds, "");
}
/**
* @dev Safely transfers the ownership of given token IDs to another address
* If the target address is a contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
* Requires the msg.sender to be the owner, approved, or operator
* @param _from - current owner of the token
* @param _to - address to receive the ownership of the given token ID
* @param _tokenIds - uint256 ID of the tokens to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] memory _tokenIds, bytes memory _data) public {
for (uint256 i = 0; i < _tokenIds.length; i++) {
safeTransferFrom(_from, _to, _tokenIds[i], _data);
}
}
/**
* @dev Get keccak256 of a wearableId.
* @param _wearableId - token wearable
* @return bytes32 keccak256 of the wearableId
*/
function getWearableKey(string memory _wearableId) public pure returns (bytes32) {
return keccak256(abi.encodePacked(_wearableId));
}
/**
* @dev Mint a new NFT of the specified kind.
* @notice that will throw if kind has reached its maximum or is invalid
* @param _beneficiary - owner of the token
* @param _tokenId - token
* @param _wearableIdKey - wearable key
* @param _wearableId - token wearable
* @param _issuedId - issued id
*/
function _mint(
address _beneficiary,
uint256 _tokenId...
// [truncated — 53830 bytes total]
Read Contract
allowed 0xd63a8e11 → bool
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
getApproved 0x081812fc → address
getWearableKey 0x823bfc3f → bytes32
isApprovedForAll 0xe985e9c5 → bool
isComplete 0xb2fa1c9e → bool
isOwner 0x8f32d59b → bool
issued 0xc59a138b → uint256
maxIssuance 0xe181ff33 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
wearables 0xb416cfd7 → string
wearablesCount 0xd8b41647 → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
addWearable 0x3fb1d1cf
string _wearableId
uint256 _maxIssuance
addWearables 0x40bd647e
bytes32[] _wearableIds
uint256[] _maxIssuances
approve 0x095ea7b3
address to
uint256 tokenId
batchTransferFrom 0xf3993d11
address _from
address _to
uint256[] _tokenIds
completeCollection 0xf59d9e3f
No parameters
issueToken 0x5669c94f
address _beneficiary
string _wearableId
issueTokens 0x105f7b7c
address[] _beneficiaries
bytes32[] _wearableIds
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x034601ec
address _from
address _to
uint256[] _tokenIds
safeBatchTransferFrom 0x28cfbd46
address _from
address _to
uint256[] _tokenIds
bytes _data
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAllowed 0x4697f05d
address _operator
bool _allowed
setApprovalForAll 0xa22cb465
address to
bool approved
setBaseURI 0x55f804b3
string _baseURI
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address