Address Contract Verified
Address
0x2Bb501A0374ff3Af41f2009509E9D6a36D56A6c0
Balance
0 ETH
Nonce
1
Code Size
14305 bytes
Creator
0x6b8C6E15...6799 at tx 0x17e4a2df...964426
Indexed Transactions
0
Contract Bytecode
14305 bytes
0x60806040526004361061025c5760003560e01c806370a0823111610144578063c2eb764d116100b6578063d943f65f1161007a578063d943f65f1461072a578063e43252d71461074a578063e8a3d4851461076a578063e985e9c51461077f578063f2fde38b1461079f578063f3fef3a3146107bf57600080fd5b8063c2eb764d1461068a578063c87b56dd1461069d578063cad96cca146106bd578063d3ad3c19146106ea578063d5f2c7561461070a57600080fd5b80638da5cb5b116101085780638da5cb5b146105ee5780638de932221461060c578063911927651461061f57806395d89b4114610635578063a22cb4651461064a578063b88d4fde1461066a57600080fd5b806370a0823114610564578063715018a6146105845780637c461e181461059957806389e877a3146105b95780638ab1d681146105ce57600080fd5b806342966c68116101dd5780636352211e116101a15780636352211e146104af5780636a3705e5146104cf5780636a627842146104ef5780636c1438621461050f5780636c79af10146105245780636e3b5c121461054457600080fd5b806342966c68146103f457806347c8ff5e146104145780634eef87c4146104345780635aae4a46146104615780635b8d02d71461048f57600080fd5b806323b872dd1161022457806323b872dd1461034b5780632a55205a1461036b5780633597d7f3146103aa57806341c0e1b5146103bf57806342842e0e146103d457600080fd5b806301ffc9a71461026157806306fdde0314610296578063081812fc146102b8578063095ea7b3146102f057806309fd821214610312575b600080fd5b34801561026d57600080fd5b5061028161027c3660046130d5565b6107df565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ab610891565b60405161028d9190613376565b3480156102c457600080fd5b506102d86102d3366004613144565b610923565b6040516001600160a01b03909116815260200161028d565b3480156102fc57600080fd5b5061031061030b366004612ec3565b6109b0565b005b34801561031e57600080fd5b5061028161032d366004612ea6565b6001600160a01b031660009081526008602052604090205460ff1690565b34801561035757600080fd5b50610310610366366004612f28565b610ac6565b34801561037757600080fd5b5061038b61038636600461315d565b610af7565b604080516001600160a01b03909316835260208301919091520161028d565b3480156103b657600080fd5b50610310610b8b565b3480156103cb57600080fd5b50610310610be3565b3480156103e057600080fd5b506103106103ef366004612f28565b610c10565b34801561040057600080fd5b5061031061040f366004613144565b610c2b565b34801561042057600080fd5b5061031061042f36600461310f565b610ce6565b34801561044057600080fd5b5061045461044f36600461310f565b610d22565b60405161028d91906132c3565b34801561046d57600080fd5b5061048161047c366004613144565b610e29565b60405190815260200161028d565b34801561049b57600080fd5b50600c546102d8906001600160a01b031681565b3480156104bb57600080fd5b506102d86104ca366004613144565b610eac565b3480156104db57600080fd5b506104546104ea36600461317f565b610f23565b3480156104fb57600080fd5b5061048161050a366004612ea6565b611141565b34801561051b57600080fd5b50610481611176565b34801561053057600080fd5b5061031061053f36600461301c565b611186565b34801561055057600080fd5b5061031061055f366004612ea6565b6112d7565b34801561057057600080fd5b5061048161057f366004612ea6565b611393565b34801561059057600080fd5b5061031061141a565b3480156105a557600080fd5b506102816105b4366004612ea6565b611450565b3480156105c557600080fd5b5061031061146e565b3480156105da57600080fd5b506103106105e9366004612ea6565b6114c5565b3480156105fa57600080fd5b506006546001600160a01b03166102d8565b61028161061a366004612ec3565b611582565b34801561062b57600080fd5b506104816105dc81565b34801561064157600080fd5b506102ab611735565b34801561065657600080fd5b50610310610665366004612fe9565b611744565b34801561067657600080fd5b50610310610685366004612f69565b611809565b610281610698366004612ec3565b611841565b3480156106a957600080fd5b506102ab6106b8366004613144565b611a1c565b3480156106c957600080fd5b506106dd6106d8366004613144565b611acf565b60405161028d9190613310565b3480156106f657600080fd5b50610310610705366004612ea6565b611bb7565b34801561071657600080fd5b506102ab61072536600461319a565b611c73565b34801561073657600080fd5b506103106107453660046131cd565b611dcd565b34801561075657600080fd5b50610310610765366004612ea6565b611ef3565b34801561077657600080fd5b506102ab611fb7565b34801561078b57600080fd5b5061028161079a366004612eef565b611fc6565b3480156107ab57600080fd5b506103106107ba366004612ea6565b611ff4565b3480156107cb57600080fd5b506103106107da366004612ec3565b61208f565b60006001600160e01b031982166301ffc9a760e01b148061081057506001600160e01b0319821663656cb66560e11b145b8061082b57506001600160e01b031982166380ac58cd60e01b145b8061084657506001600160e01b03198216635b5e139f60e01b145b8061086157506001600160e01b0319821663780e9d6360e01b145b8061087c57506001600160e01b0319821663152a902d60e11b145b8061088b575061088b8261214d565b92915050565b6060600080546108a09061367c565b80601f01602080910402602001604051908101604052809291908181526020018280546108cc9061367c565b80156109195780601f106108ee57610100808354040283529160200191610919565b820191906000526020600020905b8154815290600101906020018083116108fc57829003601f168201915b5050505050905090565b600061092e8261219d565b6109945760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006109bb82610eac565b9050806001600160a01b0316836001600160a01b03161415610a295760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161098b565b336001600160a01b0382161480610a455750610a458133611fc6565b610ab75760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161098b565b610ac183836121ba565b505050565b610ad03382612228565b610aec5760405162461bcd60e51b815260040161098b9061348b565b610ac18383836122f2565b6000808380600111158015610b0e57506103788111155b610b5a5760405162461bcd60e51b815260206004820152601b60248201527f4b6173626565724d6164653732313a20746f6b656e4964204f4f420000000000604482015260640161098b565b6000610b73610b6b866105dc61249d565b6127106124b0565b600c546001600160a01b031697909650945050505050565b610b9433611450565b610bb05760405162461bcd60e51b815260040161098b906134dc565b60095460ff161515600114610bd75760405162461bcd60e51b815260040161098b9061352b565b6009805460ff19169055565b6006546001600160a01b03163314610c0d5760405162461bcd60e51b815260040161098b90613427565b33ff5b610ac183838360405180602001604052806000815250611809565b610c3433611450565b80610c585750610c4381610eac565b6001600160a01b0316336001600160a01b0316145b610caf5760405162461bcd60e51b815260206004820152602260248201527f4b6173626565723732313a206e6f74206f776e6572206f7220696e2073717561604482015261321760f11b606482015260840161098b565b610cb8816124bc565b60405181907f73e94ba5e807ee3b36c6fb070ffa581dca869275b98a3778a32721a55824a7c490600090a250565b610cef33611450565b610d0b5760405162461bcd60e51b815260040161098b906134dc565b8051610d1e90600b906020840190612d84565b5050565b6060610d2d82612563565b610d725760405162461bcd60e51b81526020600482015260166024820152750a0d8eace7440dcdedccaf0d2e6e8cadce840d0c2e6d60531b604482015260640161098b565b60408051610378808252616f20820190925260009160208201616f0080368337019050509050600160005b600a548261ffff1611610e2057610dc0610dba8361ffff16612685565b8661290e565b15610e0e57610dd28261ffff16610eac565b838261ffff1681518110610de857610de8613754565b6001600160a01b039092166020928302919091019091015280610e0a816136b1565b9150505b81610e18816136b1565b925050610d9d565b50909392505050565b600081610e358161219d565b610e7b5760405162461bcd60e51b815260206004820152601760248201527628363ab39d103737b732bc34b9ba32b73a103a37b5b2b760491b604482015260640161098b565b6000838152602560205260409020546201518090610e999042613639565b610ea39190613606565b91505b50919050565b6000818152600260205260408120546001600160a01b03168061088b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161098b565b60608160028160ff161115610f4a5760405162461bcd60e51b815260040161098b9061345c565b60408051610378808252616f20820190925260009160208201616f008036833701905050905060008060ff86166110175760b191505b6103788261ffff161161101257610f986058836136f3565b61ffff1615801590610fb25750610fb28261ffff1661219d565b1561100057610fc48261ffff16610eac565b838261ffff1681518110610fda57610fda613754565b6001600160a01b039092166020928302919091019091015280610ffc816136b1565b9150505b8161100a816136b1565b925050610f80565b611137565b8560ff16600114156110a157600191505b60b08261ffff1611611012576110418261ffff1661219d565b1561108f576110538261ffff16610eac565b838261ffff168151811061106957611069613754565b6001600160a01b03909216602092830291909101909101528061108b816136b1565b9150505b81611099816136b1565b925050611028565b60b191505b6103788261ffff1611611137576110be6058836136f3565b61ffff161580156110d757506110d78261ffff1661219d565b15611125576110e98261ffff16610eac565b838261ffff16815181106110ff576110ff613754565b6001600160a01b039092166020928302919091019091015280611121816136b1565b9150505b8161112f816136b1565b9250506110a6565b5090949350505050565b600061114c33611450565b6111685760405162461bcd60e51b815260040161098b906134dc565b61088b82612943565b919050565b6000611181600a5490565b905090565b61118f33611450565b6111ab5760405162461bcd60e51b815260040161098b906134dc565b60018151116112175760405162461bcd60e51b815260206004820152603260248201527f4b617362656572416363657373436f6e74726f6c3a207573652060616464546f60448201527115da1a5d195b1a5cdd18081a5b9cdd19585960721b606482015260840161098b565b60005b81518160ff161015610d1e5760086000838360ff168151811061123f5761123f613754565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff166112c557600160086000848460ff168151811061128557611285613754565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806112cf816136d3565b91505061121a565b6006546001600160a01b031633146113015760405162461bcd60e51b815260040161098b90613427565b61130a81611450565b6113725760405162461bcd60e51b815260206004820152603360248201527f4b617362656572416363657373436f6e74726f6c3a204164647265737320616c6044820152723932b0b23c903737ba1034b71039b8bab0b21760691b606482015260840161098b565b6001600160a01b03166000908152600760205260409020805460ff19169055565b60006001600160a01b0382166113fe5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161098b565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b031633146114445760405162461bcd60e51b815260040161098b90613427565b61144e60006129e0565b565b6001600160a01b031660009081526007602052604090205460ff1690565b61147733611450565b6114935760405162461bcd60e51b815260040161098b906134dc565b60095460ff16156114b65760405162461bcd60e51b815260040161098b906133db565b6009805460ff19166001179055565b6114ce33611450565b6114ea5760405162461bcd60e51b815260040161098b906134dc565b6001600160a01b03811660009081526008602052604090205460ff166115615760405162461bcd60e51b815260206004820152602660248201527f4b617362656572416363657373436f6e74726f6c3a206e6f7420696e207768696044820152651d195b1a5cdd60d21b606482015260840161098b565b6001600160a01b03166000908152600860205260409020805460ff19169055565b60095460009060ff16156115a85760405162461bcd60e51b815260040161098b906133db565b81806001111580156115bb575060088111155b6116075760405162461bcd60e51b815260206004820152601a60248201527f506c75673a206d696e74206265747765656e203120616e642038000000000000604482015260640161098b565b8261037881611615600a5490565b61161f91906135ee565b111561163d5760405162461bcd60e51b815260040161098b90613575565b61164f67013b7b21280e00008561361a565b3410156116975760405162461bcd60e51b815260206004820152601660248201527528363ab39d103737ba1032b737bab3b41032ba3432b960511b604482015260640161098b565b34156116fd5760006116bb6116b48667013b7b21280e000061361a565b3490612a32565b905080156116fb576040516001600160a01b0387169082156108fc029083906000818181858888f193505050501580156116f9573d6000803e3d6000fd5b505b505b60005b848160ff1610156117275761171486612943565b508061171f816136d3565b915050611700565b60019350505b505092915050565b6060600180546108a09061367c565b6001600160a01b03821633141561179d5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161098b565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6118133383612228565b61182f5760405162461bcd60e51b815260040161098b9061348b565b61183b84848484612a3e565b50505050565b60095460009060ff16151560011461186b5760405162461bcd60e51b815260040161098b9061352b565b8261188e816001600160a01b031660009081526008602052604090205460ff1690565b61189757600080fd5b82806001111580156118aa575060088111155b6118f65760405162461bcd60e51b815260206004820152601a60248201527f506c75673a206d696e74206265747765656e203120616e642038000000000000604482015260640161098b565b8361037881611904600a5490565b61190e91906135ee565b111561192c5760405162461bcd60e51b815260040161098b90613575565b61193e67013b7b21280e00008661361a565b3410156119865760405162461bcd60e51b815260206004820152601660248201527528363ab39d103737ba1032b737bab3b41032ba3432b960511b604482015260640161098b565b34156119e55760006119a36116b48767013b7b21280e000061361a565b905080156119e3576040516001600160a01b0388169082156108fc029083906000818181858888f193505050501580156119e1573d6000803e3d6000fd5b505b505b60005b858160ff161015611a0f576119fc87612943565b5080611a07816136d3565b9150506119e8565b5060019695505050505050565b606081611a288161219d565b611a6e5760405162461bcd60e51b815260206004820152601760248201527628363ab39d103737b732bc34b9ba32b73a103a37b5b2b760491b604482015260640161098b565b6000611a94604080518082019091526007815266697066733a2f2f60c81b602082015290565b90506000611aa185612685565b90508181604051602001611ab6929190613257565b6040516020818303038152906040529350505050919050565b60608180600111158015611ae557506103788111155b611b315760405162461bcd60e51b815260206004820152601b60248201527f4b6173626565724d6164653732313a20746f6b656e4964204f4f420000000000604482015260640161098b565b604080516001808252818301909252600091816020015b6040805180820190915260008082526020820152815260200190600190039081611b4857505060408051808201909152600c546001600160a01b031681526105dc60208201528151919250908290600090611ba557611ba5613754565b60209081029190910101529392505050565b6006546001600160a01b03163314611be15760405162461bcd60e51b815260040161098b90613427565b611bea81611450565b15611c4f5760405162461bcd60e51b815260206004820152602f60248201527f4b617362656572416363657373436f6e74726f6c3a204164647265737320616c60448201526e3932b0b23c9034b71039b8bab0b21760891b606482015260840161098b565b6001600160a01b03166000908152600760205260409020805460ff19166001179055565b60608260028160ff161115611c9a5760405162461bcd60e51b815260040161098b9061345c565b8260088160ff1610611ce65760405162461bcd60e51b815260206004820152601560248201527425b0b9b132b2b91b99189d1034b73232bc1027a7a160591b604482015260640161098b565b60ff8516611d9557600d8460ff1660088110611d0457611d04613754565b018054611d109061367c565b80601f0160208091040260200160405190810160405280929190818152602001828054611d3c9061367c565b8015611d895780601f10611d5e57610100808354040283529160200191611d89565b820191906000526020600020905b815481529060010190602001808311611d6c57829003601f168201915b5050505050925061172d565b8460ff1660011415611db75760158460ff1660088110611d0457611d04613754565b601d8460ff1660088110611d0457611d04613754565b611dd633611450565b611df25760405162461bcd60e51b815260040161098b906134dc565b8260028160ff161115611e175760405162461bcd60e51b815260040161098b9061345c565b8260088160ff1610611e635760405162461bcd60e51b815260206004820152601560248201527425b0b9b132b2b91b99189d1034b73232bc1027a7a160591b604482015260640161098b565b60ff8516611e9c5782600d8560ff1660088110611e8257611e82613754565b019080519060200190611e96929190612d84565b50611eec565b8460ff1660011415611ebf578260158560ff1660088110611e8257611e82613754565b82601d8560ff1660088110611ed657611ed6613754565b019080519060200190611eea929190612d84565b505b5050505050565b611efc33611450565b611f185760405162461bcd60e51b815260040161098b906134dc565b6001600160a01b03811660009081526008602052604090205460ff1615611f935760405162461bcd60e51b815260206004820152602960248201527f4b617362656572416363657373436f6e74726f6c3a20616c72656164792077686044820152681a5d195b1a5cdd195960ba1b606482015260840161098b565b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b6060600b80546108a09061367c565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6006546001600160a01b0316331461201e5760405162461bcd60e51b815260040161098b90613427565b6001600160a01b0381166120835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161098b565b61208c816129e0565b50565b61209833611450565b6120b45760405162461bcd60e51b815260040161098b906134dc565b478111156121175760405162461bcd60e51b815260206004820152602a60248201527f4b6173626565723732313a20496e73756666696369656e742066756e647320746044820152696f20776974686472617760b01b606482015260840161098b565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610ac1573d6000803e3d6000fd5b60006001600160e01b031982166380ac58cd60e01b148061217e57506001600160e01b03198216635b5e139f60e01b145b8061088b57506301ffc9a760e01b6001600160e01b031983161461088b565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906121ef82610eac565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006122338261219d565b6122945760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161098b565b600061229f83610eac565b9050806001600160a01b0316846001600160a01b031614806122da5750836001600160a01b03166122cf84610923565b6001600160a01b0316145b806122ea57506122ea8185611fc6565b949350505050565b826001600160a01b031661230582610eac565b6001600160a01b03161461236d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161098b565b6001600160a01b0382166123cf5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161098b565b6123da838383612a71565b6123e56000826121ba565b6001600160a01b038316600090815260036020526040812080546001929061240e908490613639565b90915550506001600160a01b038216600090815260036020526040812080546001929061243c9084906135ee565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006124a9828461361a565b9392505050565b60006124a98284613606565b60006124c782610eac565b90506124d581600084612a71565b6124e06000836121ba565b6001600160a01b0381166000908152600360205260408120805460019290612509908490613639565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000805b60088160ff16101561267c5761261c83600d8360ff166008811061258d5761258d613754565b0180546125999061367c565b80601f01602080910402602001604051908101604052809291908181526020018280546125c59061367c565b80156126125780601f106125e757610100808354040283529160200191612612565b820191906000526020600020905b8154815290600101906020018083116125f557829003601f168201915b505050505061290e565b8061263c575061263c8360158360ff166008811061258d5761258d613754565b8061265c575061265c83601d8360ff166008811061258d5761258d613754565b1561266a5750600192915050565b80612674816136d3565b915050612567565b50600092915050565b60606126908261219d565b6126a857505060408051602081019091526000815290565b60006126b383610e29565b905061022d811061277e5760b0831161275d57601560075b0180546126d79061367c565b80601f01602080910402602001604051908101604052809291908181526020018280546127039061367c565b80156127505780601f1061272557610100808354040283529160200191612750565b820191906000526020600020905b81548152906001019060200180831161273357829003601f168201915b5050505050915050919050565b612768605884613714565b61277557601d60076126cb565b600d60076126cb565b61016881106127b95760b0831161279857601560066126cb565b6127a3605884613714565b6127b057601d60066126cb565b600d60066126cb565b61012c81106127f45760b083116127d357601560056126cb565b6127de605884613714565b6127eb57601d60056126cb565b600d60056126cb565b60f0811061282e5760b0831161280d57601560046126cb565b612818605884613714565b61282557601d60046126cb565b600d60046126cb565b60b481106128685760b0831161284757601560036126cb565b612852605884613714565b61285f57601d60036126cb565b600d60036126cb565b607881106128a25760b0831161288157601560026126cb565b61288c605884613714565b61289957601d60026126cb565b600d60026126cb565b603c81106128dc5760b083116128bb57601560016126cb565b6128c6605884613714565b6128d357601d60016126cb565b600d60016126cb565b60b083116128ed57601560006126cb565b6128f8605884613714565b61290557601d60006126cb565b600d60006126cb565b8051825160009184918491146129295760009250505061088b565b80805190602001208280519060200120149250505061088b565b6000600161037881612954600a5490565b61295e91906135ee565b111561297c5760405162461bcd60e51b815260040161098b90613575565b61298a600a80546001019055565b6000612995600a5490565b90506129a18482612aeb565b6000818152602560205260408082204290555182917f13fa860159ae1884a33ae74731c54c551a1bb60e82041df5567301398d93911e91a29392505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006124a98284613639565b612a498484846122f2565b612a5584848484612b05565b61183b5760405162461bcd60e51b815260040161098b90613389565b612a7a8161219d565b8015612a8f575061022d612a8d82610e29565b105b15612aa65760008181526025602052604090204290555b816001600160a01b0316836001600160a01b03167feb7ac0e701265b69c6dc323e53b38160716fd18681b7f80942549e1c70b4ccfd60405160405180910390a3505050565b610d1e828260405180602001604052806000815250612c12565b60006001600160a01b0384163b15612c0757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b49903390899088908890600401613286565b602060405180830381600087803b158015612b6357600080fd5b505af1925050508015612b93575060408051601f3d908101601f19168201909252612b90918101906130f2565b60015b612bed573d808015612bc1576040519150601f19603f3d011682016040523d82523d6000602084013e612bc6565b606091505b508051612be55760405162461bcd60e51b815260040161098b90613389565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506122ea565b506001949350505050565b612c1c8383612c45565b612c296000848484612b05565b610ac15760405162461bcd60e51b815260040161098b90613389565b6001600160a01b038216612c9b5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161098b565b612ca48161219d565b15612cf15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161098b565b612cfd60008383612a71565b6001600160a01b0382166000908152600360205260408120805460019290612d269084906135ee565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054612d909061367c565b90600052602060002090601f016020900481019282612db25760008555612df8565b82601f10612dcb57805160ff1916838001178555612df8565b82800160010185558215612df8579182015b82811115612df8578251825591602001919060010190612ddd565b50612e04929150612e08565b5090565b5b80821115612e045760008155600101612e09565b600067ffffffffffffffff831115612e3757612e3761376a565b612e4a601f8401601f19166020016135bd565b9050828152838383011115612e5e57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612e8657600080fd5b6124a983833560208501612e1d565b803560ff8116811461117157600080fd5b600060208284031215612eb857600080fd5b81356124a981613780565b60008060408385031215612ed657600080fd5b8235612ee181613780565b946020939093013593505050565b60008060408385031215612f0257600080fd5b8235612f0d81613780565b91506020830135612f1d81613780565b809150509250929050565b600080600060608486031215612f3d57600080fd5b8335612f4881613780565b92506020840135612f5881613780565b929592945050506040919091013590565b60008060008060808587031215612f7f57600080fd5b8435612f8a81613780565b93506020850135612f9a81613780565b925060408501359150606085013567ffffffffffffffff811115612fbd57600080fd5b8501601f81018713612fce57600080fd5b612fdd87823560208401612e1d565b91505092959194509250565b60008060408385031215612ffc57600080fd5b823561300781613780565b915060208301358015158114612f1d57600080fd5b6000602080838503121561302f57600080fd5b823567ffffffffffffffff8082111561304757600080fd5b818501915085601f83011261305b57600080fd5b81358181111561306d5761306d61376a565b8060051b915061307e8483016135bd565b8181528481019084860184860187018a101561309957600080fd5b600095505b838610156130c857803594506130b385613780565b8483526001959095019491860191860161309e565b5098975050505050505050565b6000602082840312156130e757600080fd5b81356124a981613795565b60006020828403121561310457600080fd5b81516124a981613795565b60006020828403121561312157600080fd5b813567ffffffffffffffff81111561313857600080fd5b6122ea84828501612e75565b60006020828403121561315657600080fd5b5035919050565b6000806040838503121561317057600080fd5b50508035926020909101359150565b60006020828403121561319157600080fd5b6124a982612e95565b600080604083850312156131ad57600080fd5b6131b683612e95565b91506131c460208401612e95565b90509250929050565b6000806000606084860312156131e257600080fd5b6131eb84612e95565b92506131f960208501612e95565b9150604084013567ffffffffffffffff81111561321557600080fd5b61322186828701612e75565b9150509250925092565b60008151808452613243816020860160208601613650565b601f01601f19169290920160200192915050565b60008351613269818460208801613650565b83519083019061327d818360208801613650565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132b99083018461322b565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156133045783516001600160a01b0316835292840192918401916001016132df565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b8281101561336957815180516001600160a01b031685528601516bffffffffffffffffffffffff1686850152928401929085019060010161332d565b5091979650505050505050565b6020815260006124a9602083018461322b565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602c908201527f4b617362656572416363657373436f6e74726f6c3a2077686974656c6973742060408201526b7374696c6c2061637469766560a01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526015908201527425b0b9b132b2b91b99189d1033b937bab81027a7a160591b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252602f908201527f4b617362656572416363657373436f6e74726f6c3a2043616c6c6572206e6f7460408201526e103830b93a1037b31039b8bab0b21760891b606082015260800190565b6020808252602a908201527f4b617362656572416363657373436f6e74726f6c3a2077686974656c697374206040820152696e6f742061637469766560b01b606082015260800190565b60208082526028908201527f506c75673a206e6f7420656e6f75676820506c7567732072656d61696e696e67604082015267081d1bc81b5a5b9d60c21b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff811182821017156135e6576135e661376a565b604052919050565b6000821982111561360157613601613728565b500190565b6000826136155761361561373e565b500490565b600081600019048311821515161561363457613634613728565b500290565b60008282101561364b5761364b613728565b500390565b60005b8381101561366b578181015183820152602001613653565b8381111561183b5750506000910152565b600181811c9082168061369057607f821691505b60208210811415610ea657634e487b7160e01b600052602260045260246000fd5b600061ffff808316818114156136c9576136c9613728565b6001019392505050565b600060ff821660ff8114156136ea576136ea613728565b60010192915050565b600061ffff808416806137085761370861373e565b92169190910692915050565b6000826137235761372361373e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461208c57600080fd5b6001600160e01b03198116811461208c57600080fdfea2646970667358221220c914d6972c0de66e0b77cc3561b9c9f547d68ca8f243c24a1a8078480b51404164736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
Plug.sol 324 lines
// SPDX-License-Identifier: MIT
/*
* Plug.sol
*
* Author: Jack Kasbeer
* Created: August 3, 2021
*
* Price: 0.0888 ETH
* Rinkeby: 0xf9d798514eb5eA645C90D8633FcC3DA17da8288e
*
* Description: An ERC-721 token that will change based on (1) time held by a single owner and
* (2) trades between owners; the different versions give you access to airdrops.
*
* - As long as the owner remains the same, every 60 days, the asset will acquire more "juice"
* not only updating the asset, but allowing the owner to receive more airdrops from other
* artists. This means after a year, the final asset (and most valuable) will now be in the
* owner's wallet (naturally each time, the previous asset is replaced).
* - If the NFT changes owners, the initial/day 0 asset is now what will be seen by the owner,
* and they'll have to wait a full cycle "final asset status" (gold)
* - If a Plug is a Alchemist (final state), it means that it will never lose juice again,
* even if it is transferred.
*/
pragma solidity >=0.5.16 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Kasbeer721.sol";
//@title The Plug
//@author Jack Kasbeer (gh:@jcksber, tw:@satoshigoat)
contract Plug is Kasbeer721 {
using Counters for Counters.Counter;
using SafeMath for uint256;
//@dev Emitted when token is transferred
event PlugTransferred(address indexed from, address indexed to);
//@dev How we keep track of how many days a person has held a Plug
mapping(uint256 => uint) internal _birthdays; //tokenID -> UTCTime
constructor() Kasbeer721("the Plug", "PLUG") {
whitelistActive = true;
contractUri = "ipfs://QmYUDei8kuEHrPTyEMrWDQSLEtQwzDS16bpFwZab6RZN5j";
payoutAddress = 0x6b8C6E15818C74895c31A1C91390b3d42B336799;//logik
_squad[payoutAddress] = true;
addToWhitelist(payoutAddress);
}
// -----------
// RESTRICTORS
// -----------
modifier batchLimit(uint256 numToMint)
{
require(1 <= numToMint && numToMint <= 8, "Plug: mint between 1 and 8");
_;
}
modifier plugsAvailable(uint256 numToMint)
{
require(_tokenIds.current() + numToMint <= MAX_NUM_TOKENS,
"Plug: not enough Plugs remaining to mint");
_;
}
modifier tokenExists(uint256 tokenId)
{
require(_exists(tokenId), "Plug: nonexistent token");
_;
}
// ----------
// PLUG MAGIC
// ----------
//@dev Override 'tokenURI' to account for asset/hash cycling
function tokenURI(uint256 tokenId)
tokenExists(tokenId) public view virtual override returns (string memory)
{
string memory baseURI = _baseURI();
string memory hash = _tokenHash(tokenId);
return string(abi.encodePacked(baseURI, hash));
}
//@dev Based on the number of days that have passed since the last transfer of
// ownership, this function returns the appropriate IPFS hash
function _tokenHash(uint256 tokenId)
internal virtual view
returns (string memory)
{
if (!_exists(tokenId)) {
return "";//not a require statement to avoid errors being thrown
}
// Calculate days gone by for this particular token
uint daysPassed = countDaysPassed(tokenId);
// Based on the number of days that have gone by, return the appropriate state of the Plug
if (daysPassed >= 557) {
if (tokenId <= 176) {
return chiHashes[7];
} else if (tokenId % 88 == 0) {
return stlHashes[7];
} else {
return normHashes[7];
}
} else if (daysPassed >= 360) {
if (tokenId <= 176) {
return chiHashes[6];
} else if (tokenId % 88 == 0) {
return stlHashes[6];
} else {
return normHashes[6];
}
} else if (daysPassed >= 300) {
if (tokenId <= 176) {
return chiHashes[5];
} else if (tokenId % 88 == 0) {
return stlHashes[5];
} else {
return normHashes[5];
}
} else if (daysPassed >= 240) {
if (tokenId <= 176) {
return chiHashes[4];
} else if (tokenId % 88 == 0) {
return stlHashes[4];
} else {
return normHashes[4];
}
} else if (daysPassed >= 180) {
if (tokenId <= 176) {
return chiHashes[3];
} else if (tokenId % 88 == 0) {
return stlHashes[3];
} else {
return normHashes[3];
}
} else if (daysPassed >= 120) {
if (tokenId <= 176) {
return chiHashes[2];
} else if (tokenId % 88 == 0) {
return stlHashes[2];
} else {
return normHashes[2];
}
} else if (daysPassed >= 60) {
if (tokenId <= 176) {
return chiHashes[1];
} else if (tokenId % 88 == 0) {
return stlHashes[1];
} else {
return normHashes[1];
}
} else { //if 60 days haven't passed, the initial asset/Plug is returned
if (tokenId <= 176) {
return chiHashes[0];
} else if (tokenId % 88 == 0) {
return stlHashes[0];
} else {
return normHashes[0];
}
}
}
//@dev Any Plug transfer this will be called beforehand (updating the transfer time)
// If a Plug is now an Alchemist, it's timestamp won't be updated so that it never loses juice
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal virtual override
{
// If the "1.5 years" have passed, don't change birthday
if (_exists(tokenId) && countDaysPassed(tokenId) < 557) {
_setBirthday(tokenId);
}
emit PlugTransferred(from, to);
}
//@dev Set the last transfer time for a tokenId
function _setBirthday(uint256 tokenId)
private
{
_birthdays[tokenId] = block.timestamp;
}
//@dev List the owners for a certain level (determined by _assetHash)
// We'll need this for airdrops and benefits
function listPlugOwnersForHash(string memory assetHash)
public view returns (address[] memory)
{
require(_hashExists(assetHash), "Plug: nonexistent hash");
address[] memory levelOwners = new address[](MAX_NUM_TOKENS);
uint16 tokenId;
uint16 counter;
for (tokenId = 1; tokenId <= _tokenIds.current(); tokenId++) {
if (_stringsEqual(_tokenHash(tokenId), assetHash)) {
levelOwners[counter] = ownerOf(tokenId);
counter++;
}
}
return levelOwners;
}
//@dev List the owners of a category of the Plug (Nomad, Chicago, or St. Louis)
function listPlugOwnersForType(uint8 group)
groupInRange(group) public view returns (address[] memory)
{
address[] memory typeOwners = new address[](MAX_NUM_TOKENS);
uint16 tokenId;
uint16 counter;
if (group == 0) {
//nomad
for (tokenId = 177; tokenId <= MAX_NUM_TOKENS; tokenId++) {
if (tokenId % 88 != 0 && _exists(tokenId)) {
typeOwners[counter] = ownerOf(tokenId);
counter++;
}
}
} else if (group == 1) {
//chicago
for (tokenId = 1; tokenId <= 176; tokenId++) {
if (_exists(tokenId)) {
typeOwners[counter] = ownerOf(tokenId);
counter++;
}
}
} else {
//st. louis
for (tokenId = 177; tokenId <= MAX_NUM_TOKENS; tokenId++) {
if (tokenId % 88 == 0 && _exists(tokenId)) {
typeOwners[counter] = ownerOf(tokenId);
counter++;
}
}
}
return typeOwners;
}
// --------------------
// MINTING & PURCHASING
// --------------------
//@dev Allows owners to mint for free
function mint(address to)
isSquad public virtual override returns (uint256)
{
return _mintInternal(to);
}
//@dev Purchase & mint multiple Plugs
function purchase(
address payable to,
uint256 numToMint
) whitelistDisabled batchLimit(numToMint) plugsAvailable(numToMint)
public payable
returns (bool)
{
require(msg.value >= numToMint * TOKEN_WEI_PRICE, "Plug: not enough ether");
//send change if too much was sent
if (msg.value > 0) {
uint256 diff = msg.value.sub(TOKEN_WEI_PRICE * numToMint);
if (diff > 0) {
to.transfer(diff);
}
}
uint8 i;//mint `numToMint` Plugs to address `to`
for (i = 0; i < numToMint; i++) {
_mintInternal(to);
}
return true;
}
//@dev A whitelist controlled version of `purchaseMultiple`
function whitelistPurchase(
address payable to,
uint256 numToMint
) whitelistEnabled onlyWhitelist(to) batchLimit(numToMint) plugsAvailable(numToMint)
public payable
returns (bool)
{
require(msg.value >= numToMint * TOKEN_WEI_PRICE, "Plug: not enough ether");
//send change if too much was sent
if (msg.value > 0) {
uint256 diff = msg.value.sub(TOKEN_WEI_PRICE * numToMint);
if (diff > 0) {
to.transfer(diff);
}
}
uint8 i;//mint `_num` Plugs to address `_to`
for (i = 0; i < numToMint; i++) {
_mintInternal(to);
}
return true;
}
//@dev Mints a single Plug & sets up the initial birthday
function _mintInternal(address to)
plugsAvailable(1) internal virtual returns (uint256)
{
_tokenIds.increment();
uint256 newId = _tokenIds.current();
_safeMint(to, newId);
_setBirthday(newId);
emit ERC721Minted(newId);
return newId;
}
// ----
// TIME
// ----
//@dev Returns number of days that have passed since transfer/mint
function countDaysPassed(uint256 tokenId)
tokenExists(tokenId) public view returns (uint256)
{
return uint256((block.timestamp - _birthdays[tokenId]) / 1 days);
}
}
LibPart.sol 23 lines
// SPDX-License-Identifier: MIT
/*
* LibPart.sol
*
* Author: Jack Kasbeer (token from 'dot')
* Created: October 20, 2021
*/
pragma solidity >=0.5.16 <0.9.0;
//@dev We need this libary for Rarible
library LibPart {
bytes32 public constant TYPE_HASH = keccak256("Part(address account,uint96 value)");
struct Part {
address payable account;
uint96 value;
}
function hash(Part memory part) internal pure returns (bytes32) {
return keccak256(abi.encode(TYPE_HASH, part.account, part.value));
}
}
Kasbeer721.sol 248 lines
// SPDX-License-Identifier: MIT
/*
* Kasbeer721.sol
*
* Author: Jack Kasbeer
* Created: August 21, 2021
*/
pragma solidity >=0.5.16 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./KasbeerStorage.sol";
import "./KasbeerAccessControl.sol";
import "./LibPart.sol";
//@title Kasbeer Made Contract for an ERC721
//@author Jack Kasbeer (git:@jcksber, tw:@satoshigoat)
contract Kasbeer721 is ERC721, KasbeerAccessControl, KasbeerStorage {
using Counters for Counters.Counter;
using SafeMath for uint256;
event ERC721Minted(uint256 indexed tokenId);
event ERC721Burned(uint256 indexed tokenId);
constructor(string memory temp_name, string memory temp_symbol)
ERC721(temp_name, temp_symbol)
{
// Add my personal address & sender
_squad[msg.sender] = true;
_squad[0xB9699469c0b4dD7B1Dda11dA7678Fa4eFD51211b] = true;
addToWhitelist(0xB9699469c0b4dD7B1Dda11dA7678Fa4eFD51211b);
}
// -----------
// RESTRICTORS
// -----------
modifier hashIndexInRange(uint8 idx)
{
require(0 <= idx && idx < NUM_ASSETS, "Kasbeer721: index OOB");
_;
}
modifier groupInRange(uint8 group)
{
require(0 <= group && group <= 2, "Kasbeer721: group OOB");
_;// 0:nomad, 1:chicago, 2:st.louis
}
modifier onlyValidTokenId(uint256 tokenId)
{
require(1 <= tokenId && tokenId <= MAX_NUM_TOKENS, "KasbeerMade721: tokenId OOB");
_;
}
// ------
// ERC721
// ------
//@dev All of the asset's will be pinned to IPFS
function _baseURI()
internal view virtual override returns (string memory)
{
return "ipfs://";//NOTE: per OpenSea recommendations
}
//@dev This is here as a reminder to override for custom transfer functionality
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal virtual override
{
super._beforeTokenTransfer(from, to, tokenId);
}
//@dev Allows owners to mint for free
function mint(address to)
isSquad public virtual returns (uint256)
{
_tokenIds.increment();
uint256 newId = _tokenIds.current();
_safeMint(to, newId);
emit ERC721Minted(newId);
return newId;
}
//@dev Custom burn function - nothing special
function burn(uint256 tokenId)
public virtual
{
require(isInSquad(msg.sender) || msg.sender == ownerOf(tokenId),
"Kasbeer721: not owner or in squad.");
_burn(tokenId);
emit ERC721Burned(tokenId);
}
function supportsInterface(bytes4 interfaceId)
public view virtual override returns (bool)
{
return interfaceId == _INTERFACE_ID_ERC165
|| interfaceId == _INTERFACE_ID_ROYALTIES
|| interfaceId == _INTERFACE_ID_ERC721
|| interfaceId == _INTERFACE_ID_ERC721_METADATA
|| interfaceId == _INTERFACE_ID_ERC721_ENUMERABLE
|| interfaceId == _INTERFACE_ID_EIP2981
|| super.supportsInterface(interfaceId);
}
// ----------------------
// IPFS HASH MANIPULATION
// ----------------------
//@dev Get the hash stored at `idx` for `group`
function getHashByIndex(
uint8 group,
uint8 idx
) groupInRange(group) hashIndexInRange(idx) public view
returns (string memory)
{
if (group == 0) {
return normHashes[idx];
} else if (group == 1) {
return chiHashes[idx];
} else {
return stlHashes[idx];
}
}
//@dev Allows us to update the IPFS hash values (one at a time)
function updateHash(
uint8 group,
uint8 hashNum,
string memory str
) isSquad groupInRange(group) hashIndexInRange(hashNum) public
{
if (group == 0) {
normHashes[hashNum] = str;
} else if (group == 1) {
chiHashes[hashNum] = str;
} else {
stlHashes[hashNum] = str;
}
}
//@dev Determine if '_assetHash' is one of the IPFS hashes in asset hashes
function _hashExists(string memory assetHash)
internal view returns (bool)
{
uint8 i;
for (i = 0; i < NUM_ASSETS; i++) {
if (_stringsEqual(assetHash, normHashes[i]) ||
_stringsEqual(assetHash, chiHashes[i]) ||
_stringsEqual(assetHash, stlHashes[i])) {
return true;
}
}
return false;
}
// ------
// USEFUL
// ------
//@dev Returns the current token id (number minted so far)
function getCurrentId()
public view returns (uint256)
{
return _tokenIds.current();
}
//@dev Allows us to withdraw funds collected
function withdraw(address payable wallet, uint256 amount)
isSquad public
{
require(amount <= address(this).balance,
"Kasbeer721: Insufficient funds to withdraw");
wallet.transfer(amount);
}
//@dev Destroy contract and reclaim leftover funds
function kill()
onlyOwner public
{
selfdestruct(payable(msg.sender));
}
// ------------
// CONTRACT URI
// ------------
//@dev Controls the contract-level metadata to include things like royalties
function contractURI()
public view returns(string memory)
{
return contractUri;
}
//@dev Ability to change the contract URI
function updateContractUri(string memory updatedContractUri)
isSquad public
{
contractUri = updatedContractUri;
}
// -----------------
// SECONDARY MARKETS
// -----------------
//@dev Rarible Royalties V2
function getRaribleV2Royalties(uint256 id)
onlyValidTokenId(id) external view returns (LibPart.Part[] memory)
{
LibPart.Part[] memory royalties = new LibPart.Part[](1);
royalties[0] = LibPart.Part({
account: payable(payoutAddress),
value: uint96(royaltyFeeBps)
});
return royalties;
}
//@dev EIP-2981
function royaltyInfo(uint256 tokenId, uint256 salePrice) external view onlyValidTokenId(tokenId) returns (address receiver, uint256 amount) {
uint256 ourCut = SafeMath.div(SafeMath.mul(salePrice, royaltyFeeBps), 10000);
return (payoutAddress, ourCut);
}
// -------
// HELPERS
// -------
//@dev Determine if two strings are equal using the length + hash method
function _stringsEqual(string memory a, string memory b)
internal pure returns (bool)
{
bytes memory A = bytes(a);
bytes memory B = bytes(b);
if (A.length != B.length) {
return false;
} else {
return keccak256(A) == keccak256(B);
}
}
}
KasbeerStorage.sol 66 lines
// SPDX-License-Identifier: MIT
/*
* KasbeerStorage.sol
*
* Author: Jack Kasbeer
* Created: August 21, 2021
*/
pragma solidity >=0.5.16 <0.9.0;
import "@openzeppelin/contracts/utils/Counters.sol";
//@title A storage contract for relevant data
//@author Jack Kasbeer (@jcksber, @satoshigoat)
contract KasbeerStorage {
//@dev These take care of token id incrementing
using Counters for Counters.Counter;
Counters.Counter internal _tokenIds;
uint256 constant public royaltyFeeBps = 1500; // 15%
bytes4 internal constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
bytes4 internal constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
bytes4 internal constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
bytes4 internal constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
bytes4 internal constant _INTERFACE_ID_EIP2981 = 0x2a55205a;
bytes4 internal constant _INTERFACE_ID_ROYALTIES = 0xcad96cca;
//@dev Important numbers
uint constant NUM_ASSETS = 8;
uint constant MAX_NUM_TOKENS = 888;
uint constant TOKEN_WEI_PRICE = 88800000000000000;//0.0888 ETH
//@dev Properties
string internal contractUri;
address public payoutAddress;
//@dev Initial production hashes
//Our list of IPFS hashes for each of the "Nomad" 8 Plugs (varying juice levels)
string [NUM_ASSETS] normHashes = ["QmZzB15bPgTqyHzULMFK1jNdbbDGVGCX4PJNbyGGMqLCjL",
"QmeXZGeywxRRDK5mSBHNVnUzGv7Kv2ATfLHydPfT5LpbZr",
"QmYTf2HE8XycQD9uXshiVtXqNedS83WycJvS2SpWAPfx5b",
"QmYXjEkeio2nbMqy3DA7z2LwYFDyq1itbzdujGSoCsFwpN",
"QmWmvRqpT59QU9rDT28fiKgK6g8vUjRD2TSSeeBPr9aBNm",
"QmWtMb73QgSgkL7mY8PQEt6tgufMovXWF8ecurp2RD7X6R",
"Qmbd4uEwtPBfw1XASkgPijqhZDL2nZcRwPbueYaETuAfGt",
"QmayAeQafrWUHV3xb8DnXTGLn97xnh7X2Z957Ss9AtfkAD"];
//Our list of IPFS hashes for each of the "Chicago" 8 Plugs (varying juice levels)
string [NUM_ASSETS] chiHashes = ["QmNsSUji2wX4E8xmv8vynmSUCACPdCh7NznVSGMQ3hwLC3",
"QmYPq4zFLyREaZsPwZzXB3w94JVYdgFHGgRAuM6CK6PMes",
"QmbrATHXTkiyNijkfQcEMGT7ujpunsoLNTaupMYW922jp3",
"QmWaj5VHcBXgAQnct88tbthVmv1ecX7ft2aGGqMAt4N52p",
"QmTyFgbJXX2vUCZSjraKubXfE4NVr4nVrKtg3GK4ysscDX",
"QmQxQoAe47CUXtGY9NTA6dRgTJuDtM4HDqz9kW2UK1VHtU",
"QmaXYexRBrbr6Uv89cGyWXWCbyaoQDhy3hHJuktSTWFXtJ",
"QmeSQdMYLECcSfCSkMenPYuNL2v42YQEEA4HJiP36Zn7Z6"];
//Our list of IPFS hashes for each of the "Chicago" 8 Plugs (varying juice levels)
string [NUM_ASSETS] stlHashes = ["QmcB5AqhpNA8o5RT3VTeDsqNBn6VGEaXzeTKuomakTNueM",
"QmcjP9d54RcmPXgGt6XxNavr7dtQDAhAnatKjJ5a1Bqbmc",
"QmV3uFvGgGQdN4Ub81LWVnp3qjwMpKDvVwQmBzBNzAjWxB",
"Qmc3fWuQTxAgsBYK2g4z5VrK47nvfCrWHFNa5zA8DDoUbs",
"QmWRPStH4RRMrFzAJcTs2znP7hbVctbLHPUvEn9vXWSTfk",
"QmVobnLvtSvgrWssFyWAPCUQFvKsonRMYMYRQPsPSaQHTK",
"QmQvGuuRgKxqTcAA7xhGdZ5u2EzDKvWGYb1dMXz2ECwyZi",
"QmdurJn1GYVz1DcNgqbMTqnCKKFxpjsFuhoS7bnfBp2YGk"];
}
KasbeerAccessControl.sol 137 lines
// SPDX-License-Identifier: MIT
/*
* KasbeerAccessControl.sol
*
* Author: Jack Kasbeer
* Created: October 14, 2021
*
* This is an extension of `Ownable` to allow a larger set of addresses to have
* certain control in the inheriting contracts.
*/
pragma solidity >=0.5.16 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract KasbeerAccessControl is Ownable {
// -----
// SQUAD
// -----
//@dev Ownership - list of squad members (owners)
mapping (address => bool) internal _squad;
//@dev Custom "approved" modifier because I don't like that language
modifier isSquad()
{
require(isInSquad(msg.sender), "KasbeerAccessControl: Caller not part of squad.");
_;
}
//@dev Determine if address `a` is an approved owner
function isInSquad(address a)
public view returns (bool)
{
return _squad[a];
}
//@dev Add `a` to the squad
function addToSquad(address a)
onlyOwner public
{
require(!isInSquad(a), "KasbeerAccessControl: Address already in squad.");
_squad[a] = true;
}
//@dev Remove `a` from the squad
function removeFromSquad(address a)
onlyOwner public
{
require(isInSquad(a), "KasbeerAccessControl: Address already not in squad.");
_squad[a] = false;
}
// ---------
// WHITELIST
// ---------
//@dev Whitelist mapping for client addresses
mapping (address => bool) internal _whitelist;
//@dev Whitelist flag for active/inactive states
bool whitelistActive;
//@dev Determine if someone is in the whitelsit
modifier onlyWhitelist(address a)
{
require(isInWhitelist(a));
_;
}
//@dev Prevent non-whitelist minting functions from being used
// if `whitelistActive` == 1
modifier whitelistDisabled()
{
require(whitelistActive == false, "KasbeerAccessControl: whitelist still active");
_;
}
//@dev Require that the whitelist is currently enabled
modifier whitelistEnabled()
{
require(whitelistActive == true, "KasbeerAccessControl: whitelist not active");
_;
}
//@dev Turn the whitelist on
function activateWhitelist()
isSquad whitelistDisabled public
{
whitelistActive = true;
}
//@dev Turn the whitelist off
function deactivateWhitelist()
isSquad whitelistEnabled public
{
whitelistActive = false;
}
//@dev Prove that one of our whitelist address owners has been approved
function isInWhitelist(address a)
public view returns (bool)
{
return _whitelist[a];
}
//@dev Add a single address to whitelist
function addToWhitelist(address a)
isSquad public
{
require(!isInWhitelist(a), "KasbeerAccessControl: already whitelisted");
//here we care if address already whitelisted to save on gas fees
_whitelist[a] = true;
}
//@dev Remove a single address from the whitelist
function removeFromWhitelist(address a)
isSquad public
{
require(isInWhitelist(a), "KasbeerAccessControl: not in whitelist");
_whitelist[a] = false;
}
//@dev Add a list of addresses to the whitelist
function bulkAddToWhitelist(address[] memory addys)
isSquad public
{
require(addys.length > 1, "KasbeerAccessControl: use `addToWhitelist` instead");
uint8 i;
for (i = 0; i < addys.length; i++) {
if (!_whitelist[addys[i]]) {
_whitelist[addys[i]] = true;
}
}
}
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
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");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
Counters.sol 42 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
SafeMath.sol 226 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
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) {
unchecked {
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) {
unchecked {
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) {
unchecked {
// 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) {
unchecked {
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) {
unchecked {
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) {
return a + b;
}
/**
* @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) {
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) {
return a * b;
}
/**
* @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.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
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) {
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) {
unchecked {
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.
*
* 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) {
unchecked {
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) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Read Contract
balanceOf 0x70a08231 → uint256
contractURI 0xe8a3d485 → string
countDaysPassed 0x5aae4a46 → uint256
getApproved 0x081812fc → address
getCurrentId 0x6c143862 → uint256
getHashByIndex 0xd5f2c756 → string
getRaribleV2Royalties 0xcad96cca → tuple[]
isApprovedForAll 0xe985e9c5 → bool
isInSquad 0x7c461e18 → bool
isInWhitelist 0x09fd8212 → bool
listPlugOwnersForHash 0x4eef87c4 → address[]
listPlugOwnersForType 0x6a3705e5 → address[]
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
payoutAddress 0x5b8d02d7 → address
royaltyFeeBps 0x91192765 → uint256
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
activateWhitelist 0x89e877a3
No parameters
addToSquad 0xd3ad3c19
address a
addToWhitelist 0xe43252d7
address a
approve 0x095ea7b3
address to
uint256 tokenId
bulkAddToWhitelist 0x6c79af10
address[] addys
burn 0x42966c68
uint256 tokenId
deactivateWhitelist 0x3597d7f3
No parameters
kill 0x41c0e1b5
No parameters
mint 0x6a627842
address to
returns: uint256
purchase 0x8de93222
address to
uint256 numToMint
returns: bool
removeFromSquad 0x6e3b5c12
address a
removeFromWhitelist 0x8ab1d681
address a
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
updateContractUri 0x47c8ff5e
string updatedContractUri
updateHash 0xd943f65f
uint8 group
uint8 hashNum
string str
whitelistPurchase 0xc2eb764d
address to
uint256 numToMint
returns: bool
withdraw 0xf3fef3a3
address wallet
uint256 amount
Recent Transactions
No transactions found for this address