Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x8754F54074400CE745a7CEddC928FB1b7E985eD6
Balance 215.1782 ETH
Nonce 1
Code Size 14243 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

14243 bytes
0x6080604052600436106102035760003560e01c80635c86f2c811610118578063b81f7888116100a0578063eb9eb9fd1161006f578063eb9eb9fd14610af5578063f242432a14610b1f578063f2fde38b14610bf5578063f908108e14610c28578063f9c894a814610cd957610203565b8063b81f788814610a66578063bd85b03914610a7b578063cd3293de14610aa5578063e985e9c514610aba57610203565b8063911d0004116100e7578063911d00041461099857806391b7f5ed146109c257806395d89b41146109ec5780639d76a17114610a01578063a22cb46514610a2b57610203565b80635c86f2c81461093c5780636817c76c14610959578063715018a61461096e5780638da5cb5b1461098357610203565b80632802a1901161019b5780633ccfd60b1161016a5780633ccfd60b14610737578063425af3731461074c57806349701d43146107925780634ba44fd2146107a75780634e1273f4146107bc57610203565b80632802a190146104605780632eb2c2d614610513578063328d8f72146106e1578063346fd5dd1461070d57610203565b806307a3681c116101d757806307a3681c146103d85780630e89341c146104025780631249c58b1461042c578063211e28b61461043457610203565b8062fdd58e1461020857806301ffc9a71461025357806302fe53051461029b57806306fdde031461034e575b600080fd5b34801561021457600080fd5b506102416004803603604081101561022b57600080fd5b506001600160a01b038135169060200135610d09565b60408051918252519081900360200190f35b34801561025f57600080fd5b506102876004803603602081101561027657600080fd5b50356001600160e01b031916610d7b565b604080519115158252519081900360200190f35b3480156102a757600080fd5b5061034c600480360360208110156102be57600080fd5b810190602081018135600160201b8111156102d857600080fd5b8201836020820111156102ea57600080fd5b803590602001918460018302840111600160201b8311171561030b57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610d9e945050505050565b005b34801561035a57600080fd5b50610363610e0c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561039d578181015183820152602001610385565b50505050905090810190601f1680156103ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e457600080fd5b50610241600480360360208110156103fb57600080fd5b5035610e9a565b34801561040e57600080fd5b506103636004803603602081101561042557600080fd5b5035610ebc565b610241610f9d565b34801561044057600080fd5b5061034c6004803603602081101561045757600080fd5b50351515611128565b34801561046c57600080fd5b5061034c6004803603604081101561048357600080fd5b810190602081018135600160201b81111561049d57600080fd5b8201836020820111156104af57600080fd5b803590602001918460018302840111600160201b831117156104d057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506111f6915050565b34801561051f57600080fd5b5061034c600480360360a081101561053657600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561056957600080fd5b82018360208201111561057b57600080fd5b803590602001918460208302840111600160201b8311171561059c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156105eb57600080fd5b8201836020820111156105fd57600080fd5b803590602001918460208302840111600160201b8311171561061e57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561066d57600080fd5b82018360208201111561067f57600080fd5b803590602001918460018302840111600160201b831117156106a057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061131a945050505050565b3480156106ed57600080fd5b5061034c6004803603602081101561070457600080fd5b5035151561161d565b34801561071957600080fd5b506102416004803603602081101561073057600080fd5b5035611692565b34801561074357600080fd5b5061034c6116ad565b34801561075857600080fd5b506107766004803603602081101561076f57600080fd5b503561175a565b604080516001600160a01b039092168252519081900360200190f35b34801561079e57600080fd5b50610241611775565b3480156107b357600080fd5b5061024161177b565b3480156107c857600080fd5b506108ec600480360360408110156107df57600080fd5b810190602081018135600160201b8111156107f957600080fd5b82018360208201111561080b57600080fd5b803590602001918460208302840111600160201b8311171561082c57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561087b57600080fd5b82018360208201111561088d57600080fd5b803590602001918460208302840111600160201b831117156108ae57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611781945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610928578181015183820152602001610910565b505050509050019250505060405180910390f35b6102416004803603602081101561095257600080fd5b50356118ff565b34801561096557600080fd5b50610241611bdd565b34801561097a57600080fd5b5061034c611be3565b34801561098f57600080fd5b50610776611c8f565b3480156109a457600080fd5b50610363600480360360208110156109bb57600080fd5b5035611c9e565b3480156109ce57600080fd5b5061034c600480360360208110156109e557600080fd5b5035611d8b565b3480156109f857600080fd5b50610363611e40565b348015610a0d57600080fd5b5061024160048036036020811015610a2457600080fd5b5035611e9b565b348015610a3757600080fd5b5061034c60048036036040811015610a4e57600080fd5b506001600160a01b0381351690602001351515611fb3565b348015610a7257600080fd5b5061034c6120a2565b348015610a8757600080fd5b5061024160048036036020811015610a9e57600080fd5b503561215d565b348015610ab157600080fd5b5061024161216f565b348015610ac657600080fd5b5061028760048036036040811015610add57600080fd5b506001600160a01b0381358116916020013516612175565b348015610b0157600080fd5b5061024160048036036020811015610b1857600080fd5b50356121a3565b348015610b2b57600080fd5b5061034c600480360360a0811015610b4257600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b811115610b8157600080fd5b820183602082011115610b9357600080fd5b803590602001918460018302840111600160201b83111715610bb457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506121ad945050505050565b348015610c0157600080fd5b5061034c60048036036020811015610c1857600080fd5b50356001600160a01b0316612378565b348015610c3457600080fd5b5061034c60048036036020811015610c4b57600080fd5b810190602081018135600160201b811115610c6557600080fd5b820183602082011115610c7757600080fd5b803590602001918460018302840111600160201b83111715610c9857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061247a945050505050565b348015610ce557600080fd5b5061034c60048036036040811015610cfc57600080fd5b5080359060200135612565565b60006001600160a01b038316610d505760405162461bcd60e51b815260040180806020018281038252602b81526020018061351f602b913960400191505060405180910390fd5b5060008181526002602090815260408083206001600160a01b03861684529091529020545b92915050565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b610da66127d9565b6001600160a01b0316610db7611c8f565b6001600160a01b031614610e00576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b610e09816127dd565b50565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e925780601f10610e6757610100808354040283529160200191610e92565b820191906000526020600020905b815481529060010190602001808311610e7557829003601f168201915b505050505081565b600080610ea6836121a3565b6000908152600a60205260409020549392505050565b60606006610ec9836127f0565b6040516020018083805460018160011615610100020316600290048015610f275780601f10610f05576101008083540402835291820191610f27565b820191906000526020600020905b815481529060010190602001808311610f13575b5050825160208401908083835b60208310610f535780518252601f199092019160209182019101610f34565b5181516020939093036101000a600019018019909116921691909117905264173539b7b760d91b92019182525060408051808303601a190181526005909201905295945050505050565b60075460009060ff16610fee576040805162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081a5cc8191a5cd8589b195960621b604482015290519081900360640190fd5b600b54600090610fff9060016128ca565b9050601b81111561104c576040805162461bcd60e51b815260206004820152601260248201527113585e081cdd5c1c1b1e481c995858da195960721b604482015290519081900360640190fd5b600d543414611099576040805162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b604482015290519081900360640190fd5b60006110a482612924565b6000818152600a602052604090208054600190810191829055919250146110c757fe5b81600b819055506110ea33826001604051806020016040528060008152506129f1565b604080518281529051839133917fe4f0f5c21ed48cb2fc51c9d879699cdb5bc1c00eb8804ee42d80f4c396a706b59181900360200190a39150505b90565b6111306127d9565b6001600160a01b0316611141611c8f565b6001600160a01b03161461118a576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b600754610100900460ff16156111dc576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81b1bd8dad95960721b604482015290519081900360640190fd5b600780549115156101000261ff0019909216919091179055565b6111fe6127d9565b6001600160a01b031661120f611c8f565b6001600160a01b031614611258576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b600754610100900460ff16156112aa576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81b1bd8dad95960721b604482015290519081900360640190fd5b60085481106112f6576040805162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015290519081900360640190fd5b6000818152600960209081526040909120835161131592850190613376565b505050565b815183511461135a5760405162461bcd60e51b81526004018080602001828103825260288152602001806137256028913960400191505060405180910390fd5b6001600160a01b03841661139f5760405162461bcd60e51b81526004018080602001828103825260258152602001806135ee6025913960400191505060405180910390fd5b6113a76127d9565b6001600160a01b0316856001600160a01b031614806113d257506113d2856113cd6127d9565b612175565b61140d5760405162461bcd60e51b81526004018080602001828103825260328152602001806136136032913960400191505060405180910390fd5b60006114176127d9565b9050611427818787878787612af9565b60005b845181101561152d57600085828151811061144157fe5b60200260200101519050600085838151811061145957fe5b602002602001015190506114c6816040518060600160405280602a8152602001613668602a91396002600086815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002054612b889092919063ffffffff16565b60008381526002602090815260408083206001600160a01b038e811685529252808320939093558a16815220546114fd90826128ca565b60009283526002602090815260408085206001600160a01b038c168652909152909220919091555060010161142a565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156115b357818101518382015260200161159b565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156115f25781810151838201526020016115da565b5050505090500194505050505060405180910390a4611615818787878787612c1f565b505050505050565b6116256127d9565b6001600160a01b0316611636611c8f565b6001600160a01b03161461167f576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b6007805460ff1916911515919091179055565b60008061169e83611e9b565b6064605a909102049392505050565b6116b56127d9565b6001600160a01b03166116c6611c8f565b6001600160a01b03161461170f576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b6000611726600e5447612e9590919063ffffffff16565b604051909150339082156108fc029083906000818181858888f19350505050158015611756573d6000803e3d6000fd5b5050565b600c602052600090815260409020546001600160a01b031681565b600b5481565b60085481565b606081518351146117c35760405162461bcd60e51b81526004018080602001828103825260298152602001806136fc6029913960400191505060405180910390fd5b6000835167ffffffffffffffff811180156117dd57600080fd5b50604051908082528060200260200182016040528015611807578160200160208202803683370190505b50905060005b84518110156118f75760006001600160a01b031685828151811061182d57fe5b60200260200101516001600160a01b0316141561187b5760405162461bcd60e51b815260040180806020018281038252603181526020018061354a6031913960400191505060405180910390fd5b6002600085838151811061188b57fe5b6020026020010151815260200190815260200160002060008683815181106118af57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106118e457fe5b602090810291909101015260010161180d565b509392505050565b60075460009060ff16611950576040805162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081a5cc8191a5cd8589b195960621b604482015290519081900360640190fd5b6000828152600c60205260409020546001600160a01b03166119af576040805162461bcd60e51b815260206004820152601360248201527214d9595908191bd95cc81b9bdd08195e1a5cdd606a1b604482015290519081900360640190fd5b60006119ba836121a3565b6000818152600a60205260408120549192506119d860018301611e9b565b905080341015611a24576040805162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b604482015290519081900360640190fd5b6000838152600a6020526040812054611a3e9060016128ca565b6000858152600a60205260408120829055909150611a5b82611692565b600e54909150611a6b90826128ca565b600e556000611a82611a7d8584612e95565b612ef2565b9050611aa033876001604051806020016040528060008152506129f1565b6000888152600c60205260408082205490516001600160a01b039091169190829084908381818185875af1925050503d8060008114611afb576040519150601f19603f3d011682016040523d82523d6000602084013e611b00565b606091505b5050905080611b47576040805162461bcd60e51b815260206004820152600e60248201526d14185e5b595b9d0819985a5b195960921b604482015290519081900360640190fd5b611b5086612f04565b6001600160a01b0382168a337f4251d75749ad140eadaa466a69c53451f36b41cc82640aa2a74327b0039b8e6c8b8a611b92611b8d8c60016128ca565b611e9b565b600e5460408051948552602085019390935283830191909152606083018b9052608083018c905260a083018a905260c0830152519081900360e00190a4509598975050505050505050565b600d5481565b611beb6127d9565b6001600160a01b0316611bfc611c8f565b6001600160a01b031614611c45576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60606008548210611cec576040805162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b604482015290519081900360640190fd5b60008281526009602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084529091830182828015611d7f5780601f10611d5457610100808354040283529160200191611d7f565b820191906000526020600020905b815481529060010190602001808311611d6257829003601f168201915b50505050509050919050565b611d936127d9565b6001600160a01b0316611da4611c8f565b6001600160a01b031614611ded576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b60075460ff1615611e3b576040805162461bcd60e51b815260206004820152601360248201527210dbdb9d1c9858dd081a5cc8195b98589b1959606a1b604482015290519081900360640190fd5b600d55565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e925780601f10610e6757610100808354040283529160200191610e92565b60006078821115611ef3576040805162461bcd60e51b815260206004820152601760248201527f4d6178696d756d20737570706c79206578636565646564000000000000000000604482015290519081900360640190fd5b6103e86032831015611f3557611f2e611f0d603285612e95565b600b0a611f2883611f1f603288612e95565b600a0a90612faa565b90613003565b9150611f72565b6032831415611f4657809150611f72565b611f6f611f54846032612e95565b600a0a611f2883611f66876032612e95565b600b0a90612faa565b91505b611f87611f80601a85612faa565b83906128ca565b9150611f94826008612e95565b9150611fac81611f2884670de0b6b3a7640000612faa565b9392505050565b816001600160a01b0316611fc56127d9565b6001600160a01b0316141561200b5760405162461bcd60e51b81526004018080602001828103825260298152602001806136d36029913960400191505060405180910390fd5b80600360006120186127d9565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561205c6127d9565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6120aa6127d9565b6001600160a01b03166120bb611c8f565b6001600160a01b031614612104576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b600754610100900460ff1615612156576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81b1bd8dad95960721b604482015290519081900360640190fd5b6000600855565b600a6020526000908152604090205481565b600e5481565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205460ff1690565b6480000000001790565b6001600160a01b0384166121f25760405162461bcd60e51b81526004018080602001828103825260258152602001806135ee6025913960400191505060405180910390fd5b6121fa6127d9565b6001600160a01b0316856001600160a01b031614806122205750612220856113cd6127d9565b61225b5760405162461bcd60e51b81526004018080602001828103825260298152602001806135c56029913960400191505060405180910390fd5b60006122656127d9565b90506122858187876122768861306a565b61227f8861306a565b87612af9565b6122cc836040518060600160405280602a8152602001613668602a913960008781526002602090815260408083206001600160a01b038d1684529091529020549190612b88565b60008581526002602090815260408083206001600160a01b038b8116855292528083209390935587168152205461230390846128ca565b60008581526002602090815260408083206001600160a01b03808b168086529184529382902094909455805188815291820187905280518a8416938616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a46116158187878787876130af565b6123806127d9565b6001600160a01b0316612391611c8f565b6001600160a01b0316146123da576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b6001600160a01b03811661241f5760405162461bcd60e51b815260040180806020018281038252602681526020018061357b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6124826127d9565b6001600160a01b0316612493611c8f565b6001600160a01b0316146124dc576040805162461bcd60e51b815260206004820181905260248201526000805160206136b3833981519152604482015290519081900360640190fd5b600754610100900460ff161561252e576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81b1bd8dad95960721b604482015290519081900360640190fd5b6008546000908152600960209081526040909120825161255092840190613376565b5060085461255f9060016128ca565b60085550565b60075460ff166125b3576040805162461bcd60e51b815260206004820152601460248201527310dbdb9d1c9858dd081a5cc8191a5cd8589b195960621b604482015290519081900360640190fd5b6000828152600c60205260409020546001600160a01b0316612612576040805162461bcd60e51b815260206004820152601360248201527214d9595908191bd95cc81b9bdd08195e1a5cdd606a1b604482015290519081900360640190fd5b600061261d836121a3565b6000818152600a602052604090205490915082811015612679576040805162461bcd60e51b8152602060048201526012602482015271135a5b881cdd5c1c1b1e481b9bdd081b595d60721b604482015290519081900360640190fd5b600061268482611692565b6000848152600a6020526040812054919250906126a2906001612e95565b6000858152600a60205260409020819055600e549091506126c39083612e95565b600e556126d233856001613220565b604051600090339084908381818185875af1925050503d8060008114612714576040519150601f19603f3d011682016040523d82523d6000602084013e612719565b606091505b5050905080612765576040805162461bcd60e51b8152602060048201526013602482015272109d5c9b881c185e5b595b9d0819985a5b1959606a1b604482015290519081900360640190fd5b86337f28c10a3ed4dd25f5f55dfd6c310c0e429c49e5e360db37f0cb3dbef72343e80f878661279389611e9b565b61279c88611692565b600e546040805195865260208601949094528484019290925260608401526080830188905260a0830152519081900360c00190a350505050505050565b3390565b8051611756906006906020840190613376565b60608161281557506040805180820190915260018152600360fc1b6020820152610d99565b818060005b821561282e57600101600a8304925061281a565b60008167ffffffffffffffff8111801561284757600080fd5b506040519080825280601f01601f191660200182016040528015612872576020820181803683370190505b50905060001982015b83156128c057600a840660300160f81b8282806001900393508151811061289e57fe5b60200101906001600160f81b031916908160001a905350600a8404935061287b565b5095945050505050565b600082820183811015611fac576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60408051436020808301829052600019909101408284015233606090811b9083015260748083018590528351808403909101815260949092019092528051910120600090600681831a06603b600183901a06600b600284901a06600c600385901a06856129976009600488901a06613353565b90508060ff1660088360ff1664ffffffffff16901b60108560ff1664ffffffffff16901b60188760ff1664ffffffffff16901b60208960ff1664ffffffffff16901b1717171764ffffffffff169650505050505050919050565b6001600160a01b038416612a365760405162461bcd60e51b815260040180806020018281038252602181526020018061374d6021913960400191505060405180910390fd5b6000612a406127d9565b9050612a52816000876122768861306a565b60008481526002602090815260408083206001600160a01b0389168452909152902054612a7f90846128ca565b60008581526002602090815260408083206001600160a01b03808b16808652918452828520959095558151898152928301889052815190948616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a4612af2816000878787876130af565b5050505050565b612b07868686868686611615565b60005b8351811015612b7f5764800000000080858381518110612b2657fe5b60200260200101511614612b77576000848281518110612b4257fe5b6020908102919091018101516000908152600c9091526040902080546001600160a01b0319166001600160a01b038816179055505b600101612b0a565b50505050505050565b60008184841115612c175760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bdc578181015183820152602001612bc4565b50505050905090810190601f168015612c095780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b612c31846001600160a01b0316613370565b1561161557836001600160a01b031663bc197c8187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b03168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015612cbf578181015183820152602001612ca7565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015612cfe578181015183820152602001612ce6565b50505050905001848103825285818151815260200191508051906020019080838360005b83811015612d3a578181015183820152602001612d22565b50505050905090810190601f168015612d675780820380516001836020036101000a031916815260200191505b5098505050505050505050602060405180830381600087803b158015612d8c57600080fd5b505af1925050508015612db157506040513d6020811015612dac57600080fd5b505160015b612e4657612dbd61341d565b80612dc85750612e0f565b60405162461bcd60e51b8152602060048201818152835160248401528351849391928392604401919085019080838360008315612bdc578181015183820152602001612bc4565b60405162461bcd60e51b81526004018080602001828103825260348152602001806134c36034913960400191505060405180910390fd5b6001600160e01b0319811663bc197c8160e01b14612b7f5760405162461bcd60e51b81526004018080602001828103825260288152602001806134f76028913960400191505060405180910390fd5b600082821115612eec576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000610d75600a611f28846008612faa565b6000612f103483612e95565b1115610e0957600033612f233484612e95565b604051600081818185875af1925050503d8060008114612f5f576040519150601f19603f3d011682016040523d82523d6000602084013e612f64565b606091505b5050905080611756576040805162461bcd60e51b815260206004820152600d60248201526c1499599d5b990819985a5b1959609a1b604482015290519081900360640190fd5b600082612fb957506000610d75565b82820282848281612fc657fe5b0414611fac5760405162461bcd60e51b81526004018080602001828103825260218152602001806136926021913960400191505060405180910390fd5b6000808211613059576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161306257fe5b049392505050565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061309e57fe5b602090810291909101015292915050565b6130c1846001600160a01b0316613370565b1561161557836001600160a01b031663f23a6e6187878686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001856001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015613150578181015183820152602001613138565b50505050905090810190601f16801561317d5780820380516001836020036101000a031916815260200191505b509650505050505050602060405180830381600087803b1580156131a057600080fd5b505af19250505080156131c557506040513d60208110156131c057600080fd5b505160015b6131d157612dbd61341d565b6001600160e01b0319811663f23a6e6160e01b14612b7f5760405162461bcd60e51b81526004018080602001828103825260288152602001806134f76028913960400191505060405180910390fd5b6001600160a01b0383166132655760405162461bcd60e51b81526004018080602001828103825260238152602001806136456023913960400191505060405180910390fd5b600061326f6127d9565b905061329f818560006132818761306a565b61328a8761306a565b60405180602001604052806000815250612af9565b6132e6826040518060600160405280602481526020016135a16024913960008681526002602090815260408083206001600160a01b038b1684529091529020549190612b88565b60008481526002602090815260408083206001600160a01b03808a16808652918452828520959095558151888152928301879052815193949093908616927fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6292908290030190a450505050565b600060028260ff16111561336957506003610d99565b5080610d99565b3b151590565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826133ac57600085556133f2565b82601f106133c557805160ff19168380011785556133f2565b828001600101855582156133f2579182015b828111156133f25782518255916020019190600101906133d7565b506133fe929150613402565b5090565b5b808211156133fe5760008155600101613403565b60e01c90565b600060443d101561342d57611125565b600481823e6308c379a06134418251613417565b1461344b57611125565b6040513d600319016004823e80513d67ffffffffffffffff816024840111818411171561347b5750505050611125565b828401925082519150808211156134955750505050611125565b503d830160208284010111156134ad57505050611125565b601f01601f191681016020016040529150509056fe455243313135353a207472616e7366657220746f206e6f6e2045524331313535526563656976657220696d706c656d656e746572455243313135353a204552433131353552656365697665722072656a656374656420746f6b656e73455243313135353a2062616c616e636520717565727920666f7220746865207a65726f2061646472657373455243313135353a2062617463682062616c616e636520717565727920666f7220746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373455243313135353a206275726e20616d6f756e7420657863656564732062616c616e6365455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135353a207472616e7366657220746f20746865207a65726f2061646472657373455243313135353a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564455243313135353a206275726e2066726f6d20746865207a65726f2061646472657373455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e73666572536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572455243313135353a2073657474696e6720617070726f76616c2073746174757320666f722073656c66455243313135353a206163636f756e747320616e6420696473206c656e677468206d69736d61746368455243313135353a2069647320616e6420616d6f756e7473206c656e677468206d69736d61746368455243313135353a206d696e7420746f20746865207a65726f2061646472657373a2646970667358221220e6ff8979ee3c9ab68c156483af0818cab926c99b3384789f57650c089ca3eb8464736f6c63430007060033

