Address Contract Partially Verified
Address
0x1e9385eE28c5C7d33F3472f732Fb08CE3ceBce1F
Balance
0 ETH
Nonce
1
Code Size
15595 bytes
Creator
0x795afF8d...5EbA at tx 0xce2a9c92...c9f77e
Indexed Transactions
0 (1 on-chain, 0.7% indexed)
Contract Bytecode
15595 bytes
0x6080604052600436106102675760003560e01c80638f742d1611610144578063b88d4fde116100b6578063ce606ee01161007a578063ce606ee0146106eb578063d47f030d14610700578063da6c928314610713578063e5187f4314610741578063e985e9c514610761578063f2fde38b1461078157610267565b8063b88d4fde14610643578063b93a89f714610663578063c2ca0ac514610696578063c2d2bccb146106b6578063c87b56dd146106cb57610267565b8063a035b1fe11610108578063a035b1fe146105a4578063a0712d68146105b9578063a1a4c27f146105cc578063a22cb465146105f9578063a350de0d14610619578063a5eb6ff21461062e57610267565b80638f742d161461051c57806391b7f5ed1461053c57806394bf804d1461055c57806395d89b411461056f5780639e288b1a1461058457610267565b806339d78e6b116101dd5780636352211e116101a15780636352211e1461047457806365cde733146104945780636a28f000146104b45780636fa14b54146104c957806370a08231146104e957806382db3fb61461050957610267565b806339d78e6b146103ea57806342842e0e146103ff5780634f6ccce71461041f5780635c4719951461043f57806362a5af3b1461045f57610267565b80630ce06b681161022f5780630ce06b681461032857806314152f711461034857806318160ddd1461036857806323b872dd1461038a5780632f745c59146103aa57806335a9cede146103ca57610267565b806301ffc9a71461026c578063054f7d9c146102a257806306fdde03146102b7578063081812fc146102d9578063095ea7b314610306575b600080fd5b34801561027857600080fd5b5061028c6102873660046131fa565b6107a1565b60405161029991906134b4565b60405180910390f35b3480156102ae57600080fd5b5061028c6107f5565b3480156102c357600080fd5b506102cc610806565b60405161029991906134d4565b3480156102e557600080fd5b506102f96102f43660046131e2565b610831565b604051610299919061340c565b34801561031257600080fd5b50610326610321366004613077565b61084d565b005b34801561033457600080fd5b50610326610343366004613077565b610906565b34801561035457600080fd5b506103266103633660046131aa565b61099c565b34801561037457600080fd5b5061037d610b54565b60405161029991906133f5565b34801561039657600080fd5b506103266103a5366004612f63565b610b66565b3480156103b657600080fd5b5061037d6103c5366004613077565b610c27565b3480156103d657600080fd5b506103266103e53660046130cb565b610c7c565b3480156103f657600080fd5b50610326610d1a565b34801561040b57600080fd5b5061032661041a366004612f63565b610d84565b34801561042b57600080fd5b5061037d61043a3660046131e2565b610d9f565b34801561044b57600080fd5b5061032661045a366004612eec565b610dad565b34801561046b57600080fd5b50610326610ed6565b34801561048057600080fd5b506102f961048f3660046131e2565b610f42565b3480156104a057600080fd5b5061028c6104af3660046131e2565b610f7e565b3480156104c057600080fd5b50610326610fdc565b3480156104d557600080fd5b506103266104e43660046131e2565b611017565b3480156104f557600080fd5b5061037d610504366004612eec565b6110a8565b610326610517366004613155565b6110ca565b34801561052857600080fd5b506102cc6105373660046131e2565b61121e565b34801561054857600080fd5b506103266105573660046131e2565b6114a3565b61032661056a3660046132e5565b6114d4565b34801561057b57600080fd5b506102cc6115b0565b34801561059057600080fd5b5061032661059f3660046130a2565b6115ce565b3480156105b057600080fd5b5061037d611607565b6103266105c73660046131e2565b61160e565b3480156105d857600080fd5b506105ec6105e73660046131e2565b61161b565b6040516102999190613a00565b34801561060557600080fd5b5061032661061436600461304a565b611684565b34801561062557600080fd5b5061028c61171d565b34801561063a57600080fd5b506102f961172e565b34801561064f57600080fd5b5061032661065e366004612fa3565b61173d565b34801561066f57600080fd5b5061068361067e3660046131e2565b611910565b6040516102999796959493929190613a0e565b3480156106a257600080fd5b506103266106b13660046131e2565b611bdd565b3480156106c257600080fd5b5061037d611d31565b3480156106d757600080fd5b506102cc6106e63660046131e2565b611d8e565b3480156106f757600080fd5b506102f9611f53565b61032661070e366004613115565b611f63565b34801561071f57600080fd5b5061073361072e3660046131e2565b611f6e565b60405161029992919061396a565b34801561074d57600080fd5b5061032661075c366004612eec565b611f9b565b34801561076d57600080fd5b5061028c61077c366004612f2b565b611fe8565b34801561078d57600080fd5b5061032661079c366004612eec565b612017565b60006001600160e01b031982166380ac58cd60e01b14806107d257506001600160e01b03198216635b5e139f60e01b145b806107ed57506001600160e01b0319821663780e9d6360e01b145b90505b919050565b6101f654600160a01b900460ff1681565b60408051808201909152601081526f135bdbdb90d85d131bdbdd1c1c9a5b9d60821b60208201525b90565b600090815261667360205260409020546001600160a01b031690565b8061085a61667082612065565b61087f5760405162461bcd60e51b81526004016108769061370e565b60405180910390fd5b600061088a83610f42565b9050806001600160a01b0316846001600160a01b031614156108be5760405162461bcd60e51b8152600401610876906138a1565b336001600160a01b03821614806108da57506108da8133611fe8565b6108f65760405162461bcd60e51b8152600401610876906137b1565b610900848461207d565b50505050565b6101f6546001600160a01b031633146109315760405162461bcd60e51b8152600401610876906135e3565b6101f654604051632142170760e11b81526001600160a01b03808516926342842e0e9261096692309216908690600401613453565b600060405180830381600087803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b505050505050565b6101f6546001600160a01b031633146109c75760405162461bcd60e51b8152600401610876906135e3565b61636081156109d557506163b05b60006102708261640081106109fa57634e487b7160e01b600052603260045260246000fd5b01546201000090046001600160a01b031614610a285760405162461bcd60e51b8152600401610876906136b7565b805b610a35826050613add565b811015610b4f576040518060400160405280610a526166706120d7565b61ffff1681526101f6546001600160a01b0316602090910152610270826164008110610a8e57634e487b7160e01b600052603260045260246000fd5b8251910180546020909301516001600160a01b0316620100000262010000600160b01b031961ffff90931661ffff199094169390931791909116919091179055610ada616670826120db565b506101f6546001600160a01b0316600090815261667260205260409020610b0190826120db565b506101f65460405182916001600160a01b0316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480610b4781613beb565b915050610a2a565b505050565b6000610b616166706120d7565b905090565b80610b7361667082612065565b610b8f5760405162461bcd60e51b815260040161087690613836565b6000610b9a82610f42565b9050336001600160a01b0382161480610bca5750600082815261667360205260409020546001600160a01b031633145b80610bf957506001600160a01b03811660009081526166746020908152604080832033845290915290205460ff165b610c155760405162461bcd60e51b8152600401610876906138e2565b610c20858585612125565b5050505050565b6000610c32836110a8565b8210610c505760405162461bcd60e51b81526004016108769061350f565b6001600160a01b038316600090815261667260205260409020610c73908361221c565b90505b92915050565b6101f6546001600160a01b03163314610ca75760405162461bcd60e51b8152600401610876906135e3565b60005b8281101561090057838382818110610cd257634e487b7160e01b600052603260045260246000fd5b9050602002013560668284610ce79190613add565b6101908110610d0657634e487b7160e01b600052603260045260246000fd5b015580610d1281613beb565b915050610caa565b6101f6546001600160a01b03163314610d455760405162461bcd60e51b8152600401610876906135e3565b6101f6546014600160b01b90910460ff161015610d745760405162461bcd60e51b815260040161087690613879565b6101f6805460ff60a81b19169055565b610b4f8383836040518060200160405280600081525061173d565b60006107ed6166708361221c565b6101f6546001600160a01b03163314610dd85760405162461bcd60e51b8152600401610876906135e3565b6101f6546040516370a0823160e01b815282916001600160a01b038084169263a9059cbb929091169083906370a0823190610e1790309060040161340c565b60206040518083038186803b158015610e2f57600080fd5b505afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6791906132cd565b6040518363ffffffff1660e01b8152600401610e84929190613420565b602060405180830381600087803b158015610e9e57600080fd5b505af1158015610eb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4f91906131c6565b6101f6546001600160a01b03163314610f015760405162461bcd60e51b8152600401610876906135e3565b6101f654600160a01b900460ff1615610f2c5760405162461bcd60e51b81526004016108769061375a565b6101f6805460ff60a01b1916600160a01b179055565b6000610270826164008110610f6757634e487b7160e01b600052603260045260246000fd5b01546201000090046001600160a01b031692915050565b600080610f8d61010084613b16565b90506000610f9d61010085613c26565b9050610faa8160ff613b73565b6101f88360648110610fcc57634e487b7160e01b600052603260045260246000fd5b0154901c60011615949350505050565b6101f6546001600160a01b031633146110075760405162461bcd60e51b8152600401610876906135e3565b6101f6805460ff60a01b19169055565b6101f6546001600160a01b031633146110425760405162461bcd60e51b8152600401610876906135e3565b6166755460ff161580156110595750616677548114155b801561107357506101f6546014600160b01b90910460ff16105b61108f5760405162461bcd60e51b8152600401610876906135ac565b616677554361667655616675805460ff19166001179055565b6001600160a01b0381166000908152616672602052604081206107ed906120d7565b6101f654600160a01b900460ff16156110f55760405162461bcd60e51b81526004016108769061375a565b6000805b838110156111885761113085858381811061112457634e487b7160e01b600052603260045260246000fd5b90506020020135610f7e565b15611146576101f7546111439083613add565b91505b61117685858381811061116957634e487b7160e01b600052603260045260246000fd5b9050602002013584612254565b8061118081613beb565b9150506110f9565b50804710156111a95760405162461bcd60e51b815260040161087690613610565b80156111ec576101f6546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156111ea573d6000803e3d6000fd5b505b47156109005760405133904780156108fc02916000818181858888f19350505050158015610c20573d6000803e3d6000fd5b60608161122d61667082612065565b6112495760405162461bcd60e51b81526004016108769061370e565b600061027084616400811061126e57634e487b7160e01b600052603260045260246000fd5b6040805180820190915291015461ffff811682526201000090046001600160a01b03166020820152905060006112a38561161b565b825190915060009061025c906112bc9061050090613af5565b61ffff16601481106112de57634e487b7160e01b600052603260045260246000fd5b0154111561140d5760008561025c61050085600001516112fe9190613af5565b61ffff166014811061132057634e487b7160e01b600052603260045260246000fd5b01546040516020016113339291906133fe565b6040516020818303038152906040528051906020012060001c90506000611359826126aa565b90506000611366836126f3565b9050600061137384612cdb565b6002546040516335d01c1d60e11b81529192506001600160a01b031690636ba0383a906113ac908c9087908a90879089906004016139c1565b60006040518083038186803b1580156113c457600080fd5b505afa1580156113d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611400919081019061325a565b975050505050505061149d565b6002546040516335d01c1d60e11b81526001600160a01b0390911690636ba0383a9061144490889060049086906000908301613987565b60006040518083038186803b15801561145c57600080fd5b505afa158015611470573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611498919081019061325a565b935050505b50919050565b6101f6546001600160a01b031633146114ce5760405162461bcd60e51b8152600401610876906135e3565b6101f755565b6101f654600160a01b900460ff16156114ff5760405162461bcd60e51b81526004016108769061375a565b61150882610f7e565b15611570576101f7544710156115305760405162461bcd60e51b815260040161087690613610565b6101f6546101f7546040516001600160a01b039092169181156108fc0291906000818181858888f1935050505015801561156e573d6000803e3d6000fd5b505b61157a8282612254565b47156115ac5760405133904780156108fc02916000818181858888f19350505050158015610b4f573d6000803e3d6000fd5b5050565b6040805180820190915260048152633c27e4e760e21b602082015290565b6101f6546001600160a01b031633146115f95760405162461bcd60e51b8152600401610876906135e3565b6115ac6101f8826064612e28565b6101f75481565b61161881336114d4565b50565b600080611629604084613b16565b90506000611638604085613c26565b90506000606683610190811061165e57634e487b7160e01b600052603260045260246000fd5b0154905061166d826004613b54565b6116789060fc613b73565b1c600f16949350505050565b6001600160a01b0382163314156116ad5760405162461bcd60e51b815260040161087690613680565b336000818152616674602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31906117119085906134b4565b60405180910390a35050565b6101f654600160a81b900460ff1681565b6002546001600160a01b031681565b8161174a61667082612065565b6117665760405162461bcd60e51b815260040161087690613836565b600061177182610f42565b9050336001600160a01b03821614806117a15750600082815261667360205260409020546001600160a01b031633145b806117d057506001600160a01b03811660009081526166746020908152604080832033845290915290205460ff165b6117ec5760405162461bcd60e51b8152600401610876906138e2565b6117f7868686612125565b843b801561190757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906118319033908b908a908a90600401613477565b602060405180830381600087803b15801561184b57600080fd5b505af192505050801561187b575060408051601f3d908101601f1916820190925261187891810190613216565b60015b6118d5573d8080156118a9576040519150601f19603f3d011682016040523d82523d6000602084013e6118ae565b606091505b5080516118cd5760405162461bcd60e51b81526004016108769061355a565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146119055760405162461bcd60e51b81526004016108769061355a565b505b50505050505050565b600060606000606080600080600061027089616400811061194157634e487b7160e01b600052603260045260246000fd5b6040805180820190915291015461ffff811682526001600160a01b03620100009091048116602083015260025491925016636082e3a26119808b61161b565b6040518263ffffffff1660e01b815260040161199c9190613a00565b60006040518083038186803b1580156119b457600080fd5b505afa1580156119c8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526119f0919081019061325a565b945060009250611a026166708a612065565b15611b7457805160009061025c90611a1d9061050090613af5565b61ffff1660148110611a3f57634e487b7160e01b600052603260045260246000fd5b01541115611b64578861025c6105008360000151611a5d9190613af5565b61ffff1660148110611a7f57634e487b7160e01b600052603260045260246000fd5b0154604051602001611a929291906133fe565b60408051601f1981840301815291905280516020909101206002549092506003906001600160a01b0316632901237c611aca856126aa565b6040518263ffffffff1660e01b8152600401611ae69190613a00565b60006040518083038186803b158015611afe57600080fd5b505afa158015611b12573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b3a919081019061325a565b611b4384612cdb565b87611b4d866126f3565b856020015197509750975097509750975050611bd2565b6002975080602001519250611b90565b611b7d89610f7e565b15611b8b5760009750611b90565b600197505b505060408051808201825260078152662ab735b737bbb760c91b602080830191909152825180840190935260018352603f60f81b908301529550600094509150835b919395979092949650565b6101f6546001600160a01b03163314611c085760405162461bcd60e51b8152600401610876906135e3565b6166755460ff168015611c1d57506166765443115b8015611c5157506166775481604051602001611c3991906133f5565b60405160208183030381529060405280519060200120145b611c6d5760405162461bcd60e51b81526004016108769061377a565b60ff6166765443611c7e9190613b73565b1015611d23576000816166765440604051602001611c9d9291906133fe565b6040516020818303038152906040528051906020012090508061025c6101f660169054906101000a900460ff1660ff1660148110611ceb57634e487b7160e01b600052603260045260246000fd5b01556101f68054600160b01b900460ff16906016611d0883613c06565b91906101000a81548160ff021916908360ff16021790555050505b50616675805460ff19169055565b6101f6546000908190611d5090600160b01b900460ff16610a00613b2a565b61ffff169050611d616166706120d7565b811115611d7257600091505061082e565b80611d7e6166706120d7565b611d889190613b73565b91505090565b606081611d9d61667082612065565b611db95760405162461bcd60e51b81526004016108769061370e565b6000610270846164008110611dde57634e487b7160e01b600052603260045260246000fd5b6040805180820190915291015461ffff811682526201000090046001600160a01b0316602082015290506000611e138561161b565b825190915060009061025c90611e2c9061050090613af5565b61ffff1660148110611e4e57634e487b7160e01b600052603260045260246000fd5b01541115611f1c5760008561025c6105008560000151611e6e9190613af5565b61ffff1660148110611e9057634e487b7160e01b600052603260045260246000fd5b0154604051602001611ea39291906133fe565b6040516020818303038152906040528051906020012060001c90506000611ec9826126aa565b90506000611ed6836126f3565b90506000611ee384612cdb565b600254604051630a85782160e01b81529192506001600160a01b031690630a857821906113ac908c9087908a90879089906004016139c1565b600254604051630a85782160e01b81526001600160a01b0390911690630a8578219061144490889060049086906000908301613987565b6101f6546001600160a01b031681565b6115ac8282336110ca565b610270816164008110611f8057600080fd5b015461ffff811691506201000090046001600160a01b031682565b6101f6546001600160a01b03163314611fc65760405162461bcd60e51b8152600401610876906135e3565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0391821660009081526166746020908152604080832093909416825291909152205460ff1690565b6101f6546001600160a01b031633146120425760405162461bcd60e51b8152600401610876906135e3565b6101f680546001600160a01b0319166001600160a01b0392909216919091179055565b60009081526001919091016020526040902054151590565b6000818152616673602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839233917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a45050565b5490565b60006120e78383612065565b61211d57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c76565b506000610c76565b6001600160a01b03821661214b5760405162461bcd60e51b81526004016108769061363c565b61215660008261207d565b6001600160a01b0383166000908152616672602052604090206121799082612d0b565b506001600160a01b03821660009081526166726020526040902061219d90826120db565b50816102708261640081106121c257634e487b7160e01b600052603260045260246000fd5b01805462010000600160b01b031916620100006001600160a01b0393841602179055604051829184811691908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4505050565b600082600001828154811061224157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6101f654600160a81b900460ff1661227e5760405162461bcd60e51b8152600401610876906136df565b600154604051630869624160e31b81526001600160a01b0390911690633894ca5790829063434b1208906122b69087906004016133f5565b60206040518083038186803b1580156122ce57600080fd5b505afa1580156122e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123069190613232565b6040518263ffffffff1660e01b815260040161232291906134bf565b60206040518083038186803b15801561233a57600080fd5b505afa15801561234e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123729190612f0f565b6001600160a01b031673c3f733ca98e0dad0386979eb96fb1722a1a05e696001600160a01b0316146123b65760405162461bcd60e51b8152600401610876906134e7565b600080546040516331a9108f60e11b81526001600160a01b0390911690636352211e906123e79086906004016133f5565b60206040518083038186803b1580156123ff57600080fd5b505afa158015612413573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124379190612f0f565b9050336001600160a01b03821614806124e0575060005460405163020604bf60e21b81526001600160a01b039091169063081812fc9061247b9086906004016133f5565b60206040518083038186803b15801561249357600080fd5b505afa1580156124a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124cb9190612f0f565b6001600160a01b0316336001600160a01b0316145b80612568575060005460405163e985e9c560e01b81526001600160a01b039091169063e985e9c5906125189084903390600401613439565b60206040518083038186803b15801561253057600080fd5b505afa158015612544573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256891906131c6565b6125845760405162461bcd60e51b815260040161087690613933565b61259061667084612065565b156125ad5760405162461bcd60e51b81526004016108769061380e565b60405180604001604052806125c36166706120d7565b61ffff168152602001836001600160a01b03168152506102708461640081106125fc57634e487b7160e01b600052603260045260246000fd5b8251910180546020909301516001600160a01b0316620100000262010000600160b01b031961ffff90931661ffff199094169390931791909116919091179055612648616670846120db565b506001600160a01b03821660009081526166726020526040902061266c90846120db565b5060405183906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4505050565b6000600f821660028110156126c35760009150506107f0565b60058110156126d65760019150506107f0565b60098110156126e95760029150506107f0565b60039150506107f0565b60081c62ffffff1660606000612707612e66565b600f841691506008821015612851576040805180820190915260048082526302a3432960e51b6020830152908252821015612851576003826004811061275d57634e487b7160e01b600052603260045260246000fd5b01805461276990613bb6565b80601f016020809104026020016040519081016040528092919081815260200182805461279590613bb6565b80156127e25780601f106127b7576101008083540402835291602001916127e2565b820191906000526020600020905b8154815290600101906020018083116127c557829003601f168201915b50505050508160016009811061280857634e487b7160e01b600052603260045260246000fd5b6020020181905250604051806040016040528060018152602001600160fd1b8152508160026009811061284b57634e487b7160e01b600052603260045260246000fd5b60200201525b60048463ffffffff16901c93508360011663ffffffff166001141561298f57601f600185901c1691506007826020811061289b57634e487b7160e01b600052603260045260246000fd5b0180546128a790613bb6565b80601f01602080910402602001604051908101604052809291908181526020018280546128d390613bb6565b80156129205780601f106128f557610100808354040283529160200191612920565b820191906000526020600020905b81548152906001019060200180831161290357829003601f168201915b50505050508160036009811061294657634e487b7160e01b600052603260045260246000fd5b6020020181905250604051806040016040528060018152602001600160fd1b8152508160046009811061298957634e487b7160e01b600052603260045260246000fd5b60200201525b60068463ffffffff16901c935083600f1663ffffffff169150600f821015612a8357602782600f81106129d257634e487b7160e01b600052603260045260246000fd5b0180546129de90613bb6565b80601f0160208091040260200160405190810160405280929190818152602001828054612a0a90613bb6565b8015612a575780601f10612a2c57610100808354040283529160200191612a57565b820191906000526020600020905b815481529060010190602001808311612a3a57829003601f168201915b505050505081600560098110612a7d57634e487b7160e01b600052603260045260246000fd5b60200201525b630fffffff60049490941c93841693601f16915060368260208110612ab857634e487b7160e01b600052603260045260246000fd5b018054612ac490613bb6565b80601f0160208091040260200160405190810160405280929190818152602001828054612af090613bb6565b8015612b3d5780601f10612b1257610100808354040283529160200191612b3d565b820191906000526020600020905b815481529060010190602001808311612b2057829003601f168201915b505050505081600660098110612b6357634e487b7160e01b600052603260045260246000fd5b60200201526307ffffff60059490941c9384169360019081161415612c7d57604080518082019091526001808252600160fd1b602083015285901c600f169250816007602002015260568260108110612bcc57634e487b7160e01b600052603260045260246000fd5b018054612bd890613bb6565b80601f0160208091040260200160405190810160405280929190818152602001828054612c0490613bb6565b8015612c515780601f10612c2657610100808354040283529160200191612c51565b820191906000526020600020905b815481529060010190602001808311612c3457829003601f168201915b505050505081600860098110612c7757634e487b7160e01b600052603260045260246000fd5b60200201525b80516020808301516040808501516060860151608087015160a088015160c089015160e08a01516101008b01519651612cc39a9996979596949593949293919201613335565b60405160208183030381529060405292505050919050565b6000600f600483901c166003811015612cf85760059150506107f0565b60088110156126e95760049150506107f0565b60008181526001830160205260408120548015612e1e576000612d2f600183613b73565b8554909150600090612d4390600190613b73565b9050818114612dc4576000866000018281548110612d7157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110612da257634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612de357634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610c76565b6000915050610c76565b8260648101928215612e56579160200282015b82811115612e56578235825591602001919060010190612e3b565b50612e62929150612e8e565b5090565b6040518061012001604052806009905b6060815260200190600190039081612e765790505090565b5b80821115612e625760008155600101612e8f565b60008083601f840112612eb4578182fd5b50813567ffffffffffffffff811115612ecb578182fd5b6020830191508360208083028501011115612ee557600080fd5b9250929050565b600060208284031215612efd578081fd5b8135612f0881613c7c565b9392505050565b600060208284031215612f20578081fd5b8151612f0881613c7c565b60008060408385031215612f3d578081fd5b8235612f4881613c7c565b91506020830135612f5881613c7c565b809150509250929050565b600080600060608486031215612f77578081fd5b8335612f8281613c7c565b92506020840135612f9281613c7c565b929592945050506040919091013590565b60008060008060808587031215612fb8578081fd5b8435612fc381613c7c565b93506020850135612fd381613c7c565b925060408501359150606085013567ffffffffffffffff811115612ff5578182fd5b8501601f81018713613005578182fd5b803561301861301382613ab5565b613a84565b81815288602083850101111561302c578384fd5b81602084016020830137908101602001929092525092959194509250565b6000806040838503121561305c578182fd5b823561306781613c7c565b91506020830135612f5881613c91565b60008060408385031215613089578182fd5b823561309481613c7c565b946020939093013593505050565b6000610c808083850312156130b5578182fd5b8381840111156130c3578182fd5b509092915050565b6000806000604084860312156130df578081fd5b833567ffffffffffffffff8111156130f5578182fd5b61310186828701612ea3565b909790965060209590950135949350505050565b60008060208385031215613127578182fd5b823567ffffffffffffffff81111561313d578283fd5b61314985828601612ea3565b90969095509350505050565b600080600060408486031215613169578081fd5b833567ffffffffffffffff81111561317f578182fd5b61318b86828701612ea3565b909450925050602084013561319f81613c7c565b809150509250925092565b6000602082840312156131bb578081fd5b8135612f0881613c91565b6000602082840312156131d7578081fd5b8151612f0881613c91565b6000602082840312156131f3578081fd5b5035919050565b60006020828403121561320b578081fd5b8135612f0881613c9f565b600060208284031215613227578081fd5b8151612f0881613c9f565b600060208284031215613243578081fd5b81516001600160d81b031981168114612f08578182fd5b60006020828403121561326b578081fd5b815167ffffffffffffffff811115613281578182fd5b8201601f81018413613291578182fd5b805161329f61301382613ab5565b8181528560208385010111156132b3578384fd5b6132c4826020830160208601613b8a565b95945050505050565b6000602082840312156132de578081fd5b5051919050565b600080604083850312156132f7578182fd5b823591506020830135612f5881613c7c565b60008151808452613321816020860160208601613b8a565b601f01601f19169290920160200192915050565b60008a51613347818460208f01613b8a565b8a516133598183860160208f01613b8a565b8a51918401019061336e818360208e01613b8a565b89516133808183850160208e01613b8a565b8951929091010190613396818360208c01613b8a565b87516133a88183850160208c01613b8a565b87519290910101906133be818360208a01613b8a565b85519101906133d1818360208901613b8a565b84516133e38183850160208901613b8a565b9101019b9a5050505050505050505050565b90815260200190565b918252602082015260400190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906134aa90830184613309565b9695505050505050565b901515815260200190565b6001600160d81b031991909116815260200190565b600060208252610c736020830184613309565b6020808252600e908201526d139bdd081058d8db1a5b585d195960921b604082015260600190565b6020808252602b908201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560408201526a74206f6620626f756e647360a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526017908201527f5072657020436f6e646974696f6e73204e6f74204d6574000000000000000000604082015260600190565b60208082526013908201527227b7363c9021b7b73a3930b1ba1027bbb732b960691b604082015260600190565b602080825260129082015271496e73756666696369656e742056616c756560701b604082015260600190565b60208082526024908201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526019908201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604082015260600190565b6020808252600e908201526d0416c7265616479205365742055760941b604082015260600190565b602080825260159082015274135a5b9d1a5b99c815da5b991bddc810db1bdcd959605a1b604082015260600190565b6020808252602c908201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860408201526b34b9ba32b73a103a37b5b2b760a11b606082015260800190565b602080825260069082015265233937bd32b760d11b604082015260600190565b60208082526019908201527f52657665616c20436f6e646974696f6e73204e6f74204d657400000000000000604082015260600190565b60208082526038908201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760408201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606082015260800190565b6020808252600e908201526d105b1c9958591e48135a5b9d195960921b604082015260600190565b60208082526023908201527f4552433732313a20717565727920666f72206e6f6e6578697374656e7420746f60408201526235b2b760e91b606082015260800190565b6020808252600e908201526d52657665616c2050656e64696e6760901b604082015260600190565b60208082526021908201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656040820152603960f91b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526019908201527f4e6f7420414d43204f776e6572206f7220417070726f76656400000000000000604082015260600190565b61ffff9290921682526001600160a01b0316602082015260400190565b93845260ff9283166020850152908216604084015216606082015260a060808201819052600190820152603f60f81b60c082015260e00190565b600086825260ff8616602083015260ff8516604083015260ff8416606083015260a060808301526139f560a0830184613309565b979650505050505050565b60ff91909116815260200190565b600060ff8916825260e06020830152613a2a60e0830189613309565b60ff881660408401528281036060840152613a458188613309565b90508281036080840152613a598187613309565b6001600160a01b039590951660a0840152505063ffffffff9190911660c09091015295945050505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715613aad57613aad613c66565b604052919050565b600067ffffffffffffffff821115613acf57613acf613c66565b50601f01601f191660200190565b60008219821115613af057613af0613c3a565b500190565b600061ffff80841680613b0a57613b0a613c50565b92169190910492915050565b600082613b2557613b25613c50565b500490565b600061ffff80831681851681830481118215151615613b4b57613b4b613c3a565b02949350505050565b6000816000190483118215151615613b6e57613b6e613c3a565b500290565b600082821015613b8557613b85613c3a565b500390565b60005b83811015613ba5578181015183820152602001613b8d565b838111156109005750506000910152565b600281046001821680613bca57607f821691505b6020821081141561149d57634e487b7160e01b600052602260045260246000fd5b6000600019821415613bff57613bff613c3a565b5060010190565b600060ff821660ff811415613c1d57613c1d613c3a565b60010192915050565b600082613c3557613c35613c50565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461161857600080fd5b801515811461161857600080fd5b6001600160e01b03198116811461161857600080fdfea264697066735822122081e186b108a804cfc7b946734740a8a096f979c510e10f2759fe1fad1938b9b064736f6c63430008010033
Verified Source Code Partial Match
Compiler: v0.8.1+commit.df193b15
EVM: istanbul
Optimization: Yes (200 runs)
MoonCatLootprints.sol 850 lines
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.1;
interface IMoonCatAcclimator {
function getApproved(uint256 tokenId) external view returns (address);
function isApprovedForAll(address owner, address operator) external view returns (bool);
function ownerOf(uint256 tokenId) external view returns (address);
}
interface IMoonCatRescue {
function rescueOrder(uint256 tokenId) external view returns (bytes5);
function catOwners(bytes5 catId) external view returns (address);
}
interface IReverseResolver {
function claim(address owner) external returns (bytes32);
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
interface IERC721Metadata is IERC721 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
interface IERC721Enumerable is IERC721 {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
}
interface IMoonCatLootprintsMetadata {
function getJSON(uint256 lootprintId,
uint8 classId,
uint8 colorId,
uint8 bays,
string calldata shipName)
external view returns (string memory);
function getImage(uint256 lootprintId,
uint8 classId,
uint8 colorId,
uint8 bays,
string calldata shipName)
external view returns (string memory);
function getClassName(uint8 classId) external view returns (string memory);
function getColorName(uint8 classId) external view returns (string memory);
}
/**
* @dev Derived from OpenZeppelin standard template
* https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol
* b0cf6fbb7a70f31527f36579ad644e1cf12fdf4e
*/
library EnumerableSet {
struct Set {
uint256[] _values;
mapping (uint256 => uint256) _indexes;
}
function at(Set storage set, uint256 index) internal view returns (uint256) {
return set._values[index];
}
function contains(Set storage set, uint256 value) internal view returns (bool) {
return set._indexes[value] != 0;
}
function length(Set storage set) internal view returns (uint256) {
return set._values.length;
}
function add(Set storage set, uint256 value) internal returns (bool) {
if (!contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function remove(Set storage set, uint256 value) internal returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
uint256 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
}
/**
* @title MoonCatLootprints
* @dev MoonCats have found some plans for building spaceships
*/
contract MoonCatLootprints is IERC165, IERC721Enumerable, IERC721Metadata {
/* ERC-165 */
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165) returns (bool) {
return (interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId);
}
/* External Contracts */
IMoonCatAcclimator MCA = IMoonCatAcclimator(0xc3f733ca98E0daD0386979Eb96fb1722A1A05E69);
IMoonCatRescue MCR = IMoonCatRescue(0x60cd862c9C687A9dE49aecdC3A99b74A4fc54aB6);
IMoonCatLootprintsMetadata public Metadata;
/* Name String Data */
string[4] internal honorifics =
[
"Legendary",
"Notorious",
"Distinguished",
"Renowned"
];
string[32] internal adjectives =
[
"Turbo",
"Tectonic",
"Rugged",
"Derelict",
"Scratchscarred",
"Purrfect",
"Rickety",
"Sparkly",
"Ethereal",
"Hissing",
"Pouncing",
"Stalking",
"Standing",
"Sleeping",
"Playful",
"Menancing", // Poor Steve.
"Cuddly",
"Neurotic",
"Skittish",
"Impulsive",
"Sly",
"Ponderous",
"Prodigal",
"Hungry",
"Grumpy",
"Harmless",
"Mysterious",
"Frisky",
"Furry",
"Scratchy",
"Patchy",
"Hairless"
];
string[15] internal mods =
[
"Star",
"Galaxy",
"Constellation",
"World",
"Moon",
"Alley",
"Midnight",
"Wander",
"Tuna",
"Mouse",
"Catnip",
"Toy",
"Kibble",
"Hairball",
"Litterbox"
];
string[32] internal mains =
[
"Lightning",
"Wonder",
"Toebean",
"Whisker",
"Paw",
"Fang",
"Tail",
"Purrbox",
"Meow",
"Claw",
"Scratcher",
"Chomper",
"Nibbler",
"Mouser",
"Racer",
"Teaser",
"Chaser",
"Hunter",
"Leaper",
"Sleeper",
"Pouncer",
"Stalker",
"Stander",
"TopCat",
"Ambassador",
"Admiral",
"Commander",
"Negotiator",
"Vandal",
"Mischief",
"Ultimatum",
"Frolic"
];
string[16] internal designations =
[
"Alpha",
"Tau",
"Pi",
"I",
"II",
"III",
"IV",
"V",
"X",
"Prime",
"Proper",
"1",
"1701-D",
"2017",
"A",
"Runt"
];
/* Data */
bytes32[400] ColorTable;
/* Structs */
struct Lootprint {
uint16 index;
address owner;
}
/* State */
using EnumerableSet for EnumerableSet.Set;
address payable public contractOwner;
bool public frozen = true;
bool public mintingWindowOpen = true;
uint8 revealCount = 0;
uint256 public price = 50000000000000000;
bytes32[100] NoChargeList;
bytes32[20] revealBlockHashes;
Lootprint[25600] public Lootprints; // lootprints by lootprintId/rescueOrder
EnumerableSet.Set internal LootprintIdByIndex;
mapping(address => EnumerableSet.Set) internal LootprintsByOwner;
mapping(uint256 => address) private TokenApprovals; // lootprint id -> approved address
mapping(address => mapping(address => bool)) private OperatorApprovals; // owner address -> operator address -> bool
/* Modifiers */
modifier onlyContractOwner () {
require(msg.sender == contractOwner, "Only Contract Owner");
_;
}
modifier lootprintExists (uint256 lootprintId) {
require(LootprintIdByIndex.contains(lootprintId), "ERC721: operator query for nonexistent token");
_;
}
modifier onlyOwnerOrApproved(uint256 lootprintId) {
require(LootprintIdByIndex.contains(lootprintId), "ERC721: query for nonexistent token");
address owner = ownerOf(lootprintId);
require(msg.sender == owner || msg.sender == TokenApprovals[lootprintId] || OperatorApprovals[owner][msg.sender],
"ERC721: transfer caller is not owner nor approved");
_;
}
modifier notFrozen () {
require(!frozen, "Frozen");
_;
}
/* ERC-721 Helpers */
function setApprove(address to, uint256 lootprintId) private {
TokenApprovals[lootprintId] = to;
emit Approval(msg.sender, to, lootprintId);
}
function handleTransfer(address from, address to, uint256 lootprintId) private {
require(to != address(0), "ERC721: transfer to the zero address");
setApprove(address(0), lootprintId);
LootprintsByOwner[from].remove(lootprintId);
LootprintsByOwner[to].add(lootprintId);
Lootprints[lootprintId].owner = to;
emit Transfer(from, to, lootprintId);
}
/* ERC-721 */
function totalSupply() public view override returns (uint256) {
return LootprintIdByIndex.length();
}
function balanceOf(address owner) public view override returns (uint256 balance) {
return LootprintsByOwner[owner].length();
}
function ownerOf(uint256 lootprintId) public view override returns (address owner) {
return Lootprints[lootprintId].owner;
}
function approve(address to, uint256 lootprintId) public override lootprintExists(lootprintId) {
address owner = ownerOf(lootprintId);
require(to != owner, "ERC721: approval to current owner");
require(msg.sender == owner || isApprovedForAll(owner, msg.sender), "ERC721: approve caller is not owner nor approved for all");
setApprove(to, lootprintId);
}
function getApproved(uint256 lootprintId) public view override returns (address operator) {
return TokenApprovals[lootprintId];
}
function setApprovalForAll(address operator, bool approved) public override {
require(operator != msg.sender, "ERC721: approve to caller");
OperatorApprovals[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function isApprovedForAll(address owner, address operator) public view override returns (bool) {
return OperatorApprovals[owner][operator];
}
function safeTransferFrom(address from, address to, uint256 lootprintId, bytes memory _data) public override onlyOwnerOrApproved(lootprintId) {
handleTransfer(from, to, lootprintId);
uint256 size;
assembly {
size := extcodesize(to)
}
if (size > 0) {
try IERC721Receiver(to).onERC721Received(msg.sender, from, lootprintId, _data) returns (bytes4 retval) {
if (retval != IERC721Receiver.onERC721Received.selector) {
revert("ERC721: transfer to non ERC721Receiver implementer");
}
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
}
function safeTransferFrom(address from, address to, uint256 lootprintId) public override {
safeTransferFrom(from, to, lootprintId, "");
}
function transferFrom(address from, address to, uint256 lootprintId) public override onlyOwnerOrApproved(lootprintId) {
handleTransfer(from, to, lootprintId);
}
/* ERC-721 Enumerable */
function tokenByIndex(uint256 index) public view override returns (uint256) {
return LootprintIdByIndex.at(index);
}
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return LootprintsByOwner[owner].at(index);
}
/* Reveal */
bool pendingReveal = false;
uint256 revealPrepBlock;
bytes32 revealSeedHash;
/**
* @dev How many lootprints are awaiting being revealed?
*/
function pendingRevealCount() public view returns (uint256) {
uint256 numRevealed = revealCount * 2560;
if (numRevealed > LootprintIdByIndex.length()) return 0;
return LootprintIdByIndex.length() - numRevealed;
}
/**
* @dev Start a reveal action.
* The hash submitted here must be the keccak256 hash of a secret number that will be submitted to the next function
*/
function prepReveal(bytes32 seedHash) public onlyContractOwner {
require(!pendingReveal && seedHash != revealSeedHash && revealCount < 20, "Prep Conditions Not Met");
revealSeedHash = seedHash;
revealPrepBlock = block.number;
pendingReveal = true;
}
/**
* @dev Finalize a reveal action.
* Must take place at least one block after the `prepReveal` action was taken
*/
function reveal(uint256 revealSeed) public onlyContractOwner{
require(pendingReveal
&& block.number > revealPrepBlock
&& keccak256(abi.encodePacked(revealSeed)) == revealSeedHash
, "Reveal Conditions Not Met");
if (block.number - revealPrepBlock < 255) {
bytes32 blockSeed = keccak256(abi.encodePacked(revealSeed, blockhash(revealPrepBlock)));
revealBlockHashes[revealCount] = blockSeed;
revealCount++;
}
pendingReveal = false;
}
/* Minting */
/**
* @dev Is the minting of a specific rescueOrder needing payment or is it free?
*/
function paidMint(uint256 rescueOrder) public view returns (bool) {
uint256 wordIndex = rescueOrder / 256;
uint256 bitIndex = rescueOrder % 256;
return (uint(NoChargeList[wordIndex] >> (255 - bitIndex)) & 1) == 0;
}
/**
* @dev Create the token
* Checks that the address minting is the current owner of the MoonCat, and ensures that MoonCat is Acclimated
*/
function handleMint(uint256 rescueOrder, address to) private {
require(mintingWindowOpen, "Minting Window Closed");
require(MCR.catOwners(MCR.rescueOrder(rescueOrder)) == 0xc3f733ca98E0daD0386979Eb96fb1722A1A05E69,
"Not Acclimated");
address moonCatOwner = MCA.ownerOf(rescueOrder);
require((msg.sender == moonCatOwner)
|| (msg.sender == MCA.getApproved(rescueOrder))
|| (MCA.isApprovedForAll(moonCatOwner, msg.sender)),
"Not AMC Owner or Approved"
);
require(!LootprintIdByIndex.contains(rescueOrder), "Already Minted");
Lootprints[rescueOrder] = Lootprint(uint16(LootprintIdByIndex.length()), to);
LootprintIdByIndex.add(rescueOrder);
LootprintsByOwner[to].add(rescueOrder);
emit Transfer(address(0), to, rescueOrder);
}
/**
* @dev Mint a lootprint, and give it to a specific address
*/
function mint(uint256 rescueOrder, address to) public payable notFrozen {
if (paidMint(rescueOrder)) {
require(address(this).balance >= price, "Insufficient Value");
contractOwner.transfer(price);
}
handleMint(rescueOrder, to);
if (address(this).balance > 0) {
// The buyer over-paid; transfer their funds back to them
payable(msg.sender).transfer(address(this).balance);
}
}
/**
* @dev Mint a lootprint, and give it to the address making the transaction
*/
function mint(uint256 rescueOrder) public payable {
mint(rescueOrder, msg.sender);
}
/**
* @dev Mint multiple lootprints, sending them all to a specific address
*/
function mintMultiple(uint256[] calldata rescueOrders, address to) public payable notFrozen {
uint256 totalPrice = 0;
for (uint i = 0; i < rescueOrders.length; i++) {
if (paidMint(rescueOrders[i])) {
totalPrice += price;
}
handleMint(rescueOrders[i], to);
}
require(address(this).balance >= totalPrice, "Insufficient Value");
if (totalPrice > 0) {
contractOwner.transfer(totalPrice);
}
if (address(this).balance > 0) {
// The buyer over-paid; transfer their funds back to them
payable(msg.sender).transfer(address(this).balance);
}
}
/**
* @dev Mint multiple lootprints, sending them all to the address making the transaction
*/
function mintMultiple(uint256[] calldata rescueOrders) public payable {
mintMultiple(rescueOrders, msg.sender);
}
/* Contract Owner */
constructor(address metadataContract) {
contractOwner = payable(msg.sender);
Metadata = IMoonCatLootprintsMetadata(metadataContract);
// https://docs.ens.domains/contract-api-reference/reverseregistrar#claim-address
IReverseResolver(0x084b1c3C81545d370f3634392De611CaaBFf8148)
.claim(msg.sender);
}
/**
* @dev Mint the 160 Hero lootprint tokens, and give them to the contract owner
*/
function setupHeroShips(bool groupTwo) public onlyContractOwner {
uint startIndex = 25440;
if (groupTwo) {
startIndex = 25520;
}
require(Lootprints[startIndex].owner == address(0), "Already Set Up");
for (uint i = startIndex; i < (startIndex+80); i++) {
Lootprints[i] = Lootprint(uint16(LootprintIdByIndex.length()), contractOwner);
LootprintIdByIndex.add(i);
LootprintsByOwner[contractOwner].add(i);
emit Transfer(address(0), contractOwner, i);
}
}
/**
* @dev Update the contract used for image/JSON rendering
*/
function setMetadataContract(address metadataContract) public onlyContractOwner{
Metadata = IMoonCatLootprintsMetadata(metadataContract);
}
/**
* @dev Set configuration values for which MoonCat creates which color lootprint when minted
*/
function setColorTable(bytes32[] calldata table, uint startAt) public onlyContractOwner {
for (uint i = 0; i < table.length; i++) {
ColorTable[startAt + i] = table[i];
}
}
/**
* @dev Set configuration values for which MoonCats need to pay for minting a lootprint
*/
function setNoChargeList (bytes32[100] calldata noChargeList) public onlyContractOwner {
NoChargeList = noChargeList;
}
/**
* @dev Set configuration values for how much a paid lootprint costs
*/
function setPrice(uint256 priceWei) public onlyContractOwner {
price = priceWei;
}
/**
* @dev Allow current `owner` to transfer ownership to another address
*/
function transferOwnership (address payable newOwner) public onlyContractOwner {
contractOwner = newOwner;
}
/**
* @dev Prevent creating lootprints
*/
function freeze () public onlyContractOwner notFrozen {
frozen = true;
}
/**
* @dev Enable creating lootprints
*/
function unfreeze () public onlyContractOwner {
frozen = false;
}
/**
* @dev Prevent any further minting from happening
* Checks to ensure all have been revealed before allowing locking down the minting process
*/
function permanentlyCloseMintingWindow() public onlyContractOwner {
require(revealCount >= 20, "Reveal Pending");
mintingWindowOpen = false;
}
/* Property Decoders */
function decodeColor(uint256 rescueOrder) public view returns (uint8) {
uint256 wordIndex = rescueOrder / 64;
uint256 nibbleIndex = rescueOrder % 64;
bytes32 word = ColorTable[wordIndex];
return uint8(uint(word >> (252 - nibbleIndex * 4)) & 15);
}
function decodeName(uint32 seed) internal view returns (string memory) {
seed = seed >> 8;
uint index;
string[9] memory parts;
//honorific
index = seed & 15;
if (index < 8) {
parts[0] = "The ";
if (index < 4) {
parts[1] = honorifics[index];
parts[2] = " ";
}
}
seed >>= 4;
//adjective
if ((seed & 1) == 1) {
index = (seed >> 1) & 31;
parts[3] = adjectives[index];
parts[4] = " ";
}
seed >>= 6;
//mod
index = seed & 15;
if (index < 15) {
parts[5] = mods[index];
}
seed >>= 4;
//main
index = seed & 31;
parts[6] = mains[index];
seed >>= 5;
//designation
if ((seed & 1) == 1) {
index = (seed >> 1) & 15;
parts[7] = " ";
parts[8] = designations[index];
}
return string(abi.encodePacked(parts[0], parts[1], parts[2],
parts[3], parts[4], parts[5],
parts[6], parts[7], parts[8]));
}
function decodeClass(uint32 seed) internal pure returns (uint8) {
uint class_determiner = seed & 15;
if (class_determiner < 2) {
return 0;
} else if (class_determiner < 5) {
return 1;
} else if (class_determiner < 9) {
return 2;
} else {
return 3;
}
}
function decodeBays(uint32 seed) internal pure returns (uint8) {
uint bay_determiner = (seed >> 4) & 15;
if (bay_determiner < 3) {
return 5;
} else if (bay_determiner < 8) {
return 4;
} else {
return 3;
}
}
uint8 constant internal STATUS_NOT_MINTED = 0;
uint8 constant internal STATUS_NOT_MINTED_FREE = 1;
uint8 constant internal STATUS_PENDING = 2;
uint8 constant internal STATUS_MINTED = 3;
/**
* @dev Get detailed traits about a lootprint token
* Provides trait values in native contract return values, which can be used by other contracts
*/
function getDetails (uint256 lootprintId)
public
view
returns (uint8 status, string memory class, uint8 bays, string memory colorName, string memory shipName, address tokenOwner, uint32 seed)
{
Lootprint memory lootprint = Lootprints[lootprintId];
colorName = Metadata.getColorName(decodeColor(lootprintId));
tokenOwner = address(0);
if (LootprintIdByIndex.contains(lootprintId)) {
if (revealBlockHashes[lootprint.index / 1280] > 0) {
seed = uint32(uint256(keccak256(abi.encodePacked(lootprintId, revealBlockHashes[lootprint.index / 1280]))));
return (STATUS_MINTED,
Metadata.getClassName(decodeClass(seed)),
decodeBays(seed),
colorName,
decodeName(seed),
lootprint.owner,
seed);
}
status = STATUS_PENDING;
tokenOwner = lootprint.owner;
} else if (paidMint(lootprintId)) {
status = STATUS_NOT_MINTED;
} else {
status = STATUS_NOT_MINTED_FREE;
}
return (status, "Unknown", 0, colorName, "?", tokenOwner, 0);
}
/* ERC-721 Metadata */
function name() public pure override returns (string memory) {
return "MoonCatLootprint";
}
function symbol() public pure override returns (string memory) {
return unicode"📜";
}
function tokenURI(uint256 lootprintId) public view override lootprintExists(lootprintId) returns (string memory) {
Lootprint memory lootprint = Lootprints[lootprintId];
uint8 colorId = decodeColor(lootprintId);
if (revealBlockHashes[lootprint.index / 1280] > 0) {
uint32 seed = uint32(uint256(keccak256(abi.encodePacked(lootprintId, revealBlockHashes[lootprint.index / 1280]))));
uint8 classId = decodeClass(seed);
string memory shipName = decodeName(seed);
uint8 bays = decodeBays(seed);
return Metadata.getJSON(lootprintId, classId, colorId, bays, shipName);
} else {
return Metadata.getJSON(lootprintId, 4, colorId, 0, "?");
}
}
function imageURI(uint256 lootprintId) public view lootprintExists(lootprintId) returns (string memory) {
Lootprint memory lootprint = Lootprints[lootprintId];
uint8 colorId = decodeColor(lootprintId);
if (revealBlockHashes[lootprint.index / 1280] > 0) {
uint32 seed = uint32(uint256(keccak256(abi.encodePacked(lootprintId, revealBlockHashes[lootprint.index / 1280]))));
uint8 classId = decodeClass(seed);
string memory shipName = decodeName(seed);
uint8 bays = decodeBays(seed);
return Metadata.getImage(lootprintId, classId, colorId, bays, shipName);
} else {
return Metadata.getImage(lootprintId, 4, colorId, 0, "?");
}
}
/* Rescue Tokens */
/**
* @dev Rescue ERC20 assets sent directly to this contract.
*/
function withdrawForeignERC20(address tokenContract)
public
onlyContractOwner
{
IERC20 token = IERC20(tokenContract);
token.transfer(contractOwner, token.balanceOf(address(this)));
}
/**
* @dev Rescue ERC721 assets sent directly to this contract.
*/
function withdrawForeignERC721(address tokenContract, uint256 lootprintId)
public
onlyContractOwner
{
IERC721(tokenContract).safeTransferFrom(address(this), contractOwner, lootprintId);
}
}
Read Contract
Lootprints 0xda6c9283 → uint16, address
Metadata 0xa5eb6ff2 → address
balanceOf 0x70a08231 → uint256
contractOwner 0xce606ee0 → address
decodeColor 0xa1a4c27f → uint8
frozen 0x054f7d9c → bool
getApproved 0x081812fc → address
getDetails 0xb93a89f7 → uint8, string, uint8, string, string, address, uint32
imageURI 0x8f742d16 → string
isApprovedForAll 0xe985e9c5 → bool
mintingWindowOpen 0xa350de0d → bool
name 0x06fdde03 → string
ownerOf 0x6352211e → address
paidMint 0x65cde733 → bool
pendingRevealCount 0xc2d2bccb → uint256
price 0xa035b1fe → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 lootprintId
freeze 0x62a5af3b
No parameters
mint 0x94bf804d
uint256 rescueOrder
address to
mint 0xa0712d68
uint256 rescueOrder
mintMultiple 0x82db3fb6
uint256[] rescueOrders
address to
mintMultiple 0xd47f030d
uint256[] rescueOrders
permanentlyCloseMintingWindow 0x39d78e6b
No parameters
prepReveal 0x6fa14b54
bytes32 seedHash
reveal 0xc2ca0ac5
uint256 revealSeed
safeTransferFrom 0x42842e0e
address from
address to
uint256 lootprintId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 lootprintId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setColorTable 0x35a9cede
bytes32[] table
uint256 startAt
setMetadataContract 0xe5187f43
address metadataContract
setNoChargeList 0x9e288b1a
bytes32[100] noChargeList
setPrice 0x91b7f5ed
uint256 priceWei
setupHeroShips 0x14152f71
bool groupTwo
transferFrom 0x23b872dd
address from
address to
uint256 lootprintId
transferOwnership 0xf2fde38b
address newOwner
unfreeze 0x6a28f000
No parameters
withdrawForeignERC20 0x5c471995
address tokenContract
withdrawForeignERC721 0x0ce06b68
address tokenContract
uint256 lootprintId
Recent Transactions
This address has 1 on-chain transactions, but only 0.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →