Address Contract Partially Verified
Address
0x919bf3D406Ff90c17F97CD5887aDF8c8C111FA8C
Balance
0 ETH
Nonce
1
Code Size
17360 bytes
Creator
0x598D843E...5EC4 at tx 0xc099f621...921d05
Indexed Transactions
0
Contract Bytecode
17360 bytes
0x60806040526004361061021a5760003560e01c80635c975abb11610123578063a22cb465116100ab578063e0a808531161006f578063e0a808531461078a578063e985e9c5146107b3578063e9bced0a146107f0578063efbd73f41461081b578063f2fde38b146108445761021a565b8063a22cb465146106b9578063a45ba8e7146106e2578063a67698731461070d578063b88d4fde14610724578063c87b56dd1461074d5761021a565b8063715018a6116100f2578063715018a6146106075780637ec4a6591461061e5780638da5cb5b1461064757806395d89b4114610672578063a0712d681461069d5761021a565b80635c975abb1461053757806362b99ad4146105625780636352211e1461058d57806370a08231146105ca5761021a565b8063239c70ae116101a6578063438b630011610175578063438b63001461045257806344a0d68a1461048f5780634fdd43cb146104b857806351830227146104e15780635503a0e81461050c5761021a565b8063239c70ae146103be57806323b872dd146103e95780633ccfd60b1461041257806342842e0e146104295761021a565b8063095ea7b3116101ed578063095ea7b3146102ed57806313faede61461031657806316ba10e01461034157806316c38b3c1461036a57806318160ddd146103935761021a565b806301ffc9a71461021f57806306fdde031461025c578063081812fc14610287578063088a4ed0146102c4575b600080fd5b34801561022b57600080fd5b5061024660048036038101906102419190612f8e565b61086d565b6040516102539190613643565b60405180910390f35b34801561026857600080fd5b5061027161094f565b60405161027e919061365e565b60405180910390f35b34801561029357600080fd5b506102ae60048036038101906102a99190613031565b6109e1565b6040516102bb91906135ba565b60405180910390f35b3480156102d057600080fd5b506102eb60048036038101906102e69190613031565b610a66565b005b3480156102f957600080fd5b50610314600480360381019061030f9190612f21565b610aec565b005b34801561032257600080fd5b5061032b610c04565b6040516103389190613920565b60405180910390f35b34801561034d57600080fd5b5061036860048036038101906103639190612fe8565b610c0a565b005b34801561037657600080fd5b50610391600480360381019061038c9190612f61565b610ca0565b005b34801561039f57600080fd5b506103a8610d39565b6040516103b59190613920565b60405180910390f35b3480156103ca57600080fd5b506103d3610d4a565b6040516103e09190613920565b60405180910390f35b3480156103f557600080fd5b50610410600480360381019061040b9190612e0b565b610d50565b005b34801561041e57600080fd5b50610427610db0565b005b34801561043557600080fd5b50610450600480360381019061044b9190612e0b565b610eac565b005b34801561045e57600080fd5b5061047960048036038101906104749190612d9e565b610ecc565b6040516104869190613621565b60405180910390f35b34801561049b57600080fd5b506104b660048036038101906104b19190613031565b610fd7565b005b3480156104c457600080fd5b506104df60048036038101906104da9190612fe8565b61105d565b005b3480156104ed57600080fd5b506104f66110f3565b6040516105039190613643565b60405180910390f35b34801561051857600080fd5b50610521611106565b60405161052e919061365e565b60405180910390f35b34801561054357600080fd5b5061054c611194565b6040516105599190613643565b60405180910390f35b34801561056e57600080fd5b506105776111a7565b604051610584919061365e565b60405180910390f35b34801561059957600080fd5b506105b460048036038101906105af9190613031565b611235565b6040516105c191906135ba565b60405180910390f35b3480156105d657600080fd5b506105f160048036038101906105ec9190612d9e565b6112e7565b6040516105fe9190613920565b60405180910390f35b34801561061357600080fd5b5061061c61139f565b005b34801561062a57600080fd5b5061064560048036038101906106409190612fe8565b611427565b005b34801561065357600080fd5b5061065c6114bd565b60405161066991906135ba565b60405180910390f35b34801561067e57600080fd5b506106876114e7565b604051610694919061365e565b60405180910390f35b6106b760048036038101906106b29190613031565b611579565b005b3480156106c557600080fd5b506106e060048036038101906106db9190612ee1565b6116d2565b005b3480156106ee57600080fd5b506106f76116e8565b604051610704919061365e565b60405180910390f35b34801561071957600080fd5b50610722611776565b005b34801561073057600080fd5b5061074b60048036038101906107469190612e5e565b611882565b005b34801561075957600080fd5b50610774600480360381019061076f9190613031565b6118e4565b604051610781919061365e565b60405180910390f35b34801561079657600080fd5b506107b160048036038101906107ac9190612f61565b611a3d565b005b3480156107bf57600080fd5b506107da60048036038101906107d59190612dcb565b611ad6565b6040516107e79190613643565b60405180910390f35b3480156107fc57600080fd5b50610805611b6a565b6040516108129190613920565b60405180910390f35b34801561082757600080fd5b50610842600480360381019061083d919061305e565b611b70565b005b34801561085057600080fd5b5061086b60048036038101906108669190612d9e565b611ca6565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061093857507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610948575061094782611d9e565b5b9050919050565b60606000805461095e90613c29565b80601f016020809104026020016040519081016040528092919081815260200182805461098a90613c29565b80156109d75780601f106109ac576101008083540402835291602001916109d7565b820191906000526020600020905b8154815290600101906020018083116109ba57829003601f168201915b5050505050905090565b60006109ec82611e08565b610a2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2290613840565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b610a6e611e74565b73ffffffffffffffffffffffffffffffffffffffff16610a8c6114bd565b73ffffffffffffffffffffffffffffffffffffffff1614610ae2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad990613860565b60405180910390fd5b80600d8190555050565b6000610af782611235565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5f906138c0565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b87611e74565b73ffffffffffffffffffffffffffffffffffffffff161480610bb65750610bb581610bb0611e74565b611ad6565b5b610bf5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bec906137a0565b60405180910390fd5b610bff8383611e7c565b505050565b600b5481565b610c12611e74565b73ffffffffffffffffffffffffffffffffffffffff16610c306114bd565b73ffffffffffffffffffffffffffffffffffffffff1614610c86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7d90613860565b60405180910390fd5b8060099080519060200190610c9c929190612bb2565b5050565b610ca8611e74565b73ffffffffffffffffffffffffffffffffffffffff16610cc66114bd565b73ffffffffffffffffffffffffffffffffffffffff1614610d1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1390613860565b60405180910390fd5b80600e60006101000a81548160ff02191690831515021790555050565b6000610d456007611f35565b905090565b600d5481565b610d61610d5b611e74565b82611f43565b610da0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d97906138e0565b60405180910390fd5b610dab838383612021565b505050565b610db8611e74565b73ffffffffffffffffffffffffffffffffffffffff16610dd66114bd565b73ffffffffffffffffffffffffffffffffffffffff1614610e2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2390613860565b60405180910390fd5b6000610e366114bd565b73ffffffffffffffffffffffffffffffffffffffff1647604051610e59906135a5565b60006040518083038185875af1925050503d8060008114610e96576040519150601f19603f3d011682016040523d82523d6000602084013e610e9b565b606091505b5050905080610ea957600080fd5b50565b610ec783838360405180602001604052806000815250611882565b505050565b60606000610ed9836112e7565b905060008167ffffffffffffffff811115610ef757610ef6613dc2565b5b604051908082528060200260200182016040528015610f255781602001602082028036833780820191505090505b50905060006001905060005b8381108015610f425750600c548211155b15610fcb576000610f5283611235565b90508673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610fb75782848381518110610f9c57610f9b613d93565b5b6020026020010181815250508180610fb390613c8c565b9250505b8280610fc290613c8c565b93505050610f31565b82945050505050919050565b610fdf611e74565b73ffffffffffffffffffffffffffffffffffffffff16610ffd6114bd565b73ffffffffffffffffffffffffffffffffffffffff1614611053576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104a90613860565b60405180910390fd5b80600b8190555050565b611065611e74565b73ffffffffffffffffffffffffffffffffffffffff166110836114bd565b73ffffffffffffffffffffffffffffffffffffffff16146110d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d090613860565b60405180910390fd5b80600a90805190602001906110ef929190612bb2565b5050565b600e60019054906101000a900460ff1681565b6009805461111390613c29565b80601f016020809104026020016040519081016040528092919081815260200182805461113f90613c29565b801561118c5780601f106111615761010080835404028352916020019161118c565b820191906000526020600020905b81548152906001019060200180831161116f57829003601f168201915b505050505081565b600e60009054906101000a900460ff1681565b600880546111b490613c29565b80601f01602080910402602001604051908101604052809291908181526020018280546111e090613c29565b801561122d5780601f106112025761010080835404028352916020019161122d565b820191906000526020600020905b81548152906001019060200180831161121057829003601f168201915b505050505081565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156112de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d5906137e0565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611358576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134f906137c0565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6113a7611e74565b73ffffffffffffffffffffffffffffffffffffffff166113c56114bd565b73ffffffffffffffffffffffffffffffffffffffff161461141b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141290613860565b60405180910390fd5b6114256000612288565b565b61142f611e74565b73ffffffffffffffffffffffffffffffffffffffff1661144d6114bd565b73ffffffffffffffffffffffffffffffffffffffff16146114a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149a90613860565b60405180910390fd5b80600890805190602001906114b9929190612bb2565b5050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546114f690613c29565b80601f016020809104026020016040519081016040528092919081815260200182805461152290613c29565b801561156f5780601f106115445761010080835404028352916020019161156f565b820191906000526020600020905b81548152906001019060200180831161155257829003601f168201915b5050505050905090565b8060008111801561158c5750600d548111155b6115cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c290613820565b60405180910390fd5b600c54816115d96007611f35565b6115e39190613a5e565b1115611624576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161b90613700565b60405180910390fd5b600e60009054906101000a900460ff1615611674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166b90613880565b60405180910390fd5b81600b546116829190613ae5565b3410156116c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bb90613900565b60405180910390fd5b6116ce338361234e565b5050565b6116e46116dd611e74565b838361238e565b5050565b600a80546116f590613c29565b80601f016020809104026020016040519081016040528092919081815260200182805461172190613c29565b801561176e5780601f106117435761010080835404028352916020019161176e565b820191906000526020600020905b81548152906001019060200180831161175157829003601f168201915b505050505081565b61177e611e74565b73ffffffffffffffffffffffffffffffffffffffff1661179c6114bd565b73ffffffffffffffffffffffffffffffffffffffff16146117f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e990613860565b60405180910390fd5b60006117fe6007611f35565b9050600c54611817600a836124fb90919063ffffffff16565b10611857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184e90613780565b60405180910390fd5b60005b600a81101561187e5761186b612511565b808061187690613c8c565b91505061185a565b5050565b61189361188d611e74565b83611f43565b6118d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c9906138e0565b60405180910390fd5b6118de84848484612536565b50505050565b60606118ef82611e08565b61192e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611925906138a0565b60405180910390fd5b60001515600e60019054906101000a900460ff16151514156119dc57600a805461195790613c29565b80601f016020809104026020016040519081016040528092919081815260200182805461198390613c29565b80156119d05780601f106119a5576101008083540402835291602001916119d0565b820191906000526020600020905b8154815290600101906020018083116119b357829003601f168201915b50505050509050611a38565b60006119e6612592565b90506000815111611a065760405180602001604052806000815250611a34565b80611a1084612624565b6009604051602001611a2493929190613574565b6040516020818303038152906040525b9150505b919050565b611a45611e74565b73ffffffffffffffffffffffffffffffffffffffff16611a636114bd565b73ffffffffffffffffffffffffffffffffffffffff1614611ab9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab090613860565b60405180910390fd5b80600e60016101000a81548160ff02191690831515021790555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600c5481565b81600081118015611b835750600d548111155b611bc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb990613820565b60405180910390fd5b600c5481611bd06007611f35565b611bda9190613a5e565b1115611c1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1290613700565b60405180910390fd5b611c23611e74565b73ffffffffffffffffffffffffffffffffffffffff16611c416114bd565b73ffffffffffffffffffffffffffffffffffffffff1614611c97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8e90613860565b60405180910390fd5b611ca1828461234e565b505050565b611cae611e74565b73ffffffffffffffffffffffffffffffffffffffff16611ccc6114bd565b73ffffffffffffffffffffffffffffffffffffffff1614611d22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1990613860565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611d92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d89906136a0565b60405180910390fd5b611d9b81612288565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611eef83611235565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081600001549050919050565b6000611f4e82611e08565b611f8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8490613760565b60405180910390fd5b6000611f9883611235565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061200757508373ffffffffffffffffffffffffffffffffffffffff16611fef846109e1565b73ffffffffffffffffffffffffffffffffffffffff16145b8061201857506120178185611ad6565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661204182611235565b73ffffffffffffffffffffffffffffffffffffffff1614612097576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208e906136c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612107576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120fe90613720565b60405180910390fd5b612112838383612785565b61211d600082611e7c565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461216d9190613b3f565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546121c49190613a5e565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461228383838361278a565b505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60005b8181101561238957612363600761278f565b612376836123716007611f35565b6127a5565b808061238190613c8c565b915050612351565b505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156123fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f490613740565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516124ee9190613643565b60405180910390a3505050565b600081836125099190613a5e565b905092915050565b600061251d6007611f35565b905061252933826127a5565b612533600761278f565b50565b612541848484612021565b61254d848484846127c3565b61258c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161258390613680565b60405180910390fd5b50505050565b6060600880546125a190613c29565b80601f01602080910402602001604051908101604052809291908181526020018280546125cd90613c29565b801561261a5780601f106125ef5761010080835404028352916020019161261a565b820191906000526020600020905b8154815290600101906020018083116125fd57829003601f168201915b5050505050905090565b6060600082141561266c576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612780565b600082905060005b6000821461269e57808061268790613c8c565b915050600a826126979190613ab4565b9150612674565b60008167ffffffffffffffff8111156126ba576126b9613dc2565b5b6040519080825280601f01601f1916602001820160405280156126ec5781602001600182028036833780820191505090505b5090505b60008514612779576001826127059190613b3f565b9150600a856127149190613cd5565b60306127209190613a5e565b60f81b81838151811061273657612735613d93565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856127729190613ab4565b94506126f0565b8093505050505b919050565b505050565b505050565b6001816000016000828254019250508190555050565b6127bf82826040518060200160405280600081525061295a565b5050565b60006127e48473ffffffffffffffffffffffffffffffffffffffff166129b5565b1561294d578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261280d611e74565b8786866040518563ffffffff1660e01b815260040161282f94939291906135d5565b602060405180830381600087803b15801561284957600080fd5b505af192505050801561287a57506040513d601f19601f820116820180604052508101906128779190612fbb565b60015b6128fd573d80600081146128aa576040519150601f19603f3d011682016040523d82523d6000602084013e6128af565b606091505b506000815114156128f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128ec90613680565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612952565b600190505b949350505050565b61296483836129d8565b61297160008484846127c3565b6129b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129a790613680565b60405180910390fd5b505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a3f90613800565b60405180910390fd5b612a5181611e08565b15612a91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a88906136e0565b60405180910390fd5b612a9d60008383612785565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612aed9190613a5e565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612bae6000838361278a565b5050565b828054612bbe90613c29565b90600052602060002090601f016020900481019282612be05760008555612c27565b82601f10612bf957805160ff1916838001178555612c27565b82800160010185558215612c27579182015b82811115612c26578251825591602001919060010190612c0b565b5b509050612c349190612c38565b5090565b5b80821115612c51576000816000905550600101612c39565b5090565b6000612c68612c6384613960565b61393b565b905082815260208101848484011115612c8457612c83613df6565b5b612c8f848285613be7565b509392505050565b6000612caa612ca584613991565b61393b565b905082815260208101848484011115612cc657612cc5613df6565b5b612cd1848285613be7565b509392505050565b600081359050612ce88161433e565b92915050565b600081359050612cfd81614355565b92915050565b600081359050612d128161436c565b92915050565b600081519050612d278161436c565b92915050565b600082601f830112612d4257612d41613df1565b5b8135612d52848260208601612c55565b91505092915050565b600082601f830112612d7057612d6f613df1565b5b8135612d80848260208601612c97565b91505092915050565b600081359050612d9881614383565b92915050565b600060208284031215612db457612db3613e00565b5b6000612dc284828501612cd9565b91505092915050565b60008060408385031215612de257612de1613e00565b5b6000612df085828601612cd9565b9250506020612e0185828601612cd9565b9150509250929050565b600080600060608486031215612e2457612e23613e00565b5b6000612e3286828701612cd9565b9350506020612e4386828701612cd9565b9250506040612e5486828701612d89565b9150509250925092565b60008060008060808587031215612e7857612e77613e00565b5b6000612e8687828801612cd9565b9450506020612e9787828801612cd9565b9350506040612ea887828801612d89565b925050606085013567ffffffffffffffff811115612ec957612ec8613dfb565b5b612ed587828801612d2d565b91505092959194509250565b60008060408385031215612ef857612ef7613e00565b5b6000612f0685828601612cd9565b9250506020612f1785828601612cee565b9150509250929050565b60008060408385031215612f3857612f37613e00565b5b6000612f4685828601612cd9565b9250506020612f5785828601612d89565b9150509250929050565b600060208284031215612f7757612f76613e00565b5b6000612f8584828501612cee565b91505092915050565b600060208284031215612fa457612fa3613e00565b5b6000612fb284828501612d03565b91505092915050565b600060208284031215612fd157612fd0613e00565b5b6000612fdf84828501612d18565b91505092915050565b600060208284031215612ffe57612ffd613e00565b5b600082013567ffffffffffffffff81111561301c5761301b613dfb565b5b61302884828501612d5b565b91505092915050565b60006020828403121561304757613046613e00565b5b600061305584828501612d89565b91505092915050565b6000806040838503121561307557613074613e00565b5b600061308385828601612d89565b925050602061309485828601612cd9565b9150509250929050565b60006130aa8383613556565b60208301905092915050565b6130bf81613b73565b82525050565b60006130d0826139e7565b6130da8185613a15565b93506130e5836139c2565b8060005b838110156131165781516130fd888261309e565b975061310883613a08565b9250506001810190506130e9565b5085935050505092915050565b61312c81613b85565b82525050565b600061313d826139f2565b6131478185613a26565b9350613157818560208601613bf6565b61316081613e05565b840191505092915050565b6000613176826139fd565b6131808185613a42565b9350613190818560208601613bf6565b61319981613e05565b840191505092915050565b60006131af826139fd565b6131b98185613a53565b93506131c9818560208601613bf6565b80840191505092915050565b600081546131e281613c29565b6131ec8186613a53565b9450600182166000811461320757600181146132185761324b565b60ff1983168652818601935061324b565b613221856139d2565b60005b8381101561324357815481890152600182019150602081019050613224565b838801955050505b50505092915050565b6000613261603283613a42565b915061326c82613e16565b604082019050919050565b6000613284602683613a42565b915061328f82613e65565b604082019050919050565b60006132a7602583613a42565b91506132b282613eb4565b604082019050919050565b60006132ca601c83613a42565b91506132d582613f03565b602082019050919050565b60006132ed601683613a42565b91506132f882613f2c565b602082019050919050565b6000613310602483613a42565b915061331b82613f55565b604082019050919050565b6000613333601983613a42565b915061333e82613fa4565b602082019050919050565b6000613356602c83613a42565b915061336182613fcd565b604082019050919050565b6000613379601383613a42565b91506133848261401c565b602082019050919050565b600061339c603883613a42565b91506133a782614045565b604082019050919050565b60006133bf602a83613a42565b91506133ca82614094565b604082019050919050565b60006133e2602983613a42565b91506133ed826140e3565b604082019050919050565b6000613405602083613a42565b915061341082614132565b602082019050919050565b6000613428600f83613a42565b91506134338261415b565b602082019050919050565b600061344b602c83613a42565b915061345682614184565b604082019050919050565b600061346e602083613a42565b9150613479826141d3565b602082019050919050565b6000613491601783613a42565b915061349c826141fc565b602082019050919050565b60006134b4602f83613a42565b91506134bf82614225565b604082019050919050565b60006134d7602183613a42565b91506134e282614274565b604082019050919050565b60006134fa600083613a37565b9150613505826142c3565b600082019050919050565b600061351d603183613a42565b9150613528826142c6565b604082019050919050565b6000613540601383613a42565b915061354b82614315565b602082019050919050565b61355f81613bdd565b82525050565b61356e81613bdd565b82525050565b600061358082866131a4565b915061358c82856131a4565b915061359882846131d5565b9150819050949350505050565b60006135b0826134ed565b9150819050919050565b60006020820190506135cf60008301846130b6565b92915050565b60006080820190506135ea60008301876130b6565b6135f760208301866130b6565b6136046040830185613565565b81810360608301526136168184613132565b905095945050505050565b6000602082019050818103600083015261363b81846130c5565b905092915050565b60006020820190506136586000830184613123565b92915050565b60006020820190508181036000830152613678818461316b565b905092915050565b6000602082019050818103600083015261369981613254565b9050919050565b600060208201905081810360008301526136b981613277565b9050919050565b600060208201905081810360008301526136d98161329a565b9050919050565b600060208201905081810360008301526136f9816132bd565b9050919050565b60006020820190508181036000830152613719816132e0565b9050919050565b6000602082019050818103600083015261373981613303565b9050919050565b6000602082019050818103600083015261375981613326565b9050919050565b6000602082019050818103600083015261377981613349565b9050919050565b600060208201905081810360008301526137998161336c565b9050919050565b600060208201905081810360008301526137b98161338f565b9050919050565b600060208201905081810360008301526137d9816133b2565b9050919050565b600060208201905081810360008301526137f9816133d5565b9050919050565b60006020820190508181036000830152613819816133f8565b9050919050565b600060208201905081810360008301526138398161341b565b9050919050565b600060208201905081810360008301526138598161343e565b9050919050565b6000602082019050818103600083015261387981613461565b9050919050565b6000602082019050818103600083015261389981613484565b9050919050565b600060208201905081810360008301526138b9816134a7565b9050919050565b600060208201905081810360008301526138d9816134ca565b9050919050565b600060208201905081810360008301526138f981613510565b9050919050565b6000602082019050818103600083015261391981613533565b9050919050565b60006020820190506139356000830184613565565b92915050565b6000613945613956565b90506139518282613c5b565b919050565b6000604051905090565b600067ffffffffffffffff82111561397b5761397a613dc2565b5b61398482613e05565b9050602081019050919050565b600067ffffffffffffffff8211156139ac576139ab613dc2565b5b6139b582613e05565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000613a6982613bdd565b9150613a7483613bdd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613aa957613aa8613d06565b5b828201905092915050565b6000613abf82613bdd565b9150613aca83613bdd565b925082613ada57613ad9613d35565b5b828204905092915050565b6000613af082613bdd565b9150613afb83613bdd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613b3457613b33613d06565b5b828202905092915050565b6000613b4a82613bdd565b9150613b5583613bdd565b925082821015613b6857613b67613d06565b5b828203905092915050565b6000613b7e82613bbd565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613c14578082015181840152602081019050613bf9565b83811115613c23576000848401525b50505050565b60006002820490506001821680613c4157607f821691505b60208210811415613c5557613c54613d64565b5b50919050565b613c6482613e05565b810181811067ffffffffffffffff82111715613c8357613c82613dc2565b5b80604052505050565b6000613c9782613bdd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613cca57613cc9613d06565b5b600182019050919050565b6000613ce082613bdd565b9150613ceb83613bdd565b925082613cfb57613cfa613d35565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f457863656564656420746f74616c20537570706c792100000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4e6f7420656e6f7567682043617073756c657300000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f496e76616c696420616d6f756e74210000000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f54686520636f6e74726163742069732070617573656421000000000000000000600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f496e73756666696369656e742066756e64732100000000000000000000000000600082015250565b61434781613b73565b811461435257600080fd5b50565b61435e81613b85565b811461436957600080fd5b50565b61437581613b91565b811461438057600080fd5b50565b61438c81613bdd565b811461439757600080fd5b5056fea264697066735822122005489d2a3750ba1c8e9ddce80f311238bf99b68eb9b4ded63a22d5a75389fb5f64736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: No
CapsuleCorpNFT.sol 1563 lines
// File: openzeppelin-solidity/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
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 generally not needed starting with Solidity 0.8, since 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;
}
}
}
// File: @openzeppelin/contracts/utils/Counters.sol
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
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;
}
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
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);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @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() {
_transferOwnership(_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 {
_transferOwnership(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");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
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);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
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);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
// File: @openzeppelin/contracts/token/ERC721/ERC721.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
/**
* @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 {
_setApprovalForAll(_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);
_afterTokenTransfer(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);
_afterTokenTransfer(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 from incorrect owner");
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);
_afterTokenTransfer(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 Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
// File: contracts/CapsuleNFT.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
//////////////////////////////////////////////////
// ⣿⣿⠿⠿⠿⠿⣿⣷⣂⠄⠄⠄⠄⠄⠄⠈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿|| //
// ⣷⡾⠯⠉⠉⠉⠉⠚⠑⠄⡀⠄⠄⠄⠄⠄⠈⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿|| //
// ⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡀⠄⠄⠄⠄⠄⠄⠄⠄⠉⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿|| //
// ⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⠎⠄⠄⣀⡀⠄⠄⠄⠄⠄⠄⠄⠘⠋⠉⠉⠉⠉⠭⠿⣿|| //
// ⡀⠄⠄⠄⠄⠄⠄⠄⠄⡇⠄⣠⣾⣳⠁⠄⠄⢺⡆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄|| //
// ⣿⣷⡦⠄⠄⠄⠄⠄⢠⠃⢰⣿⣯⣿⡁⢔⡒⣶⣯⡄⢀⢄⡄⠄⠄⠄⠄⠄⣀⣤⣶|| //
// ⠓⠄⠄⠄⠄⠄⠸⠄⢀⣤⢘⣿⣿⣷⣷⣿⠛⣾⣿⣿⣆⠾⣷⠄⠄⠄⠄⢀⣀⣼⣿|| //
// ⠄⠄⠄⠄⠄⠄⠄⠑⢘⣿⢰⡟⣿⣿⣷⣫⣭⣿⣾⣿⣿⣴⠏⠄⠄⢀⣺⣿⣿⣿⣿|| //
// ⣿⣿⣿⣿⣷⠶⠄⠄⠄⠹⣮⣹⡘⠛⠿⣫⣾⣿⣿⣿⡇⠑⢤⣶⣿⣿⣿⣿⣿⣿⣿|| //
// ⣿⣿⣿⣯⣤⣤⣤⣤⣀⣀⡹⣿⣿⣷⣯⣽⣿⣿⡿⣋⣴⡀⠈⣿⣿⣿⣿⣿⣿⣿⣿|| //
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣝⡻⢿⣿⡿⠋⡒⣾⣿⣧⢰⢿⣿⣿⣿⣿⣿⣿⣿|| //
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⣏⣟⣼⢋⡾⣿⣿⣿⣘⣔⠙⠿⠿⠿⣿⣿⣿|| //
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣛⡵⣻⠿⠟⠁⠛⠰⠿⢿⠿⡛⠉⠄⠄⢀⠄⠉⠉⢉|| //
// ⣿⣿⣿⣿⡿⢟⠩⠉⣠⣴⣶⢆⣴⡶⠿⠟⠛⠋⠉⠩⠄⠉⢀⠠⠂⠈⠄⠐⠄⠄⠄|| //
//////////////////////////////////////////////////
contract CapsuleCorpNFT is ERC721, Ownable {
using Strings for uint256;
using Counters for Counters.Counter;
using SafeMath for uint256;
Counters.Counter private supply;
string public uriPrefix = "";
string public uriSuffix = ".json";
string public hiddenMetadataUri;
uint256 public cost = 0.07 ether;
uint256 public maxCapsules = 5000;
uint256 public maxMintAmount = 3;
bool public paused = false;
bool public revealed = false;
constructor() ERC721("CapsuleCorp.", "CPSL") {
setHiddenMetadataUri("https://gateway.pinata.cloud/ipfs/Qmbw4CDKs5exCFrXsmQZX4DrkwEQ6QEjke3unXt5ibC5Ro/hidden.json");
}
// Minting requirements
modifier mintCompliance(uint256 _mintAmount) {
require(_mintAmount > 0 && _mintAmount <= maxMintAmount, "Invalid amount!");
require(supply.current() + _mintAmount <= maxCapsules, "Exceeded total Supply!");
_;
}
// Total supply minted so far
function totalSupply() public view returns (uint256) {
return supply.current();
}
// Minting process
function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) {
require(!paused, "The contract is paused!");
require(msg.value >= cost * _mintAmount, "Insufficient funds!");
_mintLoop(msg.sender, _mintAmount);
}
// Used to reserve capsules for owner once called
function _mintSingleCapsule() private {
uint newTokenID = supply.current();
_safeMint(msg.sender, newTokenID);
supply.increment();
}
// Mint for a provided address
function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {
_mintLoop(_receiver, _mintAmount);
}
// Mints up to 3 capsules
function _mintLoop(address _receiver, uint256 _mintAmount) internal {
for (uint256 i = 0; i < _mintAmount; i++) {
supply.increment();
_safeMint(_receiver, supply.current());
}
}
// Reserves 10 capsules for owner
function reserveCapsules() public onlyOwner {
uint totalMinted = supply.current();
require(
totalMinted.add(10) < maxCapsules, "Not enough Capsules"
);
for (uint i = 0; i < 10; i++) {
_mintSingleCapsule();
}
}
function _baseURI() internal view virtual override returns (string memory) {
return uriPrefix;
}
function walletOfOwner(address _owner) public ...
// [truncated — 52276 bytes total]
Read Contract
balanceOf 0x70a08231 → uint256
cost 0x13faede6 → uint256
getApproved 0x081812fc → address
hiddenMetadataUri 0xa45ba8e7 → string
isApprovedForAll 0xe985e9c5 → bool
maxCapsules 0xe9bced0a → uint256
maxMintAmount 0x239c70ae → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
revealed 0x51830227 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
uriPrefix 0x62b99ad4 → string
uriSuffix 0x5503a0e8 → string
walletOfOwner 0x438b6300 → uint256[]
Write Contract 18 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xa0712d68
uint256 _mintAmount
mintForAddress 0xefbd73f4
uint256 _mintAmount
address _receiver
renounceOwnership 0x715018a6
No parameters
reserveCapsules 0xa6769873
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
setCost 0x44a0d68a
uint256 _cost
setHiddenMetadataUri 0x4fdd43cb
string _hiddenMetadataUri
setMaxMintAmount 0x088a4ed0
uint256 _maxMintAmount
setPaused 0x16c38b3c
bool _state
setRevealed 0xe0a80853
bool _state
setUriPrefix 0x7ec4a659
string _uriPrefix
setUriSuffix 0x16ba10e0
string _uriSuffix
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address