Verified Source Code Full Match

Compiler: v0.7.6+commit.7338295f EVM: istanbul Optimization: Yes (200 runs)
ERC1155.sol 419 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/introspection/ERC165.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";

/**
 *
 * @dev CLONE OF THE BASIC ERC1155 CONTRACT FROM OPEN ZEPPELIN
 * Only changes made are changing the uri related variable and getter
 * to be internal and virtual.
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using SafeMath for uint256;
    using Address for address;

    // Mapping from token ID to account balances
    mapping (uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping (address => mapping(address => bool)) private _operatorApprovals;

    // contract name
    string public name;
    // contract symbol
    string public symbol;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string internal _uri;

    /*
     *     bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e
     *     bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a
     *     bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6
     *
     *     => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^
     *        0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26
     */
    bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;

    /*
     *     bytes4(keccak256('uri(uint256)')) == 0x0e89341c
     */
    bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c;

    /**
     * @dev See {_setURI}.
     */
    constructor (string memory name_, string memory symbol_, string memory uri_) {
        name = name_;
        symbol = symbol_;

        _setURI(uri_);

        // register the supported interfaces to conform to ERC1155 via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155);

        // register the supported interfaces to conform to ERC1155MetadataURI via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI);
    }

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) external view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    )
        public
        view
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            require(accounts[i] != address(0), "ERC1155: batch balance query for the zero address");
            batchBalances[i] = _balances[ids[i]][accounts[i]];
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    )
        public
        virtual
        override
    {
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer");
        _balances[id][to] = _balances[id][to].add(amount);

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        public
        virtual
        override
    {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            _balances[id][from] = _balances[id][from].sub(
                amount,
                "ERC1155: insufficient balance for transfer"
            );
            _balances[id][to] = _balances[id][to].add(amount);
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][account] = _balances[id][account].add(amount);
        emit TransferSingle(operator, address(0), account, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]);
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `account`
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens of token type `id`.
     */
    function _burn(address account, uint256 id, uint256 amount) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        _balances[id][account] = _balances[id][account].sub(
            amount,
            "ERC1155: burn amount exceeds balance"
        );

        emit TransferSingle(operator, account, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), ids, amounts, "");

        for (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][account] = _balances[ids[i]][account].sub(
                amounts[i],
                "ERC1155: burn amount exceeds balance"
            );
        }

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual
    { }

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    )
        private
    {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver(to).onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        private
    {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) {
                if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}
EulerBeats.sol 474 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC1155.sol";


// EulerBeats are generative visual & audio art pieces. The recipe and instructions to re-create the visualization and music reside on Ethereum blockchain.
//
// To recreate your art, you will need to retrieve the script
//
//  STEPS TO RETRIEVE THE SCRIPTS:
// - The artwork re-generation script is written in JavaScript, split into pieces, and stored on chain.
// - Query the contract for the scriptCount - this is the number of pieces of the re-genereation script. You will need all of them.
// - Run the getScriptAtIndex method in the EulerBeats smart contract starting with parameter 0, this is will return a transaction hash
// - The "Input Data" field of this transaction contains the first segment of the script. Convert this into UTF-8 format
// - Repeat these last two steps, incrementing the parameter in the getScriptAtIndex method until the number of script segments matches the scrtipCount

contract EulerBeats is Ownable, ERC1155 {
    using SafeMath for uint256;

    /***********************************|
    |        Variables and Events       |
    |__________________________________*/
    // For Minting and Burning, locks the prices
    bool private _enabled = false;
    // For metadata (scripts), when locked, cannot be changed
    bool private _locked = false;

    // Number of script sections stored
    uint256 public scriptCount = 0;
    // The scripts that can be used to render the NFT (audio and visual)
    mapping (uint256 => string) scripts;

    // The 40 bit is flag to distinguish prints - 1 for print
    uint256 constant SEED_MASK = uint40(~0);
    uint256 constant PRINTS_FLAG_BIT = 1 << 39;


    // Supply restriction on prints
    uint256 constant MAX_PRINT_SUPPLY = 120;
    // Supply restriction on seeds/original NFTs
    uint256 constant MAX_SEEDS_SUPPLY = 27;


    // Total supply of prints and seeds/original NFTs
    mapping(uint256 => uint256) public totalSupply;
    // Total number of seeds/original NFTs minted
    uint256 public originalsMinted = 0;
    // Owner of the seed/original NFT
    mapping(uint256 => address payable) public seedToOwner;


    // Cost of minting an original/seed 
    uint256 public mintPrice = 0.271 ether;
    // Funds reserved for burns
    uint256 public reserve = 0;

    // For bonding curve
    uint256 constant K = 1 ether;
    uint256 constant B = 50;
    uint256 constant C = 26;
    uint256 constant D = 8;
    uint256 constant SIG_DIGITS = 3;

    /**
     * @dev Emitted when an original NFT with a new seed is minted
     */
    event MintOriginal(address indexed to, uint256 seed, uint256 indexed originalsMinted);

    /**
     * @dev Emitted when an print is minted
     */
    event PrintMinted(
        address indexed to,
        uint256 id,
        uint256 indexed seed,
        uint256 pricePaid,
        uint256 nextPrintPrice,
        uint256 nextBurnPrice,
        uint256 printsSupply,
        uint256 royaltyPaid,
        uint256 reserve,
        address indexed royaltyRecipient
    );

    /**
     * @dev Emitted when an print is burned
     */
    event PrintBurned(
        address indexed to,
        uint256 id,
        uint256 indexed seed,
        uint256 priceReceived,
        uint256 nextPrintPrice,
        uint256 nextBurnPrice,
        uint256 printsSupply,
        uint256 reserve
    );


    constructor(string memory _uri) ERC1155("EulerBeats", "eBEATS", _uri) {}


    /***********************************|
    |        Modifiers                  |
    |__________________________________*/
    modifier onlyWhenEnabled() {
        require(_enabled, "Contract is disabled");
        _;
    }
    modifier onlyWhenDisabled() {
        require(!_enabled, "Contract is enabled");
        _;
    }
    modifier onlyUnlocked() {
        require(!_locked, "Contract is locked");
        _;
    }


    /***********************************|
    |        User Interactions          |
    |__________________________________*/
    /**
     * @dev Function to mint tokens. Msg.value must be sufficient
     */
    function mint() public payable onlyWhenEnabled returns (uint256) {
        uint256 newOriginalsSupply = originalsMinted.add(1);
        require(
            newOriginalsSupply <= MAX_SEEDS_SUPPLY,
            "Max supply reached"
        );
        require(msg.value == mintPrice, "Insufficient payment");

        // The generated seed  == the original nft token id. 
        // Both terms are used throughout and refer to the same thing.
        uint256 seed = _generateSeed(newOriginalsSupply);

        // Increment the supply per original nft (max: 1)
        totalSupply[seed]++;
        assert(totalSupply[seed] == 1);

        // Update total originals minted
        originalsMinted = newOriginalsSupply;

        _mint(msg.sender, seed, 1, "");

        emit MintOriginal(msg.sender, seed, newOriginalsSupply);
        return seed;
    }

    /**
     * @dev Function to mint prints from an existing seed. Msg.value must be sufficient.
     * @param seed The NFT id to mint print of
     */
    function mintPrint(uint256 seed)
        public
        payable
        onlyWhenEnabled
        returns (uint256)
    {
        require(seedToOwner[seed] != address(0), "Seed does not exist");
        uint256 tokenId = getPrintTokenIdFromSeed(seed);
        uint256 oldSupply = totalSupply[tokenId];
        // Get price to mint the next print
        uint256 printPrice = getPrintPrice(oldSupply + 1);
        require(msg.value >= printPrice, "Insufficient funds");

        uint256 newSupply = totalSupply[tokenId].add(1);
        totalSupply[tokenId] = newSupply;

        // Update reserve - reserveCut == Price to burn next token
        uint256 reserveCut = getBurnPrice(newSupply);
        reserve = reserve.add(reserveCut);

        // Calculate fees - seedOwner gets 80% of fee (printPrice - reserveCut)
        uint256 seedOwnerRoyalty = _getSeedOwnerCut(printPrice.sub(reserveCut));

        // Mint token
        _mint(msg.sender, tokenId, 1, "");

        // Disburse royalties
        address seedOwner = seedToOwner[seed];
        (bool success, ) = seedOwner.call{value: seedOwnerRoyalty}("");
        require(success, "Payment failed");
        // Remaining 20% kept for contract/Treum

        // If buyer sent extra ETH as padding in case another purchase was made they are refunded
        _refundSender(printPrice);

        emit PrintMinted(msg.sender, tokenId, seed, printPrice, getPrintPrice(newSupply.add(1)), reserveCut, newSupply, seedOwnerRoyalty, reserve, seedOwner);
        return tokenId;
    }

    /**
     * @dev Function to burn a print
     * @param seed The seed for the print to burn.
     * @param minimumSupply The minimum token supply for burn to succeed, this is a way to set slippage. 
     * Set to 1 to allow burn to go through no matter what the price is.
     */
    function burnPrint(uint256 seed, uint256 minimumSupply) public onlyWhenEnabled {
        require(seedToOwner[seed] != address(0), "Seed does not exist");
        uint256 tokenId = getPrintTokenIdFromSeed(seed);
        uint256 oldSupply = totalSupply[tokenId];
        require(oldSupply >= minimumSupply, 'Min supply not met');

        uint256 burnPrice = getBurnPrice(oldSupply);
        uint256 newSupply = totalSupply[tokenId].sub(1);
        totalSupply[tokenId] = newSupply;

        // Update reserve
        reserve = reserve.sub(burnPrice);

        _burn(msg.sender, tokenId, 1);

        // Disburse funds
        (bool success, ) = msg.sender.call{value: burnPrice}("");
        require(success, "Burn payment failed");

        emit PrintBurned(msg.sender, tokenId, seed, burnPrice, getPrintPrice(oldSupply), getBurnPrice(newSupply), newSupply, reserve);
    }


    /***********************************|
    |   Public Getters - Pricing        |
    |__________________________________*/
    /**
     * @dev Function to get print price
     * @param printNumber the print number of the print Ex. if there are 2 existing prints, and you want to get the
     * next print price, then this should be 3 as you are getting the price to mint the 3rd print
     */
    function getPrintPrice(uint256 printNumber) public pure returns (uint256 price) {
        require(printNumber <= MAX_PRINT_SUPPLY, "Maximum supply exceeded");

        uint256 decimals = 10 ** SIG_DIGITS;
        if (printNumber < B) {
            price = (10 ** ( B.sub(printNumber) )).mul(decimals).div(11 ** ( B.sub(printNumber)));
        } else if (printNumber == B) {
            price = decimals;     // price = decimals * (A ^ 0)
        } else {
            price = (11 ** ( printNumber.sub(B) )).mul(decimals).div(10 ** ( printNumber.sub(B) ));
        }
        price = price.add(C.mul(printNumber));

        price = price.sub(D);
        price = price.mul(1 ether).div(decimals);
    }

    /**
     * @dev Function to get funds received when burned
     * @param supply the supply of prints before burning. Ex. if there are 2 existing prints, to get the funds
     * receive on burn the supply should be 2
     */
    function getBurnPrice(uint256 supply) public pure returns (uint256 price) {
        uint256 printPrice = getPrintPrice(supply);
        price = printPrice * 90 / 100;  // 90 % of print price
    }


    /***********************************|
    | Public Getters - Seed + Prints    |
    |__________________________________*/
    /**
     * @dev Get the number of prints minted for the corresponding seed
     * @param seed The seed/original NFT token id
     */
    function seedToPrintsSupply(uint256 seed)
        public
        view
        returns (uint256)
    {
        uint256 tokenId = getPrintTokenIdFromSeed(seed);
        return totalSupply[tokenId];
    }

    /**
     * @dev The token id for the prints contains the seed/original NFT id
     * @param seed The seed/original NFT token id
     */
    function getPrintTokenIdFromSeed(uint256 seed) public pure returns (uint256) {
        return seed | PRINTS_FLAG_BIT;
    }

    /***********************************|
    |   Public Getters - Metadata       |
    |__________________________________*/
    function getScriptAtIndex(uint256 index) public view returns (string memory) {
        require(index < scriptCount, "Index out of bounds");
        return scripts[index];
    }

    /**
    * @notice A distinct Uniform Resource Identifier (URI) for a given token.
    * @dev URIs are defined in RFC 3986.
    *      URIs are assumed to be deterministically generated based on token ID
    * @return URI string
    */
    function uri(uint256 _id) public override view returns (string memory) {
        return string(abi.encodePacked(_uri, _uint2str(_id), ".json"));
    }


    /***********************************|
    |Internal Functions - Generate Seed |
    |__________________________________*/
    function _generateSeed(uint256 uniqueValue) internal view returns (uint256) {
        bytes32 hash = keccak256(abi.encodePacked(block.number, blockhash(block.number - 1), msg.sender, uniqueValue));

        // gridLength 0-5
        uint8 gridLength = uint8(hash[0]) % 6;

        // horizontalLever 0-58
        uint8 horizontalLever = uint8(hash[1]) % 59;

        // diagonalLever 0-10
        uint8 diagonalLever = uint8(hash[2]) % 11;

        // palette 4 0-11
        uint8 palette = uint8(hash[3]) % 12;

        // innerShape 0-3 with rarity
        uint8 innerShape = _getRareTrait(uint8(hash[4]) % 9);

        return uint256(uint40(gridLength) << 32 | uint40(horizontalLever) << 24 | uint40(diagonalLever) << 16 | uint40(palette) << 8 | uint40(innerShape));
    }

    function _getRareTrait(uint8 value) internal pure returns (uint8) {
        // 70% circle
        // 10% square;
        // 10% squareCircle;
        // 10% squareDiamond;
        
        if (value > 2) {
            return 3;
        } else {
            return value;
        }
    }


    /***********************************|
    |  Internal Functions - Prints      |
    |__________________________________*/
    function _getSeedOwnerCut(uint256 fee) internal pure returns (uint256) {
        return fee.mul(8).div(10);
    }

    function _refundSender(uint256 printPrice) internal {
        if (msg.value.sub(printPrice) > 0) {
            (bool success, ) =
                msg.sender.call{value: msg.value.sub(printPrice)}("");
            require(success, "Refund failed");
        }
    }


    /***********************************|
    |        Admin                      |
    |__________________________________*/
    /**
     * @dev Set mint price for seed/original NFT
     * @param _mintPrice The cost of an original
     */
    function setPrice(uint256 _mintPrice) public onlyOwner onlyWhenDisabled {
        mintPrice = _mintPrice;
    }

    function addScript(string memory _script) public onlyOwner onlyUnlocked {
        scripts[scriptCount] = _script;
        scriptCount = scriptCount.add(1);
    }

    function updateScript(string memory _script, uint256 index) public onlyOwner onlyUnlocked {
        require(index < scriptCount, "Index out of bounds");
        scripts[index] = _script;
    }

    function resetScriptCount() public onlyOwner onlyUnlocked {
        scriptCount = 0;
    }

    /**
     * @dev Withdraw earned funds from original Nft sales and print fees. Cannot withdraw the reserve funds.
     */
    function withdraw() public onlyOwner {
        uint256 withdrawableFunds = address(this).balance.sub(reserve);
        msg.sender.transfer(withdrawableFunds);
    }

    /**
     * @dev Function to enable/disable token minting
     * @param enabled The flag to turn minting on or off
     */
    function setEnabled(bool enabled) public onlyOwner {
        _enabled = enabled;
    }

    /**
     * @dev Function to lock/unlock the on-chain metadata
     * @param locked The flag turn locked on
     */
    function setLocked(bool locked) public onlyOwner onlyUnlocked {
        _locked = locked;
    }

    /**
     * @dev Function to update the base _uri for all tokens
     * @param newuri The base uri string
     */
    function setURI(string memory newuri) public onlyOwner {
        _setURI(newuri);
    }


    /***********************************|
    |        Hooks                      |
    |__________________________________*/
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            // If token is original, keep track of owner so can send them fees
            if (ids[i] & PRINTS_FLAG_BIT != PRINTS_FLAG_BIT) {
                uint256 seed = ids[i];
                seedToOwner[seed] = payable(to);
            }
        }
    }

    /***********************************|
    |    Utility Internal Functions     |
    |__________________________________*/

    /**
    * @notice Convert uint256 to string
    * @param _i Unsigned integer to convert to string
    */
    function _uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
        if (_i == 0) {
        return "0";
        }

        uint256 j = _i;
        uint256 ii = _i;
        uint256 len;

        // Get number of bytes
        while (j != 0) {
        len++;
        j /= 10;
        }

        bytes memory bstr = new bytes(len);
        uint256 k = len - 1;

        // Get each individual ASCII
        while (ii != 0) {
        bstr[k--] = byte(uint8(48 + ii % 10));
        ii /= 10;
        }

        // Convert to string
        return string(bstr);
    }
}
Context.sol 5 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.sol";
SafeMath.sol 214 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}
Address.sol 189 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <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);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}
Ownable.sol 68 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}
ERC165.sol 54 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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);
}
IERC1155.sol 103 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}
IERC1155Receiver.sol 57 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../introspection/IERC165.sol";

