Address Contract Verified
Address
0xfB52bBA2Ed5e04b9075FbDd7054d903aB47b46A0
Balance
0 ETH
Nonce
2
Code Size
11737 bytes
Creator
0x888f8AA9...C871 at tx 0x8c5f7099...5a3766
Indexed Transactions
0 (2 on-chain, 0.9% indexed)
Contract Bytecode
11737 bytes
0x6080604052600436106101e25760003560e01c806366e3387011610102578063c6374d0c11610095578063e985e9c511610064578063e985e9c51461052e578063f0292a0314610569578063f2fde38b1461057e578063f756b53e1461059e57600080fd5b8063c6374d0c146104db578063c87b56dd146104f3578063d06aec2114610513578063d2ed5c591461052657600080fd5b806395d89b41116100d157806395d89b411461046b578063a22cb46514610480578063b88d4fde146104a0578063c002d23d146104c057600080fd5b806366e33870146103f157806370a082311461041157806372f90ac1146104315780638da5cb5b1461044b57600080fd5b806323b872dd1161017a5780633ccfd60b116101495780633ccfd60b1461039657806342842e0e1461039e57806352f0dc9b146103be5780636352211e146103d157600080fd5b806323b872dd1461031f5780632fb098d21461033f57806332cb6b0c1461036d578063349d27481461038357600080fd5b806308338e4b116101b657806308338e4b146102b057806308871ceb146102d4578063095ea7b3146102e957806318160ddd1461030957600080fd5b80625ea307146101e757806301ffc9a71461021d57806306fdde031461024d578063081812fc14610262575b600080fd5b3480156101f357600080fd5b50610207610202366004612094565b6105a6565b6040516102149190612105565b60405180910390f35b34801561022957600080fd5b5061023d610238366004612131565b61060f565b6040519015158152602001610214565b34801561025957600080fd5b5061020761065d565b34801561026e57600080fd5b5061029861027d366004612094565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610214565b3480156102bc57600080fd5b506102c660075481565b604051908152602001610214565b6102e76102e2366004612199565b6106eb565b005b3480156102f557600080fd5b506102e76103043660046121f1565b61088c565b34801561031557600080fd5b506102c660095481565b34801561032b57600080fd5b506102e761033a36600461221b565b61096e565b34801561034b57600080fd5b5061035f61035a366004612257565b610b35565b604051610214929190612279565b34801561037957600080fd5b506102c661020081565b6102e7610391366004612392565b610c86565b6102e7610d7f565b3480156103aa57600080fd5b506102e76103b936600461221b565b610f74565b6102e76103cc366004612094565b611067565b3480156103dd57600080fd5b506102986103ec366004612094565b61111d565b3480156103fd57600080fd5b5061020761040c3660046124ba565b611174565b34801561041d57600080fd5b506102c661042c3660046124ee565b6112e6565b34801561043d57600080fd5b5060085461023d9060ff1681565b34801561045757600080fd5b50600654610298906001600160a01b031681565b34801561047757600080fd5b50610207611349565b34801561048c57600080fd5b506102e761049b366004612509565b611356565b3480156104ac57600080fd5b506102e76104bb366004612545565b6113c2565b3480156104cc57600080fd5b506102c6665af3107a40000081565b3480156104e757600080fd5b506102c66363c99a3881565b3480156104ff57600080fd5b5061020761050e366004612094565b6114aa565b6102e76105213660046125df565b6115af565b6102e7611696565b34801561053a57600080fd5b5061023d61054936600461264a565b600560209081526000928352604080842090915290825290205460ff1681565b34801561057557600080fd5b506102c6600381565b34801561058a57600080fd5b506102e76105993660046124ee565b6116d4565b6102e761174a565b336000908152600b60205260409020546060904360089190911c036105de5760405163a5e0079160e01b815260040160405180910390fd5b60095482106106005760405163732f483160e11b815260040160405180910390fd5b6106098261177b565b92915050565b60006301ffc9a760e01b6001600160e01b03198316148061064057506380ac58cd60e01b6001600160e01b03198316145b806106095750506001600160e01b031916635b5e139f60e01b1490565b6000805461066a9061267d565b80601f01602080910402602001604051908101604052809291908181526020018280546106969061267d565b80156106e35780601f106106b8576101008083540402835291602001916106e3565b820191906000526020600020905b8154815290600101906020018083116106c657829003601f168201915b505050505081565b6040516bffffffffffffffffffffffff193360601b1660208201526000906034016040516020818303038152906040528051906020012090506107848383808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152507fea35e50958ff75fe96e04a6dd792de75a26dd0c2a2d12e8a4c485d938961eb3992508591506118519050565b6107c15760405162461bcd60e51b8152602060048201526009602482015268139bdd081bdb8815d360ba1b60448201526064015b60405180910390fd5b665af3107a40000034146107e857604051637edfcf7960e11b815260040160405180910390fd5b336000908152600b6020526040902054600f600482901c161561081e57604051633eae439d60e01b815260040160405180910390fd5b600754600003610840576040516298598d60e61b815260040160405180910390fd5b60076000815461084f906126cd565b909155506010176108664360081b60ff83166126e4565b336000818152600b60205260409020829055909150610886906001611867565b50505050565b6000818152600260205260409020546001600160a01b0316338114806108d557506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b6109125760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064016107b8565b60008281526004602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000818152600260205260409020546001600160a01b038481169116146109c45760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b60448201526064016107b8565b6001600160a01b038216610a0e5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b60448201526064016107b8565b336001600160a01b0384161480610a4857506001600160a01b038316600090815260056020908152604080832033845290915290205460ff165b80610a6957506000818152600460205260409020546001600160a01b031633145b610aa65760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064016107b8565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526002825284832080546001600160a01b03199081168317909155600490925284832080549092169091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600d6020528160005260406000208181548110610b5157600080fd5b906000526020600020906002020160009150915050806000018054610b759061267d565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba19061267d565b8015610bee5780601f10610bc357610100808354040283529160200191610bee565b820191906000526020600020905b815481529060010190602001808311610bd157829003601f168201915b505050505090806001018054610c039061267d565b80601f0160208091040260200160405190810160405280929190818152602001828054610c2f9061267d565b8015610c7c5780601f10610c5157610100808354040283529160200191610c7c565b820191906000526020600020905b815481529060010190602001808311610c5f57829003601f168201915b5050505050905082565b6006546001600160a01b03163314610cb05760405162461bcd60e51b81526004016107b8906126fc565b60005b8151811015610d7957600d60008481526020019081526020016000206040518060400160405280848481518110610cec57610cec612722565b6020026020010151600001518152602001848481518110610d0f57610d0f612722565b602090810291909101810151810151909152825460018101845560009384529281902082518051939460020290910192610d4c9284920190611ffb565b506020828101518051610d659260018501920190611ffb565b50505080610d7290612738565b9050610cb3565b505b5050565b6006546001600160a01b03163314610da95760405162461bcd60e51b81526004016107b8906126fc565b6000610db6606447612767565b610dc190600c61277b565b90506000610dd0606447612767565b610ddb90605361277b565b90506000610dea606447612767565b610df590600561277b565b604051909150600090734533d1f65906368ebfd61259daee561df3f3559d9085908381818185875af1925050503d8060008114610e4e576040519150601f19603f3d011682016040523d82523d6000602084013e610e53565b606091505b5050905080610e745760405162c0f29960e01b815260040160405180910390fd5b60405160009073888f8aa938dbb18b28bdd111fa4a0d3b8e10c8719084908381818185875af1925050503d8060008114610eca576040519150601f19603f3d011682016040523d82523d6000602084013e610ecf565b606091505b5050905080610ef05760405162c0f29960e01b815260040160405180910390fd5b60405160009073e4260df86f5261a41d19c2066f1eb2eb4f009e849086908381818185875af1925050503d8060008114610f46576040519150601f19603f3d011682016040523d82523d6000602084013e610f4b565b606091505b5050905080610f6c5760405162c0f29960e01b815260040160405180910390fd5b505050505050565b610f7f83838361096e565b6001600160a01b0382163b15806110285750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c919061279a565b6001600160e01b031916145b610d795760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b60448201526064016107b8565b60038111156110895760405163355ad2e760e01b815260040160405180910390fd5b61109a81665af3107a40000061277b565b34146110b957604051637edfcf7960e11b815260040160405180910390fd5b336000908152600b6020526040902054600f8116156110eb5760405163317f85f760e21b815260040160405180910390fd5b6001176110fe4360081b60ff83166126e4565b336000818152600b60205260409020829055909150610d7b9083611867565b6000818152600260205260409020546001600160a01b03168061116f5760405162461bcd60e51b815260206004820152600a6024820152691393d517d3525395115160b21b60448201526064016107b8565b919050565b336000908152600b60205260409020546060904360089190911c036111ac5760405163a5e0079160e01b815260040160405180910390fd5b606060005b60068160ff1610156112bd5760006111e26111dd8660ff85166111d58660016127b7565b60ff1661194d565b611a19565b905082600d60008460ff1681526020019081526020016000208260ff168154811061120f5761120f612722565b9060005260206000209060020201600101600d60008560ff1681526020019081526020016000208360ff168154811061124a5761124a612722565b906000526020600020906002020160000160405160200161126d93929190612875565b60405160208183030381529060405292508160ff166005146112ac578260405160200161129a91906128e2565b60405160208183030381529060405292505b506112b681612907565b90506111b1565b50806040516020016112cf9190612926565b604051602081830303815290604052915050919050565b60006001600160a01b03821661132d5760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b60448201526064016107b8565b506001600160a01b031660009081526003602052604090205490565b6001805461066a9061267d565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6113cd85858561096e565b6001600160a01b0384163b15806114645750604051630a85bd0160e11b808252906001600160a01b0386169063150b7a02906114159033908a9089908990899060040161295a565b6020604051808303816000875af1158015611434573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611458919061279a565b6001600160e01b031916145b6114a35760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b60448201526064016107b8565b5050505050565b606060095482106114ce5760405163732f483160e11b815260040160405180910390fd5b60006114d9836105a6565b905061159f6114e784611ad7565b600e54604051630e4b241160e11b8152611584916001600160a01b031690631c9648229061151b90899088906004016129ae565b600060405180830381865afa158015611538573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261156091908101906129c7565b6040516020016115709190612a34565b604051602081830303815290604052611bdf565b61158d84611174565b60405160200161157093929190612b21565b6040516020016112cf9190612c5b565b6006546001600160a01b031633146115d95760405162461bcd60e51b81526004016107b8906126fc565b600a5460ff16156115fd5760405163eddaeeb360e01b815260040160405180910390fd5b8281811461161e57604051637faa19c760e01b815260040160405180910390fd5b60005b818110156116815761167186868381811061163e5761163e612722565b905060200201602081019061165391906124ee565b85858481811061166557611665612722565b90506020020135611867565b61167a81612738565b9050611621565b5050600a805460ff1916600117905550505050565b6006546001600160a01b031633146116c05760405162461bcd60e51b81526004016107b8906126fc565b6008805460ff19811660ff90911615179055565b6006546001600160a01b031633146116fe5760405162461bcd60e51b81526004016107b8906126fc565b600680546001600160a01b0319166001600160a01b03831690811790915560405133907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350565b6006546001600160a01b031633146117745760405162461bcd60e51b81526004016107b8906126fc565b6000600755565b60408051602080820183526000808352848152600c909152918220546060925b60068160ff16101561184857600061271083836040516020016117d592919091825260f81b6001600160f81b031916602082015260210190565b6040516020818303038152906040528051906020012060001c6117f89190612ca0565b90508361181461180c8361ffff1685611d45565b60ff16611ad7565b604051602001611825929190612cb4565b6040516020818303038152906040529350508061184190612907565b905061179b565b50909392505050565b60008261185e8584611e19565b14949350505050565b60085460ff16158061187c57506363c99a3842105b1561189a5760405163baf13b3f60e01b815260040160405180910390fd5b806000036118bb5760405163220328c760e11b815260040160405180910390fd5b610200600754826009546118cf91906126e4565b6118d991906126e4565b11156118f8576040516352df9fe560e01b815260040160405180910390fd5b600954600061190783836126e4565b90505b808210156119455761191c8483611e5e565b6000838152600c60205260409020556119358483611ebe565b61193e82612738565b915061190a565b600955505050565b606083600061195c8585612ce3565b6001600160401b03811115611973576119736122a7565b6040519080825280601f01601f19166020018201604052801561199d576020820181803683370190505b509050845b84811015611a0f578281815181106119bc576119bc612722565b01602001516001600160f81b031916826119d68884612ce3565b815181106119e6576119e6612722565b60200101906001600160f81b031916908160001a90535080611a0781612738565b9150506119a2565b5095945050505050565b60008181805b82518160ff161015611acf576030838260ff1681518110611a4257611a42612722565b016020015160f81c10801590611a7557506039838260ff1681518110611a6a57611a6a612722565b016020015160f81c11155b15611abd57611a85600a83612cfa565b91506030838260ff1681518110611a9e57611a9e612722565b0160200151611ab0919060f81c612d23565b611aba90836127b7565b91505b80611ac781612907565b915050611a1f565b509392505050565b606081600003611afe5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611b285780611b1281612738565b9150611b219050600a83612767565b9150611b02565b6000816001600160401b03811115611b4257611b426122a7565b6040519080825280601f01601f191660200182016040528015611b6c576020820181803683370190505b5090505b8415611bd757611b81600183612ce3565b9150611b8e600a86612ca0565b611b999060306126e4565b60f81b818381518110611bae57611bae612722565b60200101906001600160f81b031916908160001a905350611bd0600a86612767565b9450611b70565b949350505050565b60608151600003611bfe57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612d646040913990506000600384516002611c2d91906126e4565b611c379190612767565b611c4290600461277b565b90506000611c518260206126e4565b6001600160401b03811115611c6857611c686122a7565b6040519080825280601f01601f191660200182016040528015611c92576020820181803683370190505b509050818152600183018586518101602084015b81831015611d005760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b93820193909352600401611ca6565b600389510660018114611d1a5760028114611d2b57611d37565b613d3d60f01b600119830152611d37565b603d60f81b6000198301525b509398975050505050505050565b6000806000600f8460ff1660068110611d6057611d60612722565b0154905060005b818160ff161015611e13576000600f8660ff1660068110611d8a57611d8a612722565b018260ff1681548110611d9f57611d9f612722565b90600052602060002090601091828204019190066002029054906101000a900461ffff1690508361ffff168710158015611de55750611dde8185612d46565b61ffff1687105b15611df557509250610609915050565b611dff8185612d46565b93505080611e0c90612907565b9050611d67565b50600080fd5b600081815b8451811015611acf57611e4a82868381518110611e3d57611e3d612722565b6020026020010151611fc9565b915080611e5681612738565b915050611e1e565b600042448484604051602001611e9f9493929190938452602084019290925260601b6bffffffffffffffffffffffff19166040830152605482015260740190565b60408051601f1981840301815291905280516020909101209392505050565b6001600160a01b038216611f085760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b60448201526064016107b8565b6000818152600260205260409020546001600160a01b031615611f5e5760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b60448201526064016107b8565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000818310611fe5576000828152602084905260409020611ff4565b60008381526020839052604090205b9392505050565b8280546120079061267d565b90600052602060002090601f016020900481019282612029576000855561206f565b82601f1061204257805160ff191683800117855561206f565b8280016001018555821561206f579182015b8281111561206f578251825591602001919060010190612054565b5061207b92915061207f565b5090565b5b8082111561207b5760008155600101612080565b6000602082840312156120a657600080fd5b5035919050565b60005b838110156120c85781810151838201526020016120b0565b838111156108865750506000910152565b600081518084526120f18160208601602086016120ad565b601f01601f19169290920160200192915050565b602081526000611ff460208301846120d9565b6001600160e01b03198116811461212e57600080fd5b50565b60006020828403121561214357600080fd5b8135611ff481612118565b60008083601f84011261216057600080fd5b5081356001600160401b0381111561217757600080fd5b6020830191508360208260051b850101111561219257600080fd5b9250929050565b600080602083850312156121ac57600080fd5b82356001600160401b038111156121c257600080fd5b6121ce8582860161214e565b90969095509350505050565b80356001600160a01b038116811461116f57600080fd5b6000806040838503121561220457600080fd5b61220d836121da565b946020939093013593505050565b60008060006060848603121561223057600080fd5b612239846121da565b9250612247602085016121da565b9150604084013590509250925092565b6000806040838503121561226a57600080fd5b50508035926020909101359150565b60408152600061228c60408301856120d9565b828103602084015261229e81856120d9565b95945050505050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b03811182821017156122df576122df6122a7565b60405290565b604051601f8201601f191681016001600160401b038111828210171561230d5761230d6122a7565b604052919050565b60006001600160401b0382111561232e5761232e6122a7565b50601f01601f191660200190565b600082601f83011261234d57600080fd5b813561236061235b82612315565b6122e5565b81815284602083860101111561237557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408084860312156123a657600080fd5b833592506020808501356001600160401b03808211156123c557600080fd5b818701915087601f8301126123d957600080fd5b8135818111156123eb576123eb6122a7565b8060051b6123fa8582016122e5565b918252838101850191858101908b84111561241457600080fd5b86860192505b838310156124a8578235858111156124325760008081fd5b8601808d03601f19018913156124485760008081fd5b6124506122bd565b88820135878111156124625760008081fd5b6124708f8b8386010161233c565b82525089820135878111156124855760008081fd5b6124938f8b8386010161233c565b828b015250835250918601919086019061241a565b80985050505050505050509250929050565b6000602082840312156124cc57600080fd5b81356001600160401b038111156124e257600080fd5b611bd78482850161233c565b60006020828403121561250057600080fd5b611ff4826121da565b6000806040838503121561251c57600080fd5b612525836121da565b91506020830135801515811461253a57600080fd5b809150509250929050565b60008060008060006080868803121561255d57600080fd5b612566866121da565b9450612574602087016121da565b93506040860135925060608601356001600160401b038082111561259757600080fd5b818801915088601f8301126125ab57600080fd5b8135818111156125ba57600080fd5b8960208285010111156125cc57600080fd5b9699959850939650602001949392505050565b600080600080604085870312156125f557600080fd5b84356001600160401b038082111561260c57600080fd5b6126188883890161214e565b9096509450602087013591508082111561263157600080fd5b5061263e8782880161214e565b95989497509550505050565b6000806040838503121561265d57600080fd5b612666836121da565b9150612674602084016121da565b90509250929050565b600181811c9082168061269157607f821691505b6020821081036126b157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816126dc576126dc6126b7565b506000190190565b600082198211156126f7576126f76126b7565b500190565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006001820161274a5761274a6126b7565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261277657612776612751565b500490565b6000816000190483118215151615612795576127956126b7565b500290565b6000602082840312156127ac57600080fd5b8151611ff481612118565b600060ff821660ff84168060ff038211156127d4576127d46126b7565b019392505050565b8054600090600181811c90808316806127f657607f831692505b6020808410820361281757634e487b7160e01b600052602260045260246000fd5b81801561282b576001811461283c57612869565b60ff19861689528489019650612869565b60008881526020902060005b868110156128615781548b820152908501908301612848565b505084890196505b50505050505092915050565b600084516128878184602089016120ad565b6e3d913a3930b4ba2fba3cb832911d1160891b9083019081526128ad600f8201866127dc565b6a1116113b30b63ab2911d1160a91b815290506128cd600b8201856127dc565b61227d60f01b81526002019695505050505050565b600082516128f48184602087016120ad565b600b60fa1b920191825250600101919050565b600060ff821660ff810361291d5761291d6126b7565b60010192915050565b605b60f81b8152600082516129428160018501602087016120ad565b605d60f81b6001939091019283015250600201919050565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b828152604060208201526000611bd760408301846120d9565b6000602082840312156129d957600080fd5b81516001600160401b038111156129ef57600080fd5b8201601f81018413612a0057600080fd5b8051612a0e61235b82612315565b818152856020838501011115612a2357600080fd5b61229e8260208301602086016120ad565b7f3c7376672076696577426f783d27302030203230203230272077696474683d2781527f36303027206865696768743d273630302720786d6c6e733d27687474703a2f2f60208201527f7777772e77332e6f72672f323030302f7376672720707265736572766541737060408201527f656374526174696f3d27784d6964594d696e273e3c726563742077696474683d60608201527f27323027206865696768743d273230272066696c6c3d27230000000000000000608082015260008251612b048160988501602087016120ad565b651e17b9bb339f60d11b6098939091019283015250609e01919050565b757b226e616d65223a2022434834314e5734563335202360501b81528351600090612b538160168501602089016120ad565b7f222c226465736372697074696f6e223a202246756c6c79206f6e636861696e206016918401918201527f67656e65726174697665206172742053564720636f6c6c656374696f6e2e204360368201527f726561746564206279204d63546f616479202620436972636f6c6f72732e220060568201527f2c22696d616765223a2022646174613a696d6167652f7376672b786d6c3b62616075820152641cd94d8d0b60da1b60958201528451612c1081609a8401602089016120ad565b6e11161130ba3a3934b13aba32b9911d60891b609a92909101918201528351612c408160a98401602088016120ad565b607d60f81b60a9929091019182015260aa0195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612c9381601d8501602087016120ad565b91909101601d0192915050565b600082612caf57612caf612751565b500690565b60008351612cc68184602088016120ad565b835190830190612cda8183602088016120ad565b01949350505050565b600082821015612cf557612cf56126b7565b500390565b600060ff821660ff84168160ff0481118215151615612d1b57612d1b6126b7565b029392505050565b600060ff821660ff841680821015612d3d57612d3d6126b7565b90039392505050565b600061ffff808316818516808303821115612cda57612cda6126b756fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220a16ad100558bec1aa07c2dbb585111b82addb6abfed4f6b7bf30663d18999e8b64736f6c634300080d0033
Verified Source Code Full Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (200 runs)
ChainWavesErrors.sol 21 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
interface ChainWavesErrors {
error SoldOut();
error NotLive();
error MintPrice();
error MaxThree();
error PublicMinted();
error SnowcrashMinted();
error NotToad();
error FreeMintDone();
error NotSnowcrashList();
error ReserveClosed();
error SelfMintOnly();
error ArrayLengths();
error NonExistantId();
error Stap();
error WithdrawFail();
error MintZero();
}
ChainWaves.sol 337 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "solmate/tokens/ERC721.sol";
import "solmate/auth/Owned.sol";
import "openzeppelin-contracts/utils/cryptography/MerkleProof.sol";
import "./AnonymiceLibrary.sol";
import "./ChainWavesGenerator.sol";
import "./ChainWavesErrors.sol";
contract ChainWaves is ChainWavesErrors, ERC721, Owned {
using AnonymiceLibrary for uint8;
struct Trait {
string traitName;
string traitType;
}
uint256 public constant MAX_SUPPLY = 512;
uint256 public constant MINT_PRICE = 0.0256 ether;
uint256 public constant MINT_START = 1674156600;
uint256 public constant MAX_MINT = 3;
uint256 public snowcrashReserve = 120;
bool public MINTING_LIVE;
uint256 public totalSupply;
// TODO: generate actual root (this is folded faces)
bytes32 constant snowcrashRoot =
0xea35e50958ff75fe96e04a6dd792de75a26dd0c2a2d12e8a4c485d938961eb39;
bool private freeMinted;
mapping(address => uint256) mintInfo;
mapping(uint256 => uint256) tokenIdToHash;
mapping(uint256 => Trait[]) public traitTypes;
//Mappings
ChainWavesGenerator chainWavesGenerator;
//uint arrays
uint16[][6] private TIERS;
constructor()
ERC721("ChainWaves", "CA")
Owned(0xB6eE8B1899e4cad7e28015995B82969e44BD0bb0)
{
chainWavesGenerator = new ChainWavesGenerator();
//Palette
TIERS[0] = [1000, 1500, 1400, 1700, 1200, 400, 400, 1600, 800];
//Noise
TIERS[1] = [1000, 4000, 4000, 1000];
//Speed
TIERS[2] = [1000, 4000, 4000, 1000];
//Char set
TIERS[3] = [2250, 2250, 2250, 2250, 600, 400];
//Detail
TIERS[4] = [1000, 6000, 3000];
//NumCols
TIERS[5] = [800, 6200, 2600, 400];
}
//prevents someone calling read functions the same block they mint
modifier disallowIfStateIsChanging() {
if ((mintInfo[msg.sender] >> 8) == block.number) revert Stap();
_;
}
/**
* @dev Converts a digit from 0 - 10000 into its corresponding rarity based on the given rarity tier.
* @param _randinput The input from 0 - 10000 to use for rarity gen.
* @param _rarityTier The tier to use.
*/
function rarityGen(uint256 _randinput, uint8 _rarityTier)
internal
view
returns (uint8)
{
uint16 currentLowerBound;
uint256 tiersLength = TIERS[_rarityTier].length;
for (uint8 i; i < tiersLength; ++i) {
uint16 thisPercentage = TIERS[_rarityTier][i];
if (
_randinput >= currentLowerBound &&
_randinput < currentLowerBound + thisPercentage
) return i;
currentLowerBound = currentLowerBound + thisPercentage;
}
revert();
}
/**
* @param _a The address to be used within the hash.
*/
function hash(address _a, uint256 _tokenId)
internal
view
returns (uint256)
{
return
uint256(
keccak256(
abi.encodePacked(
block.timestamp,
block.difficulty,
_a,
_tokenId
)
)
);
}
function normieMint(uint256 _amount) external payable {
if (_amount > MAX_MINT) revert MaxThree();
if (msg.value != MINT_PRICE * _amount) revert MintPrice();
uint256 minterInfo = mintInfo[msg.sender];
if ((minterInfo & 0xF) != 0) revert PublicMinted();
minterInfo |= 1;
minterInfo = (minterInfo & 0xFF) + (block.number << 8);
mintInfo[msg.sender] = minterInfo;
mintInternal(msg.sender, _amount);
}
// TODO: add merkle root,
function snowcrashMint(bytes32[] calldata merkleProof) external payable {
bytes32 node = keccak256(abi.encodePacked(msg.sender));
require(
MerkleProof.verify(merkleProof, snowcrashRoot, node),
"Not on WL"
);
if (msg.value != MINT_PRICE) revert MintPrice();
uint256 minterInfo = mintInfo[msg.sender];
if (((minterInfo & 0xF0) >> 4) != 0) revert SnowcrashMinted();
if (snowcrashReserve == 0) revert ReserveClosed();
--snowcrashReserve;
minterInfo |= (1 << 4);
minterInfo = (minterInfo & 0xFF) + (block.number << 8);
mintInfo[msg.sender] = minterInfo;
mintInternal(msg.sender, 1);
}
function freeMints(
address[] calldata _addresses,
uint256[] calldata _amount
) external payable onlyOwner {
if (freeMinted) revert FreeMintDone();
uint256 addressesLength = _addresses.length;
if (addressesLength != _amount.length) revert ArrayLengths();
for (uint256 i; i < addressesLength; ++i) {
mintInternal(_addresses[i], _amount[i]);
}
freeMinted = true;
}
function mintInternal(address _to, uint256 _amount) internal {
if (!MINTING_LIVE || block.timestamp < MINT_START) revert NotLive();
if (_amount == 0) revert MintZero();
if (totalSupply + _amount + snowcrashReserve > MAX_SUPPLY)
revert SoldOut();
uint256 nextTokenId = totalSupply;
uint256 newTotalSupply = totalSupply + _amount;
for (; nextTokenId < newTotalSupply; ++nextTokenId) {
tokenIdToHash[nextTokenId] = hash(_to, nextTokenId);
_mint(_to, nextTokenId);
}
totalSupply = newTotalSupply;
}
// hash stuff
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
* From anonymice
*/
function buildHash(uint256 _t) internal view returns (string memory) {
// This will generate a 4 character string.
string memory currentHash = "";
uint256 tokenHash = tokenIdToHash[_t];
for (uint8 i; i < 6; ++i) {
uint16 _randinput = uint16(
uint256(keccak256(abi.encodePacked(tokenHash, i))) % 10000
);
currentHash = string(
abi.encodePacked(
currentHash,
rarityGen(_randinput, i).toString()
)
);
}
return currentHash;
}
// Views
function hashToMetadata(string memory _hash)
public
view
disallowIfStateIsChanging
returns (string memory)
{
string memory metadataString;
for (uint8 i; i < 6; ++i) {
uint8 thisTraitIndex = AnonymiceLibrary.parseInt(
AnonymiceLibrary.substring(_hash, i, i + 1)
);
metadataString = string(
abi.encodePacked(
metadataString,
'{"trait_type":"',
traitTypes[i][thisTraitIndex].traitType,
'","value":"',
traitTypes[i][thisTraitIndex].traitName,
'"}'
)
);
if (i != 5)
metadataString = string(abi.encodePacked(metadataString, ","));
}
return string(abi.encodePacked("[", metadataString, "]"));
}
function _tokenIdToHash(uint256 _tokenId)
public
view
disallowIfStateIsChanging
returns (string memory tokenHash)
{
if (_tokenId >= totalSupply) revert NonExistantId();
tokenHash = buildHash(_tokenId);
}
function tokenURI(uint256 _tokenId)
public
view
override
returns (string memory _URI)
{
if (_tokenId >= totalSupply) revert NonExistantId();
string memory _hash = _tokenIdToHash(_tokenId);
_URI = string(
abi.encodePacked(
"data:application/json;base64,",
AnonymiceLibrary.encode(
bytes(
string(
abi.encodePacked(
'{"name": "CH41NW4V35 #',
AnonymiceLibrary.toString(_tokenId),
'","description": "Fully onchain generative art SVG collection. Created by McToady & Circolors."',
',"image": "data:image/svg+xml;base64,',
AnonymiceLibrary.encode(
bytes(
abi.encodePacked(
"<svg viewBox='0 0 20 20' width='600' height='600' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='xMidYMin'><rect width='20' height='20' fill='#",
chainWavesGenerator.buildSVG(
_tokenId,
_hash
),
"</svg>"
)
)
),
'","attributes":',
hashToMetadata(_hash),
"}"
)
)
)
)
)
);
}
// Owner Functions
/**
* @dev Add a trait type
* @param _traitTypeIndex The trait type index
* @param traits Array of traits to add
*/
function addTraitType(uint256 _traitTypeIndex, Trait[] memory traits)
external
payable
onlyOwner
{
for (uint256 i; i < traits.length; ++i) {
traitTypes[_traitTypeIndex].push(
Trait(traits[i].traitName, traits[i].traitType)
);
}
return;
}
function flipMint() external payable onlyOwner {
MINTING_LIVE = !MINTING_LIVE;
}
function withdraw() external payable onlyOwner {
uint256 twelve = (address(this).balance / 100) * 12;
uint256 eightythree = (address(this).balance / 100) * 83;
uint256 five = (address(this).balance / 100) * 5;
(bool sentI, ) = payable(
address(0x4533d1F65906368ebfd61259dAee561DF3f3559D)
).call{value: twelve}("");
if (!sentI) revert WithdrawFail();
(bool sentC, ) = payable(
address(0x888f8AA938dbb18b28bdD111fa4A0D3B8e10C871)
).call{value: five}("");
if (!sentC) revert WithdrawFail();
(bool sentT, ) = payable(
address(0xE4260Df86f5261A41D19c2066f1Eb2Eb4F009e84)
).call{value: eightythree}("");
if (!sentT) revert WithdrawFail();
}
function wipeSnowcrashReserve() external payable onlyOwner {
snowcrashReserve = 0;
}
}
ERC721.sol 231 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721 {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 indexed id);
event Approval(address indexed owner, address indexed spender, uint256 indexed id);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/*//////////////////////////////////////////////////////////////
METADATA STORAGE/LOGIC
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
function tokenURI(uint256 id) public view virtual returns (string memory);
/*//////////////////////////////////////////////////////////////
ERC721 BALANCE/OWNER STORAGE
//////////////////////////////////////////////////////////////*/
mapping(uint256 => address) internal _ownerOf;
mapping(address => uint256) internal _balanceOf;
function ownerOf(uint256 id) public view virtual returns (address owner) {
require((owner = _ownerOf[id]) != address(0), "NOT_MINTED");
}
function balanceOf(address owner) public view virtual returns (uint256) {
require(owner != address(0), "ZERO_ADDRESS");
return _balanceOf[owner];
}
/*//////////////////////////////////////////////////////////////
ERC721 APPROVAL STORAGE
//////////////////////////////////////////////////////////////*/
mapping(uint256 => address) public getApproved;
mapping(address => mapping(address => bool)) public isApprovedForAll;
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
}
/*//////////////////////////////////////////////////////////////
ERC721 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 id) public virtual {
address owner = _ownerOf[id];
require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED");
getApproved[id] = spender;
emit Approval(owner, spender, id);
}
function setApprovalForAll(address operator, bool approved) public virtual {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function transferFrom(
address from,
address to,
uint256 id
) public virtual {
require(from == _ownerOf[id], "WRONG_FROM");
require(to != address(0), "INVALID_RECIPIENT");
require(
msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id],
"NOT_AUTHORIZED"
);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
unchecked {
_balanceOf[from]--;
_balanceOf[to]++;
}
_ownerOf[id] = to;
delete getApproved[id];
emit Transfer(from, to, id);
}
function safeTransferFrom(
address from,
address to,
uint256 id
) public virtual {
transferFrom(from, to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
function safeTransferFrom(
address from,
address to,
uint256 id,
bytes calldata data
) public virtual {
transferFrom(from, to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
/*//////////////////////////////////////////////////////////////
ERC165 LOGIC
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
}
/*//////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 id) internal virtual {
require(to != address(0), "INVALID_RECIPIENT");
require(_ownerOf[id] == address(0), "ALREADY_MINTED");
// Counter overflow is incredibly unrealistic.
unchecked {
_balanceOf[to]++;
}
_ownerOf[id] = to;
emit Transfer(address(0), to, id);
}
function _burn(uint256 id) internal virtual {
address owner = _ownerOf[id];
require(owner != address(0), "NOT_MINTED");
// Ownership check above ensures no underflow.
unchecked {
_balanceOf[owner]--;
}
delete _ownerOf[id];
delete getApproved[id];
emit Transfer(owner, address(0), id);
}
/*//////////////////////////////////////////////////////////////
INTERNAL SAFE MINT LOGIC
//////////////////////////////////////////////////////////////*/
function _safeMint(address to, uint256 id) internal virtual {
_mint(to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
function _safeMint(
address to,
uint256 id,
bytes memory data
) internal virtual {
_mint(to, id);
require(
to.code.length == 0 ||
ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
ERC721TokenReceiver.onERC721Received.selector,
"UNSAFE_RECIPIENT"
);
}
}
/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver {
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external virtual returns (bytes4) {
return ERC721TokenReceiver.onERC721Received.selector;
}
}
Owned.sol 44 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;
/// @notice Simple single owner authorization mixin.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)
abstract contract Owned {
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event OwnershipTransferred(address indexed user, address indexed newOwner);
/*//////////////////////////////////////////////////////////////
OWNERSHIP STORAGE
//////////////////////////////////////////////////////////////*/
address public owner;
modifier onlyOwner() virtual {
require(msg.sender == owner, "UNAUTHORIZED");
_;
}
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(address _owner) {
owner = _owner;
emit OwnershipTransferred(address(0), _owner);
}
/*//////////////////////////////////////////////////////////////
OWNERSHIP LOGIC
//////////////////////////////////////////////////////////////*/
function transferOwnership(address newOwner) public virtual onlyOwner {
owner = newOwner;
emit OwnershipTransferred(msg.sender, newOwner);
}
}
MerkleProof.sol 223 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
AnonymiceLibrary.sol 146 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
library AnonymiceLibrary {
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;
}
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
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);
}
function parseInt(string memory _a)
internal
pure
returns (uint8 _parsedInt)
{
bytes memory bresult = bytes(_a);
uint8 mint = 0;
for (uint8 i = 0; i < bresult.length; i++) {
if (
(uint8(uint8(bresult[i])) >= 48) &&
(uint8(uint8(bresult[i])) <= 57)
) {
mint *= 10;
mint += uint8(bresult[i]) - 48;
}
}
return mint;
}
function substring(
string memory str,
uint256 startIndex,
uint256 endIndex
) internal pure returns (string memory) {
bytes memory strBytes = bytes(str);
bytes memory result = new bytes(endIndex - startIndex);
for (uint256 i = startIndex; i < endIndex; i++) {
result[i - startIndex] = strBytes[i];
}
return string(result);
}
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;
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
ChainWavesGenerator.sol 185 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "./AnonymiceLibrary.sol";
contract ChainWavesGenerator {
using AnonymiceLibrary for uint8;
string[][9] private PALETTES;
uint256[] private NOISE;
uint256[] private SPEED;
string[] private CHARS;
uint256[] private TIGHTNESS;
struct Traits {
string[] palette;
uint256 noise;
uint256 speed;
string charSet;
uint256 tightness;
uint256 numCols;
}
constructor() {
//lava
PALETTES[0] = ["d00000", "370617", "faa307", "e85d04", "03071e"];
//flamingo
PALETTES[1] = ["3a0ca3", "f72585", "4cc9f0", "7209b7", "4cc9f0"];
//rioja
PALETTES[2] = ["250902", "38040e", "640d14", "800e13", "ad2831"];
//forest
PALETTES[3] = ["013026", "a1ce3f", "107e57", "014760", "cbe58e"];
//samba
PALETTES[4] = ["009638", "F6D800", "002672", "fff", "f8961e"];
//pepewaves
PALETTES[5] = ["23B024", "F02423", "294AF6", "fff", "000"];
//cow
PALETTES[6] = ["aabf98", "1f1f1f", "f2f2f2", "b5caa3", "20251e"];
//pastelize
PALETTES[7] = ["7067cf", "b7c0ee", "cbf3d2", "f87575", "ef626c"];
//dank
PALETTES[8] = ["414Cb3", "06061a", "e80663", "fff", "ff0066"];
NOISE = [20, 35, 55, 85];
SPEED = [95, 75, 50, 25];
CHARS = ["#83!:", "@94?;", "W72a+", "N$50c", "0101/", "gm;)'"];
TIGHTNESS = [2, 3, 5];
}
struct Palette {
bytes3 bg;
bytes3 colOne;
bytes3 colTwo;
}
function buildLine(
string memory _chars,
uint256 _modJump,
uint8 _x,
uint8 _y
) public pure returns (string memory lineOut) {
bytes memory byteChars = bytes(_chars);
uint256 randomModulo = 1;
lineOut = string(
abi.encodePacked(
"<text x ='-",
_x.toString(),
"' y='",
_y.toString(),
"'>"
)
);
for (uint256 i; i < 12; ++i) {
string memory charChoice = string(
abi.encodePacked(byteChars[randomModulo % 4])
);
lineOut = string(abi.encodePacked(lineOut, charChoice));
randomModulo += _modJump;
}
lineOut = string(abi.encodePacked(lineOut, "</text>"));
}
function buildXLines(
string memory _chars,
uint256 _modStart,
uint256 numLines
) public pure returns (string memory lineOut) {
uint8 x = 1;
uint8 y;
for (uint256 i; i < numLines; ++i) {
lineOut = string(
abi.encodePacked(lineOut, buildLine(_chars, _modStart, x, y))
);
_modStart += 7;
y += 4;
if (x == 1) {
x = 3;
} else {
x = 1;
}
}
}
function buildSVG(uint256 _tokenId, string memory _hash)
public
view
returns (string memory _svg)
{
// get traits from id
Traits memory tokenTraits = buildTraits(_hash);
uint256 modStart = tokenTraits.noise + tokenTraits.tightness;
_svg = string(
abi.encodePacked(
tokenTraits.palette[0],
"'/><defs><g id='chars' font-family='monospace'>",
buildXLines(
tokenTraits.charSet,
modStart,
10 - tokenTraits.numCols
),
"<animate attributeName='font-size' attributeType='XML' values='100%;",
AnonymiceLibrary.toString(tokenTraits.speed),
"%;100%' begin='0s' dur='15s' repeatCount='indefinite'/></g><filter id='turbulence'><feTurbulence type='turbulence' baseFrequency='0.",
AnonymiceLibrary.toString(tokenTraits.noise),
"' numOctaves='",
AnonymiceLibrary.toString(tokenTraits.tightness),
"' result='noise' seed='",
AnonymiceLibrary.toString(_tokenId),
buildUseLines(tokenTraits.palette, tokenTraits.numCols)
)
);
}
function buildTraits(string memory _hash)
public
view
returns (Traits memory tokenTraits)
{
uint256[] memory traitArray = new uint256[](6);
for (uint256 i; i < 6; ++i) {
traitArray[i] = AnonymiceLibrary.parseInt(
AnonymiceLibrary.substring(_hash, i, i + 1)
);
}
tokenTraits = Traits(
PALETTES[traitArray[0]],
NOISE[traitArray[1]],
SPEED[traitArray[2]],
CHARS[traitArray[3]],
TIGHTNESS[traitArray[4]],
traitArray[5] + 1
);
// Go palettes array and return this palette
}
function buildUseLines(string[] memory _pal, uint256 _numCols)
internal
pure
returns (string memory output)
{
output = "'/><feDisplacementMap in='SourceGraphic' in2='noise' scale='3' /></filter></defs>";
uint256 y;
for (uint256 i; i < _numCols; ++i) {
output = string(
abi.encodePacked(
output,
"<use href='#chars' y='",
AnonymiceLibrary.toString(y),
"' x='0' filter='url(#turbulence)' width='20' height='20' fill='#",
_pal[i + 1],
"'/>"
)
);
y += 3;
}
}
}
Read Contract
MAX_MINT 0xf0292a03 → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
MINTING_LIVE 0x72f90ac1 → bool
MINT_PRICE 0xc002d23d → uint256
MINT_START 0xc6374d0c → uint256
_tokenIdToHash 0x005ea307 → string
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
hashToMetadata 0x66e33870 → string
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
snowcrashReserve 0x08338e4b → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
traitTypes 0x2fb098d2 → string, string
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
addTraitType 0x685bcb16
uint256 _traitTypeIndex
tuple[] traits
approve 0x095ea7b3
address spender
uint256 id
flipMint 0xd2ed5c59
No parameters
freeMints 0xd06aec21
address[] _addresses
uint256[] _amount
normieMint 0x52f0dc9b
uint256 _amount
safeTransferFrom 0x42842e0e
address from
address to
uint256 id
safeTransferFrom 0xb88d4fde
address from
address to
uint256 id
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
snowcrashMint 0x08871ceb
bytes32[] merkleProof
transferFrom 0x23b872dd
address from
address to
uint256 id
transferOwnership 0xf2fde38b
address newOwner
wipeSnowcrashReserve 0xf756b53e
No parameters
withdraw 0x3ccfd60b
No parameters
Recent Transactions
This address has 2 on-chain transactions, but only 0.9% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →