Address Contract Verified
Address
0xb28f5E8da53De004e8CB2b3bfE744126A47081A5
Balance
0 ETH
Nonce
1
Code Size
14727 bytes
Creator
0xaF69610e...9B03 at tx 0x557a8030...66f539
Indexed Transactions
0
Contract Bytecode
14727 bytes
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c80638a3b6ab8116100ad578063b1a867d511610071578063b1a867d514610369578063b88d4fde14610399578063b978cf29146103b5578063c87b56dd146103d1578063e985e9c5146104015761012c565b80638a3b6ab8146102b15780638da5cb5b146102e157806395d89b41146102ff578063a22cb4651461031d578063a48b3b8f146103395761012c565b806323b872dd116100f457806323b872dd146101e957806342842e0e146102055780634b44d812146102215780636352211e1461025157806370a08231146102815761012c565b806301ffc9a71461013157806306fdde0314610161578063081812fc1461017f578063095ea7b3146101af57806318160ddd146101cb575b600080fd5b61014b600480360381019061014691906122b7565b610431565b6040516101589190612a48565b60405180910390f35b610169610513565b6040516101769190612a63565b60405180910390f35b61019960048036038101906101949190612309565b6105a5565b6040516101a691906129e1565b60405180910390f35b6101c960048036038101906101c4919061227b565b61062a565b005b6101d3610734565b6040516101e09190612c85565b60405180910390f35b61020360048036038101906101fe9190612175565b61073a565b005b61021f600480360381019061021a9190612175565b610793565b005b61023b60048036038101906102369190612309565b6107b3565b6040516102489190612a63565b60405180910390f35b61026b60048036038101906102669190612309565b610a95565b60405161027891906129e1565b60405180910390f35b61029b60048036038101906102969190612110565b610b47565b6040516102a89190612c85565b60405180910390f35b6102cb60048036038101906102c69190612309565b610bff565b6040516102d89190612a63565b60405180910390f35b6102e9610c9f565b6040516102f691906129e1565b60405180910390f35b610307610cc5565b6040516103149190612a63565b60405180910390f35b6103376004803603810190610332919061223f565b610d57565b005b610353600480360381019061034e9190612309565b610ec3565b6040516103609190612a63565b60405180910390f35b610383600480360381019061037e9190612309565b610edd565b6040516103909190612c85565b60405180910390f35b6103b360048036038101906103ae91906121c4565b610ef5565b005b6103cf60048036038101906103ca9190612332565b610f50565b005b6103eb60048036038101906103e69190612309565b610f5f565b6040516103f89190612a63565b60405180910390f35b61041b60048036038101906104169190612139565b611054565b6040516104289190612a48565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806104fc57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061050c575061050b826112aa565b5b9050919050565b60606000805461052290612f35565b80601f016020809104026020016040519081016040528092919081815260200182805461054e90612f35565b801561059b5780601f106105705761010080835404028352916020019161059b565b820191906000526020600020905b81548152906001019060200180831161057e57829003601f168201915b5050505050905090565b60006105b082611314565b6105ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e690612bc5565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061063582610a95565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156106a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069d90612c25565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806106e657506106e58133611054565b5b610725576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071c90612b25565b60405180910390fd5b61072f8383611380565b505050565b60095481565b6107443382611439565b610783576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077a90612c45565b60405180910390fd5b61078e838383611517565b505050565b6107ae83838360405180602001604052806000815250610ef5565b505050565b606060006007600084815260200190815260200160002080546107d590612f35565b80601f016020809104026020016040519081016040528092919081815260200182805461080190612f35565b801561084e5780601f106108235761010080835404028352916020019161084e565b820191906000526020600020905b81548152906001019060200180831161083157829003601f168201915b5050505050905060008190506000604051806020016040528060008152509050600060019050600080603c905060005b8551811015610a405760009250855182826108999190612d6a565b11156108f557846108c16014866108b09190612df1565b603c6108bc9190612d6a565b611768565b6108cd89848a51611915565b6040516020016108df93929190612870565b6040516020818303038152906040529450610a13565b5b7f2000000000000000000000000000000000000000000000000000000000000000868484846109259190612d6a565b61092f9190612e4b565b81518110610966577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146109ac576001836109a59190612d6a565b92506108f6565b846109ce6014866109bd9190612df1565b603c6109c99190612d6a565b611768565b6109ef89848787876109e09190612d6a565b6109ea9190612e4b565b611915565b604051602001610a0193929190612870565b60405160208183030381529060405294505b600184610a209190612d6a565b93508282610a2e9190612e4b565b81610a399190612d6a565b905061087e565b50610a4a88611768565b610a66600860008b815260200190815260200160002054611768565b85604051602001610a799392919061292a565b6040516020818303038152906040529650505050505050919050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3590612b65565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baf90612b45565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60076020528060005260406000206000915090508054610c1e90612f35565b80601f0160208091040260200160405190810160405280929190818152602001828054610c4a90612f35565b8015610c975780601f10610c6c57610100808354040283529160200191610c97565b820191906000526020600020905b815481529060010190602001808311610c7a57829003601f168201915b505050505081565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060018054610cd490612f35565b80601f0160208091040260200160405190810160405280929190818152602001828054610d0090612f35565b8015610d4d5780601f10610d2257610100808354040283529160200191610d4d565b820191906000526020600020905b815481529060010190602001808311610d3057829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbd90612ae5565b60405180910390fd5b80600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051610eb79190612a48565b60405180910390a35050565b6060610ed6610ed1836107b3565b611a83565b9050919050565b60086020528060005260406000206000915090505481565b610eff3383611439565b610f3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3590612c45565b60405180910390fd5b610f4a84848484611c2e565b50505050565b610f5b338383611c8a565b5050565b6060610f6a82611314565b610fa9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa090612c05565b60405180910390fd5b6000610fb483611768565b604051602001610fc491906129bf565b604051602081830303815290604052905060006040518060600160405280603681526020016138dc6036913990506000610ffd85610ec3565b905061102b838383604051602001611017939291906128c2565b604051602081830303815290604052611a83565b60405160200161103b919061299d565b6040516020818303038152906040529350505050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611158576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114f90612ba5565b60405180910390fd5b61116181611314565b156111a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119890612aa5565b60405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111f19190612d6a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166113f383610a95565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061144482611314565b611483576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147a90612b05565b60405180910390fd5b600061148e83610a95565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806114fd57508373ffffffffffffffffffffffffffffffffffffffff166114e5846105a5565b73ffffffffffffffffffffffffffffffffffffffff16145b8061150e575061150d8185611054565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661153782610a95565b73ffffffffffffffffffffffffffffffffffffffff161461158d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158490612be5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f490612ac5565b60405180910390fd5b611608600082611380565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116589190612e4b565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116af9190612d6a565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b606060008214156117b0576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611910565b600082905060005b600082146117e25780806117cb90612f98565b915050600a826117db9190612dc0565b91506117b8565b60008167ffffffffffffffff811115611824577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156118565781602001600182028036833780820191505090505b5090505b600085146119095760018261186f9190612e4b565b9150600a8561187e9190612fe1565b603061188a9190612d6a565b60f81b8183815181106118c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856119029190612dc0565b945061185a565b8093505050505b919050565b606060008490506000848461192a9190612e4b565b67ffffffffffffffff811115611969577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561199b5781602001600182028036833780820191505090505b50905060008590505b84811015611a76578281815181106119e5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602001015160f81c60f81b8287836119fd9190612e4b565b81518110611a34577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080611a6e90612f98565b9150506119a4565b5080925050509392505050565b6060600082511415611aa657604051806020016040528060008152509050611c29565b60006040518060600160405280604081526020016139126040913990506000600360028551611ad59190612d6a565b611adf9190612dc0565b6004611aeb9190612df1565b90506000602082611afc9190612d6a565b67ffffffffffffffff811115611b3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611b6d5781602001600182028036833780820191505090505b509050818152600183018586518101602084015b81831015611be8576003830192508251603f8160121c1685015160f81b8252600182019150603f81600c1c1685015160f81b8252600182019150603f8160061c1685015160f81b8252600182019150603f811685015160f81b825260018201915050611b81565b600389510660018114611c025760028114611c1257611c1d565b613d3d60f01b6002830352611c1d565b603d60f81b60018303525b50505050508093505050505b919050565b611c39848484611517565b611c4584848484611d91565b611c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7b90612a85565b60405180910390fd5b50505050565b600060095414611cdd57611c9d82611314565b611cdc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd390612b85565b60405180910390fd5b5b610200815110611d22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1990612c65565b60405180910390fd5b806007600060095481526020019081526020016000209080519060200190611d4b929190611f34565b508160086000600954815260200190815260200160002081905550611d72836009546110e8565b600160096000828254611d859190612d6a565b92505081905550505050565b6000611db28473ffffffffffffffffffffffffffffffffffffffff16611f21565b15611f14578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02338786866040518563ffffffff1660e01b8152600401611df694939291906129fc565b602060405180830381600087803b158015611e1057600080fd5b505af1925050508015611e4157506040513d601f19601f82011682018060405250810190611e3e91906122e0565b60015b611ec4573d8060008114611e71576040519150601f19603f3d011682016040523d82523d6000602084013e611e76565b606091505b50600081511415611ebc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb390612a85565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050611f19565b600190505b949350505050565b600080823b905060008111915050919050565b828054611f4090612f35565b90600052602060002090601f016020900481019282611f625760008555611fa9565b82601f10611f7b57805160ff1916838001178555611fa9565b82800160010185558215611fa9579182015b82811115611fa8578251825591602001919060010190611f8d565b5b509050611fb69190611fba565b5090565b5b80821115611fd3576000816000905550600101611fbb565b5090565b6000611fea611fe584612cc5565b612ca0565b90508281526020810184848401111561200257600080fd5b61200d848285612ef3565b509392505050565b600061202861202384612cf6565b612ca0565b90508281526020810184848401111561204057600080fd5b61204b848285612ef3565b509392505050565b6000813590506120628161387f565b92915050565b60008135905061207781613896565b92915050565b60008135905061208c816138ad565b92915050565b6000815190506120a1816138ad565b92915050565b600082601f8301126120b857600080fd5b81356120c8848260208601611fd7565b91505092915050565b600082601f8301126120e257600080fd5b81356120f2848260208601612015565b91505092915050565b60008135905061210a816138c4565b92915050565b60006020828403121561212257600080fd5b600061213084828501612053565b91505092915050565b6000806040838503121561214c57600080fd5b600061215a85828601612053565b925050602061216b85828601612053565b9150509250929050565b60008060006060848603121561218a57600080fd5b600061219886828701612053565b93505060206121a986828701612053565b92505060406121ba868287016120fb565b9150509250925092565b600080600080608085870312156121da57600080fd5b60006121e887828801612053565b94505060206121f987828801612053565b935050604061220a878288016120fb565b925050606085013567ffffffffffffffff81111561222757600080fd5b612233878288016120a7565b91505092959194509250565b6000806040838503121561225257600080fd5b600061226085828601612053565b925050602061227185828601612068565b9150509250929050565b6000806040838503121561228e57600080fd5b600061229c85828601612053565b92505060206122ad858286016120fb565b9150509250929050565b6000602082840312156122c957600080fd5b60006122d78482850161207d565b91505092915050565b6000602082840312156122f257600080fd5b600061230084828501612092565b91505092915050565b60006020828403121561231b57600080fd5b6000612329848285016120fb565b91505092915050565b6000806040838503121561234557600080fd5b6000612353858286016120fb565b925050602083013567ffffffffffffffff81111561237057600080fd5b61237c858286016120d1565b9150509250929050565b61238f81612e7f565b82525050565b61239e81612e91565b82525050565b60006123af82612d27565b6123b98185612d3d565b93506123c9818560208601612f02565b6123d2816130ce565b840191505092915050565b60006123e882612d32565b6123f28185612d4e565b9350612402818560208601612f02565b61240b816130ce565b840191505092915050565b600061242182612d32565b61242b8185612d5f565b935061243b818560208601612f02565b80840191505092915050565b6000612454600983612d5f565b915061245f826130df565b600982019050919050565b600061247760dc83612d5f565b915061248282613108565b60dc82019050919050565b600061249a603283612d4e565b91506124a582613215565b604082019050919050565b60006124bd601c83612d4e565b91506124c882613264565b602082019050919050565b60006124e0602483612d4e565b91506124eb8261328d565b604082019050919050565b6000612503601983612d4e565b915061250e826132dc565b602082019050919050565b6000612526602d83612d5f565b915061253182613305565b602d82019050919050565b6000612549602c83612d4e565b915061255482613354565b604082019050919050565b600061256c603883612d4e565b9150612577826133a3565b604082019050919050565b600061258f602a83612d4e565b915061259a826133f2565b604082019050919050565b60006125b2602983612d4e565b91506125bd82613441565b604082019050919050565b60006125d5601d83612d4e565b91506125e082613490565b602082019050919050565b60006125f8600283612d5f565b9150612603826134b9565b600282019050919050565b600061261b600783612d5f565b9150612626826134e2565b600782019050919050565b600061263e603183612d5f565b91506126498261350b565b603182019050919050565b6000612661602083612d4e565b915061266c8261355a565b602082019050919050565b6000612684600d83612d5f565b915061268f82613583565b600d82019050919050565b60006126a7602c83612d4e565b91506126b2826135ac565b604082019050919050565b60006126ca601283612d5f565b91506126d5826135fb565b601282019050919050565b60006126ed602983612d4e565b91506126f882613624565b604082019050919050565b6000612710602f83612d4e565b915061271b82613673565b604082019050919050565b6000612733601083612d5f565b915061273e826136c2565b601082019050919050565b6000612756602183612d4e565b9150612761826136eb565b604082019050919050565b6000612779601d83612d5f565b91506127848261373a565b601d82019050919050565b600061279c600f83612d5f565b91506127a782613763565b600f82019050919050565b60006127bf603183612d4e565b91506127ca8261378c565b604082019050919050565b60006127e2600d83612d4e565b91506127ed826137db565b602082019050919050565b6000612805600683612d5f565b915061281082613804565b600682019050919050565b6000612828600683612d5f565b91506128338261382d565b600682019050919050565b600061284b601a83612d5f565b915061285682613856565b601a82019050919050565b61286a81612ee9565b82525050565b600061287c8286612416565b915061288782612726565b91506128938285612416565b915061289e8261278f565b91506128aa8284612416565b91506128b58261260e565b9150819050949350505050565b60006128cd82612447565b91506128d98286612416565b91506128e4826126bd565b91506128f08285612416565b91506128fb82612677565b91506129068261283e565b91506129128284612416565b915061291d826125eb565b9150819050949350505050565b60006129358261246a565b915061294082612519565b915061294c8286612416565b91506129578261260e565b915061296282612631565b915061296e8285612416565b91506129798261260e565b91506129858284612416565b91506129908261281b565b9150819050949350505050565b60006129a88261276c565b91506129b48284612416565b915081905092915050565b60006129ca826127f8565b91506129d68284612416565b915081905092915050565b60006020820190506129f66000830184612386565b92915050565b6000608082019050612a116000830187612386565b612a1e6020830186612386565b612a2b6040830185612861565b8181036060830152612a3d81846123a4565b905095945050505050565b6000602082019050612a5d6000830184612395565b92915050565b60006020820190508181036000830152612a7d81846123dd565b905092915050565b60006020820190508181036000830152612a9e8161248d565b9050919050565b60006020820190508181036000830152612abe816124b0565b9050919050565b60006020820190508181036000830152612ade816124d3565b9050919050565b60006020820190508181036000830152612afe816124f6565b9050919050565b60006020820190508181036000830152612b1e8161253c565b9050919050565b60006020820190508181036000830152612b3e8161255f565b9050919050565b60006020820190508181036000830152612b5e81612582565b9050919050565b60006020820190508181036000830152612b7e816125a5565b9050919050565b60006020820190508181036000830152612b9e816125c8565b9050919050565b60006020820190508181036000830152612bbe81612654565b9050919050565b60006020820190508181036000830152612bde8161269a565b9050919050565b60006020820190508181036000830152612bfe816126e0565b9050919050565b60006020820190508181036000830152612c1e81612703565b9050919050565b60006020820190508181036000830152612c3e81612749565b9050919050565b60006020820190508181036000830152612c5e816127b2565b9050919050565b60006020820190508181036000830152612c7e816127d5565b9050919050565b6000602082019050612c9a6000830184612861565b92915050565b6000612caa612cbb565b9050612cb68282612f67565b919050565b6000604051905090565b600067ffffffffffffffff821115612ce057612cdf61309f565b5b612ce9826130ce565b9050602081019050919050565b600067ffffffffffffffff821115612d1157612d1061309f565b5b612d1a826130ce565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000612d7582612ee9565b9150612d8083612ee9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612db557612db4613012565b5b828201905092915050565b6000612dcb82612ee9565b9150612dd683612ee9565b925082612de657612de5613041565b5b828204905092915050565b6000612dfc82612ee9565b9150612e0783612ee9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612e4057612e3f613012565b5b828202905092915050565b6000612e5682612ee9565b9150612e6183612ee9565b925082821015612e7457612e73613012565b5b828203905092915050565b6000612e8a82612ec9565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612f20578082015181840152602081019050612f05565b83811115612f2f576000848401525b50505050565b60006002820490506001821680612f4d57607f821691505b60208210811415612f6157612f60613070565b5b50919050565b612f70826130ce565b810181811067ffffffffffffffff82111715612f8f57612f8e61309f565b5b80604052505050565b6000612fa382612ee9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612fd657612fd5613012565b5b600182019050919050565b6000612fec82612ee9565b9150612ff783612ee9565b92508261300757613006613041565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f7b226e616d65223a220000000000000000000000000000000000000000000000600082015250565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323060008201527f30302f73766722207072657365727665417370656374526174696f3d22784d6960208201527f6e594d696e206d656574222076696577426f783d22302030203330302033303060408201527f223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f60608201527f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a2031307060808201527f783b207d3c2f7374796c653e3c726563742077696474683d223130302522206860a08201527f65696768743d2231303025222066696c6c3d22626c61636b22202f3e0000000060c082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f3c7465787420783d2232302220793d2232302220636c6173733d22626173652260008201527f3e53746f7279204e6f6465202300000000000000000000000000000000000000602082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4e6f20737563682070726576696f75732073746f727920657869737473000000600082015250565b7f227d000000000000000000000000000000000000000000000000000000000000600082015250565b7f3c2f746578743e00000000000000000000000000000000000000000000000000600082015250565b7f3c7465787420783d2232302220793d2234302220636c6173733d22626173652260008201527f3e4c696e6b656420546f204e6f64652023000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f222c2022696d616765223a202200000000000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f222c20226465736372697074696f6e223a220000000000000000000000000000600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f3c7465787420783d2232302220793d2200000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000600082015250565b7f2220636c6173733d2262617365223e0000000000000000000000000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f546f6f206d756368207465787400000000000000000000000000000000000000600082015250565b7f4e6f646520230000000000000000000000000000000000000000000000000000600082015250565b7f3c2f7376673e0000000000000000000000000000000000000000000000000000600082015250565b7f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000600082015250565b61388881612e7f565b811461389357600080fd5b50565b61389f81612e91565b81146138aa57600080fd5b50565b6138b681612e9d565b81146138c157600080fd5b50565b6138cd81612ee9565b81146138d857600080fd5b5056fe412053746f7279204e6f646520496e20546865204c696e6b65642054726565204f6620546865204c6f6767656420556e6976657273654142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212206aeaca4a72484d8437361264ed389bcd915c994f7dd5038f37e133168337a5bc64736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: No
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/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;
}
}
ERC721.sol 363 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/IERC721.sol";
import "./interfaces/IERC721Receiver.sol";
import "./interfaces/IERC721Metadata.sol";
import "./utils/Address.sol";
// import "../../utils/Context.sol";
import "./utils/Strings.sol";
import "./ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping (uint256 => address) private _owners;
// Mapping owner address to token count
mapping (address => uint256) private _balances;
// Mapping from token ID to approved address
mapping (uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC721).interfaceId
|| interfaceId == type(IERC721Metadata).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != msg.sender, "ERC721: approve to caller");
_operatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, 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(msg.sender, 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(msg.sender, tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
_mint(to, tokenId);
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
// _beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
// _beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
// _beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev 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(msg.sender, from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
// modified from ERC721 template:
// removed BeforeTokenTransfer
}
TreeVerse.sol 164 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ERC721.sol";
import "./utils/Base64.sol";
/*
A Linked Tree Of The Logged Universe:
An experiment in collaborative creative storytelling in The Logged Universe from Untitled Frontier.
Each story node is an NFT, and each story node MUST point to a previous story.
To continue telling the story, merely point to a previous story node and mint your addition.
Words are compiled into an NFT image from on-chain SVG.
NOTE: This is experimental and not audited. The SVG might break. And under some circumstances, the rendering might not work properly. Basically, don't submit weird formatted text and you'll be fine.
It costs a ~ 450k of gas to store 512 bytes, so it can be expensive. Play with accordingly.
Partly inspired by Loot Project + Kalen Iwamoto's "Few Understand" series, linking text NFTs to each other. https://opensea.io/collection/kalen-iwamoto.
*/
/**
* @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 TreeVerse is ERC721 {
address public owner = 0xaF69610ea9ddc95883f97a6a3171d52165b69B03; // for OpenSea storefront integration. Doesn't do anything in-contract.
mapping(uint256 => string) public stories;
mapping(uint256 => uint256) public link;
uint256 public totalSupply = 0;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor (string memory name_, string memory symbol_) ERC721(name_, symbol_) {
_mintStoryToAddress(owner, 0, "A simulated eternity sprawled in front of them: a veritable meta heaven. Anything and everything they could dream of. However, they soon realised that humans weren't made to live for aeons...");
}
/**
* @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 name = string(abi.encodePacked('Node #', toString(tokenId)));
string memory description = "A Story Node In The Linked Tree Of The Logged Universe";
string memory image = generateBase64Image(tokenId);
return string(
abi.encodePacked(
'data:application/json;base64,',
Base64.encode(
bytes(
abi.encodePacked(
'{"name":"',
name,
'", "description":"',
description,
'", "image": "',
'data:image/svg+xml;base64,',
image,
'"}'
)
)
)
)
);
}
function generateBase64Image(uint256 tokenId) public view returns (string memory) {
return Base64.encode(bytes(generateImage(tokenId)));
}
function generateImage(uint256 tokenId) public view returns (string memory) {
string memory story = stories[tokenId];
bytes memory bs = bytes(story);
string memory textBoxes = "";
uint256 amount = 1;
uint256 offset = 0;
uint256 e = 60;
for (uint i = 0; i<bs.length; i+=e-offset) {
offset = 0;
if(i+e > bs.length) {
textBoxes = string(abi.encodePacked(textBoxes, '<text x="20" y="',toString(60+amount*20),'" class="base">',substring(story,i,bs.length),'</text>'));
} else {
// somewhat inefficient hack to wrap words.
// CAN break in some circumstances
while(bs[i+e-offset] != " ") {
offset+=1;
}
textBoxes = string(abi.encodePacked(textBoxes, '<text x="20" y="',toString(60+amount*20),'" class="base">',substring(story,i,i+e-offset),'</text>'));
}
amount += 1;
}
return string(
abi.encodePacked(
'<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 300 300"><style>.base { fill: white; font-family: serif; font-size: 10px; }</style><rect width="100%" height="100%" fill="black" />',
'<text x="20" y="20" class="base">Story Node #',toString(tokenId),'</text>',
'<text x="20" y="40" class="base">Linked To Node #',toString(link[tokenId]),'</text>',
textBoxes,
'</svg>'
)
);
}
function _mintStoryToAddress(address newOwner, uint256 prevStoryId, string memory story) internal {
if(totalSupply != 0) {
require(_exists(prevStoryId), "No such previous story exists");
}
require(bytes(story).length < 512, "Too much text");
stories[totalSupply] = story;
link[totalSupply] = prevStoryId;
super._mint(newOwner, totalSupply);
totalSupply += 1;
}
function mintStory(uint256 prevStoryId, string memory story) public {
_mintStoryToAddress(msg.sender, prevStoryId, story);
}
// GENERIC helpers
// from: https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Strings.sol
/**
* @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);
}
// from: https://ethereum.stackexchange.com/questions/31457/substring-in-solidity/31470
function substring(string memory str, uint startIndex, uint endIndex) internal pure returns (string memory) {
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex-startIndex);
for(uint i = startIndex; i < endIndex; i++) {
result[i-startIndex] = strBytes[i];
}
return string(result);
}
}
Base64.sol 63 lines
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides a function for encoding some bytes in base64 library Base64 { string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { dataPtr := add(dataPtr, 3) // read 3 bytes let input := mload(dataPtr) // write 4 characters mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr( 6, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and( input, 0x3F))))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } }
Address.sol 189 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev 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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721.sol 129 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Receiver.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}
Read Contract
balanceOf 0x70a08231 → uint256
generateBase64Image 0xa48b3b8f → string
generateImage 0x4b44d812 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
link 0xb1a867d5 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
stories 0x8a3b6ab8 → string
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 6 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mintStory 0xb978cf29
uint256 prevStoryId
string story
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
Recent Transactions
No transactions found for this address