/**
 * _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {

    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    )
        external
        returns(bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    )
        external
        returns(bytes4);
}
IERC1155MetadataURI.sol 21 lines
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

Read Contract

balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
getBurnPrice 0x346fd5dd → uint256
getPrintPrice 0x9d76a171 → uint256
getPrintTokenIdFromSeed 0xeb9eb9fd → uint256
getScriptAtIndex 0x911d0004 → string
isApprovedForAll 0xe985e9c5 → bool
mintPrice 0x6817c76c → uint256
name 0x06fdde03 → string
originalsMinted 0x49701d43 → uint256
owner 0x8da5cb5b → address
reserve 0xcd3293de → uint256
scriptCount 0x4ba44fd2 → uint256
seedToOwner 0x425af373 → address
seedToPrintsSupply 0x07a3681c → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string

Write Contract 16 functions

These functions modify contract state and require a wallet transaction to execute.

addScript 0xf908108e
string _script
burnPrint 0xf9c894a8
uint256 seed
uint256 minimumSupply
mint 0x1249c58b
No parameters
returns: uint256
mintPrint 0x5c86f2c8
uint256 seed
returns: uint256
renounceOwnership 0x715018a6
No parameters
resetScriptCount 0xb81f7888
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setEnabled 0x328d8f72
bool enabled
setLocked 0x211e28b6
bool locked
setPrice 0x91b7f5ed
uint256 _mintPrice
setURI 0x02fe5305
string newuri
transferOwnership 0xf2fde38b
address newOwner
updateScript 0x2802a190
string _script
uint256 index
withdraw 0x3ccfd60b
No parameters

Token Balances (1)

View Transfers →
WETH 0

Recent Transactions

No transactions found for this address