From 81ec2198aa65ef7d08a8f20e592217e78cd0601c Mon Sep 17 00:00:00 2001 From: nolash Date: Mon, 7 Jun 2021 17:49:22 +0200 Subject: [PATCH] Improve resolution in fractional calc in contract --- .../data/DemurrageTokenSingleCap.bin | 2 +- python/examples/sim_noredistribute.py | 4 ++-- python/tests/test_basic.py | 15 +++++++++++++++ solidity/DemurrageTokenSingleCap.sol | 14 +++++++------- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin b/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin index 497b533..5634948 100644 --- a/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin +++ b/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin @@ -1 +1 @@ -60e06040523480156200001157600080fd5b50604051620032da380380620032da83398181016040528101906200003791906200043f565b33600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600c6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555086600690805190602001906200010a929190620002d8565b50856007908051906020019062000123929190620002d8565b508460ff166008819055504260038190555060035460808181525050603c836200014e919062000715565b60a08181525050620f42406d04ee2d6d415b85acef810000000062000174919062000715565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508360c081815250506000620001d96000620f42406000600162000272640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600a8190555082600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508560ff16600a6200025e9190620005d8565b600b8190555050505050505050506200095c565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b828054620002e690620007f7565b90600052602060002090601f0160209004810192826200030a576000855562000356565b82601f106200032557805160ff191683800117855562000356565b8280016001018555821562000356579182015b828111156200035557825182559160200191906001019062000338565b5b50905062000365919062000369565b5090565b5b80821115620003845760008160009055506001016200036a565b5090565b60006200039f620003998462000547565b6200051e565b905082815260208101848484011115620003b857600080fd5b620003c5848285620007c1565b509392505050565b600081519050620003de816200090e565b92915050565b600082601f830112620003f657600080fd5b81516200040884826020860162000388565b91505092915050565b600081519050620004228162000928565b92915050565b600081519050620004398162000942565b92915050565b600080600080600080600060e0888a0312156200045b57600080fd5b600088015167ffffffffffffffff8111156200047657600080fd5b620004848a828b01620003e4565b975050602088015167ffffffffffffffff811115620004a257600080fd5b620004b08a828b01620003e4565b9650506040620004c38a828b0162000428565b9550506060620004d68a828b0162000411565b9450506080620004e98a828b0162000411565b93505060a0620004fc8a828b01620003cd565b92505060c06200050f8a828b0162000411565b91505092959891949750929550565b60006200052a6200053d565b90506200053882826200082d565b919050565b6000604051905090565b600067ffffffffffffffff821115620005655762000564620008c1565b5b6200057082620008f0565b9050602081019050919050565b6000808291508390505b6001851115620005cf57808604811115620005a757620005a662000863565b5b6001851615620005b75780820291505b8081029050620005c78562000901565b945062000587565b94509492505050565b6000620005e582620007aa565b9150620005f283620007aa565b9250620006217fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000629565b905092915050565b6000826200063b57600190506200070e565b816200064b57600090506200070e565b81600181146200066457600281146200066f57620006a5565b60019150506200070e565b60ff84111562000684576200068362000863565b5b8360020a9150848211156200069e576200069d62000863565b5b506200070e565b5060208310610133831016604e8410600b8410161715620006df5782820a905083811115620006d957620006d862000863565b5b6200070e565b620006ee84848460016200057d565b9250905081840481111562000708576200070762000863565b5b81810290505b9392505050565b60006200072282620007aa565b91506200072f83620007aa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156200076b576200076a62000863565b5b828202905092915050565b600062000783826200078a565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015620007e1578082015181840152602081019050620007c4565b83811115620007f1576000848401525b50505050565b600060028204905060018216806200081057607f821691505b6020821081141562000827576200082662000892565b5b50919050565b6200083882620008f0565b810181811067ffffffffffffffff821117156200085a5762000859620008c1565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6000600282049050919050565b620009198162000776565b81146200092557600080fd5b50565b6200093381620007aa565b81146200093f57600080fd5b50565b6200094d81620007b4565b81146200095957600080fd5b50565b60805160a05160c051612924620009b660003960008181610bcb01528181610e1c01526119b50152600081816110b2015281816119630152611a500152600081816110de01528181611a710152611ab601526129246000f3fe608060405234801561001057600080fd5b506004361061024f576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be1161014d57806395d89b41116100d5578063e3ab207a11610099578063e3ab207a14610776578063e54d63f7146107a6578063e8095295146107d6578063eda4e6d6146107f4578063f2fde38b146108125761024f565b806395d89b41146106aa578063983b2d56146106c85780639da7d8ba146106f8578063a9059cbb14610728578063b470aade146107585761024f565b8063731f237c1161011c578063731f237c1461061457806379ba5097146106325780638da5cb5b146106505780638f1df6bc1461066e5780638f770ad01461068c5761024f565b80636787a9be146105545780636a2d094e146105845780636ffa8a05146105b457806370a08231146105e45761024f565b806331333487116101db5780634abfbba21161019f5780634abfbba21461048857806351b4541c146104b8578063573cc507146104e857806358b2833b146105065780636721d4ef146105245761024f565b806331333487146103aa578063313ce567146103da57806340452d91146103f8578063449a52f81461042857806347a50517146104585761024f565b806318160ddd1161022257806318160ddd146102f05780631989c6a81461030e578063229ba1971461032c57806323b872dd1461034a5780633092afd51461037a5761024f565b806301ffc9a71461025457806306fdde0314610284578063095ea7b3146102a257806309f28f3c146102d2575b600080fd5b61026e60048036038101906102699190612200565b610842565b60405161027b91906123ce565b60405180910390f35b61028c6109ed565b6040516102999190612404565b60405180910390f35b6102bc60048036038101906102b7919061219b565b610a7b565b6040516102c991906123ce565b60405180910390f35b6102da610b95565b6040516102e79190612486565b60405180910390f35b6102f8610bb7565b60405161030591906124bc565b60405180910390f35b610316610bbd565b60405161032391906124bc565b60405180910390f35b610334610bc9565b60405161034191906124bc565b60405180910390f35b610364600480360381019061035f919061214c565b610bed565b60405161037191906123ce565b60405180910390f35b610394600480360381019061038f9190612123565b610d0d565b6040516103a191906123ce565b60405180910390f35b6103c460048036038101906103bf919061227b565b610e00565b6040516103d191906124bc565b60405180910390f35b6103e2610eb1565b6040516103ef91906124bc565b60405180910390f35b610412600480360381019061040d9190612252565b610eb7565b60405161041f91906123e9565b60405180910390f35b610442600480360381019061043d919061219b565b610edb565b60405161044f91906123ce565b60405180910390f35b610472600480360381019061046d9190612123565b611065565b60405161047f91906124bc565b60405180910390f35b6104a2600480360381019061049d9190612252565b6110ae565b6040516104af91906124bc565b60405180910390f35b6104d260048036038101906104cd9190612252565b61110e565b6040516104df91906124bc565b60405180910390f35b6104f061112f565b6040516104fd91906124bc565b60405180910390f35b61050e611135565b60405161051b91906124bc565b60405180910390f35b61053e6004803603810190610539919061227b565b61113b565b60405161054b91906124bc565b60405180910390f35b61056e60048036038101906105699190612252565b611178565b60405161057b91906124bc565b60405180910390f35b61059e60048036038101906105999190612252565b6111e4565b6040516105ab91906124bc565b60405180910390f35b6105ce60048036038101906105c991906121d7565b611205565b6040516105db91906124bc565b60405180910390f35b6105fe60048036038101906105f99190612123565b611238565b60405161060b91906124bc565b60405180910390f35b61061c6112e1565b60405161062991906123ce565b60405180910390f35b61063a611405565b60405161064791906123ce565b60405180910390f35b6106586115ac565b60405161066591906123b3565b60405180910390f35b6106766115d2565b60405161068391906123ce565b60405180910390f35b61069461174e565b6040516106a191906124bc565b60405180910390f35b6106b2611754565b6040516106bf9190612404565b60405180910390f35b6106e260048036038101906106dd9190612123565b6117e2565b6040516106ef91906123ce565b60405180910390f35b610712600480360381019061070d91906121d7565b61189f565b60405161071f91906124bc565b60405180910390f35b610742600480360381019061073d919061219b565b6118cb565b60405161074f91906123ce565b60405180910390f35b610760611961565b60405161076d91906124bc565b60405180910390f35b610790600480360381019061078b91906121d7565b611985565b60405161079d91906124bc565b60405180910390f35b6107c060048036038101906107bb919061227b565b611999565b6040516107cd91906124bc565b60405180910390f35b6107de611a4a565b6040516107eb9190612486565b60405180910390f35b6107fc611ab4565b60405161080991906124bc565b60405180910390f35b61082c60048036038101906108279190612123565b611ad8565b60405161083991906123ce565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561089757600190506109e8565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108ea57600190506109e8565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561093d57600190506109e8565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561099057600190506109e8565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109e357600190506109e8565b600090505b919050565b600680546109fa906126e7565b80601f0160208091040260200160405190810160405280929190818152602001828054610a26906126e7565b8015610a735780601f10610a4857610100808354040283529160200191610a73565b820191906000526020600020905b815481529060010190602001808311610a5657829003601f168201915b505050505081565b600080610a866115d2565b50610a9083611178565b905080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e91906124f3565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610b8291906124bc565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60095481565b60008080549050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610bfa6115d2565b50610c0484611178565b915081600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c8f57600080fd5b610c9a868684611b7a565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610cf991906124bc565b60405180910390a380925050509392505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d9657503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610d9f57600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000610e459190612549565b905060005b84811015610e8c57620f42408284610e62919061257a565b610e6c9190612549565b83610e7791906125d4565b92508080610e8490612719565b915050610e4a565b50620f42408583610e9d919061257a565b610ea79190612549565b9250505092915050565b60085481565b60008181548110610ec757600080fd5b906000526020600020016000915090505481565b600080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6190612446565b60405180910390fd5b600a5460095484610f7b91906124f3565b1115610fbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb390612426565b60405180910390fd5b610fc46115d2565b508290508260096000828254610fda91906124f3565b92505081905550610feb8482611bbb565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f88560405161104991906124bc565b60405180910390a3611059611c80565b50600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826110dc919061257a565b7f000000000000000000000000000000000000000000000000000000000000000061110791906124f3565b9050919050565b6000603c824261111e91906125d4565b6111289190612549565b9050919050565b600b5481565b60035481565b6000620f42408261114c9190612549565b6d04ee2d6d415b85acef810000000061116591906125d4565b83611170919061257a565b905092915050565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16620f42406d04ee2d6d415b85acef8100000000846111c9919061257a565b6111d3919061257a565b6111dd9190612549565b9050919050565b6000603c82426111f491906125d4565b6111fe9190612549565b9050919050565b6000608c60ff1673fffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b60008060008061124785611065565b925061125460035461110e565b9050611290600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610e00565b6fffffffffffffffffffffffffffffffff169150620f42406d04ee2d6d415b85acef81000000006112c1919061257a565b82846112cd919061257a565b6112d79190612549565b9350505050919050565b60008060008060006112f460035461110e565b9250600083141561130c576000945050505050611402565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1691506113498284610e00565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550603c8361138e919061257a565b60035461139b91906124f3565b6003819055508183427fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff166040516113f191906124a1565b60405180910390a460019450505050505b90565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146257600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060006115e8611d78565b975060006001028814156116075760009850505050505050505061174b565b61161088611985565b955060018661161f91906124f3565b905061162a866110ae565b91506116346112e1565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611671826111e4565b925060008311156116a6576d04ee2d6d415b85acef81000000006116958685611999565b61169f9190612549565b93506116c3565b6d04ee2d6d415b85acef8100000000856116c09190612549565b93505b6116d260008560095484611ea8565b9650600087908060018154018082558091505060019003906000526020600020016000909190919091505561170688611f0e565b507f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161173691906124bc565b60405180910390a16001985050505050505050505b90565b600a5481565b60078054611761906126e7565b80601f016020809104026020016040519081016040528092919081815260200182805461178d906126e7565b80156117da5780601f106117af576101008083540402835291602001916117da565b820191906000526020600020905b8154815290600101906020018083116117bd57829003601f168201915b505050505081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461183e57600080fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b60008060006118d86115d2565b506118e284611178565b91506118ef338684611b7a565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161194e91906124bc565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f00000000000000000000000000000000000000000000000000000000000000006119de9190612549565b905060005b84811015611a2557620f424082846119fb919061257a565b611a059190612549565b83611a1091906124f3565b92508080611a1d90612719565b9150506119e3565b50620f42408583611a36919061257a565b611a409190612549565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611a9b91906125d4565b611aa59190612549565b611aaf91906124f3565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b3457600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080611b878584611fb2565b50611b928484611bbb565b50611b9b611a4a565b6fffffffffffffffffffffffffffffffff16905060019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000851415611c185760009350505050611c7a565b611c2186611065565b92508483611c2f91906124f3565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000806000611c926009546001611999565b905060006001600080549050611ca891906125d4565b81548110611cdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900491506cffffffffffffffffff000000001982169150602060ff16819060020a02821791508160010260006001600080549050611d2a91906125d4565b81548110611d61577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555060019250505090565b6000806000806001600080549050611d9091906125d4565b81548110611dc7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611e3657600080fd5b505afa158015611e4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6e9190612229565b6fffffffffffffffffffffffffffffffff169050611e8b82611985565b8111611e9f57600060010292505050611ea5565b81925050505b90565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b6000806000611f1c8461189f565b9150611f5882600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1661113b565b9050611fa7600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611fa26d04ee2d6d415b85acef810000000084611f9d9190612549565b611178565b611bbb565b508092505050919050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600085141561200f57600093505050506120b4565b61201886611065565b92508483101561205d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205490612466565b60405180910390fd5b848361206991906125d4565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000813590506120c98161287b565b92915050565b6000813590506120de81612892565b92915050565b6000813590506120f3816128a9565b92915050565b600081519050612108816128c0565b92915050565b60008135905061211d816128d7565b92915050565b60006020828403121561213557600080fd5b6000612143848285016120ba565b91505092915050565b60008060006060848603121561216157600080fd5b600061216f868287016120ba565b9350506020612180868287016120ba565b92505060406121918682870161210e565b9150509250925092565b600080604083850312156121ae57600080fd5b60006121bc858286016120ba565b92505060206121cd8582860161210e565b9150509250929050565b6000602082840312156121e957600080fd5b60006121f7848285016120cf565b91505092915050565b60006020828403121561221257600080fd5b6000612220848285016120e4565b91505092915050565b60006020828403121561223b57600080fd5b6000612249848285016120f9565b91505092915050565b60006020828403121561226457600080fd5b60006122728482850161210e565b91505092915050565b6000806040838503121561228e57600080fd5b600061229c8582860161210e565b92505060206122ad8582860161210e565b9150509250929050565b6122c081612608565b82525050565b6122cf8161261a565b82525050565b6122de81612626565b82525050565b60006122ef826124d7565b6122f981856124e2565b93506123098185602086016126b4565b612312816127ef565b840191505092915050565b600061232a6007836124e2565b915061233582612800565b602082019050919050565b600061234d600a836124e2565b915061235882612829565b602082019050919050565b6000612370600d836124e2565b915061237b82612852565b602082019050919050565b61238f8161265c565b82525050565b61239e816126a2565b82525050565b6123ad81612698565b82525050565b60006020820190506123c860008301846122b7565b92915050565b60006020820190506123e360008301846122c6565b92915050565b60006020820190506123fe60008301846122d5565b92915050565b6000602082019050818103600083015261241e81846122e4565b905092915050565b6000602082019050818103600083015261243f8161231d565b9050919050565b6000602082019050818103600083015261245f81612340565b9050919050565b6000602082019050818103600083015261247f81612363565b9050919050565b600060208201905061249b6000830184612386565b92915050565b60006020820190506124b66000830184612395565b92915050565b60006020820190506124d160008301846123a4565b92915050565b600081519050919050565b600082825260208201905092915050565b60006124fe82612698565b915061250983612698565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561253e5761253d612762565b5b828201905092915050565b600061255482612698565b915061255f83612698565b92508261256f5761256e612791565b5b828204905092915050565b600061258582612698565b915061259083612698565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125c9576125c8612762565b5b828202905092915050565b60006125df82612698565b91506125ea83612698565b9250828210156125fd576125fc612762565b5b828203905092915050565b600061261382612678565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006126ad8261265c565b9050919050565b60005b838110156126d25780820151818401526020810190506126b7565b838111156126e1576000848401525b50505050565b600060028204905060018216806126ff57607f821691505b60208210811415612713576127126127c0565b5b50919050565b600061272482612698565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561275757612756612762565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4552525f43415000000000000000000000000000000000000000000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f4f5645525350454e4400000000000000000000000000000000000000600082015250565b61288481612608565b811461288f57600080fd5b50565b61289b81612626565b81146128a657600080fd5b50565b6128b281612630565b81146128bd57600080fd5b50565b6128c98161265c565b81146128d457600080fd5b50565b6128e081612698565b81146128eb57600080fd5b5056fea2646970667358221220dacc9738ac01a1784f9699c61cfc619c23340292871ca5a2ece3a59ee2e0c07e64736f6c63430008040033 \ No newline at end of file +60e06040523480156200001157600080fd5b50604051620032e1380380620032e183398181016040528101906200003791906200043e565b33600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600c6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555086600690805190602001906200010a929190620002d7565b50856007908051906020019062000123929190620002d7565b508460ff166008819055504260038190555060035460808181525050603c836200014e919062000714565b60a0818152505064e8d4a510006a52b7d2dcc80cd2e400000062000173919062000714565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508360c081815250506000620001d86000620f42406000600162000271640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600a8190555082600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508560ff16600a6200025d9190620005d7565b600b8190555050505050505050506200095b565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b828054620002e590620007f6565b90600052602060002090601f01602090048101928262000309576000855562000355565b82601f106200032457805160ff191683800117855562000355565b8280016001018555821562000355579182015b828111156200035457825182559160200191906001019062000337565b5b50905062000364919062000368565b5090565b5b808211156200038357600081600090555060010162000369565b5090565b60006200039e620003988462000546565b6200051d565b905082815260208101848484011115620003b757600080fd5b620003c4848285620007c0565b509392505050565b600081519050620003dd816200090d565b92915050565b600082601f830112620003f557600080fd5b81516200040784826020860162000387565b91505092915050565b600081519050620004218162000927565b92915050565b600081519050620004388162000941565b92915050565b600080600080600080600060e0888a0312156200045a57600080fd5b600088015167ffffffffffffffff8111156200047557600080fd5b620004838a828b01620003e3565b975050602088015167ffffffffffffffff811115620004a157600080fd5b620004af8a828b01620003e3565b9650506040620004c28a828b0162000427565b9550506060620004d58a828b0162000410565b9450506080620004e88a828b0162000410565b93505060a0620004fb8a828b01620003cc565b92505060c06200050e8a828b0162000410565b91505092959891949750929550565b6000620005296200053c565b90506200053782826200082c565b919050565b6000604051905090565b600067ffffffffffffffff821115620005645762000563620008c0565b5b6200056f82620008ef565b9050602081019050919050565b6000808291508390505b6001851115620005ce57808604811115620005a657620005a562000862565b5b6001851615620005b65780820291505b8081029050620005c68562000900565b945062000586565b94509492505050565b6000620005e482620007a9565b9150620005f183620007a9565b9250620006207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000628565b905092915050565b6000826200063a57600190506200070d565b816200064a57600090506200070d565b81600181146200066357600281146200066e57620006a4565b60019150506200070d565b60ff84111562000683576200068262000862565b5b8360020a9150848211156200069d576200069c62000862565b5b506200070d565b5060208310610133831016604e8410600b8410161715620006de5782820a905083811115620006d857620006d762000862565b5b6200070d565b620006ed84848460016200057c565b9250905081840481111562000707576200070662000862565b5b81810290505b9392505050565b60006200072182620007a9565b91506200072e83620007a9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156200076a576200076962000862565b5b828202905092915050565b6000620007828262000789565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015620007e0578082015181840152602081019050620007c3565b83811115620007f0576000848401525b50505050565b600060028204905060018216806200080f57607f821691505b6020821081141562000826576200082562000891565b5b50919050565b6200083782620008ef565b810181811067ffffffffffffffff82111715620008595762000858620008c0565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6000600282049050919050565b620009188162000775565b81146200092457600080fd5b50565b6200093281620007a9565b81146200093e57600080fd5b50565b6200094c81620007b3565b81146200095857600080fd5b50565b60805160a05160c05161292c620009b560003960008181610bcb01528181610e2701526119c00152600081816110bd015281816119630152611a5b0152600081816110e901528181611a7c0152611ac1015261292c6000f3fe608060405234801561001057600080fd5b506004361061024f576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be1161014d57806395d89b41116100d5578063e3ab207a11610099578063e3ab207a14610776578063e54d63f7146107a6578063e8095295146107d6578063eda4e6d6146107f4578063f2fde38b146108125761024f565b806395d89b41146106aa578063983b2d56146106c85780639da7d8ba146106f8578063a9059cbb14610728578063b470aade146107585761024f565b8063731f237c1161011c578063731f237c1461061457806379ba5097146106325780638da5cb5b146106505780638f1df6bc1461066e5780638f770ad01461068c5761024f565b80636787a9be146105545780636a2d094e146105845780636ffa8a05146105b457806370a08231146105e45761024f565b806331333487116101db5780634abfbba21161019f5780634abfbba21461048857806351b4541c146104b8578063573cc507146104e857806358b2833b146105065780636721d4ef146105245761024f565b806331333487146103aa578063313ce567146103da57806340452d91146103f8578063449a52f81461042857806347a50517146104585761024f565b806318160ddd1161022257806318160ddd146102f05780631989c6a81461030e578063229ba1971461032c57806323b872dd1461034a5780633092afd51461037a5761024f565b806301ffc9a71461025457806306fdde0314610284578063095ea7b3146102a257806309f28f3c146102d2575b600080fd5b61026e60048036038101906102699190612208565b610842565b60405161027b91906123d6565b60405180910390f35b61028c6109ed565b604051610299919061240c565b60405180910390f35b6102bc60048036038101906102b791906121a3565b610a7b565b6040516102c991906123d6565b60405180910390f35b6102da610b95565b6040516102e7919061248e565b60405180910390f35b6102f8610bb7565b60405161030591906124c4565b60405180910390f35b610316610bbd565b60405161032391906124c4565b60405180910390f35b610334610bc9565b60405161034191906124c4565b60405180910390f35b610364600480360381019061035f9190612154565b610bed565b60405161037191906123d6565b60405180910390f35b610394600480360381019061038f919061212b565b610d0d565b6040516103a191906123d6565b60405180910390f35b6103c460048036038101906103bf9190612283565b610e00565b6040516103d191906124c4565b60405180910390f35b6103e2610ebc565b6040516103ef91906124c4565b60405180910390f35b610412600480360381019061040d919061225a565b610ec2565b60405161041f91906123f1565b60405180910390f35b610442600480360381019061043d91906121a3565b610ee6565b60405161044f91906123d6565b60405180910390f35b610472600480360381019061046d919061212b565b611070565b60405161047f91906124c4565b60405180910390f35b6104a2600480360381019061049d919061225a565b6110b9565b6040516104af91906124c4565b60405180910390f35b6104d260048036038101906104cd919061225a565b611119565b6040516104df91906124c4565b60405180910390f35b6104f061113a565b6040516104fd91906124c4565b60405180910390f35b61050e611140565b60405161051b91906124c4565b60405180910390f35b61053e60048036038101906105399190612283565b611146565b60405161054b91906124c4565b60405180910390f35b61056e6004803603810190610569919061225a565b611182565b60405161057b91906124c4565b60405180910390f35b61059e6004803603810190610599919061225a565b6111ed565b6040516105ab91906124c4565b60405180910390f35b6105ce60048036038101906105c991906121df565b61120e565b6040516105db91906124c4565b60405180910390f35b6105fe60048036038101906105f9919061212b565b611241565b60405161060b91906124c4565b60405180910390f35b61061c6112e9565b60405161062991906123d6565b60405180910390f35b61063a61140b565b60405161064791906123d6565b60405180910390f35b6106586115b2565b60405161066591906123bb565b60405180910390f35b6106766115d8565b60405161068391906123d6565b60405180910390f35b61069461174e565b6040516106a191906124c4565b60405180910390f35b6106b2611754565b6040516106bf919061240c565b60405180910390f35b6106e260048036038101906106dd919061212b565b6117e2565b6040516106ef91906123d6565b60405180910390f35b610712600480360381019061070d91906121df565b61189f565b60405161071f91906124c4565b60405180910390f35b610742600480360381019061073d91906121a3565b6118cb565b60405161074f91906123d6565b60405180910390f35b610760611961565b60405161076d91906124c4565b60405180910390f35b610790600480360381019061078b91906121df565b611985565b60405161079d91906124c4565b60405180910390f35b6107c060048036038101906107bb9190612283565b611999565b6040516107cd91906124c4565b60405180910390f35b6107de611a55565b6040516107eb919061248e565b60405180910390f35b6107fc611abf565b60405161080991906124c4565b60405180910390f35b61082c6004803603810190610827919061212b565b611ae3565b60405161083991906123d6565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561089757600190506109e8565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108ea57600190506109e8565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561093d57600190506109e8565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561099057600190506109e8565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109e357600190506109e8565b600090505b919050565b600680546109fa906126ef565b80601f0160208091040260200160405190810160405280929190818152602001828054610a26906126ef565b8015610a735780601f10610a4857610100808354040283529160200191610a73565b820191906000526020600020905b815481529060010190602001808311610a5657829003601f168201915b505050505081565b600080610a866115d8565b50610a9083611182565b905080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e91906124fb565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610b8291906124c4565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60095481565b60008080549050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610bfa6115d8565b50610c0484611182565b915081600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c8f57600080fd5b610c9a868684611b85565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610cf991906124c4565b60405180910390a380925050509392505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d9657503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610d9f57600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f42409150620f42406a52b7d2dcc80cd2e4000000610e259190612582565b7f0000000000000000000000000000000000000000000000000000000000000000610e509190612551565b905060005b84811015610e9757620f42408284610e6d9190612582565b610e779190612551565b83610e8291906125dc565b92508080610e8f90612721565b915050610e55565b50620f42408583610ea89190612582565b610eb29190612551565b9250505092915050565b60085481565b60008181548110610ed257600080fd5b906000526020600020016000915090505481565b600080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6c9061244e565b60405180910390fd5b600a5460095484610f8691906124fb565b1115610fc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbe9061242e565b60405180910390fd5b610fcf6115d8565b508290508260096000828254610fe591906124fb565b92505081905550610ff68482611bc6565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f88560405161105491906124c4565b60405180910390a3611064611c8b565b50600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826110e79190612582565b7f000000000000000000000000000000000000000000000000000000000000000061111291906124fb565b9050919050565b6000603c824261112991906125dc565b6111339190612551565b9050919050565b600b5481565b60035481565b600064e8d4a51000826111599190612551565b6a52b7d2dcc80cd2e400000061116f91906125dc565b8361117a9190612582565b905092915050565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1664e8d4a510006a52b7d2dcc80cd2e4000000846111d29190612582565b6111dc9190612582565b6111e69190612551565b9050919050565b6000603c82426111fd91906125dc565b6112079190612551565b9050919050565b6000608c60ff1673fffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b60008060008061125085611070565b925061125d600354611119565b9050611299600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610e00565b6fffffffffffffffffffffffffffffffff16915064e8d4a510006a52b7d2dcc80cd2e40000006112c99190612582565b82846112d59190612582565b6112df9190612551565b9350505050919050565b6000806000806112fa600354611119565b915060008214156113115760009350505050611408565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16905061134e8183610e00565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550603c826113939190612582565b6003546113a091906124fb565b60038190555080826003547fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff166040516113f891906124a9565b60405180910390a4600193505050505b90565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146857600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060006115ee611d83565b9750600060010288141561160d5760009850505050505050505061174b565b61161688611985565b955060018661162591906124fb565b9050611630866110b9565b915061163a6112e9565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611677826111ed565b925060008311156116a9576a52b7d2dcc80cd2e40000006116988685611999565b6116a29190612551565b93506116c3565b6a52b7d2dcc80cd2e4000000856116c09190612551565b93505b6116d260008560095484611eb3565b9650600087908060018154018082558091505060019003906000526020600020016000909190919091505561170688611f19565b507f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161173691906124c4565b60405180910390a16001985050505050505050505b90565b600a5481565b60078054611761906126ef565b80601f016020809104026020016040519081016040528092919081815260200182805461178d906126ef565b80156117da5780601f106117af576101008083540402835291602001916117da565b820191906000526020600020905b8154815290600101906020018083116117bd57829003601f168201915b505050505081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461183e57600080fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b60008060006118d86115d8565b506118e284611182565b91506118ef338684611b85565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161194e91906124c4565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b6000806000620f42409150620f42406a52b7d2dcc80cd2e40000006119be9190612582565b7f00000000000000000000000000000000000000000000000000000000000000006119e99190612551565b905060005b84811015611a3057620f42408284611a069190612582565b611a109190612551565b83611a1b91906124fb565b92508080611a2890612721565b9150506119ee565b50620f42408583611a419190612582565b611a4b9190612551565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611aa691906125dc565b611ab09190612551565b611aba91906124fb565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b3f57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080611b928584611fba565b50611b9d8484611bc6565b50611ba6611a55565b6fffffffffffffffffffffffffffffffff16905060019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000851415611c235760009350505050611c85565b611c2c86611070565b92508483611c3a91906124fb565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000806000611c9d6009546001611999565b905060006001600080549050611cb391906125dc565b81548110611cea577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900491506cffffffffffffffffff000000001982169150602060ff16819060020a02821791508160010260006001600080549050611d3591906125dc565b81548110611d6c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555060019250505090565b6000806000806001600080549050611d9b91906125dc565b81548110611dd2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611e4157600080fd5b505afa158015611e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e799190612231565b6fffffffffffffffffffffffffffffffff169050611e9682611985565b8111611eaa57600060010292505050611eb0565b81925050505b90565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b6000806000611f278461189f565b9150611f6382600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611146565b9050611faf600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611faa6a52b7d2dcc80cd2e400000084611fa59190612551565b611182565b611bc6565b508092505050919050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600085141561201757600093505050506120bc565b61202086611070565b925084831015612065576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205c9061246e565b60405180910390fd5b848361207191906125dc565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000813590506120d181612883565b92915050565b6000813590506120e68161289a565b92915050565b6000813590506120fb816128b1565b92915050565b600081519050612110816128c8565b92915050565b600081359050612125816128df565b92915050565b60006020828403121561213d57600080fd5b600061214b848285016120c2565b91505092915050565b60008060006060848603121561216957600080fd5b6000612177868287016120c2565b9350506020612188868287016120c2565b925050604061219986828701612116565b9150509250925092565b600080604083850312156121b657600080fd5b60006121c4858286016120c2565b92505060206121d585828601612116565b9150509250929050565b6000602082840312156121f157600080fd5b60006121ff848285016120d7565b91505092915050565b60006020828403121561221a57600080fd5b6000612228848285016120ec565b91505092915050565b60006020828403121561224357600080fd5b600061225184828501612101565b91505092915050565b60006020828403121561226c57600080fd5b600061227a84828501612116565b91505092915050565b6000806040838503121561229657600080fd5b60006122a485828601612116565b92505060206122b585828601612116565b9150509250929050565b6122c881612610565b82525050565b6122d781612622565b82525050565b6122e68161262e565b82525050565b60006122f7826124df565b61230181856124ea565b93506123118185602086016126bc565b61231a816127f7565b840191505092915050565b60006123326007836124ea565b915061233d82612808565b602082019050919050565b6000612355600a836124ea565b915061236082612831565b602082019050919050565b6000612378600d836124ea565b91506123838261285a565b602082019050919050565b61239781612664565b82525050565b6123a6816126aa565b82525050565b6123b5816126a0565b82525050565b60006020820190506123d060008301846122bf565b92915050565b60006020820190506123eb60008301846122ce565b92915050565b600060208201905061240660008301846122dd565b92915050565b6000602082019050818103600083015261242681846122ec565b905092915050565b6000602082019050818103600083015261244781612325565b9050919050565b6000602082019050818103600083015261246781612348565b9050919050565b600060208201905081810360008301526124878161236b565b9050919050565b60006020820190506124a3600083018461238e565b92915050565b60006020820190506124be600083018461239d565b92915050565b60006020820190506124d960008301846123ac565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612506826126a0565b9150612511836126a0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125465761254561276a565b5b828201905092915050565b600061255c826126a0565b9150612567836126a0565b92508261257757612576612799565b5b828204905092915050565b600061258d826126a0565b9150612598836126a0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125d1576125d061276a565b5b828202905092915050565b60006125e7826126a0565b91506125f2836126a0565b9250828210156126055761260461276a565b5b828203905092915050565b600061261b82612680565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006126b582612664565b9050919050565b60005b838110156126da5780820151818401526020810190506126bf565b838111156126e9576000848401525b50505050565b6000600282049050600182168061270757607f821691505b6020821081141561271b5761271a6127c8565b5b50919050565b600061272c826126a0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561275f5761275e61276a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4552525f43415000000000000000000000000000000000000000000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f4f5645525350454e4400000000000000000000000000000000000000600082015250565b61288c81612610565b811461289757600080fd5b50565b6128a38161262e565b81146128ae57600080fd5b50565b6128ba81612638565b81146128c557600080fd5b50565b6128d181612664565b81146128dc57600080fd5b50565b6128e8816126a0565b81146128f357600080fd5b5056fea26469706673582212202b28336a06cf238d4203eee1ff279dc99ec913c7f1538f4b0b21cdc0d4dd926564736f6c63430008040033 \ No newline at end of file diff --git a/python/examples/sim_noredistribute.py b/python/examples/sim_noredistribute.py index b021d5f..24ca9f0 100644 --- a/python/examples/sim_noredistribute.py +++ b/python/examples/sim_noredistribute.py @@ -8,7 +8,7 @@ from erc20_demurrage_token.sim import DemurrageTokenSimulation logging.basicConfig(level=logging.INFO) logg = logging.getLogger() -decay_per_minute = 0.00000050105908373373 # equals approx 2% per month +decay_per_minute = 0.00050105908373373 # equals approx 2% per month # parameters for simulation object settings = DemurrageTokenSettings() @@ -17,7 +17,7 @@ settings.symbol = 'SIM' settings.decimals = 6 settings.demurrage_level = int(decay_per_minute*(10**38)) #settings.period_minutes = 1 # 1 week in minutes -settings.period_minutes = 60*24*7*4 +settings.period_minutes = 60*24*7 chain = 'evm:foochain:42' cap = (10 ** 6) * (10 ** 12) diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py index c60f6b5..763981b 100644 --- a/python/tests/test_basic.py +++ b/python/tests/test_basic.py @@ -39,6 +39,21 @@ class TestBasic(TestDemurrageDefault): r = self.rpc.do(o) + def test_balance(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[1], 1024) + r = self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + + o = c.balance_of(self.address, self.accounts[1], sender_address=self.accounts[0]) + r = self.rpc.do(o) + balance = c.parse_balance_of(r) + self.assertEqual(balance, 1024) + + def test_apply_demurrage(self): modifier = 10 * (10 ** 37) diff --git a/solidity/DemurrageTokenSingleCap.sol b/solidity/DemurrageTokenSingleCap.sol index 8d6f280..4416349 100644 --- a/solidity/DemurrageTokenSingleCap.sol +++ b/solidity/DemurrageTokenSingleCap.sol @@ -50,7 +50,7 @@ contract DemurrageTokenSingleCap { // 128 bit resolution of the demurrage divisor // (this constant x 1000000 is contained within 128 bits) - uint256 constant ppmDivider = 100000000000000000000000000000000; + uint256 constant ppmDivider = 100000000000000000000000000; // now nanodivider, 6 zeros less // Timestamp of start of periods (time which contract constructor was called) uint256 public immutable periodStart; @@ -108,7 +108,7 @@ contract DemurrageTokenSingleCap { demurrageTimestamp = block.timestamp; periodStart = demurrageTimestamp; periodDuration = _periodMinutes * 60; - demurrageAmount = uint128(ppmDivider * 1000000); // Represents 38 decimal places + demurrageAmount = uint128(ppmDivider * 1000000000000); // Represents 38 decimal places //demurragePeriod = 1; taxLevel = _taxLevelMinute; // Represents 38 decimal places bytes32 initialRedistribution = toRedistribution(0, 1000000, 0, 1); @@ -147,7 +147,7 @@ contract DemurrageTokenSingleCap { currentDemurragedAmount = uint128(decayBy(demurrageAmount, periodCount)); - return (baseBalance * currentDemurragedAmount) / (ppmDivider * 1000000); + return (baseBalance * currentDemurragedAmount) / (ppmDivider * 1000000000000); } /// Balance unmodified by demurrage @@ -271,7 +271,7 @@ contract DemurrageTokenSingleCap { } function getDistribution(uint256 _supply, uint256 _demurrageAmount) public view returns (uint256) { - return _supply * (ppmDivider - (_demurrageAmount / 1000000)); + return _supply * (ppmDivider - (_demurrageAmount / 1000000000000)); } // Returns the amount sent to the sink address @@ -365,7 +365,7 @@ contract DemurrageTokenSingleCap { uint256 truncatedTaxLevel; valueFactor = 1000000; - truncatedTaxLevel = taxLevel / ppmDivider; + truncatedTaxLevel = taxLevel / (ppmDivider * 1000000); for (uint256 i = 0; i < _period; i++) { valueFactor = valueFactor + ((valueFactor * truncatedTaxLevel) / 1000000); @@ -380,7 +380,7 @@ contract DemurrageTokenSingleCap { uint256 truncatedTaxLevel; valueFactor = 1000000; - truncatedTaxLevel = taxLevel / ppmDivider; + truncatedTaxLevel = taxLevel / (ppmDivider * 1000000); for (uint256 i = 0; i < _period; i++) { valueFactor = valueFactor - ((valueFactor * truncatedTaxLevel) / 1000000); @@ -390,7 +390,7 @@ contract DemurrageTokenSingleCap { // Inflates the given amount according to the current demurrage modifier function toBaseAmount(uint256 _value) public view returns (uint256) { - return (_value * ppmDivider * 1000000) / demurrageAmount; + return (_value * ppmDivider * 1000000000000) / demurrageAmount; } // Implements ERC20, triggers tax and/or redistribution