Address Contract Partially Verified
Address
0x773f02BBb852920099931F332089f3FadfBfa4b6
Balance
0 ETH
Nonce
1
Code Size
18920 bytes
Creator
0x8e50E862...24dF at tx 0xa550661e...bce16e
Indexed Transactions
0
Contract Bytecode
18920 bytes
0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063715018a611610125578063bceb2a22116100ad578063da8fbf2a1161007c578063da8fbf2a146105af578063e1ee5c83146105b9578063e985e9c5146105d5578063f2fde38b14610605578063f8361bab1461062157610211565b8063bceb2a221461053d578063c20938e014610559578063c87b56dd14610575578063da304499146105a557610211565b8063a0ef91df116100f4578063a0ef91df146104e7578063a22cb465146104f1578063ae2003221461050d578063b2cfad2814610517578063b88d4fde1461052157610211565b8063715018a6146104855780638da5cb5b1461048f57806395d89b41146104ad57806398df857c146104cb57610211565b806333eba49a116101a8578063589a174311610177578063589a1743146103b95780635c975abb146103e957806362b99ad4146104075780636352211e1461042557806370a082311461045557610211565b806333eba49a14610335578063423afa661461035157806342842e0e1461038157806342966c681461039d57610211565b80630b185dfe116101e45780630b185dfe146102b057806318e97fd1146102cc57806323b872dd146102e85780632a55205a1461030457610211565b806301ffc9a71461021657806306fdde0314610246578063081812fc14610264578063095ea7b314610294575b600080fd5b610230600480360381019061022b9190612c20565b61063d565b60405161023d9190612c68565b60405180910390f35b61024e6106b7565b60405161025b9190612d13565b60405180910390f35b61027e60048036038101906102799190612d6b565b610749565b60405161028b9190612dd9565b60405180910390f35b6102ae60048036038101906102a99190612e20565b61078f565b005b6102ca60048036038101906102c59190612f1b565b6108a6565b005b6102e660048036038101906102e19190612ff2565b6109c3565b005b61030260048036038101906102fd9190613052565b610c2d565b005b61031e600480360381019061031991906130a5565b610c8d565b60405161032c9291906130f4565b60405180910390f35b61034f600480360381019061034a919061324d565b610db1565b005b61036b60048036038101906103669190613296565b610f8d565b6040516103789190612c68565b60405180910390f35b61039b60048036038101906103969190613052565b610fad565b005b6103b760048036038101906103b29190612d6b565b610fcd565b005b6103d360048036038101906103ce9190612d6b565b610fe1565b6040516103e09190612dd9565b60405180910390f35b6103f1611066565b6040516103fe9190612c68565b60405180910390f35b61040f61107d565b60405161041c9190612d13565b60405180910390f35b61043f600480360381019061043a9190612d6b565b61110b565b60405161044c9190612dd9565b60405180910390f35b61046f600480360381019061046a9190613296565b6111bc565b60405161047c91906132c3565b60405180910390f35b61048d611273565b005b610497611287565b6040516104a49190612dd9565b60405180910390f35b6104b56112b1565b6040516104c29190612d13565b60405180910390f35b6104e560048036038101906104e09190613296565b611343565b005b6104ef6113e9565b005b61050b6004803603810190610506919061330a565b61148c565b005b6105156114a2565b005b61051f6114b4565b005b61053b600480360381019061053691906133eb565b61151c565b005b6105576004803603810190610552919061324d565b61157e565b005b610573600480360381019061056e919061346e565b6115e7565b005b61058f600480360381019061058a9190612d6b565b6116a2565b60405161059c9190612d13565b60405180910390f35b6105ad61178f565b005b6105b76117f7565b005b6105d360048036038101906105ce9190612d6b565b611809565b005b6105ef60048036038101906105ea91906134ae565b6118ae565b6040516105fc9190612c68565b60405180910390f35b61061f600480360381019061061a9190613296565b611942565b005b61063b6004803603810190610636919061346e565b6119c5565b005b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806106b057506106af82611b5e565b5b9050919050565b6060600080546106c69061351d565b80601f01602080910402602001604051908101604052809291908181526020018280546106f29061351d565b801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075482611c40565b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061079a8261110b565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361080a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610801906135c0565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610829611c8b565b73ffffffffffffffffffffffffffffffffffffffff161480610858575061085781610852611c8b565b6118ae565b5b610897576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088e90613652565b60405180910390fd5b6108a18383611c93565b505050565b6108ae611d4c565b8181905084849050146108f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ed906136e4565b60405180910390fd5b60005b848490508110156109bc5782828281811061091757610916613704565b5b905060200201602081019061092c9190613733565b600f600087878581811061094357610942613704565b5b90506020020160208101906109589190613296565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109b49061378f565b9150506108f9565b5050505050565b81818080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050600c81604051610a189190613813565b908152602001604051809103902060009054906101000a900460ff1615610a74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6b90613876565b60405180910390fd5b610a7d81611dca565b83610a86611287565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610b365750600d600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148015610b355750600960009054906101000a900460ff16155b5b610b75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6c906138e2565b60405180910390fd5b6000600b600087815260200190815260200160002090508484600b60008981526020019081526020016000209182610bae929190613ab9565b506001600c8686604051610bc3929190613bae565b908152602001604051809103902060006101000a81548160ff0219169083151502179055507f877cb5fe270579c5071e4a16ceb146f7be4bf5ae40e9d8896a2a3727d781de3386828787604051610c1d9493929190613c8d565b60405180910390a1505050505050565b610c3e610c38611c8b565b82611f52565b610c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7490613d46565b60405180910390fd5b610c88838383611fe7565b505050565b600080610c998461224d565b610cd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ccf90613db2565b60405180910390fd5b612710600a5484610ce99190613dd2565b610cf39190613e43565b9050600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7357600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610da8565b600d600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff165b91509250929050565b610db96122b9565b80600c81604051610dca9190613813565b908152602001604051809103902060009054906101000a900460ff1615610e26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1d90613876565b60405180910390fd5b610e2f81611dca565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610ebb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb290613ec0565b60405180910390fd5b81600b600060085481526020019081526020016000209081610edd9190613ee0565b506001600c83604051610ef09190613813565b908152602001604051809103902060006101000a81548160ff02191690831515021790555033600d6000600854815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f893360086000815480929190610f809061378f565b91905055612303565b5050565b600f6020528060005260406000206000915054906101000a900460ff1681565b610fc88383836040518060200160405280600081525061151c565b505050565b610fd5611d4c565b610fde816124dc565b50565b6000610fec8261224d565b61102b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102290613db2565b60405180910390fd5b600d600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600660149054906101000a900460ff16905090565b600e805461108a9061351d565b80601f01602080910402602001604051908101604052809291908181526020018280546110b69061351d565b80156111035780601f106110d857610100808354040283529160200191611103565b820191906000526020600020905b8154815290600101906020018083116110e657829003601f168201915b505050505081565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036111b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111aa90613ffe565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361122c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122390614090565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61127b611d4c565b61128560006125f9565b565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600180546112c09061351d565b80601f01602080910402602001604051908101604052809291908181526020018280546112ec9061351d565b80156113395780601f1061130e57610100808354040283529160200191611339565b820191906000526020600020905b81548152906001019060200180831161131c57829003601f168201915b5050505050905090565b61134b611d4c565b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fbde6a1f22996ef208a396e5e011324e19c33cc4cd523fdcc34e26ce88c43e08c60405160405180910390a350565b6113f1611d4c565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1647604051611439906140e1565b60006040518083038185875af1925050503d8060008114611476576040519150601f19603f3d011682016040523d82523d6000602084013e61147b565b606091505b505090508061148957600080fd5b50565b61149e611497611c8b565b83836126bf565b5050565b6114aa611d4c565b6114b261282b565b565b6114bc611d4c565b6000600960006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f7c2295421de1a88d6392f0fce429c317a32ed5d38be6f6e00a139f01590e920c60405160405180910390a2565b61152d611527611c8b565b83611f52565b61156c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156390613d46565b60405180910390fd5b6115788484848461288e565b50505050565b611586611d4c565b80600e90816115959190613ee0565b503373ffffffffffffffffffffffffffffffffffffffff167fde16c1e51a062f420283920369ff930e4ec41c5721ff0fa09a083ef5b79c97de826040516115dc9190612d13565b60405180910390a250565b6115ef611d4c565b60008173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518363ffffffff1660e01b815260040161164e9291906130f4565b6020604051808303816000875af115801561166d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611691919061410b565b90508061169d57600080fd5b505050565b60606116ad8261224d565b6116ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e390613db2565b60405180910390fd5b600b6000838152602001908152602001600020805461170a9061351d565b80601f01602080910402602001604051908101604052809291908181526020018280546117369061351d565b80156117835780601f1061175857610100808354040283529160200191611783565b820191906000526020600020905b81548152906001019060200180831161176657829003601f168201915b50505050509050919050565b611797611d4c565b6001600960006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167feafe05283d5f7228187a72dfd58c6ae8296f91a6a9be9a29406a6941d1c593e760405160405180910390a2565b6117ff611d4c565b6118076128ea565b565b611811611d4c565b612710811115611856576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161184d90614184565b60405180910390fd5b80600a819055503373ffffffffffffffffffffffffffffffffffffffff167f4b7dbec63042c1dda577f7aa6fd14122cddcc3f21992561e3a69c6db7822b3c6826040516118a391906132c3565b60405180910390a250565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b61194a611d4c565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b090614216565b60405180910390fd5b6119c2816125f9565b50565b600d600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611a645750611a35611287565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b611aa3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9a90614282565b60405180910390fd5b80600d600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f0a1be7c84f8d2439cd1106b06022308991ce5b9d1f38ee72ba89d2ffd89bfe8f84604051611b5291906132c3565b60405180910390a35050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611c2957507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80611c395750611c388261294d565b5b9050919050565b611c498161224d565b611c88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7f90613ffe565b60405180910390fd5b50565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16611d068361110b565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b611d54611c8b565b73ffffffffffffffffffffffffffffffffffffffff16611d72611287565b73ffffffffffffffffffffffffffffffffffffffff1614611dc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbf906142ee565b60405180910390fd5b565b60008190506000600e8054611dde9061351d565b9050905080825111611e25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1c9061435a565b60405180910390fd5b60008167ffffffffffffffff811115611e4157611e40613122565b5b6040519080825280601f01601f191660200182016040528015611e735781602001600182028036833780820191505090505b50905060005b82811015611eec57838181518110611e9457611e93613704565b5b602001015160f81c60f81b828281518110611eb257611eb1613704565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806001019050611e79565b50600e604051611efc9190614412565b6040518091039020818051906020012014611f4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4390614475565b60405180910390fd5b50505050565b600080611f5e8361110b565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611fa05750611f9f81856118ae565b5b80611fde57508373ffffffffffffffffffffffffffffffffffffffff16611fc684610749565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166120078261110b565b73ffffffffffffffffffffffffffffffffffffffff161461205d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205490614507565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036120cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c390614599565b60405180910390fd5b6120d78383836129b7565b6120e2600082611c93565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461213291906145b9565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461218991906145ed565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46122488383836129bc565b505050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b6122c1611066565b15612301576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f89061466d565b60405180910390fd5b565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612372576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612369906146d9565b60405180910390fd5b61237b8161224d565b156123bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123b290614745565b60405180910390fd5b6123c7600083836129b7565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461241791906145ed565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46124d8600083836129bc565b5050565b60006124e78261110b565b90506124f5816000846129b7565b612500600083611c93565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461255091906145b9565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46125f5816000846129bc565b5050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361272d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612724906147b1565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161281e9190612c68565b60405180910390a3505050565b6128336129c1565b6000600660146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612877611c8b565b6040516128849190612dd9565b60405180910390a1565b612899848484611fe7565b6128a584848484612a0a565b6128e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128db90614843565b60405180910390fd5b50505050565b6128f26122b9565b6001600660146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612936611c8b565b6040516129439190612dd9565b60405180910390a1565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b505050565b505050565b6129c9611066565b612a08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ff906148af565b60405180910390fd5b565b6000612a2b8473ffffffffffffffffffffffffffffffffffffffff16612b91565b15612b84578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612a54611c8b565b8786866040518563ffffffff1660e01b8152600401612a769493929190614924565b6020604051808303816000875af1925050508015612ab257506040513d601f19601f82011682018060405250810190612aaf9190614985565b60015b612b34573d8060008114612ae2576040519150601f19603f3d011682016040523d82523d6000602084013e612ae7565b606091505b506000815103612b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b2390614843565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612b89565b600190505b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b612bfd81612bc8565b8114612c0857600080fd5b50565b600081359050612c1a81612bf4565b92915050565b600060208284031215612c3657612c35612bbe565b5b6000612c4484828501612c0b565b91505092915050565b60008115159050919050565b612c6281612c4d565b82525050565b6000602082019050612c7d6000830184612c59565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612cbd578082015181840152602081019050612ca2565b60008484015250505050565b6000601f19601f8301169050919050565b6000612ce582612c83565b612cef8185612c8e565b9350612cff818560208601612c9f565b612d0881612cc9565b840191505092915050565b60006020820190508181036000830152612d2d8184612cda565b905092915050565b6000819050919050565b612d4881612d35565b8114612d5357600080fd5b50565b600081359050612d6581612d3f565b92915050565b600060208284031215612d8157612d80612bbe565b5b6000612d8f84828501612d56565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612dc382612d98565b9050919050565b612dd381612db8565b82525050565b6000602082019050612dee6000830184612dca565b92915050565b612dfd81612db8565b8114612e0857600080fd5b50565b600081359050612e1a81612df4565b92915050565b60008060408385031215612e3757612e36612bbe565b5b6000612e4585828601612e0b565b9250506020612e5685828601612d56565b9150509250929050565b600080fd5b600080fd5b600080fd5b60008083601f840112612e8557612e84612e60565b5b8235905067ffffffffffffffff811115612ea257612ea1612e65565b5b602083019150836020820283011115612ebe57612ebd612e6a565b5b9250929050565b60008083601f840112612edb57612eda612e60565b5b8235905067ffffffffffffffff811115612ef857612ef7612e65565b5b602083019150836020820283011115612f1457612f13612e6a565b5b9250929050565b60008060008060408587031215612f3557612f34612bbe565b5b600085013567ffffffffffffffff811115612f5357612f52612bc3565b5b612f5f87828801612e6f565b9450945050602085013567ffffffffffffffff811115612f8257612f81612bc3565b5b612f8e87828801612ec5565b925092505092959194509250565b60008083601f840112612fb257612fb1612e60565b5b8235905067ffffffffffffffff811115612fcf57612fce612e65565b5b602083019150836001820283011115612feb57612fea612e6a565b5b9250929050565b60008060006040848603121561300b5761300a612bbe565b5b600061301986828701612d56565b935050602084013567ffffffffffffffff81111561303a57613039612bc3565b5b61304686828701612f9c565b92509250509250925092565b60008060006060848603121561306b5761306a612bbe565b5b600061307986828701612e0b565b935050602061308a86828701612e0b565b925050604061309b86828701612d56565b9150509250925092565b600080604083850312156130bc576130bb612bbe565b5b60006130ca85828601612d56565b92505060206130db85828601612d56565b9150509250929050565b6130ee81612d35565b82525050565b60006040820190506131096000830185612dca565b61311660208301846130e5565b9392505050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61315a82612cc9565b810181811067ffffffffffffffff8211171561317957613178613122565b5b80604052505050565b600061318c612bb4565b90506131988282613151565b919050565b600067ffffffffffffffff8211156131b8576131b7613122565b5b6131c182612cc9565b9050602081019050919050565b82818337600083830152505050565b60006131f06131eb8461319d565b613182565b90508281526020810184848401111561320c5761320b61311d565b5b6132178482856131ce565b509392505050565b600082601f83011261323457613233612e60565b5b81356132448482602086016131dd565b91505092915050565b60006020828403121561326357613262612bbe565b5b600082013567ffffffffffffffff81111561328157613280612bc3565b5b61328d8482850161321f565b91505092915050565b6000602082840312156132ac576132ab612bbe565b5b60006132ba84828501612e0b565b91505092915050565b60006020820190506132d860008301846130e5565b92915050565b6132e781612c4d565b81146132f257600080fd5b50565b600081359050613304816132de565b92915050565b6000806040838503121561332157613320612bbe565b5b600061332f85828601612e0b565b9250506020613340858286016132f5565b9150509250929050565b600067ffffffffffffffff82111561336557613364613122565b5b61336e82612cc9565b9050602081019050919050565b600061338e6133898461334a565b613182565b9050828152602081018484840111156133aa576133a961311d565b5b6133b58482856131ce565b509392505050565b600082601f8301126133d2576133d1612e60565b5b81356133e284826020860161337b565b91505092915050565b6000806000806080858703121561340557613404612bbe565b5b600061341387828801612e0b565b945050602061342487828801612e0b565b935050604061343587828801612d56565b925050606085013567ffffffffffffffff81111561345657613455612bc3565b5b613462878288016133bd565b91505092959194509250565b6000806040838503121561348557613484612bbe565b5b600061349385828601612d56565b92505060206134a485828601612e0b565b9150509250929050565b600080604083850312156134c5576134c4612bbe565b5b60006134d385828601612e0b565b92505060206134e485828601612e0b565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061353557607f821691505b602082108103613548576135476134ee565b5b50919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006135aa602183612c8e565b91506135b58261354e565b604082019050919050565b600060208201905081810360008301526135d98161359d565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60008201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000602082015250565b600061363c603e83612c8e565b9150613647826135e0565b604082019050919050565b6000602082019050818103600083015261366b8161362f565b9050919050565b7f61646472657373657320616e6420616c6c6f77616e636573206d75737420626560008201527f2073616d65206c656e6774680000000000000000000000000000000000000000602082015250565b60006136ce602c83612c8e565b91506136d982613672565b604082019050919050565b600060208201905081810360008301526136fd816136c1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561374957613748612bbe565b5b6000613757848285016132f5565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061379a82612d35565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036137cc576137cb613760565b5b600182019050919050565b600081905092915050565b60006137ed82612c83565b6137f781856137d7565b9350613807818560208601612c9f565b80840191505092915050565b600061381f82846137e2565b915081905092915050565b7f746f6b656e2075726920616c7265616479207573656400000000000000000000600082015250565b6000613860601683612c8e565b915061386b8261382a565b602082019050919050565b6000602082019050818103600083015261388f81613853565b9050919050565b7f6e6f7420616c6c6f77656420746f2075706461746520746f6b656e2075726900600082015250565b60006138cc601f83612c8e565b91506138d782613896565b602082019050919050565b600060208201905081810360008301526138fb816138bf565b9050919050565b600082905092915050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261396f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82613932565b6139798683613932565b95508019841693508086168417925050509392505050565b6000819050919050565b60006139b66139b16139ac84612d35565b613991565b612d35565b9050919050565b6000819050919050565b6139d08361399b565b6139e46139dc826139bd565b84845461393f565b825550505050565b600090565b6139f96139ec565b613a048184846139c7565b505050565b5b81811015613a2857613a1d6000826139f1565b600181019050613a0a565b5050565b601f821115613a6d57613a3e8161390d565b613a4784613922565b81016020851015613a56578190505b613a6a613a6285613922565b830182613a09565b50505b505050565b600082821c905092915050565b6000613a9060001984600802613a72565b1980831691505092915050565b6000613aa98383613a7f565b9150826002028217905092915050565b613ac38383613902565b67ffffffffffffffff811115613adc57613adb613122565b5b613ae6825461351d565b613af1828285613a2c565b6000601f831160018114613b205760008415613b0e578287013590505b613b188582613a9d565b865550613b80565b601f198416613b2e8661390d565b60005b82811015613b5657848901358255600182019150602085019450602081019050613b31565b86831015613b735784890135613b6f601f891682613a7f565b8355505b6001600288020188555050505b50505050505050565b6000613b9583856137d7565b9350613ba28385846131ce565b82840190509392505050565b6000613bbb828486613b89565b91508190509392505050565b60008190508160005260206000209050919050565b60008154613be98161351d565b613bf38186612c8e565b94506001821660008114613c0e5760018114613c2457613c57565b60ff198316865281151560200286019350613c57565b613c2d85613bc7565b60005b83811015613c4f57815481890152600182019150602081019050613c30565b808801955050505b50505092915050565b6000613c6c8385612c8e565b9350613c798385846131ce565b613c8283612cc9565b840190509392505050565b6000606082019050613ca260008301876130e5565b8181036020830152613cb48186613bdc565b90508181036040830152613cc9818486613c60565b905095945050505050565b7f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560008201527f72206e6f7220617070726f766564000000000000000000000000000000000000602082015250565b6000613d30602e83612c8e565b9150613d3b82613cd4565b604082019050919050565b60006020820190508181036000830152613d5f81613d23565b9050919050565b7f6e6f6e6578697374616e7420746f6b656e000000000000000000000000000000600082015250565b6000613d9c601183612c8e565b9150613da782613d66565b602082019050919050565b60006020820190508181036000830152613dcb81613d8f565b9050919050565b6000613ddd82612d35565b9150613de883612d35565b9250828202613df681612d35565b91508282048414831517613e0d57613e0c613760565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e4e82612d35565b9150613e5983612d35565b925082613e6957613e68613e14565b5b828204905092915050565b7f63616c6c6572206e6f7420616c6c6f776564206d696e74657200000000000000600082015250565b6000613eaa601983612c8e565b9150613eb582613e74565b602082019050919050565b60006020820190508181036000830152613ed981613e9d565b9050919050565b613ee982612c83565b67ffffffffffffffff811115613f0257613f01613122565b5b613f0c825461351d565b613f17828285613a2c565b600060209050601f831160018114613f4a5760008415613f38578287015190505b613f428582613a9d565b865550613faa565b601f198416613f588661390d565b60005b82811015613f8057848901518255600182019150602085019450602081019050613f5b565b86831015613f9d5784890151613f99601f891682613a7f565b8355505b6001600288020188555050505b505050505050565b7f4552433732313a20696e76616c696420746f6b656e2049440000000000000000600082015250565b6000613fe8601883612c8e565b9150613ff382613fb2565b602082019050919050565b6000602082019050818103600083015261401781613fdb565b9050919050565b7f4552433732313a2061646472657373207a65726f206973206e6f74206120766160008201527f6c6964206f776e65720000000000000000000000000000000000000000000000602082015250565b600061407a602983612c8e565b91506140858261401e565b604082019050919050565b600060208201905081810360008301526140a98161406d565b9050919050565b600081905092915050565b50565b60006140cb6000836140b0565b91506140d6826140bb565b600082019050919050565b60006140ec826140be565b9150819050919050565b600081519050614105816132de565b92915050565b60006020828403121561412157614120612bbe565b5b600061412f848285016140f6565b91505092915050565b7f726f79616c7479206f7574206f662072616e6765000000000000000000000000600082015250565b600061416e601483612c8e565b915061417982614138565b602082019050919050565b6000602082019050818103600083015261419d81614161565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000614200602683612c8e565b915061420b826141a4565b604082019050919050565b6000602082019050818103600083015261422f816141f3565b9050919050565b7f6f6e6c792063726561746f720000000000000000000000000000000000000000600082015250565b600061426c600c83612c8e565b915061427782614236565b602082019050919050565b6000602082019050818103600083015261429b8161425f565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006142d8602083612c8e565b91506142e3826142a2565b602082019050919050565b60006020820190508181036000830152614307816142cb565b9050919050565b7f496e636f72726563742055524920707265666978206c656e6774680000000000600082015250565b6000614344601b83612c8e565b915061434f8261430e565b602082019050919050565b6000602082019050818103600083015261437381614337565b9050919050565b60008190508160005260206000209050919050565b6000815461439c8161351d565b6143a681866140b0565b945060018216600081146143c157600181146143d657614409565b60ff1983168652811515820286019350614409565b6143df8561437a565b60005b83811015614401578154818901526001820191506020810190506143e2565b838801955050505b50505092915050565b600061441e828461438f565b915081905092915050565b7f496e636f72726563742055524920707265666978000000000000000000000000600082015250565b600061445f601483612c8e565b915061446a82614429565b602082019050919050565b6000602082019050818103600083015261448e81614452565b9050919050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b60006144f1602583612c8e565b91506144fc82614495565b604082019050919050565b60006020820190508181036000830152614520816144e4565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000614583602483612c8e565b915061458e82614527565b604082019050919050565b600060208201905081810360008301526145b281614576565b9050919050565b60006145c482612d35565b91506145cf83612d35565b92508282039050818111156145e7576145e6613760565b5b92915050565b60006145f882612d35565b915061460383612d35565b925082820190508082111561461b5761461a613760565b5b92915050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000614657601083612c8e565b915061466282614621565b602082019050919050565b600060208201905081810360008301526146868161464a565b9050919050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b60006146c3602083612c8e565b91506146ce8261468d565b602082019050919050565b600060208201905081810360008301526146f2816146b6565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b600061472f601c83612c8e565b915061473a826146f9565b602082019050919050565b6000602082019050818103600083015261475e81614722565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b600061479b601983612c8e565b91506147a682614765565b602082019050919050565b600060208201905081810360008301526147ca8161478e565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b600061482d603283612c8e565b9150614838826147d1565b604082019050919050565b6000602082019050818103600083015261485c81614820565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b6000614899601483612c8e565b91506148a482614863565b602082019050919050565b600060208201905081810360008301526148c88161488c565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006148f6826148cf565b61490081856148da565b9350614910818560208601612c9f565b61491981612cc9565b840191505092915050565b60006080820190506149396000830187612dca565b6149466020830186612dca565b61495360408301856130e5565b818103606083015261496581846148eb565b905095945050505050565b60008151905061497f81612bf4565b92915050565b60006020828403121561499b5761499a612bbe565b5b60006149a984828501614970565b9150509291505056fea2646970667358221220fccadec4765f6489645d5376d40a5cbaf35be21a7cfffe47f920ff2aaf1583cd64736f6c63430008110033
Verified Source Code Partial Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: No
MonaAvatars.sol 1665 lines
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
// File: @openzeppelin/contracts/utils/Strings.sol
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @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);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
// 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/security/Pausable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
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.7.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
/// @solidity memory-safe-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 (last updated v4.6.0) (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 `IERC721Receiver.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/interfaces/IERC2981.sol
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
// 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 (last updated v4.7.0) (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`.
*
* 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;
/**
* @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 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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
// 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.7.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: address zero is not a valid owner");
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: invalid token ID");
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) {
_requireMinted(tokenId);
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 overridden 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 token owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
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: caller is not token 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: caller is not token 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) {
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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 an {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 an {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 Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @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 {
/// @solidity memory-safe-assembly
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/1_Storage.sol
pragma solidity ^0.8.0;
contract MonaAvatars is ERC721, Ownable, Pausable {
// Mona Wallet for royalty payments and emergency withdrawals.
address monaWallet;
// Next token ID to be minted.
uint256 private nextTokenId;
// Can creators update the URIs of their tokens?
bool creatorURIUpdatesPaused;
// For EIP 2981, royalty rate out of 10,000.
// For example, 10% royalties: royaltyRate = 1000.
uint256 royaltyRate;
uint256 constant royaltyRateDivisor = 10_000;
// token id => uri
mapping(uint256 => string) private _tokenURIs;
// uri => used (has this URI been used before?)
mapping(string => bool) private _tokenURIUsed;
// token id => creator (who has permission to update this token's URI and get paid royalties?)
mapping(uint256 => address) private _creators;
// Prefix that all token URIs must begin with. Enforced when token URI is set to prevent typosquatting.
string public uriPrefix;
// address => allowed to mint
mapping(address => bool) public allowedMinters;
// EVENTS
event UpdateMonaWallet(address indexed newOwner, address indexed sender);
event UpdateRoyaltyRate(uint256 newRate, address indexed sender);
event UnPauseCreatorURIUpdates(address indexed sender);
event PauseCreatorURIUpdates(address indexed sender);
event UpdateURIPrefix(string _uriPrefix, address indexed sender);
event UpdateCreator(
uint256 tokenId,
address indexed newCreator,
address indexed sender
);
event UpdateTokenURI(uint256 tokenId, string oldUri, string newUri);
// @param: _name: The name of the ERC721 token.
// @param: _symbol: The symbol of the ERC721 token.
// @param: _royaltyRate: The rate (out of 10,000) EIP 2981 royalties should be paid at.
// @param: _monaWallet: The address where Mona royalties should be paid out (also used for withdrawals).
constructor(
string memory _name,
string memory _symbol,
uint256 _royaltyRate,
address _monaWallet,
string memory _uriPrefix
) ERC721(_name, _symbol) {
updateRoyaltyRate(_royaltyRate);
updateMonaWallet(_monaWallet);
updateURIPrefix(_uriPrefix);
}
// MODIFIERS //
// Is this URI allowed to be used? Only yes if it's unused
modifier tokenURIAllowed(string memory _tokenURI) {
require(!_tokenURIUsed[_tokenURI], "token uri already used");
_tokenURIPrefixed(_tokenURI);
_;
}
// Is this user allowed to update the URI of a given token?
// Only yes if it's the creator and creator updates are unpaused, or admin.
modifier allowedToUpdateURI(uint256 _tokenId) {
require(
msg.sender == owner() ||
(msg.sender == _creators[_tokenId] && !creatorURIUpdatesPaused),
"not allowed to update token uri"
);
_;
}
modifier allowedToMint() {
require(allowedMinters[msg.sender], "caller not allowed minter");
_;
}
// Does the provided tokenURI have the correct prefix?
function _tokenURIPrefixed(string memory _tokenURI) internal view {
bytes memory newURIBytes = bytes(_tokenURI);
uint256 prefixLength = bytes(uriPrefix).length;
// New token URI must be longer than prefix, else bail early to prevent overflow.
require(
newURIBytes.length > prefixLength,
"Incorrect URI prefix length"
);
bytes memory resultPrefix = new bytes(prefixLength);
// Slice prefixLength bytes from _tokenURI to compare.
for (uint256 i; i < prefixLength; ) {
resultPrefix[i] = newURIBytes[i];
unchecked {
++i;
}
}
require(
keccak256(resultPrefix) == keccak256(bytes(uriPrefix)),
"Incorrect URI prefix"
);
}
// MINTING & BURNING //
// @notice: Mints a new token and assigns URI specific variable.
// @notice: Once a creator claims are URI it cannot be used again.
// @param: _tokenURI: URI of the new token.
function mintToken(string memory _tokenURI)
public
whenNotPaused
tokenURIAllowed(_tokenURI)
allowedToMint
{
_tokenURIs[nextTokenId] = _tokenURI;
_tokenURIUsed[_tokenURI] = true;
_creators[nextTokenId] = msg.sender;
_mint(msg.sender, nextTokenId++);
}
// @notice: Burns a given token, removing it from circulation.
// @param: _tokenId: ID of the token to burn.
function burn(uint256 _tokenId) public onlyOwner {
_burn(_tokenId);
}
// TOKEN URI FUNCTIONS //
// @notice: Updates the URI of a given token to a new URI.
// @notice: Requires that the new URI is unused, and that sender is this token's creator or admin.
// @param: _tokenId: ID of the token to update.
// @param: _tokenURI: New URI to assign to the token.
function updateTokenURI(uint256 _tokenId, string calldata _tokenURI)
public
tokenURIAllowed(_tokenURI)
allowedToUpdateURI(_tokenId)
{
string storage oldTokenUri = _tokenURIs[_tokenId];
_tokenURIs[_tokenId] = _tokenURI;
_tokenURIUsed[_tokenURI] = true;
emit UpdateTokenURI(_tokenId, oldTokenUri, _tokenURI);
}
// @notice: Returns the URI of a given token.
// @param: _tokenId: ID of the token to get the URI of.
...
// [truncated — 56113 bytes total]
Read Contract
allowedMinters 0x423afa66 → bool
balanceOf 0x70a08231 → uint256
creatorOf 0x589a1743 → address
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
uriPrefix 0x62b99ad4 → string
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 _tokenId
mintToken 0x33eba49a
string _tokenURI
pauseCreatorURIUpdates 0xda304499
No parameters
pauseMinting 0xda8fbf2a
No parameters
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
unpauseCreatorURIUpdates 0xb2cfad28
No parameters
unpauseMinting 0xae200322
No parameters
updateAllowedMinters 0x0b185dfe
address[] addresses
bool[] allowances
updateCreator 0xf8361bab
uint256 _tokenId
address _newCreator
updateMonaWallet 0x98df857c
address _newMonaWallet
updateRoyaltyRate 0xe1ee5c83
uint256 _rate
updateTokenURI 0x18e97fd1
uint256 _tokenId
string _tokenURI
updateURIPrefix 0xbceb2a22
string _uriPrefix
withdrawERC20 0xc20938e0
uint256 amount
address token
withdrawEth 0xa0ef91df
No parameters
Recent Transactions
No transactions found for this address