Address Contract Verified
Address
0xa3b71ADD41C9E4E1034fe665F946BAebFE9c07C4
Balance
0.001837 ETH
Nonce
2
Code Size
16550 bytes
Creator
0x976CAedc...B322 at tx 0x243b58b8...69ef0e
Indexed Transactions
0
Contract Bytecode
16550 bytes
0x60806040526004361061028b575f3560e01c806370a0823111610159578063a9059cbb116100c0578063dd62ed3e11610079578063dd62ed3e146109a7578063e2f45605146109e3578063e7841ec014610a0d578063e98030c714610a37578063f27fd25414610a5f578063f2fde38b14610aa257610292565b8063a9059cbb14610886578063ad56c13c146108c2578063ad5c464814610905578063c02466681461092f578063c492f04614610957578063d257b34f1461097f57610292565b80638da5cb5b116101125780638da5cb5b1461077a57806395d89b41146107a45780639a7a23d6146107ce5780639c1b8af5146107f6578063a26579ad14610820578063a8b9d2401461084a57610292565b806370a0823114610686578063715018a6146106c257806381c79ec2146106d857806385141a7714610700578063871c128d1461072a57806388bdd9be1461075257610292565b806331e79db0116101fd5780635d098b38116101b65780635d098b381461057e578063625e764c146105a657806364b0f653146105ce5780636843cd84146105f85780636b67c4df14610634578063700bb1911461065e57610292565b806331e79db0146104745780634144d9e41461049c57806343cc8c2a146104c657806349bd5a5e146105025780634e71d92d1461052c5780634fbee1931461054257610292565b806318160ddd1161024f57806318160ddd1461037a57806323b872dd146103a45780632b72c4c0146103e05780632c1f5216146103f657806330bb4cff14610420578063313ce5671461044a57610292565b806306fdde0314610296578063095ea7b3146102c057806313114a9d146102fc578063167bcf71146103265780631694505e1461035057610292565b3661029257005b5f80fd5b3480156102a1575f80fd5b506102aa610aca565b6040516102b7919061331b565b60405180910390f35b3480156102cb575f80fd5b506102e660048036038101906102e191906133d0565b610b5a565b6040516102f39190613428565b60405180910390f35b348015610307575f80fd5b50610310610b7c565b60405161031d9190613450565b60405180910390f35b348015610331575f80fd5b5061033a610b82565b6040516103479190613450565b60405180910390f35b34801561035b575f80fd5b50610364610b88565b60405161037191906134c4565b60405180910390f35b348015610385575f80fd5b5061038e610bad565b60405161039b9190613450565b60405180910390f35b3480156103af575f80fd5b506103ca60048036038101906103c591906134dd565b610bb6565b6040516103d79190613428565b60405180910390f35b3480156103eb575f80fd5b506103f4610be4565b005b348015610401575f80fd5b5061040a610dce565b604051610417919061355e565b60405180910390f35b34801561042b575f80fd5b50610434610df3565b6040516104419190613450565b60405180910390f35b348015610455575f80fd5b5061045e610e87565b60405161046b9190613592565b60405180910390f35b34801561047f575f80fd5b5061049a600480360381019061049591906135ab565b610e8f565b005b3480156104a7575f80fd5b506104b0610f21565b6040516104bd91906135e5565b60405180910390f35b3480156104d1575f80fd5b506104ec60048036038101906104e791906135ab565b610f46565b6040516104f99190613428565b60405180910390f35b34801561050d575f80fd5b50610516610f63565b60405161052391906135e5565b60405180910390f35b348015610537575f80fd5b50610540610f88565b005b34801561054d575f80fd5b50610568600480360381019061056391906135ab565b611027565b6040516105759190613428565b60405180910390f35b348015610589575f80fd5b506105a4600480360381019061059f9190613639565b611079565b005b3480156105b1575f80fd5b506105cc60048036038101906105c79190613664565b611129565b005b3480156105d9575f80fd5b506105e2611151565b6040516105ef9190613450565b60405180910390f35b348015610603575f80fd5b5061061e600480360381019061061991906135ab565b6111e5565b60405161062b9190613450565b60405180910390f35b34801561063f575f80fd5b50610648611286565b6040516106559190613450565b60405180910390f35b348015610669575f80fd5b50610684600480360381019061067f9190613664565b61128c565b005b348015610691575f80fd5b506106ac60048036038101906106a791906135ab565b61138c565b6040516106b99190613450565b60405180910390f35b3480156106cd575f80fd5b506106d66113d1565b005b3480156106e3575f80fd5b506106fe60048036038101906106f99190613664565b6113e4565b005b34801561070b575f80fd5b5061071461140c565b60405161072191906135e5565b60405180910390f35b348015610735575f80fd5b50610750600480360381019061074b9190613664565b611431565b005b34801561075d575f80fd5b50610778600480360381019061077391906135ab565b6114bd565b005b348015610785575f80fd5b5061078e611819565b60405161079b91906135e5565b60405180910390f35b3480156107af575f80fd5b506107b8611841565b6040516107c5919061331b565b60405180910390f35b3480156107d9575f80fd5b506107f460048036038101906107ef91906136b9565b6118d1565b005b348015610801575f80fd5b5061080a61196d565b6040516108179190613450565b60405180910390f35b34801561082b575f80fd5b50610834611973565b6040516108419190613450565b60405180910390f35b348015610855575f80fd5b50610870600480360381019061086b91906135ab565b611a07565b60405161087d9190613450565b60405180910390f35b348015610891575f80fd5b506108ac60048036038101906108a791906133d0565b611aa8565b6040516108b99190613428565b60405180910390f35b3480156108cd575f80fd5b506108e860048036038101906108e391906135ab565b611aca565b6040516108fc98979695949392919061370f565b60405180910390f35b348015610910575f80fd5b50610919611b87565b60405161092691906135e5565b60405180910390f35b34801561093a575f80fd5b50610955600480360381019061095091906136b9565b611bac565b005b348015610962575f80fd5b5061097d600480360381019061097891906137ec565b611c5a565b005b34801561098a575f80fd5b506109a560048036038101906109a09190613664565b611d38565b005b3480156109b2575f80fd5b506109cd60048036038101906109c89190613849565b611dcc565b6040516109da9190613450565b60405180910390f35b3480156109ee575f80fd5b506109f7611e4e565b604051610a049190613450565b60405180910390f35b348015610a18575f80fd5b50610a21611e54565b604051610a2e9190613450565b60405180910390f35b348015610a42575f80fd5b50610a5d6004803603810190610a589190613664565b611ee8565b005b348015610a6a575f80fd5b50610a856004803603810190610a809190613664565b611f7a565b604051610a9998979695949392919061370f565b60405180910390f35b348015610aad575f80fd5b50610ac86004803603810190610ac391906135ab565b612037565b005b606060038054610ad9906138b4565b80601f0160208091040260200160405190810160405280929190818152602001828054610b05906138b4565b8015610b505780601f10610b2757610100808354040283529160200191610b50565b820191905f5260205f20905b815481529060010190602001808311610b3357829003601f168201915b5050505050905090565b5f80610b646120bb565b9050610b718185856120c2565b600191505092915050565b600c5481565b600a5481565b600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f600254905090565b5f80610bc06120bb565b9050610bcd8582856120d4565b610bd8858585612166565b60019150509392505050565b610bec612256565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610c7c5750610c4c611819565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15610cb3576040517f9f8969f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f4790505f8111610cf9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf09061392e565b60405180910390fd5b5f60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682604051610d3f90613979565b5f6040518083038185875af1925050503d805f8114610d79576040519150601f19603f3d011682016040523d82523d5f602084013e610d7e565b606091505b5050905080610dc2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db9906139d7565b60405180910390fd5b5050610dcc61229c565b565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166385a6b3ae6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e5e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e829190613a09565b905090565b5f6012905090565b610e976122a6565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166331e79db0826040518263ffffffff1660e01b8152600401610ef191906135e5565b5f604051808303815f87803b158015610f08575f80fd5b505af1158015610f1a573d5f803e3d5ffd5b5050505050565b60125f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6007602052805f5260405f205f915054906101000a900460ff1681565b600f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc4c4b37335f6040518363ffffffff1660e01b8152600401610fe4929190613a43565b6020604051808303815f875af1158015611000573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110249190613a7e565b50565b5f60085f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff169050919050565b6110816122a6565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110e6576040517f9f8969f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060125f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6111316122a6565b80600b81905550600b54600a546111489190613ad6565b600c8190555050565b5f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166309bbedde6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111bc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111e09190613a09565b905090565b5f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b815260040161124091906135e5565b602060405180830381865afa15801561125b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061127f9190613a09565b9050919050565b600b5481565b5f805f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ffb2c479856040518263ffffffff1660e01b81526004016112e99190613450565b6060604051808303815f875af1158015611305573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113299190613b09565b9250925092503373ffffffffffffffffffffffffffffffffffffffff165f15157fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a988585858960405161137e9493929190613b59565b60405180910390a350505050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6113d96122a6565b6113e25f61232d565b565b6113ec6122a6565b80600a81905550600b54600a546114039190613ad6565b600c8190555050565b60115f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6114396122a6565b62030d4081108061144c57506207a12081115b15611483576040517fe64da64400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d54817f40d7e40e79af4e8e5a9b3c57030d8ea93f13d669c06d448c4d631d4ae7d23db760405160405180910390a380600d8190555050565b6114c56122a6565b5f8190503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611529573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061154d9190613bb0565b73ffffffffffffffffffffffffffffffffffffffff161461159a576040517f214b982800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166331e79db0826040518263ffffffff1660e01b81526004016115d391906135e5565b5f604051808303815f87803b1580156115ea575f80fd5b505af11580156115fc573d5f803e3d5ffd5b505050508073ffffffffffffffffffffffffffffffffffffffff166331e79db0306040518263ffffffff1660e01b815260040161163991906135e5565b5f604051808303815f87803b158015611650575f80fd5b505af1158015611662573d5f803e3d5ffd5b505050508073ffffffffffffffffffffffffffffffffffffffff166331e79db061168a611819565b6040518263ffffffff1660e01b81526004016116a691906135e5565b5f604051808303815f87803b1580156116bd575f80fd5b505af11580156116cf573d5f803e3d5ffd5b505050508073ffffffffffffffffffffffffffffffffffffffff166331e79db0600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b815260040161172d91906135e5565b5f604051808303815f87803b158015611744575f80fd5b505af1158015611756573d5f803e3d5ffd5b5050505060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f90c7d74461c613da5efa97d90740869367d74ab3aa5837aa4ae9a975f954b7a860405160405180910390a38060105f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054611850906138b4565b80601f016020809104026020016040519081016040528092919081815260200182805461187c906138b4565b80156118c75780601f1061189e576101008083540402835291602001916118c7565b820191905f5260205f20905b8154815290600101906020018083116118aa57829003601f168201915b5050505050905090565b6118d96122a6565b600f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361195f576040517f50ccb09600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61196982826123f0565b5050565b600d5481565b5f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f2789ec6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119de573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a029190613a09565b905090565b5f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a8b9d240836040518263ffffffff1660e01b8152600401611a6291906135e5565b602060405180830381865afa158015611a7d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611aa19190613a09565b9050919050565b5f80611ab26120bb565b9050611abf818585612166565b600191505092915050565b5f805f805f805f8060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fbcbc0f18a6040518263ffffffff1660e01b8152600401611b2c91906135e5565b61010060405180830381865afa158015611b48573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b6c9190613c05565b97509750975097509750975097509750919395975091939597565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611bb46122a6565b8060085f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df782604051611c4e9190613428565b60405180910390a25050565b611c626122a6565b5f5b83839050811015611cf7578160085f868685818110611c8657611c85613cb6565b5b9050602002016020810190611c9b91906135ab565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050611c64565b507f7fdaf542373fa84f4ee8d662c642f44e4c2276a217d7d29e548b6eb29a233b35838383604051611d2b93929190613d9f565b60405180910390a1505050565b611d406122a6565b5f6064611d4b610bad565b611d559190613dfc565b905080821115611d91576040517f220eae8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954827febb96427ceba6a46f9f71146db5c30bc7e2fe31285e9bf34b38bbdede7cd5ea160405160405180910390a3816009819055505050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b60095481565b5f60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e7841ec06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ebf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ee39190613a09565b905090565b611ef06122a6565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e98030c7826040518263ffffffff1660e01b8152600401611f4a9190613450565b5f604051808303815f87803b158015611f61575f80fd5b505af1158015611f73573d5f803e3d5ffd5b5050505050565b5f805f805f805f8060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635183d6fd8a6040518263ffffffff1660e01b8152600401611fdc9190613450565b61010060405180830381865afa158015611ff8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061201c9190613c05565b97509750975097509750975097509750919395975091939597565b61203f6122a6565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036120af575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016120a691906135e5565b60405180910390fd5b6120b88161232d565b50565b5f33905090565b6120cf838383600161251c565b505050565b5f6120df8484611dcc565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146121605781811015612151578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161214893929190613e2c565b60405180910390fd5b61215f84848484035f61251c565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036121d6575f6040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016121cd91906135e5565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612246575f6040517fec442f0500000000000000000000000000000000000000000000000000000000815260040161223d91906135e5565b60405180910390fd5b6122518383836126eb565b505050565b600260065403612292576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600681905550565b6001600681905550565b6122ae6120bb565b73ffffffffffffffffffffffffffffffffffffffff166122cc611819565b73ffffffffffffffffffffffffffffffffffffffff161461232b576122ef6120bb565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161232291906135e5565b60405180910390fd5b565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8060075f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555080156124d25760105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166331e79db0836040518263ffffffff1660e01b81526004016124a491906135e5565b5f604051808303815f87803b1580156124bb575f80fd5b505af11580156124cd573d5f803e3d5ffd5b505050505b8015158273ffffffffffffffffffffffffffffffffffffffff167fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab60405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361258c575f6040517fe602df0500000000000000000000000000000000000000000000000000000000815260040161258391906135e5565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036125fc575f6040517f94280d620000000000000000000000000000000000000000000000000000000081526004016125f391906135e5565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f208190555080156126e5578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516126dc9190613450565b60405180910390a35b50505050565b5f8103612702576126fd83835f612d6a565b612d65565b5f61270c3061138c565b90505f60095482101590505f6001601360149054906101000a900460ff1660ff161490505f60075f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16806127cc575060075f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b90508280156127d85750815b801561282b575060075f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b801561286a575061283a611819565b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614155b80156128a95750612879611819565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614155b8015612902575060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614155b801561295b575060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614155b156129ce576001601360148282829054906101000a900460ff1660ff16901b92506101000a81548160ff021916908360ff16021790555061299b84612f83565b6001601360148282829054906101000a900460ff1660ff16901c92506101000a81548160ff021916908360ff1602179055505b60085f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1680612a69575060085f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b80612a72575080155b15612a7b575f91505b8115612ab9575f6064600c5487612a929190613e61565b612a9c9190613dfc565b90508086612aaa9190613ea2565b9550612ab7883083612d6a565b505b612ac4878787612d6a565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663059ef8d788612b0b8a61138c565b60016040518463ffffffff1660e01b8152600401612b2b93929190613ed5565b5f604051808303815f87803b158015612b42575f80fd5b505af1925050508015612b53575060015b5060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663059ef8d787612b9b8961138c565b60016040518463ffffffff1660e01b8152600401612bbb93929190613ed5565b5f604051808303815f87803b158015612bd2575f80fd5b505af1925050508015612be3575060015b506001601360149054906101000a900460ff1660ff1603612d60575f600d5490506001601360148282829054906101000a900460ff1660ff16901b92506101000a81548160ff021916908360ff16021790555060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ffb2c479826040518263ffffffff1660e01b8152600401612c909190613450565b6060604051808303815f875af1925050508015612ccb57506040513d601f19601f82011682018060405250810190612cc89190613b09565b60015b15612d2c573273ffffffffffffffffffffffffffffffffffffffff16600115157fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a9885858589604051612d209493929190613b59565b60405180910390a35050505b6001601360148282829054906101000a900460ff1660ff16901c92506101000a81548160ff021916908360ff160217905550505b505050505b505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612dba578060025f828254612dae9190613ad6565b92505081905550612e88565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015612e43578381836040517fe450d38c000000000000000000000000000000000000000000000000000000008152600401612e3a93929190613e2c565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612ecf578060025f8282540392505081905550612f19565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612f769190613450565b60405180910390a3505050565b612f8b612256565b5f600a54600b54612f9c9190613ad6565b600b5483612faa9190613e61565b612fb49190613dfc565b90505f8183612fc39190613ea2565b9050612ff13060105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683612166565b612ffa826130c7565b60105f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633243c791826040518263ffffffff1660e01b81526004016130549190613450565b5f604051808303815f87803b15801561306b575f80fd5b505af115801561307d573d5f803e3d5ffd5b505050507f80195cc573b02cc48460cbca6e6e4cc85ddb91959d946e1c3025ea3d87942dc383826040516130b2929190613f0a565b60405180910390a150506130c461229c565b50565b5f600267ffffffffffffffff8111156130e3576130e2613f31565b5b6040519080825280602002602001820160405280156131115781602001602082028036833780820191505090505b50905030815f8151811061312857613127613cb6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160018151811061319857613197613cb6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506131fe30600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846120c2565b600e5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b8152600401613260959493929190614018565b5f604051808303815f87803b158015613277575f80fd5b505af1158015613289573d5f803e3d5ffd5b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156132c85780820151818401526020810190506132ad565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6132ed82613291565b6132f7818561329b565b93506133078185602086016132ab565b613310816132d3565b840191505092915050565b5f6020820190508181035f83015261333381846132e3565b905092915050565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61336c82613343565b9050919050565b61337c81613362565b8114613386575f80fd5b50565b5f8135905061339781613373565b92915050565b5f819050919050565b6133af8161339d565b81146133b9575f80fd5b50565b5f813590506133ca816133a6565b92915050565b5f80604083850312156133e6576133e561333b565b5b5f6133f385828601613389565b9250506020613404858286016133bc565b9150509250929050565b5f8115159050919050565b6134228161340e565b82525050565b5f60208201905061343b5f830184613419565b92915050565b61344a8161339d565b82525050565b5f6020820190506134635f830184613441565b92915050565b5f819050919050565b5f61348c61348761348284613343565b613469565b613343565b9050919050565b5f61349d82613472565b9050919050565b5f6134ae82613493565b9050919050565b6134be816134a4565b82525050565b5f6020820190506134d75f8301846134b5565b92915050565b5f805f606084860312156134f4576134f361333b565b5b5f61350186828701613389565b935050602061351286828701613389565b9250506040613523868287016133bc565b9150509250925092565b5f61353782613472565b9050919050565b5f6135488261352d565b9050919050565b6135588161353e565b82525050565b5f6020820190506135715f83018461354f565b92915050565b5f60ff82169050919050565b61358c81613577565b82525050565b5f6020820190506135a55f830184613583565b92915050565b5f602082840312156135c0576135bf61333b565b5b5f6135cd84828501613389565b91505092915050565b6135df81613362565b82525050565b5f6020820190506135f85f8301846135d6565b92915050565b5f61360882613343565b9050919050565b613618816135fe565b8114613622575f80fd5b50565b5f813590506136338161360f565b92915050565b5f6020828403121561364e5761364d61333b565b5b5f61365b84828501613625565b91505092915050565b5f602082840312156136795761367861333b565b5b5f613686848285016133bc565b91505092915050565b6136988161340e565b81146136a2575f80fd5b50565b5f813590506136b38161368f565b92915050565b5f80604083850312156136cf576136ce61333b565b5b5f6136dc85828601613389565b92505060206136ed858286016136a5565b9150509250929050565b5f819050919050565b613709816136f7565b82525050565b5f610100820190506137235f83018b6135d6565b613730602083018a613700565b61373d6040830189613700565b61374a6060830188613441565b6137576080830187613441565b61376460a0830186613441565b61377160c0830185613441565b61377e60e0830184613441565b9998505050505050505050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f8401126137ac576137ab61378b565b5b8235905067ffffffffffffffff8111156137c9576137c861378f565b5b6020830191508360208202830111156137e5576137e4613793565b5b9250929050565b5f805f604084860312156138035761380261333b565b5b5f84013567ffffffffffffffff8111156138205761381f61333f565b5b61382c86828701613797565b9350935050602061383f868287016136a5565b9150509250925092565b5f806040838503121561385f5761385e61333b565b5b5f61386c85828601613389565b925050602061387d85828601613389565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806138cb57607f821691505b6020821081036138de576138dd613887565b5b50919050565b7f4e6f2066756e647320746f2077697468647261770000000000000000000000005f82015250565b5f61391860148361329b565b9150613923826138e4565b602082019050919050565b5f6020820190508181035f8301526139458161390c565b9050919050565b5f81905092915050565b50565b5f6139645f8361394c565b915061396f82613956565b5f82019050919050565b5f61398382613959565b9150819050919050565b7f455448207472616e73666572206661696c6564000000000000000000000000005f82015250565b5f6139c160138361329b565b91506139cc8261398d565b602082019050919050565b5f6020820190508181035f8301526139ee816139b5565b9050919050565b5f81519050613a03816133a6565b92915050565b5f60208284031215613a1e57613a1d61333b565b5b5f613a2b848285016139f5565b91505092915050565b613a3d816135fe565b82525050565b5f604082019050613a565f830185613a34565b613a636020830184613419565b9392505050565b5f81519050613a788161368f565b92915050565b5f60208284031215613a9357613a9261333b565b5b5f613aa084828501613a6a565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f613ae08261339d565b9150613aeb8361339d565b9250828201905080821115613b0357613b02613aa9565b5b92915050565b5f805f60608486031215613b2057613b1f61333b565b5b5f613b2d868287016139f5565b9350506020613b3e868287016139f5565b9250506040613b4f868287016139f5565b9150509250925092565b5f608082019050613b6c5f830187613441565b613b796020830186613441565b613b866040830185613441565b613b936060830184613441565b95945050505050565b5f81519050613baa81613373565b92915050565b5f60208284031215613bc557613bc461333b565b5b5f613bd284828501613b9c565b91505092915050565b613be4816136f7565b8114613bee575f80fd5b50565b5f81519050613bff81613bdb565b92915050565b5f805f805f805f80610100898b031215613c2257613c2161333b565b5b5f613c2f8b828c01613b9c565b9850506020613c408b828c01613bf1565b9750506040613c518b828c01613bf1565b9650506060613c628b828c016139f5565b9550506080613c738b828c016139f5565b94505060a0613c848b828c016139f5565b93505060c0613c958b828c016139f5565b92505060e0613ca68b828c016139f5565b9150509295985092959890939650565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82825260208201905092915050565b5f819050919050565b613d0581613362565b82525050565b5f613d168383613cfc565b60208301905092915050565b5f613d306020840184613389565b905092915050565b5f602082019050919050565b5f613d4f8385613ce3565b9350613d5a82613cf3565b805f5b85811015613d9257613d6f8284613d22565b613d798882613d0b565b9750613d8483613d38565b925050600181019050613d5d565b5085925050509392505050565b5f6040820190508181035f830152613db8818587613d44565b9050613dc76020830184613419565b949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f613e068261339d565b9150613e118361339d565b925082613e2157613e20613dcf565b5b828204905092915050565b5f606082019050613e3f5f8301866135d6565b613e4c6020830185613441565b613e596040830184613441565b949350505050565b5f613e6b8261339d565b9150613e768361339d565b9250828202613e848161339d565b91508282048414831517613e9b57613e9a613aa9565b5b5092915050565b5f613eac8261339d565b9150613eb78361339d565b9250828203905081811115613ecf57613ece613aa9565b5b92915050565b5f606082019050613ee85f830186613a34565b613ef56020830185613441565b613f026040830184613419565b949350505050565b5f604082019050613f1d5f830185613441565b613f2a6020830184613441565b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f819050919050565b5f613f81613f7c613f7784613f5e565b613469565b61339d565b9050919050565b613f9181613f67565b82525050565b5f81519050919050565b5f819050602082019050919050565b5f602082019050919050565b5f613fc682613f97565b613fd08185613ce3565b9350613fdb83613fa1565b805f5b8381101561400b578151613ff28882613d0b565b9750613ffd83613fb0565b925050600181019050613fde565b5085935050505092915050565b5f60a08201905061402b5f830188613441565b6140386020830187613f88565b818103604083015261404a8186613fbc565b905061405960608301856135d6565b6140666080830184613441565b969550505050505056fea264697066735822122084072c1f1bfa994f5bee962c9abc6060594816e8814d8cf6208cab14c1f7138b64736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: shanghai
Optimization: No
legalx.sol 2215 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
// lib/openzeppelin-contracts/contracts/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
/**
* @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;
}
}
// src/interfaces/IDividendPayingToken.sol
/// @title Dividend-Paying Token Interface
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev An interface for a dividend-paying token contract.
interface DividendPayingTokenInterface {
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function dividendOf(address _owner) external view returns (uint256);
/// @notice Withdraws the ether distributed to the sender.
/// @dev SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer.
/// MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0.
function withdrawDividend() external;
/// @dev This event MUST emit when ether is distributed to token holders.
/// @param from The address which sends ether to this contract.
/// @param weiAmount The amount of distributed ether in wei.
event DividendsDistributed(address indexed from, uint256 weiAmount);
/// @dev This event MUST emit when an address withdraws their dividend.
/// @param to The address which withdraws ether from this contract.
/// @param weiAmount The amount of withdrawn ether in wei.
event DividendWithdrawn(address indexed to, uint256 weiAmount);
}
// src/interfaces/IDividendPayingTokenOptional.sol
/// @title Dividend-Paying Token Optional Interface
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev OPTIONAL functions for a dividend-paying token contract.
interface DividendPayingTokenOptionalInterface {
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function withdrawableDividendOf(
address _owner
) external view returns (uint256);
/// @notice View the amount of dividend in wei that an address has withdrawn.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has withdrawn.
function withdrawnDividendOf(
address _owner
) external view returns (uint256);
/// @notice View the amount of dividend in wei that an address has earned in total.
/// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has earned in total.
function accumulativeDividendOf(
address _owner
) external view returns (uint256);
}
// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
/**
* @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);
}
// src/interfaces/IUniswapV2.sol
interface IUniswapRouter01 {
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);
}
interface IUniswapRouter02 is IUniswapRouter01 {
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;
}
interface IUniswapPair {
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;
}
interface IUniswapFactory {
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;
}
// src/IterableMapping.sol
library IterableMapping {
// Iterable mapping from address to uint;
struct Map {
address[] keys;
mapping(address => uint) values;
mapping(address => uint) indexOf;
mapping(address => bool) inserted;
}
function get(Map storage map, address key) public view returns (uint) {
return map.values[key];
}
function getIndexOfKey(
Map storage map,
address key
) public view returns (int) {
if (!map.inserted[key]) {
return -1;
}
return int(map.indexOf[key]);
}
function getKeyAtIndex(
Map storage map,
uint index
) public view returns (address) {
return map.keys[index];
}
function size(Map storage map) public view returns (uint) {
return map.keys.length;
}
function set(Map storage map, address key, uint val) public {
if (map.inserted[key]) {
map.values[key] = val;
} else {
map.inserted[key] = true;
map.values[key] = val;
map.indexOf[key] = map.keys.length;
map.keys.push(key);
}
}
function remove(Map storage map, address key) public {
if (!map.inserted[key]) {
return;
}
delete map.inserted[key];
delete map.values[key];
uint index = map.indexOf[key];
uint lastIndex = map.keys.length - 1;
address lastKey = map.keys[lastIndex];
map.indexOf[lastKey] = index;
delete map.indexOf[key];
map.keys[index] = lastKey;
map.keys.pop();
}
}
// lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
/**
* @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;
}
}
// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
/**
* @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);
}
// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.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);
}
// lib/openzeppelin-contracts/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.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);
}
}
// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.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 {
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);
}
}
}
}
// src/DividendPayingToken.sol
/// @title Dividend-Paying Token
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev A mintable ERC20 token that allows anyone to pay and distribute ether
/// to token holders as dividends and allows token holders to withdraw their dividends.
contract DividendPayingToken is
ERC20,
Ownable,
DividendPayingTokenInterface,
DividendPayingTokenOptionalInterface
{
//------------------------------------------------------
// ERRORS
//------------------------------------------------------
error DividendTracker__NoSupply();
error DividendTracker__DividendCorrectionOverflow();
error DividendTracker__InvalidRewardToken();
error DividendTracker__DividendCorrectionUnderflow();
error DividendTracker__ClaimWaitOutOfRange();
error DividendTracker__InvalidAccount();
//------------------------------------------------------
// State Variables
//------------------------------------------------------
// About dividendCorrection:
// If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:
// `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.
// When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),
// `dividendOf(_user)` should not be changed,
// but the computed value of `dividendPerShare * balanceOf(_user)` is changed.
// To keep the `dividendOf(_user)` unchanged, we add a correction term:
// `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,
// where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:
// `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.
// So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.
mapping(address => int256) internal magnifiedDividendCorrections;
mapping(address => uint256) internal withdrawnDividends;
uint256 public totalDividendsDistributed;
// With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.
// For more discussion about choosing the value of `magnitude`,
// see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728
uint256 internal constant magnitude = 2 ** 128;
uint256 internal magnifiedDividendPerShare;
// Addresses 160 bits
address public immutable RewardToken;
constructor(
string memory _name,
string memory _symbol,
address _rewardToken
) ERC20(_name, _symbol) Ownable(msg.sender) {
RewardToken = _rewardToken;
}
receive() external payable {
if (RewardToken != address(0))
revert DividendTracker__InvalidRewardToken();
}
function distributeDividends(uint256 amount) public onlyOwner {
if (totalSupply() == 0) {
revert DividendTracker__NoSupply();
}
if (amount > 0) {
magnifiedDividendPerShare += (amount * magnitude) / totalSupply();
emit DividendsDistributed(msg.sender, amount);
totalDividendsDistributed += amount;
}
}
/// @notice Withdraws the ether distributed to the sender.
/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function withdrawDividend() public virtual override {
_withdrawDividendOfUser(payable(msg.sender));
}
/// @notice Withdraws the ether distributed to the sender.
/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function _withdrawDividendOfUser(
address payable user
) internal returns (uint256) {
uint256 _withdrawableDividend = withdrawableDividendOf(user);
if (_withdrawableDividend > 0) {
withdrawnDividends[user] += _withdrawableDividend;
if (RewardToken == address(0)) {
(bool success, ) = user.call{value: _withdrawableDividend}("");
if (!success) {
withdrawnDividends[user] -= _withdrawableDividend;
return 0;
}
} else {
IERC20(RewardToken).transfer(user, _withdrawableDividend);
}
emit DividendWithdrawn(user, _withdrawableDividend);
return _withdrawableDividend;
}
return 0;
}
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function dividendOf(address _owner) public view override returns (uint256) {
return withdrawableDividendOf(_owner);
}
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function withdrawableDividendOf(
address _owner
) public view override returns (uint256) {
return accumulativeDividendOf(_owner) - withdrawnDividends[_owner];
}
/// @notice View the amount of dividend in wei that an address has withdrawn.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has withdrawn.
function withdrawnDividendOf(
address _owner
) public view override returns (uint256) {
return withdrawnDividends[_owner];
}
/// @notice View the amount of dividend in wei that an address has earned in total.
/// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)
/// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has earned in total.
function accumulativeDividendOf(
address _owner
) public view override returns (uint256) {
int256 valCorrection = int256(
magnifiedDividendPerShare * balanceOf(_owner)
);
if (valCorrection < 0) {
revert DividendTracker__DividendCorrectionOverflow();
}
valCorrection += magnifiedDividendCorrections[_owner];
if (valCorrection < 0) {
revert DividendTracker__DividendCorrectionUnderflow();
}
uint256 fullCorrection = uint256(valCorrection);
return fullCorrection / magnitude;
}
/// @dev Internal function that mints tokens to an account.
/// Update magnifiedDividendCorrections to keep dividends unchanged.
/// @param account The account that will receive the created tokens.
/// @param value The amount that will be created.
function mintBalance(address account, uint256 value) internal {
if (account == address(0)) {
revert DividendTracker__InvalidAccount();
}
super._update(address(0), account, value);
int256 magVal = int256(magnifiedDividendPerShare * value);
if (magVal < 0) {
revert DividendTracker__DividendCorrectionOverflow();
}
magnifiedDividendCorrections[account] -= magVal;
}
/// @dev Internal function that burns an amount of the token of a given account.
/// Update magnifiedDividendCorrections to keep dividends unchanged.
/// @param account The account whose tokens will be burnt.
/// @param value The amount that will be burnt.
function burnBalance(address account, uint256 value) internal {
if (account == address(0)) {
revert DividendTracker__InvalidAccount();
}
super._update(account, address(0), value);
int256 magVal = int256(magnifiedDividendPerShare * value);
if (magVal < 0) {
revert DividendTracker__DividendCorrectionOverflow();
}
magnifiedDividendCorrections[account] += magVal;
}
function _setBalance(address account, uint256 newBalance) internal {
uint256 currentBalance = balanceOf(account);
if (newBalance > currentBalance) {
uint256 mintAmount = newBalance - currentBalance;
mintBalance(account, mintAmount);
} else if (newBalance < currentBalance) {
uint256 burnAmount = currentBalance - newBalance;
burnBalance(account, burnAmount);
}
}
}
// src/DividendTracker.sol
contract DividendTracker is Ownable, DividendPayingToken {
//---------------------------------------------------------------
// Errors
//---------------------------------------------------------------
error DividendTracker__TransferNotAllowed();
error DividendTracker__WithdrawDisabled();
//---------------------------------------------------------------
// State Variables
//---------------------------------------------------------------
using IterableMapping for IterableMapping.Map;
IterableMapping.Map private tokenHoldersMap;
mapping(address => bool) public excludedFromDividends;
mapping(address => uint256) public lastClaimTimes;
uint256 public lastProcessedIndex;
uint256 public claimWait;
uint256 public immutable minimumTokenBalanceForDividends;
//---------------------------------------------------------------
// Events
//---------------------------------------------------------------
event ExcludeFromDividends(address indexed account);
event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event Claim(
address indexed account,
uint256 amount,
bool indexed automatic
);
//---------------------------------------------------------------
// Constructor
//---------------------------------------------------------------
constructor(
string memory allName,
uint minTokenHold,
address _rewardToken
) DividendPayingToken(allName, allName, _rewardToken) {
claimWait = 300;
minimumTokenBalanceForDividends = minTokenHold;
}
function withdrawDividend() public pure override {
revert DividendTracker__WithdrawDisabled();
}
function excludeFromDividends(address account) external onlyOwner {
excludedFromDividends[account] = true;
_setBalance(account, 0);
tokenHoldersMap.remove(account);
emit ExcludeFromDividends(account);
}
function updateClaimWait(uint256 newClaimWait) external onlyOwner {
if (newClaimWait < 1 minutes || newClaimWait > 1 days) {
revert DividendTracker__ClaimWaitOutOfRange();
}
emit ClaimWaitUpdated(newClaimWait, claimWait);
claimWait = newClaimWait;
}
function getLastProcessedIndex() external view returns (uint256) {
return lastProcessedIndex;
}
function getNumberOfTokenHolders() external view returns (uint256) {
return tokenHoldersMap.keys.length;
}
function getAccount(
address _account
)
public
view
returns (
address account,
int256 index,
int256 iterationsUntilProcessed,
uint256 withdrawableDividends,
uint256 totalDividends,
uint256 lastClaimTime,
uint256 nextClaimTime,
uint256 secondsUntilAutoClaimAvailable
)
{
account = _account;
index = tokenHoldersMap.getIndexOfKey(account);
iterationsUntilProcessed = -1;
if (index >= 0) {
if (uint256(index) > lastProcessedIndex) {
iterationsUntilProcessed = index - int256(lastProcessedIndex);
} else {
uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length >
lastProcessedIndex
? tokenHoldersMap.keys.length - lastProcessedIndex
: 0;
iterationsUntilProcessed =
index +
int256(processesUntilEndOfArray);
}
}
withdrawableDividends = withdrawableDividendOf(account);
totalDividends = accumulativeDividendOf(account);
lastClaimTime = lastClaimTimes[account];
nextClaimTime = lastClaimTime > 0 ? lastClaimTime + claimWait : 0;
secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp
? nextClaimTime - block.timestamp
: 0;
}
function getAccountAtIndex(
uint256 index
)
public
view
returns (
address,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
if (index >= tokenHoldersMap.size()) {
return (
0x0000000000000000000000000000000000000...
// [truncated — 72656 bytes total]
Read Contract
WETH 0xad5c4648 → address
_marketingWalletAddress 0x4144d9e4 → address
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
deadWallet 0x85141a77 → address
decimals 0x313ce567 → uint8
dividendTokenBalanceOf 0x6843cd84 → uint256
dividendTracker 0x2c1f5216 → address
gasForProcessing 0x9c1b8af5 → uint256
getAccountDividendsInfo 0xad56c13c → address, int256, int256, uint256, uint256, uint256, uint256, uint256
getAccountDividendsInfoAtIndex 0xf27fd254 → address, int256, int256, uint256, uint256, uint256, uint256, uint256
getClaimWait 0xa26579ad → uint256
getLastProcessedIndex 0xe7841ec0 → uint256
getNumberOfDividendTokenHolders 0x64b0f653 → uint256
getTotalDividendsDistributed 0x30bb4cff → uint256
isExcludedFromFees 0x4fbee193 → bool
lpPairs 0x43cc8c2a → bool
marketingFee 0x6b67c4df → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
rewardTokenFee 0x167bcf71 → uint256
swapTokensAtAmount 0xe2f45605 → uint256
symbol 0x95d89b41 → string
totalFees 0x13114a9d → uint256
totalSupply 0x18160ddd → uint256
uniswapV2Pair 0x49bd5a5e → address
uniswapV2Router 0x1694505e → address
withdrawableDividendOf 0xa8b9d240 → uint256
Write Contract 19 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
excludeFromDividends 0x31e79db0
address account
excludeFromFees 0xc0246668
address account
bool excluded
excludeMultipleAccountsFromFees 0xc492f046
address[] accounts
bool excluded
processDividendTracker 0x700bb191
uint256 gas
renounceOwnership 0x715018a6
No parameters
setAutomatedMarketMakerPair 0x9a7a23d6
address pair
bool value
setMarketingFee 0x625e764c
uint256 value
setMarketingWallet 0x5d098b38
address wallet
setRewardTokenFee 0x81c79ec2
uint256 value
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateClaimWait 0xe98030c7
uint256 claimWait
updateDividendTracker 0x88bdd9be
address newAddress
updateGasForProcessing 0x871c128d
uint256 newValue
updateSwapTokensAtAmount 0xd257b34f
uint256 newAmount
withdrawMarketingFunds 0x2b72c4c0
No parameters
Recent Transactions
No transactions found for this address