Address Contract Verified
Address
0xA26B04B41162b0d7c2e1e2f9a33B752E28304a49
Balance
1.2443 ETH
Nonce
1
Code Size
17377 bytes
Creator
0x82503946...7350 at tx 0x530ac7d2...0462aa
Indexed Transactions
0
Contract Bytecode
17377 bytes
0x6080604052600436106101d15760003560e01c806395d89b41116100f7578063cb8106f411610095578063f2fde38b11610064578063f2fde38b146106a5578063f4e0d9ac146106ce578063f82f235f146106f7578063ffb54a9914610734576101d8565b8063cb8106f4146105cf578063dd62ed3e1461060e578063e291a7291461064b578063ee56977e14610676576101d8565b8063c6a30647116100d1578063c6a3064714610525578063c9567bf91461054e578063ca4b208b14610565578063cb35ac0b14610590576101d8565b806395d89b4114610494578063a33b2737146104bf578063a9059cbb146104e8576101d8565b8063313ce5671161016f57806370a082311161013e57806370a08231146103d8578063715018a614610415578063768dc7101461042c5780638da5cb5b14610469576101d8565b8063313ce567146103295780634cf088d9146103545780634e71d92d1461037f57806354e4067a14610396576101d8565b806323b872dd116101ab57806323b872dd1461026d57806329451729146102aa5780632ad4cab7146102d55780632d3e474a146102fe576101d8565b806306fdde03146101da578063095ea7b31461020557806318160ddd14610242576101d8565b366101d857005b005b3480156101e657600080fd5b506101ef61075f565b6040516101fc9190613569565b60405180910390f35b34801561021157600080fd5b5061022c60048036038101906102279190613624565b6107f1565b604051610239919061367f565b60405180910390f35b34801561024e57600080fd5b50610257610814565b60405161026491906136a9565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f91906136c4565b61081e565b6040516102a1919061367f565b60405180910390f35b3480156102b657600080fd5b506102bf61084d565b6040516102cc91906136a9565b60405180910390f35b3480156102e157600080fd5b506102fc60048036038101906102f79190613743565b610853565b005b34801561030a57600080fd5b50610313610973565b60405161032091906137a4565b60405180910390f35b34801561033557600080fd5b5061033e610997565b60405161034b91906137db565b60405180910390f35b34801561036057600080fd5b506103696109a0565b6040516103769190613805565b60405180910390f35b34801561038b57600080fd5b506103946109c6565b005b3480156103a257600080fd5b506103bd60048036038101906103b89190613820565b610c06565b6040516103cf9695949392919061384d565b60405180910390f35b3480156103e457600080fd5b506103ff60048036038101906103fa9190613820565b610d36565b60405161040c91906136a9565b60405180910390f35b34801561042157600080fd5b5061042a610d7e565b005b34801561043857600080fd5b50610453600480360381019061044e9190613820565b610d92565b604051610460919061367f565b60405180910390f35b34801561047557600080fd5b5061047e610db2565b60405161048b9190613805565b60405180910390f35b3480156104a057600080fd5b506104a9610ddc565b6040516104b69190613569565b60405180910390f35b3480156104cb57600080fd5b506104e660048036038101906104e19190613624565b610e6e565b005b3480156104f457600080fd5b5061050f600480360381019061050a9190613624565b610f46565b60405161051c919061367f565b60405180910390f35b34801561053157600080fd5b5061054c60048036038101906105479190613743565b610f69565b005b34801561055a57600080fd5b50610563611089565b005b34801561057157600080fd5b5061057a6110fe565b60405161058791906137a4565b60405180910390f35b34801561059c57600080fd5b506105b760048036038101906105b29190613820565b611122565b6040516105c6939291906138ae565b60405180910390f35b3480156105db57600080fd5b506105f660048036038101906105f191906138e5565b61114c565b60405161060593929190613912565b60405180910390f35b34801561061a57600080fd5b5061063560048036038101906106309190613949565b611258565b60405161064291906136a9565b60405180910390f35b34801561065757600080fd5b506106606112df565b60405161066d91906136a9565b60405180910390f35b34801561068257600080fd5b5061068b6112e5565b60405161069c959493929190613989565b60405180910390f35b3480156106b157600080fd5b506106cc60048036038101906106c79190613820565b61130b565b005b3480156106da57600080fd5b506106f560048036038101906106f09190613820565b611391565b005b34801561070357600080fd5b5061071e60048036038101906107199190613820565b6114fc565b60405161072b919061367f565b60405180910390f35b34801561074057600080fd5b5061074961151c565b604051610756919061367f565b60405180910390f35b60606003805461076e90613a0b565b80601f016020809104026020016040519081016040528092919081815260200182805461079a90613a0b565b80156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b6000806107fc61152f565b9050610809818585611537565b600191505092915050565b6000600254905090565b60008061082961152f565b9050610836858285611549565b6108418585856115dd565b60019150509392505050565b600f5481565b61085b611f11565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c190613a88565b60405180910390fd5b80601560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f3453aad620edfb737e1025fc5b238de98ab421a458d3715761a917b22d3afa0f82604051610967919061367f565b60405180910390a25050565b7f00000000000000000000000079d6b28753faf5c69fd0a74654112e7f28ad420e81565b60006012905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109ce611f98565b6000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905060008111610a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4f90613af4565b60405180910390fd5b6000601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555042601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555080600f6000828254610af99190613b43565b9250508190555060003373ffffffffffffffffffffffffffffffffffffffff1682604051610b2690613ba8565b60006040518083038185875af1925050503d8060008114610b63576040519150601f19603f3d011682016040523d82523d6000602084013e610b68565b606091505b5050905080610bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba390613c09565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167ffc30cddea38e2bf4d6ea7d3f9ed3b6ad7f176419f4963bd81318067a4aee73fe83604051610bf291906136a9565b60405180910390a25050610c04611fde565b565b6000806000806000806000601360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820154815250509050806000015181602001518260400151610c938b610d36565b601260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601560008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169650965096509650965096505091939550919395565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610d86611f11565b610d906000611fe8565b565b60116020528060005260406000206000915054906101000a900460ff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610deb90613a0b565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1790613a0b565b8015610e645780601f10610e3957610100808354040283529160200191610e64565b820191906000526020600020905b815481529060010190602001808311610e4757829003601f168201915b5050505050905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610efe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef590613c9b565b60405180910390fd5b80601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600080610f5161152f565b9050610f5e8185856115dd565b600191505092915050565b610f71611f11565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610fe0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd790613a88565b60405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167fbcb0010c8adfbd183728fee65133576fc1f54f36e7e7911a4323d90157340ee38260405161107d919061367f565b60405180910390a25050565b611091611f11565b601660019054906101000a900460ff16156110e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d890613d07565b60405180910390fd5b6001601660016101000a81548160ff021916908315150217905550565b7f000000000000000000000000c0f55ae5ccbf93d1a473c5c17775d77a6c128e4d81565b60136020528060005260406000206000915090508060000154908060010154908060020154905083565b6000806000806014600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905080600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036111c45760006111ce565b6111cd82610d36565b5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361120957600061124a565b601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020545b935093509350509193909250565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60105481565b600080600080600047600f54601054600d54600e54945094509450945094509091929394565b611313611f11565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036113855760006040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161137c9190613805565b60405180910390fd5b61138e81611fe8565b50565b611399611f11565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ff90613d99565b60405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60156020528060005260406000206000915054906101000a900460ff1681565b601660019054906101000a900460ff1681565b600033905090565b61154483838360016120ae565b505050565b60006115558484611258565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146115d757818110156115c7578281836040517ffb8f41b20000000000000000000000000000000000000000000000000000000081526004016115be93929190613912565b60405180910390fd5b6115d6848484840360006120ae565b5b50505050565b60008111611620576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161790613e2b565b60405180910390fd5b8061162a84610d36565b101561166b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166290613e97565b60405180910390fd5b600080479050600073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036118a457600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611734573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117589190613ecc565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118059190613ecc565b6040518363ffffffff1660e01b8152600401611822929190613ef9565b602060405180830381865afa15801561183f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118639190613ecc565b600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614801561194e5750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b611c3857601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806119f35750601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611a4b5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b611c3757600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161480611af85750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b15611b5557601660019054906101000a900460ff16611b4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4390613f6e565b60405180910390fd5b60059150611c36565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611c3557601660019054906101000a900460ff16611bf9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf090613f6e565b60405180910390fd5b600591506000611c0830610d36565b9050601660009054906101000a900460ff16611c3357600c54811115611c3257611c3181612285565b5b5b505b5b5b5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603611d2357611c95610db2565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d1e5782601260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611d169190613f8e565b925050819055505b611e8d565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603611e8c57611d80610db2565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e8b5782601260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611e34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e2b9061400e565b60405180910390fd5b82601260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611e839190613b43565b925050819055505b5b5b600060648385611e9d919061402e565b611ea7919061409f565b905060008185611eb79190613b43565b9050611ec487878361251e565b6000821115611ed957611ed887308461251e565b5b670de0b6b3a7640000600f5484611ef09190613b43565b10611efe57611efd612612565b5b611f088787612b08565b50505050505050565b611f1961152f565b73ffffffffffffffffffffffffffffffffffffffff16611f37610db2565b73ffffffffffffffffffffffffffffffffffffffff1614611f9657611f5a61152f565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611f8d9190613805565b60405180910390fd5b565b600260065403611fd4576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600681905550565b6001600681905550565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036121205760006040517fe602df050000000000000000000000000000000000000000000000000000000081526004016121179190613805565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036121925760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016121899190613805565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550801561227f578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161227691906136a9565b60405180910390a35b50505050565b6001601660006101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122bd576122bc6140d0565b5b6040519080825280602002602001820160405280156122eb5781602001602082028036833780820191505090505b5090503081600081518110612303576123026140ff565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ce9190613ecc565b816001815181106123e2576123e16140ff565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244930600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611537565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947836000847f000000000000000000000000a26b04b41162b0d7c2e1e2f9a33b752e28304a49426040518663ffffffff1660e01b81526004016124cd959493929190614231565b600060405180830381600087803b1580156124e757600080fd5b505af11580156124fb573d6000803e3d6000fd5b50505050506000601660006101000a81548160ff02191690831515021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036125905760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016125879190613805565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036126025760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016125f99190613805565b60405180910390fd5b61260d8383836132b4565b505050565b61261a611f98565b60004790506000600f548261262f9190613b43565b905060008111612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161266b906142d7565b60405180910390fd5b60006064602883612685919061402e565b61268f919061409f565b9050600060646014846126a2919061402e565b6126ac919061409f565b905060008282856126bd9190613b43565b6126c79190613b43565b905060007f000000000000000000000000c0f55ae5ccbf93d1a473c5c17775d77a6c128e4d73ffffffffffffffffffffffffffffffffffffffff168360405161270f90613ba8565b60006040518083038185875af1925050503d806000811461274c576040519150601f19603f3d011682016040523d82523d6000602084013e612751565b606091505b5050905080612795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161278c90613c09565b60405180910390fd5b60007f00000000000000000000000079d6b28753faf5c69fd0a74654112e7f28ad420e73ffffffffffffffffffffffffffffffffffffffff16856040516127db90613ba8565b60006040518083038185875af1925050503d8060008114612818576040519150601f19603f3d011682016040523d82523d6000602084013e61281d565b606091505b5050905080612861576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161285890614343565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660146000600d54815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612af75782600f60008282546128dc9190613f8e565b925050819055506000600e549050600080600e5490505b600d548111612aec57600073ffffffffffffffffffffffffffffffffffffffff166014600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612971578161297057809250600191505b5b6000601260006014600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a226014600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d36565b612a2c9190613f8e565b905060006010548289612a3f919061402e565b612a49919061409f565b905080601360006014600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254612ad09190613f8e565b9250508190555050508080612ae490614363565b9150506128f3565b5081600e8190555050505b50505050505050612b06611fde565b565b600069152d02c7e14af680000090506000600267ffffffffffffffff811115612b3457612b336140d0565b5b604051908082528060200260200182016040528015612b625781602001602082028036833780820191505090505b5090508381600081518110612b7a57612b796140ff565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508281600181518110612bc957612bc86140ff565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000600267ffffffffffffffff811115612c2057612c1f6140d0565b5b604051908082528060200260200182016040528015612c4e5781602001602082028036833780820191505090505b5090508481600081518110612c6657612c656140ff565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508381600181518110612cb557612cb46140ff565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060005b60028110156132ac57600060136000858481518110612d1457612d136140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050600060136000868581518110612d7557612d746140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050600060136000878681518110612dd657612dd56140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414612ecf5760126000858581518110612e3857612e376140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460106000828254612e8c9190613b43565b92505081905550612eb6858481518110612ea957612ea86140ff565b5b6020026020010151610d36565b60106000828254612ec79190613b43565b925050819055505b6014600060136000888781518110612eea57612ee96140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560136000868581518110612f7857612f776140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160009055600282016000905550508560126000868681518110612fed57612fec6140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613053878681518110613046576130456140ff565b5b6020026020010151610d36565b61305d9190613f8e565b101580156130cf57506015600086858151811061307d5761307c6140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561329757600d60008154809291906130e790614363565b91905055506040518060600160405280600d54815260200183815260200182815250601360008786815181106131205761311f6140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155905050848381518110613196576131956140ff565b5b602002602001015160146000600d54815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006012600086868151811061320a576132096140ff565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613270878681518110613263576132626140ff565b5b6020026020010151610d36565b61327a9190613f8e565b9050806010600082825461328e9190613f8e565b92505081905550505b505080806132a490614363565b915050612cf2565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036133065780600260008282546132fa9190613f8e565b925050819055506133d9565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015613392578381836040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161338993929190613912565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613422578060026000828254039250508190555061346f565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516134cc91906136a9565b60405180910390a3505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156135135780820151818401526020810190506134f8565b60008484015250505050565b6000601f19601f8301169050919050565b600061353b826134d9565b61354581856134e4565b93506135558185602086016134f5565b61355e8161351f565b840191505092915050565b600060208201905081810360008301526135838184613530565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006135bb82613590565b9050919050565b6135cb816135b0565b81146135d657600080fd5b50565b6000813590506135e8816135c2565b92915050565b6000819050919050565b613601816135ee565b811461360c57600080fd5b50565b60008135905061361e816135f8565b92915050565b6000806040838503121561363b5761363a61358b565b5b6000613649858286016135d9565b925050602061365a8582860161360f565b9150509250929050565b60008115159050919050565b61367981613664565b82525050565b60006020820190506136946000830184613670565b92915050565b6136a3816135ee565b82525050565b60006020820190506136be600083018461369a565b92915050565b6000806000606084860312156136dd576136dc61358b565b5b60006136eb868287016135d9565b93505060206136fc868287016135d9565b925050604061370d8682870161360f565b9150509250925092565b61372081613664565b811461372b57600080fd5b50565b60008135905061373d81613717565b92915050565b6000806040838503121561375a5761375961358b565b5b6000613768858286016135d9565b92505060206137798582860161372e565b9150509250929050565b600061378e82613590565b9050919050565b61379e81613783565b82525050565b60006020820190506137b96000830184613795565b92915050565b600060ff82169050919050565b6137d5816137bf565b82525050565b60006020820190506137f060008301846137cc565b92915050565b6137ff816135b0565b82525050565b600060208201905061381a60008301846137f6565b92915050565b6000602082840312156138365761383561358b565b5b6000613844848285016135d9565b91505092915050565b600060c082019050613862600083018961369a565b61386f602083018861369a565b61387c604083018761369a565b613889606083018661369a565b613896608083018561369a565b6138a360a0830184613670565b979650505050505050565b60006060820190506138c3600083018661369a565b6138d0602083018561369a565b6138dd604083018461369a565b949350505050565b6000602082840312156138fb576138fa61358b565b5b60006139098482850161360f565b91505092915050565b600060608201905061392760008301866137f6565b613934602083018561369a565b613941604083018461369a565b949350505050565b600080604083850312156139605761395f61358b565b5b600061396e858286016135d9565b925050602061397f858286016135d9565b9150509250929050565b600060a08201905061399e600083018861369a565b6139ab602083018761369a565b6139b8604083018661369a565b6139c5606083018561369a565b6139d2608083018461369a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680613a2357607f821691505b602082108103613a3657613a356139dc565b5b50919050565b7f6164647265737320300000000000000000000000000000000000000000000000600082015250565b6000613a726009836134e4565b9150613a7d82613a3c565b602082019050919050565b60006020820190508181036000830152613aa181613a65565b9050919050565b7f4e6f7468696e6720746f20636c61696d00000000000000000000000000000000600082015250565b6000613ade6010836134e4565b9150613ae982613aa8565b602082019050919050565b60006020820190508181036000830152613b0d81613ad1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613b4e826135ee565b9150613b59836135ee565b9250828203905081811115613b7157613b70613b14565b5b92915050565b600081905092915050565b50565b6000613b92600083613b77565b9150613b9d82613b82565b600082019050919050565b6000613bb382613b85565b9150819050919050565b7f646576656c6f706572207472616e73666572206661696c65642e000000000000600082015250565b6000613bf3601a836134e4565b9150613bfe82613bbd565b602082019050919050565b60006020820190508181036000830152613c2281613be6565b9050919050565b7f4f6e6c79207374616b696e6720636f6e74726163742063616e2075706461746560008201527f2062616c616e6365210000000000000000000000000000000000000000000000602082015250565b6000613c856029836134e4565b9150613c9082613c29565b604082019050919050565b60006020820190508181036000830152613cb481613c78565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000613cf16017836134e4565b9150613cfc82613cbb565b602082019050919050565b60006020820190508181036000830152613d2081613ce4565b9050919050565b7f61646472657373206973206e6f7420666f756e642c2074727920746f20696e7060008201527f75742061646472657373206f66207265616c207374616b696e67000000000000602082015250565b6000613d83603a836134e4565b9150613d8e82613d27565b604082019050919050565b60006020820190508181036000830152613db281613d76565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613e156029836134e4565b9150613e2082613db9565b604082019050919050565b60006020820190508181036000830152613e4481613e08565b9050919050565b7f42616c616e6365206c657373207468616e207472616e73666572000000000000600082015250565b6000613e81601a836134e4565b9150613e8c82613e4b565b602082019050919050565b60006020820190508181036000830152613eb081613e74565b9050919050565b600081519050613ec6816135c2565b92915050565b600060208284031215613ee257613ee161358b565b5b6000613ef084828501613eb7565b91505092915050565b6000604082019050613f0e60008301856137f6565b613f1b60208301846137f6565b9392505050565b7f54726164696e67206973206e6f74206f70656e20796574000000000000000000600082015250565b6000613f586017836134e4565b9150613f6382613f22565b602082019050919050565b60006020820190508181036000830152613f8781613f4b565b9050919050565b6000613f99826135ee565b9150613fa4836135ee565b9250828201905080821115613fbc57613fbb613b14565b5b92915050565b7f696e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000613ff86014836134e4565b915061400382613fc2565b602082019050919050565b6000602082019050818103600083015261402781613feb565b9050919050565b6000614039826135ee565b9150614044836135ee565b9250828202614052816135ee565b9150828204841483151761406957614068613b14565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006140aa826135ee565b91506140b5836135ee565b9250826140c5576140c4614070565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000819050919050565b6000819050919050565b600061415d6141586141538461412e565b614138565b6135ee565b9050919050565b61416d81614142565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6141a8816135b0565b82525050565b60006141ba838361419f565b60208301905092915050565b6000602082019050919050565b60006141de82614173565b6141e8818561417e565b93506141f38361418f565b8060005b8381101561422457815161420b88826141ae565b9750614216836141c6565b9250506001810190506141f7565b5085935050505092915050565b600060a082019050614246600083018861369a565b6142536020830187614164565b818103604083015261426581866141d3565b905061427460608301856137f6565b614281608083018461369a565b9695505050505050565b7f436f6e74726163742062616c616e6365206973207a65726f0000000000000000600082015250565b60006142c16018836134e4565b91506142cc8261428b565b602082019050919050565b600060208201905081810360008301526142f0816142b4565b9050919050565b7f6d61726b6574696e67207472616e73666572206661696c65642e000000000000600082015250565b600061432d601a836134e4565b9150614338826142f7565b602082019050919050565b6000602082019050818103600083015261435c81614320565b9050919050565b600061436e826135ee565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036143a05761439f613b14565b5b60018201905091905056fea2646970667358221220b71fc8e06402936b98cb4555fbd6ee284b398ae5147e38ea750d43ffd9ae2a3f64736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: paris
Optimization: No
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
ERC20.sol 316 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal virtual{
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
function updateStakedBalance(address user, uint amount) external;
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
ReentrancyGuard.sol 84 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}
IUniswapV2Factory.sol 17 lines
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
IUniswapV2Pair.sol 52 lines
pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
IUniswapV2Router01.sol 95 lines
pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
IUniswapV2Router02.sol 44 lines
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
auditAIToken.sol 300 lines
//SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
contract AuditAI is ERC20, Ownable, ReentrancyGuard {
address private immutable feeCollector;
address public staking;
IUniswapV2Router02 private uniswapRouter;
address private uniswapPair;
address private universalRouter = 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD;
address private uniswapFeeCollector = 0x000000fee13a103A10D593b9AE06b3e05F2E7E1c;
constructor(address _uniswapRouter, address payable _marketing, address payable _developer)
ERC20('AuditAI', 'AUDAI') Ownable(msg.sender)
{
require(_marketing != address(0),"marketing address zero address exception");
require(_developer != address(0),"developer address zero address exception");
require(_uniswapRouter != address(0),"Uniswap router zero address exception");
uniswapRouter = IUniswapV2Router02(_uniswapRouter);
feeCollector = address(this);
_mint(msg.sender, TOTAL);
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[uniswapFeeCollector] = true;
_isExcludedFromFee[address(this)] = true;
excludeFromRewards(owner(), true);
excludeFromRewards(uniswapFeeCollector, true);
excludeFromRewards(address(this), true);
marketing = _marketing;
developer = _developer;
}
uint256 private constant BUY_TAX = 5;
uint256 private constant SELL_TAX = 5;
uint256 private constant TOTAL = 1e26; //100,000,000
uint256 private sThreshold = 20000e18; // 20,000
uint256 private holderLastIndex = 0;
uint256 private holderMinIndex = 0;
uint256 public totalAvailableToClaim = 0;
uint256 public totalHoldedTokens = 0;
struct Holder {
uint index;
uint amountToClaim;
uint lastClaimedTimestamp;
}
mapping(address => bool) public _isExcludedFromFee;
mapping(address => uint) private stakersAmount;
mapping(address => Holder) public holdersList;
mapping(uint => address) private indexToHolder;
mapping(address => bool) public excludedFromRewards;
event UpdateExcludedFromTax(address indexed account, bool isExcluded);
event UpdateExcludedFromRewards(address indexed account, bool isExcluded);
event RewardsClaimed(address indexed user, uint amount);
address payable public immutable marketing;
address payable public immutable developer;
bool private inSwap = false;
bool public tradingOpen = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
function _transfer(address from, address to, uint256 amount) internal override {
require(amount > 0, "Transfer amount must be greater than zero");
require(balanceOf(from) >= amount,"Balance less than transfer");
uint tax = 0;
uint256 contractETHBalance = address(this).balance;
if(uniswapPair == address(0)) {
uniswapPair = IUniswapV2Factory(uniswapRouter.factory()).getPair(address(this), uniswapRouter.WETH());
}
if(!(from == uniswapPair && to == address(uniswapRouter))){
if (!(_isExcludedFromFee[from] || _isExcludedFromFee[to] || to == universalRouter) ) {
if(from == uniswapPair || from == universalRouter){
require(tradingOpen, "Trading is not open yet");
tax = BUY_TAX;
}
else if(to == uniswapPair){
require(tradingOpen, "Trading is not open yet");
tax = SELL_TAX;
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap){
if(contractTokenBalance > sThreshold){
_swapTokensForEth(contractTokenBalance);
}
}
}
}
}
if(to == staking) {
if(msg.sender != owner()) {
stakersAmount[from] += amount;
}
} else if(from == staking) {
if(msg.sender != owner()) {
require(stakersAmount[to] >= amount, "insufficient balance");
stakersAmount[to] -= amount;
}
}
uint256 feeAmount = amount*tax/100;
uint256 remainingAmount = amount - feeAmount;
super._transfer(from, to, remainingAmount);
if(feeAmount > 0){
super._transfer(from, address(this), feeAmount);
}
if(contractETHBalance - totalAvailableToClaim >= 1 ether) {
distribution();
}
checkHolders(from, to);
}
function claim() public nonReentrant{
uint amount = holdersList[msg.sender].amountToClaim;
require( amount > 0, "Nothing to claim");
holdersList[msg.sender].amountToClaim = 0;
holdersList[msg.sender].lastClaimedTimestamp = block.timestamp;
totalAvailableToClaim -= amount;
(bool success, ) = payable(msg.sender).call{value: amount}("");
require(success, "developer transfer failed.");
emit RewardsClaimed(msg.sender, amount);
}
function _swapTokensForEth(uint256 tokenAmount) internal lockTheSwap{
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapRouter.WETH();
_approve(address(this), address(uniswapRouter), tokenAmount);
uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
feeCollector,
block.timestamp
);
}
function checkHolders(address from, address to) internal {
uint hundredThousand = 100000e18;
address[] memory holders = new address[](2);
holders[0] = from;
holders[1] = to;
address[] memory stakers = new address[](2);
stakers[0] = from;
stakers[1] = to;
for(uint i=0; i<2; i++){
uint _amountToClaim = holdersList[holders[i]].amountToClaim;
uint _lastClaimedTimestamp = holdersList[holders[i]].lastClaimedTimestamp;
if(holdersList[holders[i]].index != 0){
totalHoldedTokens -= stakersAmount[stakers[i]];
totalHoldedTokens -= balanceOf(holders[i]);
}
delete indexToHolder[holdersList[holders[i]].index];
delete holdersList[holders[i]];
if(balanceOf(holders[i]) + stakersAmount[stakers[i]] >= hundredThousand && !excludedFromRewards[holders[i]]){
holderLastIndex++;
holdersList[holders[i]] = Holder({
index: holderLastIndex,
amountToClaim: _amountToClaim,
lastClaimedTimestamp: _lastClaimedTimestamp
});
indexToHolder[holderLastIndex] = holders[i];
uint totalHolded = balanceOf(holders[i]) + stakersAmount[stakers[i]];
totalHoldedTokens += totalHolded;
}
}
}
function distribution() internal nonReentrant{
uint balanceThis = address(this).balance;
uint amountToDistribute = balanceThis - totalAvailableToClaim;
require(amountToDistribute > 0, "Contract balance is zero");
uint toSentMarketing = (amountToDistribute * 40) / 100;
uint toSentDeveloper = (amountToDistribute * 20) / 100;
uint holdersReward = amountToDistribute - toSentDeveloper - toSentMarketing;
(bool success, ) = developer.call{value: toSentDeveloper}("");
require(success, "developer transfer failed.");
(bool success2, ) = marketing.call{value: toSentMarketing}("");
require(success2, "marketing transfer failed.");
if(indexToHolder[holderLastIndex] != address(0)){
totalAvailableToClaim += holdersReward;
uint tempMinIndex = holderMinIndex;
bool firstValidHolderFound = false;
for (uint i = holderMinIndex; i <= holderLastIndex; i++) {
if(indexToHolder[i] != address(0)){
if (!firstValidHolderFound) {
tempMinIndex = i;
firstValidHolderFound = true;
}
}
uint amount = balanceOf(indexToHolder[i]) + stakersAmount[indexToHolder[i]];
uint reward = (holdersReward * amount / totalHoldedTokens);
holdersList[indexToHolder[i]].amountToClaim += reward;
}
holderMinIndex = tempMinIndex;
}
}
function excludeFromTax(address _address, bool _isExclude) external onlyOwner {
require(_address != address(0), "address 0");
_isExcludedFromFee[_address] = _isExclude;
emit UpdateExcludedFromTax(_address, _isExclude);
}
function excludeFromRewards(address _address, bool _isExclude) public onlyOwner {
require(_address != address(0), "address 0");
excludedFromRewards[_address] = _isExclude;
emit UpdateExcludedFromRewards(_address, _isExclude);
}
function openTrading() external onlyOwner {
require(!tradingOpen,"trading is already open");
tradingOpen = true;
}
function setStakingAddress(address _address) external onlyOwner {
require(_address != address(0), "address is not found, try to input address of real staking");
staking = _address;
excludedFromRewards[_address] = true;
_isExcludedFromFee[_address] = true;
}
function updateStakedBalance(address user, uint amount) external {
require(msg.sender == staking, "Only staking contract can update balance!");
stakersAmount[user] = amount;
}
function getDistributionState() external view returns (
uint contractBalance,
uint totalAvailable,
uint holderTokens,
uint lastIdx,
uint minIdx
) {
return (
address(this).balance,
totalAvailableToClaim,
totalHoldedTokens,
holderLastIndex,
holderMinIndex
);
}
function getHolderInfo(address holder) external view returns (
uint index,
uint amountToClaim,
uint lastClaimedTimestamp,
uint balance,
uint stakedAmount,
bool excluded
) {
Holder memory h = holdersList[holder];
return (
h.index,
h.amountToClaim,
h.lastClaimedTimestamp,
balanceOf(holder),
stakersAmount[holder],
excludedFromRewards[holder]
);
}
function getHolderByIndex(uint index) external view returns (
address holderAddress,
uint balance,
uint staked
) {
address holder = indexToHolder[index];
return (
holder,
holder != address(0) ? balanceOf(holder) : 0,
holder != address(0) ? stakersAmount[holder] : 0
);
}
receive() external payable {}
fallback() external payable {}
}
Read Contract
_isExcludedFromFee 0x768dc710 → bool
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
developer 0xca4b208b → address
excludedFromRewards 0xf82f235f → bool
getDistributionState 0xee56977e → uint256, uint256, uint256, uint256, uint256
getHolderByIndex 0xcb8106f4 → address, uint256, uint256
getHolderInfo 0x54e4067a → uint256, uint256, uint256, uint256, uint256, bool
holdersList 0xcb35ac0b → uint256, uint256, uint256
marketing 0x2d3e474a → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
staking 0x4cf088d9 → address
symbol 0x95d89b41 → string
totalAvailableToClaim 0x29451729 → uint256
totalHoldedTokens 0xe291a729 → uint256
totalSupply 0x18160ddd → uint256
tradingOpen 0xffb54a99 → bool
Write Contract 11 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
claim 0x4e71d92d
No parameters
excludeFromRewards 0x2ad4cab7
address _address
bool _isExclude
excludeFromTax 0xc6a30647
address _address
bool _isExclude
openTrading 0xc9567bf9
No parameters
renounceOwnership 0x715018a6
No parameters
setStakingAddress 0xf4e0d9ac
address _address
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateStakedBalance 0xa33b2737
address user
uint256 amount
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address