Address Contract Verified
Address
0x849cff095342Cf62C6cb2807A95539C1bdBdB52E
Balance
0 ETH
Nonce
1
Code Size
22199 bytes
Creator
0x8dFa7056...68A4 at tx 0x4a2ab2c7...a22c99
Indexed Transactions
0
Contract Bytecode
22199 bytes
0x60806040526004361061021a5760003560e01c80635713b2f111610123578063bb660c0a116100ab578063d6c336ed1161006f578063d6c336ed146107f5578063d9224c6514610820578063e985e9c51461084b578063eb8d244414610888578063f2fde38b146108b35761021a565b8063bb660c0a146106fa578063c87b56dd14610737578063ceb2ac1814610774578063d082e3811461079f578063d5abeb01146107ca5761021a565b8063715018a6116100f2578063715018a61461063b5780638da5cb5b1461065257806395d89b411461067d578063a22cb465146106a8578063b88d4fde146106d15761021a565b80635713b2f1146105595780636352211e146105845780636dcee4ca146105c157806370a08231146105fe5761021a565b8063239c70ae116101a65780633ccfd60b116101755780633ccfd60b1461049557806342842e0e1461049f57806344a0d68a146104c85780634f6ccce7146104f157806354138b691461052e5761021a565b8063239c70ae146103c757806323b872dd146103f25780632f745c591461041b57806330d871c6146104585761021a565b8063081812fc116101ed578063081812fc146102ed578063095ea7b31461032a5780631249c58b1461035357806313faede61461037157806318160ddd1461039c5761021a565b806301ffc9a71461021f57806302c889891461025c5780630419e3141461028557806306fdde03146102c2575b600080fd5b34801561022b57600080fd5b506102466004803603810190610241919061385d565b6108dc565b60405161025391906142f5565b60405180910390f35b34801561026857600080fd5b50610283600480360381019061027e9190613834565b610956565b005b34801561029157600080fd5b506102ac60048036038101906102a79190613919565b6109ef565b6040516102b99190614310565b60405180910390f35b3480156102ce57600080fd5b506102d7610b8d565b6040516102e49190614310565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f91906138f0565b610c1f565b604051610321919061428e565b60405180910390f35b34801561033657600080fd5b50610351600480360381019061034c91906137f8565b610ca4565b005b61035b610dbc565b6040516103689190614592565b60405180910390f35b34801561037d57600080fd5b50610386611066565b6040516103939190614592565b60405180910390f35b3480156103a857600080fd5b506103b161106c565b6040516103be9190614592565b60405180910390f35b3480156103d357600080fd5b506103dc611079565b6040516103e99190614592565b60405180910390f35b3480156103fe57600080fd5b50610419600480360381019061041491906136f2565b61107f565b005b34801561042757600080fd5b50610442600480360381019061043d91906137f8565b6110df565b60405161044f9190614592565b60405180910390f35b34801561046457600080fd5b5061047f600480360381019061047a91906138af565b611184565b60405161048c9190614310565b60405180910390f35b61049d611217565b005b3480156104ab57600080fd5b506104c660048036038101906104c191906136f2565b611313565b005b3480156104d457600080fd5b506104ef60048036038101906104ea91906138f0565b611333565b005b3480156104fd57600080fd5b50610518600480360381019061051391906138f0565b6113b9565b6040516105259190614592565b60405180910390f35b34801561053a57600080fd5b50610543611450565b6040516105509190614592565b60405180910390f35b34801561056557600080fd5b5061056e611456565b60405161057b9190614592565b60405180910390f35b34801561059057600080fd5b506105ab60048036038101906105a691906138f0565b61145c565b6040516105b8919061428e565b60405180910390f35b3480156105cd57600080fd5b506105e860048036038101906105e391906138f0565b61150e565b6040516105f59190614310565b60405180910390f35b34801561060a57600080fd5b506106256004803603810190610620919061368d565b61194c565b6040516106329190614592565b60405180910390f35b34801561064757600080fd5b50610650611a04565b005b34801561065e57600080fd5b50610667611a8c565b604051610674919061428e565b60405180910390f35b34801561068957600080fd5b50610692611ab6565b60405161069f9190614310565b60405180910390f35b3480156106b457600080fd5b506106cf60048036038101906106ca91906137bc565b611b48565b005b3480156106dd57600080fd5b506106f860048036038101906106f39190613741565b611b5e565b005b34801561070657600080fd5b50610721600480360381019061071c919061368d565b611bc0565b60405161072e9190614592565b60405180910390f35b34801561074357600080fd5b5061075e600480360381019061075991906138f0565b611c15565b60405161076b9190614310565b60405180910390f35b34801561078057600080fd5b50610789611ccd565b6040516107969190614592565b60405180910390f35b3480156107ab57600080fd5b506107b4611cd3565b6040516107c19190614592565b60405180910390f35b3480156107d657600080fd5b506107df611cd9565b6040516107ec91906145ff565b60405180910390f35b34801561080157600080fd5b5061080a611cf3565b6040516108179190614592565b60405180910390f35b34801561082c57600080fd5b50610835611cf8565b6040516108429190614592565b60405180910390f35b34801561085757600080fd5b50610872600480360381019061086d91906136b6565b611d4b565b60405161087f91906142f5565b60405180910390f35b34801561089457600080fd5b5061089d611ddf565b6040516108aa91906142f5565b60405180910390f35b3480156108bf57600080fd5b506108da60048036038101906108d5919061368d565b611df2565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061094f575061094e82611eea565b5b9050919050565b61095e611fcc565b73ffffffffffffffffffffffffffffffffffffffff1661097c611a8c565b73ffffffffffffffffffffffffffffffffffffffff16146109d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c9906144f2565b60405180910390fd5b80603a60006101000a81548160ff02191690831515021790555050565b606060006040518060400160405280601d81526020017f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081525090506000610a3685611fd4565b604051602001610a46919061422f565b60405160208183030381529060405290506000601654600e600088815260200190815260200160002054610a7a9190614a28565b905060006021600e6000898152602001908152602001600020546021604051602001610aa79291906145ad565b6040516020818303038152906040528051906020012060001c610aca9190614a28565b90506000610ae3600e84610ade91906146ef565b611fd4565b604051602001610af3919061422f565b60405160208183030381529060405290506000610b0f83611fd4565b604051602001610b1f919061422f565b604051602081830303815290604052905085610b5f8684848c604051602001610b4b949392919061414c565b6040516020818303038152906040526121a9565b604051602001610b7092919061401a565b604051602081830303815290604052965050505050505092915050565b606060008054610b9c9061494e565b80601f0160208091040260200160405190810160405280929190818152602001828054610bc89061494e565b8015610c155780601f10610bea57610100808354040283529160200191610c15565b820191906000526020600020905b815481529060010190602001808311610bf857829003601f168201915b5050505050905090565b6000610c2a82612333565b610c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c60906144d2565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610caf8261145c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1790614512565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610d3f611fcc565b73ffffffffffffffffffffffffffffffffffffffff161480610d6e5750610d6d81610d68611fcc565b611d4b565b5b610dad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da490614452565b60405180910390fd5b610db7838361239f565b505050565b600080610dc761106c565b9050600060135411610dd857600080fd5b6012546013541115610de957600080fd5b601160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1660135482610e1891906146ef565b1115610e2357600080fd5b601160009054906101000a900467ffffffffffffffff1667ffffffffffffffff16601354601554610e5491906146ef565b1115610e5f57600080fd5b603a60009054906101000a900460ff16610eae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea590614432565b60405180910390fd5b6001610eb933611bc0565b10610ece57610ec9336001612458565b610eeb565b601354601454610ede91906147ad565b341015610eea57600080fd5b5b60006107d0424433604051602001610f0593929190614251565b6040516020818303038152906040528051906020012060001c610f289190614a28565b9050600160155482610f3a91906147ad565b610f4491906146ef565b60398190555033600c6000603954815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000601554905060018183610fb391906147ad565b610fbd91906146ef565b9350610fc933826124b2565b603954600e600083815260200190815260200160002081905550807faad5362ce528ed941024b95d4c18dfd49b8503e1f586a5c353631d98c2af41b76039546040516110159190614592565b60405180910390a2600160155461102c91906146ef565b60158190555080847f7231a5fbb013086872d29de4bfdd8da4afbf124c5199beb108f473a390677df460405160405180910390a350505090565b60145481565b6000600880549050905090565b60125481565b61109061108a611fcc565b826124d0565b6110cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c690614532565b60405180910390fd5b6110da8383836125ae565b505050565b60006110ea8361194c565b821061112b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112290614332565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b606060006040518060400160405280601a81526020017f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000815250905060006111ea846040516020016111d69190614003565b6040516020818303038152906040526121a9565b905081816040516020016111ff92919061401a565b60405160208183030381529060405292505050919050565b61121f611fcc565b73ffffffffffffffffffffffffffffffffffffffff1661123d611a8c565b73ffffffffffffffffffffffffffffffffffffffff1614611293576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128a906144f2565b60405180910390fd5b600061129d611a8c565b73ffffffffffffffffffffffffffffffffffffffff16476040516112c09061421a565b60006040518083038185875af1925050503d80600081146112fd576040519150601f19603f3d011682016040523d82523d6000602084013e611302565b606091505b505090508061131057600080fd5b50565b61132e83838360405180602001604052806000815250611b5e565b505050565b61133b611fcc565b73ffffffffffffffffffffffffffffffffffffffff16611359611a8c565b73ffffffffffffffffffffffffffffffffffffffff16146113af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a6906144f2565b60405180910390fd5b8060148190555050565b60006113c361106c565b8210611404576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fb90614572565b60405180910390fd5b6008828154811061143e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b60135481565b60165481565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611505576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114fc90614492565b60405180910390fd5b80915050919050565b60606000600f601654846115229190614a28565b61152c91906146ef565b905060008390506000602185602160405160200161154b9291906145ad565b6040516020818303038152906040528051906020012060001c61156e9190614a28565b905061157982611fd4565b60405160200161158991906141ed565b604051602081830303815290604052935083611641601783602181106115d8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01600481548110611612577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1662ffffff16612815565b6040516020016116529291906140f0565b60405160208183030381529060405293506000600190505b83811015611921576000602187602160405160200161168a9291906145ad565b6040516020818303038152906040528051906020012060001c6116ad9190614a28565b9050600061032088846106406116c391906147ad565b6040516020016116d49291906145d6565b6040516020818303038152906040528051906020012060001c6116f79190614a28565b90506000600b8985600b61170b91906147ad565b60405160200161171c9291906145d6565b6040516020818303038152906040528051906020012060001c61173f9190614a28565b9050600060048a86600461175391906147ad565b6040516020016117649291906145d6565b6040516020818303038152906040528051906020012060001c6117879190614a28565b905060006103208b87610fa061179d91906147ad565b6040516020016117ae9291906145d6565b6040516020818303038152906040528051906020012060001c6117d19190614a28565b9050896117e96064866117e491906146ef565b611fd4565b6117fe6064846117f991906146ef565b611fd4565b61181360648561180e91906146ef565b611fd4565b61182860648961182391906146ef565b611fd4565b6118cd60178b60218110611865577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01888154811061189e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600a91828204019190066003029054906101000a900462ffffff1662ffffff16612815565b6118e260018a6118dd91906146ef565b611fd4565b6040516020016118f8979695949392919061403e565b604051602081830303815290604052995050505050508080611919906149b1565b91505061166a565b5083604051602001611933919061412a565b6040516020818303038152906040529350505050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b490614472565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611a0c611fcc565b73ffffffffffffffffffffffffffffffffffffffff16611a2a611a8c565b73ffffffffffffffffffffffffffffffffffffffff1614611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a77906144f2565b60405180910390fd5b611a8a60006129d6565b565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054611ac59061494e565b80601f0160208091040260200160405190810160405280929190818152602001828054611af19061494e565b8015611b3e5780601f10611b1357610100808354040283529160200191611b3e565b820191906000526020600020905b815481529060010190602001808311611b2157829003601f168201915b5050505050905090565b611b5a611b53611fcc565b8383612a9c565b5050565b611b6f611b69611fcc565b836124d0565b611bae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba590614532565b60405180910390fd5b611bba84848484612c09565b50505050565b6000600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546002611c0e9190614807565b9050919050565b60606000604051806060016040528060228152602001615620602291399050611c3d83612333565b15611cc45760006039541415611c88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7f90614552565b60405180910390fd5b6000611ca6600e60008681526020019081526020016000205461150e565b90506000611cb382611184565b9050611cbf85826109ef565b925050505b80915050919050565b60395481565b60155481565b601160009054906101000a900467ffffffffffffffff1681565b600281565b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546002611d469190614807565b905090565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b603a60009054906101000a900460ff1681565b611dfa611fcc565b73ffffffffffffffffffffffffffffffffffffffff16611e18611a8c565b73ffffffffffffffffffffffffffffffffffffffff1614611e6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e65906144f2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611ede576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed590614372565b60405180910390fd5b611ee7816129d6565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611fb557507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611fc55750611fc482612c65565b5b9050919050565b600033905090565b6060600082141561201c576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506121a4565b600082905060005b6000821461204e578080612037906149b1565b915050600a82612047919061477c565b9150612024565b60008167ffffffffffffffff811115612090577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156120c25781602001600182028036833780820191505090505b50905060008290505b6000861461219c576001816120e09190614807565b90506000600a80886120f2919061477c565b6120fc91906147ad565b876121079190614807565b60306121139190614745565b905060008160f81b905080848481518110612157577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a88612193919061477c565b975050506120cb565b819450505050505b919050565b60606000825114156121cc5760405180602001604052806000815250905061232e565b600060405180606001604052806040815260200161564260409139905060006003600285516121fb91906146ef565b612205919061477c565b600461221191906147ad565b67ffffffffffffffff811115612250577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156122825781602001600182028036833780820191505090505b509050600182016020820185865187015b808210156122ee576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845360018401935050612293565b505060038651066001811461230a576002811461231d57612325565b603d6001830353603d6002830353612325565b603d60018303535b50505080925050505b919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166124128361145c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b80600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546124a791906146ef565b925050819055505050565b6124cc828260405180602001604052806000815250612ccf565b5050565b60006124db82612333565b61251a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251190614412565b60405180910390fd5b60006125258361145c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061256757506125668185611d4b565b5b806125a557508373ffffffffffffffffffffffffffffffffffffffff1661258d84610c1f565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166125ce8261145c565b73ffffffffffffffffffffffffffffffffffffffff1614612624576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161261b90614392565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612694576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161268b906143d2565b60405180910390fd5b61269f838383612d2a565b6126aa60008261239f565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546126fa9190614807565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461275191906146ef565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612810838383612e3e565b505050565b6060600082141561285d576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506129d1565b600082905060005b60008214612887578080612878906149b1565b915050600482901c9150612865565b6000600f905060008267ffffffffffffffff8111156128cf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156129015781602001600182028036833780820191505090505b50905060008390505b600087146129c85760008388169050600981116129365780603061292e91906146ef565b60f81b612947565b80603761294391906146ef565b60f81b5b838361295290614924565b9350838151811061298c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600488901c97505061290a565b81955050505050505b919050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b02906143f2565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612bfc91906142f5565b60405180910390a3505050565b612c148484846125ae565b612c2084848484612e43565b612c5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c5690614352565b60405180910390fd5b50505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b612cd98383612fda565b612ce66000848484612e43565b612d25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1c90614352565b60405180910390fd5b505050565b612d358383836131b4565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612d7857612d73816131b9565b612db7565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612db657612db58382613202565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612dfa57612df58161336f565b612e39565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612e3857612e3782826134b2565b5b5b505050565b505050565b6000612e648473ffffffffffffffffffffffffffffffffffffffff16613531565b15612fcd578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612e8d611fcc565b8786866040518563ffffffff1660e01b8152600401612eaf94939291906142a9565b602060405180830381600087803b158015612ec957600080fd5b505af1925050508015612efa57506040513d601f19601f82011682018060405250810190612ef79190613886565b60015b612f7d573d8060008114612f2a576040519150601f19603f3d011682016040523d82523d6000602084013e612f2f565b606091505b50600081511415612f75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f6c90614352565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612fd2565b600190505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561304a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613041906144b2565b60405180910390fd5b61305381612333565b15613093576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161308a906143b2565b60405180910390fd5b61309f60008383612d2a565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546130ef91906146ef565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46131b060008383612e3e565b5050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161320f8461194c565b6132199190614807565b90506000600760008481526020019081526020016000205490508181146132fe576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506133839190614807565b90506000600960008481526020019081526020016000205490506000600883815481106133d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490508060088381548110613421577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613496577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006134bd8361194c565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60006135676135628461463f565b61461a565b90508281526020810184848401111561357f57600080fd5b61358a8482856148e2565b509392505050565b60006135a56135a084614670565b61461a565b9050828152602081018484840111156135bd57600080fd5b6135c88482856148e2565b509392505050565b6000813590506135df816155c3565b92915050565b6000813590506135f4816155da565b92915050565b600081359050613609816155f1565b92915050565b60008151905061361e816155f1565b92915050565b600082601f83011261363557600080fd5b8135613645848260208601613554565b91505092915050565b600082601f83011261365f57600080fd5b813561366f848260208601613592565b91505092915050565b60008135905061368781615608565b92915050565b60006020828403121561369f57600080fd5b60006136ad848285016135d0565b91505092915050565b600080604083850312156136c957600080fd5b60006136d7858286016135d0565b92505060206136e8858286016135d0565b9150509250929050565b60008060006060848603121561370757600080fd5b6000613715868287016135d0565b9350506020613726868287016135d0565b925050604061373786828701613678565b9150509250925092565b6000806000806080858703121561375757600080fd5b6000613765878288016135d0565b9450506020613776878288016135d0565b935050604061378787828801613678565b925050606085013567ffffffffffffffff8111156137a457600080fd5b6137b087828801613624565b91505092959194509250565b600080604083850312156137cf57600080fd5b60006137dd858286016135d0565b92505060206137ee858286016135e5565b9150509250929050565b6000806040838503121561380b57600080fd5b6000613819858286016135d0565b925050602061382a85828601613678565b9150509250929050565b60006020828403121561384657600080fd5b6000613854848285016135e5565b91505092915050565b60006020828403121561386f57600080fd5b600061387d848285016135fa565b91505092915050565b60006020828403121561389857600080fd5b60006138a68482850161360f565b91505092915050565b6000602082840312156138c157600080fd5b600082013567ffffffffffffffff8111156138db57600080fd5b6138e78482850161364e565b91505092915050565b60006020828403121561390257600080fd5b600061391084828501613678565b91505092915050565b6000806040838503121561392c57600080fd5b600061393a85828601613678565b925050602083013567ffffffffffffffff81111561395757600080fd5b6139638582860161364e565b9150509250929050565b6139768161483b565b82525050565b61398d6139888261483b565b6149fa565b82525050565b61399c8161484d565b82525050565b60006139ad826146a1565b6139b781856146b7565b93506139c78185602086016148f1565b6139d081614b15565b840191505092915050565b6139e4816148d0565b82525050565b60006139f5826146ac565b6139ff81856146d3565b9350613a0f8185602086016148f1565b613a1881614b15565b840191505092915050565b6000613a2e826146ac565b613a3881856146e4565b9350613a488185602086016148f1565b80840191505092915050565b6000613a616023836146e4565b9150613a6c82614b33565b602382019050919050565b6000613a84602b836146d3565b9150613a8f82614b82565b604082019050919050565b6000613aa76032836146d3565b9150613ab282614bd1565b604082019050919050565b6000613aca6026836146d3565b9150613ad582614c20565b604082019050919050565b6000613aed6025836146d3565b9150613af882614c6f565b604082019050919050565b6000613b10601c836146d3565b9150613b1b82614cbe565b602082019050919050565b6000613b336012836146e4565b9150613b3e82614ce7565b601282019050919050565b6000613b566001836146e4565b9150613b6182614d10565b600182019050919050565b6000613b796024836146d3565b9150613b8482614d39565b604082019050919050565b6000613b9c6019836146d3565b9150613ba782614d88565b602082019050919050565b6000613bbf6003836146e4565b9150613bca82614db1565b600382019050919050565b6000613be2602c836146d3565b9150613bed82614dda565b604082019050919050565b6000613c05600f836146d3565b9150613c1082614e29565b602082019050919050565b6000613c286001836146e4565b9150613c3382614e52565b600182019050919050565b6000613c4b6038836146d3565b9150613c5682614e7b565b604082019050919050565b6000613c6e6004836146e4565b9150613c7982614eca565b600482019050919050565b6000613c91602a836146d3565b9150613c9c82614ef3565b604082019050919050565b6000613cb46029836146d3565b9150613cbf82614f42565b604082019050919050565b6000613cd76018836146e4565b9150613ce282614f91565b601882019050919050565b6000613cfa6009836146e4565b9150613d0582614fba565b600982019050919050565b6000613d1d6002836146e4565b9150613d2882614fe3565b600282019050919050565b6000613d406071836146e4565b9150613d4b8261500c565b607182019050919050565b6000613d636020836146d3565b9150613d6e826150a7565b602082019050919050565b6000613d866008836146e4565b9150613d91826150d0565b600882019050919050565b6000613daa610155836146e4565b9150613db5826150f9565b61015582019050919050565b6000613dce602c836146d3565b9150613dd9826152a1565b604082019050919050565b6000613df16020836146d3565b9150613dfc826152f0565b602082019050919050565b6000613e14603b836146e4565b9150613e1f82615319565b603b82019050919050565b6000613e376028836146e4565b9150613e4282615368565b602882019050919050565b6000613e5a6029836146e4565b9150613e65826153b7565b602982019050919050565b6000613e7d6004836146e4565b9150613e8882615406565b600482019050919050565b6000613ea06021836146d3565b9150613eab8261542f565b604082019050919050565b6000613ec36002836146e4565b9150613ece8261547e565b600282019050919050565b6000613ee6601b836146e4565b9150613ef1826154a7565b601b82019050919050565b6000613f096000836146c8565b9150613f14826154d0565b600082019050919050565b6000613f2c6000836146e4565b9150613f37826154d0565b600082019050919050565b6000613f4f6031836146d3565b9150613f5a826154d3565b604082019050919050565b6000613f72600e836146d3565b9150613f7d82615522565b602082019050919050565b6000613f95602c836146d3565b9150613fa08261554b565b604082019050919050565b6000613fb86006836146e4565b9150613fc38261559a565b600682019050919050565b613fd7816148a5565b82525050565b613fee613fe9826148a5565b614a1e565b82525050565b613ffd816148af565b82525050565b600061400f8284613a23565b915081905092915050565b60006140268285613a23565b91506140328284613a23565b91508190509392505050565b600061404a828a613a23565b915061405582613b26565b91506140618289613a23565b915061406c82613c1b565b91506140788288613a23565b915061408382613eb6565b915061408f8287613a23565b915061409a82613c1b565b91506140a68286613a23565b91506140b182613ed9565b91506140bd8285613a23565b91506140c882613a54565b91506140d48284613a23565b91506140df82613c61565b915081905098975050505050505050565b60006140fc8285613a23565b915061410782613e2a565b91506141138284613a23565b915061411e82613c61565b91508190509392505050565b60006141368284613a23565b915061414182613fab565b915081905092915050565b600061415782613cca565b91506141638287613a23565b915061416e82613e70565b915061417982613d9c565b915061418482613e07565b91506141908286613a23565b915061419b82613e4d565b91506141a78285613a23565b91506141b282613bb2565b91506141bd82613b49565b91506141c882613ced565b91506141d48284613a23565b91506141df82613d10565b915081905095945050505050565b60006141f882613d33565b91506142048284613a23565b915061420f82613d79565b915081905092915050565b600061422582613efc565b9150819050919050565b600061423a82613f1f565b91506142468284613a23565b915081905092915050565b600061425d8286613fdd565b60208201915061426d8285613fdd565b60208201915061427d828461397c565b601482019150819050949350505050565b60006020820190506142a3600083018461396d565b92915050565b60006080820190506142be600083018761396d565b6142cb602083018661396d565b6142d86040830185613fce565b81810360608301526142ea81846139a2565b905095945050505050565b600060208201905061430a6000830184613993565b92915050565b6000602082019050818103600083015261432a81846139ea565b905092915050565b6000602082019050818103600083015261434b81613a77565b9050919050565b6000602082019050818103600083015261436b81613a9a565b9050919050565b6000602082019050818103600083015261438b81613abd565b9050919050565b600060208201905081810360008301526143ab81613ae0565b9050919050565b600060208201905081810360008301526143cb81613b03565b9050919050565b600060208201905081810360008301526143eb81613b6c565b9050919050565b6000602082019050818103600083015261440b81613b8f565b9050919050565b6000602082019050818103600083015261442b81613bd5565b9050919050565b6000602082019050818103600083015261444b81613bf8565b9050919050565b6000602082019050818103600083015261446b81613c3e565b9050919050565b6000602082019050818103600083015261448b81613c84565b9050919050565b600060208201905081810360008301526144ab81613ca7565b9050919050565b600060208201905081810360008301526144cb81613d56565b9050919050565b600060208201905081810360008301526144eb81613dc1565b9050919050565b6000602082019050818103600083015261450b81613de4565b9050919050565b6000602082019050818103600083015261452b81613e93565b9050919050565b6000602082019050818103600083015261454b81613f42565b9050919050565b6000602082019050818103600083015261456b81613f65565b9050919050565b6000602082019050818103600083015261458b81613f88565b9050919050565b60006020820190506145a76000830184613fce565b92915050565b60006040820190506145c26000830185613fce565b6145cf60208301846139db565b9392505050565b60006040820190506145eb6000830185613fce565b6145f86020830184613fce565b9392505050565b60006020820190506146146000830184613ff4565b92915050565b6000614624614635565b90506146308282614980565b919050565b6000604051905090565b600067ffffffffffffffff82111561465a57614659614ae6565b5b61466382614b15565b9050602081019050919050565b600067ffffffffffffffff82111561468b5761468a614ae6565b5b61469482614b15565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b60006146fa826148a5565b9150614705836148a5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561473a57614739614a59565b5b828201905092915050565b6000614750826148c3565b915061475b836148c3565b92508260ff0382111561477157614770614a59565b5b828201905092915050565b6000614787826148a5565b9150614792836148a5565b9250826147a2576147a1614a88565b5b828204905092915050565b60006147b8826148a5565b91506147c3836148a5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156147fc576147fb614a59565b5b828202905092915050565b6000614812826148a5565b915061481d836148a5565b9250828210156148305761482f614a59565b5b828203905092915050565b600061484682614885565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600060ff82169050919050565b60006148db826148c3565b9050919050565b82818337600083830152505050565b60005b8381101561490f5780820151818401526020810190506148f4565b8381111561491e576000848401525b50505050565b600061492f826148a5565b9150600082141561494357614942614a59565b5b600182039050919050565b6000600282049050600182168061496657607f821691505b6020821081141561497a57614979614ab7565b5b50919050565b61498982614b15565b810181811067ffffffffffffffff821117156149a8576149a7614ae6565b5b80604052505050565b60006149bc826148a5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156149ef576149ee614a59565b5b600182019050919050565b6000614a0582614a0c565b9050919050565b6000614a1782614b26565b9050919050565b6000819050919050565b6000614a33826148a5565b9150614a3e836148a5565b925082614a4e57614a4d614a88565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f3b7374726f6b652d6c696e656361703a726f756e643b7374726f6b652d77696460008201527f74683a0000000000000000000000000000000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f3c706f6c796c696e6520706f696e74733d270000000000000000000000000000600082015250565b7f2c00000000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f227d5d0000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f53616c65206e6f74206163746976650000000000000000000000000000000000600082015250565b7f2000000000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f22202f3e00000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f7b226e616d65223a20222f4175746f736c616e74732f20230000000000000000600082015250565b7f22696d616765223a220000000000000000000000000000000000000000000000600082015250565b7f227d000000000000000000000000000000000000000000000000000000000000600082015250565b7f3c73766720786d6c6e733d27687474703a2f2f7777772e77332e6f72672f323060008201527f30302f73766727206865696768743d2731303030272077696474683d2731303060208201527f30273e203c7469746c653e2f4175746f736c616e74732f3c2f7469746c653e3c60408201527f646573633e20596f757220536565643a20000000000000000000000000000000606082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f203c2f646573633e000000000000000000000000000000000000000000000000600082015250565b7f226465736372697074696f6e223a20222f4175746f736c616e74732f2069732060008201527f66756c6c79206f6e2d636861696e2067656e6572617469766520617274204e4660208201527f547320616e642073746f7265206f6e20457468657265756d20426c6f636b636860408201527f61696e20666f72657665722e20412075736572207375626d6974207472616e7360608201527f616374696f6e7320616e6420636f6e74726163742072616e646f6d6c7920676560808201527f6e65726174652065616368206d696e742076696120746865206f6e2d6368616960a08201527f6e20636f64652e20546f74616c20737570706c792069732032353620616e642060c08201527f333320646966666572656e7420636f6c6f72207365747320617265206465666960e08201527f6e656420696e2074686520636f6e74726163742e2045616368206f66207468656101008201527f6d20636f6e7461696e73206265747765656e20313520616e64203136352072616101208201527f6e646f6d20736c616e7473206c696e65732e222c20000000000000000000000061014082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f2261747472696275746573223a5b7b2274726169745f74797065223a20224e7560008201527f6d626572206f6620536c616e7473222c202276616c7565223a20220000000000602082015250565b7f3c726563742077696474683d223130302522206865696768743d22313030252260008201527f2066696c6c3d2223000000000000000000000000000000000000000000000000602082015250565b7f227d2c7b2274726169745f74797065223a2022436f6c6f7220536574222c202260008201527f76616c7565223a20220000000000000000000000000000000000000000000000602082015250565b7f222c202000000000000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f2c20000000000000000000000000000000000000000000000000000000000000600082015250565b7f27207374796c653d2266696c6c3a6e6f6e653b7374726f6b653a230000000000600082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f4e65656420746f2052616e646f6d000000000000000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f3c2f7376673e0000000000000000000000000000000000000000000000000000600082015250565b6155cc8161483b565b81146155d757600080fd5b50565b6155e38161484d565b81146155ee57600080fd5b50565b6155fa81614859565b811461560557600080fd5b50565b615611816148a5565b811461561c57600080fd5b5056fe546f6b656e2077697468207468617420494420646f6573206e6f742065786973742e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122063425a417f33674c2327ee09c6678a0340f24259a151613f35401d9a1010a06664736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: No
Autoslants.sol 225 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract Autoslants is ERC721Enumerable, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
mapping(uint256 => address) internal requestIdToSender;
mapping(uint256 => uint256) internal requestIdToTokenId;
mapping(uint256 => uint256) internal tokenIdToRandomNumber;
mapping(address => uint256) private mintCountMap;
mapping(address => uint256) private allowedMintCountMap;
uint256 public constant MINT_LIMIT_PER_WALLET = 2;
uint64 public maxSupply = 257;
uint256 public maxMintAmount = 1;
uint256 public _mintAmount = 1;
uint256 public cost = 10000000000000000;
event requestedRandomSVG(uint256 indexed requestId, uint indexed tokenId);
event CreatedRSVGNFT(uint indexed tokenID, string tokenURI);
event CreatedUnfinishedRandomSVG(uint indexed, uint randomWords);
uint256 public tokenCounter;
uint256 public maxNumberofSlants;
uint24 [][33] colors;
address s_owner;
uint256 public nftChanceValue;
constructor()
ERC721("/Autoslants/","AUSLT")
{
tokenCounter = 1;
s_owner = msg.sender;
maxNumberofSlants= 150;
colors[0] = [16777215, 16777215, 16777215, 16777215, 1118481];
colors[1] = [1118481,1118481,1118481,1118481,16777215];
colors[2] = [15907775, 7308223, 15886923, 14261589, 15331570];
colors[3] = [15879018, 14277081, 15921906, 15878473, 1118481];
colors[4] = [1186634, 1053253, 1057411, 5201548, 9674431];
colors[5] = [15892170, 6260953, 3384977, 15900421, 15900825];
colors[6] = [2500134, 9204592, 12548763, 7541814, 15914453];
colors[7] = [14277081, 10921638, 7566195, 4210752, 1118481];
colors[8] = [1340186, 4315480, 3587914, 14859762, 1517086];
colors[9] = [14269344, 12553327, 4202774, 14255731, 2497813];
colors[10] = [12549806, 9985727, 7684031, 15903056, 6631641];
colors[11] = [2490625, 15861511, 12518918, 7537411, 15921906];
colors[12] = [15892855, 1118481, 1118481, 15892855, 14229038];
colors[13] = [14233867, 15901196, 12529831, 8371999, 15911948];
colors[14] = [9189168, 10918022, 13628076, 9558428, 6530707];
colors[15] = [5197196, 6249894, 9408191, 3031385, 2500134];
colors[16] = [15921906, 15872005, 15898743, 15887677, 15877125];
colors[17] = [15893953, 15877284, 15875473, 14145497, 2434342];
colors[18] = [1723097, 8762610, 15902749, 15907084, 1595609];
colors[19] = [15903308, 15903308, 15903308, 15903308, 1054752];
colors[20] = [1054752, 1054752, 1054752, 1054752, 15903308];
colors[21] = [15559270, 15559270, 15559270, 15559270, 1061024];
colors[22] = [10089539, 10089539, 10089539, 10089539, 15484059];
colors[23] = [1176541, 1119322, 1054323, 15861218, 1186482];
colors[24] = [14245168, 15906565, 6381247, 6982687, 15868505];
colors[25] = [2500134, 12535579, 7548180, 1118481, 15918549];
colors[26] = [13219570, 2626137, 4201612, 5115353, 6433753];
colors[27] = [14273293, 3922258, 15880331, 4015858, 3554495];
colors[28] = [4271961, 10457023, 12433625, 15913881, 15921906];
colors[29] = [11208178, 5610457, 7173362, 8194034, 7992050];
colors[30] = [5855318, 9210760, 12566461, 1118481, 15921387];
colors[31] = [14389276, 15262051, 8373724, 4753608, 1521273];
colors[32] = [8045035, 16702900, 16684433, 11754900, 3161719];
}
function allowedMintCount(address minter) public view returns (uint256) {
return MINT_LIMIT_PER_WALLET - mintCountMap[minter];
}
function remainFreeMint() public view returns (uint256) {
return MINT_LIMIT_PER_WALLET - mintCountMap[msg.sender];
}
function updateMintCount(address minter, uint256 count) private {
mintCountMap[minter] += count;
}
function mint() public payable returns (uint256 s_requestId){
uint256 supply = totalSupply();
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
require(tokenCounter + _mintAmount <= maxSupply);
require(saleIsActive, "Sale not active");
if (allowedMintCount(msg.sender) >= 1) {
updateMintCount(msg.sender, 1);
} else {
require(msg.value >= cost * _mintAmount);
}
uint256 randomNumber = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, msg.sender))) % 2000;
nftChanceValue = randomNumber*tokenCounter+1;
requestIdToSender[nftChanceValue] = msg.sender;
uint tokenId = tokenCounter;
s_requestId = randomNumber*tokenId+1;
_safeMint(msg.sender, tokenId);
tokenIdToRandomNumber[tokenId] = nftChanceValue;
emit CreatedUnfinishedRandomSVG(tokenId, nftChanceValue);
tokenCounter = tokenCounter + 1 ;
emit requestedRandomSVG(s_requestId, tokenId);
}
function tokenURI(uint tokenId) public view override returns(string memory){
string memory _tokenURI = "Token with that ID does not exist.";
if (_exists(tokenId)){
require(nftChanceValue != 0, "Need to Random");
string memory svg = generateSVG(tokenIdToRandomNumber[tokenId]);
string memory imageURI = svgToImageURI(svg);
_tokenURI = formatTokenURI(tokenId, imageURI);
}
return _tokenURI;
}
function generateSVG (uint256 _randomNumber) public view returns (string memory finalSvg) {
uint256 numberOfPaths = (_randomNumber % maxNumberofSlants) + 15;
uint256 seed = _randomNumber;
uint256 c_set1 = uint256(keccak256(abi.encode(_randomNumber,33))) % 33;
finalSvg = string(abi.encodePacked("<svg xmlns='http://www.w3.org/2000/svg' height='1000' width='1000'> <title>""/Autoslants/""</title><desc> Your Seed: ",uint2str(seed)," </desc>"));
finalSvg = string(abi.encodePacked(finalSvg, "<rect width=\"100%\" height=\"100%\" fill=\"#",uint2hexstr(colors[c_set1][4]),"\" />"));
for(uint i = 1; i < numberOfPaths; i++) {
uint256 c_set = uint256(keccak256(abi.encode(_randomNumber,33))) % 33;
uint256 parameterOne = uint256(keccak256(abi.encode(_randomNumber, 800*2*i))) % 800;
uint256 widths = uint256(keccak256(abi.encode(_randomNumber, 11*i))) % 11;
uint256 c_numb = uint256(keccak256(abi.encode(_randomNumber, 4*i))) % 4;
uint256 parameterTwo = uint256(keccak256(abi.encode(_randomNumber, 800*5*i))) %800;
finalSvg = string(abi.encodePacked(finalSvg, "<polyline points='",uint2str(parameterOne+100)," ",uint2str(parameterTwo+100),", ",uint2str(parameterTwo+100)," ",uint2str(parameterOne+100),"' style=\"fill:none;stroke:#",uint2hexstr(colors[c_set][c_numb]),";stroke-linecap:round;stroke-width:",uint2str(widths + 1),"\" />"));
}
finalSvg = string(abi.encodePacked(finalSvg, "</svg>"));
}
function svgToImageURI(string memory svg) public pure returns(string memory){
string memory baseURL = "data:image/svg+xml;base64,";
string memory svgBase64Encoded = Base64.encode(bytes(string(abi.encodePacked(svg))));
return string(abi.encodePacked(baseURL, svgBase64Encoded));
}
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
bool public saleIsActive = true;
function setSaleIsActive(bool saleIsActive_) external onlyOwner {
saleIsActive = saleIsActive_;
}
function uint2hexstr(uint i) internal pure returns (string memory) {
if (i == 0) return "0";
uint j = i;
uint length;
while (j != 0) {
length++;
j = j >> 4;
}
uint mask = 15;
bytes memory bstr = new bytes(length);
uint k = length;
while (i != 0) {
uint curr = (i & mask);
bstr[--k] = curr > 9 ?
bytes1(uint8(55 + curr)) :
bytes1(uint8(48 + curr));
i = i >> 4;
}
return string(bstr);
}
function formatTokenURI(uint256 id,string memory imageURI) public view returns(string memory){
string memory baseURL = "data:application/json;base64,";
string memory desc = string(abi.encodePacked('', uint2str(id)));
uint256 numberOfSlants_ = (tokenIdToRandomNumber[id] % maxNumberofSlants);
uint256 c_set_ = uint256(keccak256(abi.encode(tokenIdToRandomNumber[id],33))) % 33;
string memory numberOfSlants_desc = string(abi.encodePacked('', uint2str(numberOfSlants_ + 14)));
string memory cset_desc = string(abi.encodePacked('', uint2str(c_set_)));
return string(
abi.encodePacked(
baseURL,
Base64.encode(
bytes(
abi.encodePacked(
'{"name": "/Autoslants/ #',desc,'", ',
'"description": "/Autoslants/ is fully on-chain generative art NFTs and store on Ethereum Blockchain forever. A user submit transactions and contract randomly generate each mint via the on-chain code. Total supply is 256 and 33 different color sets are defined in the contract. Each of them contains between 15 and 165 random slants lines.", ',
'"attributes":[{"trait_type": "Number of Slants", "value": "',numberOfSlants_desc,'"},{"trait_type": "Color Set", "value": "',cset_desc,'"}]',
',',
'"image":"',
imageURI,
'"}'
)
)
)
)
);
}
function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
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;
while (_i != 0) {
k = k-1;
uint8 temp = (48 + uint8(_i - _i / 10 * 10));
bytes1 b1 = bytes1(temp);
bstr[k] = b1;
_i /= 10;
}
return string(bstr);
}
function withdraw() public payable onlyOwner {
(bool os, ) = payable(owner()).call{value: address(this).balance}("");
require(os);
}
}
Base64.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Base64.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides a set of functions to operate with Base64 strings.
*
* _Available since v4.5._
*/
library Base64 {
/**
* @dev Base64 Encoding/Decoding Table
*/
string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/**
* @dev Converts a `bytes` to its Bytes64 `string` representation.
*/
function encode(bytes memory data) internal pure returns (string memory) {
/**
* Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
* https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
*/
if (data.length == 0) return "";
// Loads the table into memory
string memory table = _TABLE;
// Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
// and split into 4 numbers of 6 bits.
// The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
// - `data.length + 2` -> Round up
// - `/ 3` -> Number of 3-bytes chunks
// - `4 *` -> 4 characters for each chunk
string memory result = new string(4 * ((data.length + 2) / 3));
assembly {
// Prepare the lookup table (skip the first "length" byte)
let tablePtr := add(table, 1)
// Prepare result pointer, jump over length
let resultPtr := add(result, 32)
// Run over the input, 3 bytes at a time
for {
let dataPtr := data
let endPtr := add(data, mload(data))
} lt(dataPtr, endPtr) {
} {
// Advance 3 bytes
dataPtr := add(dataPtr, 3)
let input := mload(dataPtr)
// To write each character, shift the 3 bytes (18 bits) chunk
// 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
// and apply logical AND with 0x3F which is the number of
// the previous character in the ASCII table prior to the Base64 Table
// The result is then added to the table to get the character to write,
// and finally write it in the result pointer but with a left shift
// of 256 (1 byte) - 8 (1 ASCII char) = 248 bits
mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
resultPtr := add(resultPtr, 1) // Advance
}
// When data `bytes` is not exactly 3 bytes long
// it is padded with `=` characters at the end
switch mod(mload(data), 3)
case 1 {
mstore8(sub(resultPtr, 1), 0x3d)
mstore8(sub(resultPtr, 2), 0x3d)
}
case 2 {
mstore8(sub(resultPtr, 1), 0x3d)
}
}
return result;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. 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;`
*/
library Counters {
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 {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 163 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @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 override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @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 = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
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);
/**
* @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
MINT_LIMIT_PER_WALLET 0xd6c336ed → uint256
_mintAmount 0x54138b69 → uint256
allowedMintCount 0xbb660c0a → uint256
balanceOf 0x70a08231 → uint256
cost 0x13faede6 → uint256
formatTokenURI 0x0419e314 → string
generateSVG 0x6dcee4ca → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintAmount 0x239c70ae → uint256
maxNumberofSlants 0x5713b2f1 → uint256
maxSupply 0xd5abeb01 → uint64
name 0x06fdde03 → string
nftChanceValue 0xceb2ac18 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
remainFreeMint 0xd9224c65 → uint256
saleIsActive 0xeb8d2444 → bool
supportsInterface 0x01ffc9a7 → bool
svgToImageURI 0x30d871c6 → string
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenCounter 0xd082e381 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0x1249c58b
No parameters
returns: uint256
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
setCost 0x44a0d68a
uint256 _newCost
setSaleIsActive 0x02c88989
bool saleIsActive_
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address