From 8f11bdc2cc88927edd84b83d83dc97b10c1fa6ec Mon Sep 17 00:00:00 2001 From: nolash Date: Mon, 1 Mar 2021 10:53:02 +0100 Subject: [PATCH] Simplify demurrage cache properties --- README.md | 3 - .../data/RedistributedDemurrageToken.bin | 2 +- .../data/RedistributedDemurrageToken.json | 2 +- python/tests/test_basic.py | 32 ++++++---- solidity/RedistributedDemurrageToken.sol | 62 +++++++------------ 5 files changed, 43 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 1c2b039..9ac2c99 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,6 @@ - bits 140-159: demurrage modifier - bits 160-254: (Unused) - bits 255: Set if individual redistribution amounts are fractions -* One word for the `demurrageModifier` (should be replaced with 2 x uint128 instead): - - bits 000-127: Accumulated demurrage modifier from last calculation - - bits 128-255: Period of last calculated demurrage modifier ### Notes diff --git a/python/sarafu_token/data/RedistributedDemurrageToken.bin b/python/sarafu_token/data/RedistributedDemurrageToken.bin index c9df816..fe821cb 100644 --- a/python/sarafu_token/data/RedistributedDemurrageToken.bin +++ b/python/sarafu_token/data/RedistributedDemurrageToken.bin @@ -1 +1 @@ -60e06040523480156200001157600080fd5b506040516200356538038062003565833981810160405281019062000037919062000443565b33600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160096000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555085600490805190602001906200010a929190620002dc565b50846005908051906020019062000123929190620002dc565b508360ff166006819055504260808181525050603c826200014591906200070a565b60a08181525050620f42406d04ee2d6d415b85acef81000000006200016b91906200070a565b6002819055507001000000000000000000000000000000006002600082825417925050819055508260c081815250506000620001bf6000620f42406000600162000250640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460ff16600a6200023d9190620005cd565b600881905550505050505050506200090a565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b828054620002ea90620007ec565b90600052602060002090601f0160209004810192826200030e57600085556200035a565b82601f106200032957805160ff19168380011785556200035a565b828001600101855582156200035a579182015b82811115620003595782518255916020019190600101906200033c565b5b5090506200036991906200036d565b5090565b5b80821115620003885760008160009055506001016200036e565b5090565b6000620003a36200039d846200053f565b6200050b565b905082815260208101848484011115620003bc57600080fd5b620003c9848285620007b6565b509392505050565b600081519050620003e281620008bc565b92915050565b600082601f830112620003fa57600080fd5b81516200040c8482602086016200038c565b91505092915050565b6000815190506200042681620008d6565b92915050565b6000815190506200043d81620008f0565b92915050565b60008060008060008060c087890312156200045d57600080fd5b600087015167ffffffffffffffff8111156200047857600080fd5b6200048689828a01620003e8565b965050602087015167ffffffffffffffff811115620004a457600080fd5b620004b289828a01620003e8565b9550506040620004c589828a016200042c565b9450506060620004d889828a0162000415565b9350506080620004eb89828a0162000415565b92505060a0620004fe89828a01620003d1565b9150509295509295509295565b6000604051905081810181811067ffffffffffffffff8211171562000535576200053462000880565b5b8060405250919050565b600067ffffffffffffffff8211156200055d576200055c62000880565b5b601f19601f8301169050602081019050919050565b6000808291508390505b6001851115620005c4578086048111156200059c576200059b62000822565b5b6001851615620005ac5780820291505b8081029050620005bc85620008af565b94506200057c565b94509492505050565b6000620005da826200079f565b9150620005e7836200079f565b9250620006167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846200061e565b905092915050565b60008262000630576001905062000703565b8162000640576000905062000703565b816001811462000659576002811462000664576200069a565b600191505062000703565b60ff84111562000679576200067862000822565b5b8360020a91508482111562000693576200069262000822565b5b5062000703565b5060208310610133831016604e8410600b8410161715620006d45782820a905083811115620006ce57620006cd62000822565b5b62000703565b620006e3848484600162000572565b92509050818404811115620006fd57620006fc62000822565b5b81810290505b9392505050565b600062000717826200079f565b915062000724836200079f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161562000760576200075f62000822565b5b828202905092915050565b600062000778826200077f565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015620007d6578082015181840152602081019050620007b9565b83811115620007e6576000848401525b50505050565b600060028204905060018216806200080557607f821691505b602082108114156200081c576200081b62000851565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000600282049050919050565b620008c7816200076b565b8114620008d357600080fd5b50565b620008e1816200079f565b8114620008ed57600080fd5b50565b620008fb81620007a9565b81146200090757600080fd5b50565b60805160a05160c051612bec6200097960003960008181610a8901528181610ce401528181610e63015281816118c301528181611e850152611ebd0152600081816111460152818161181a015261195e0152600081816111720152818161197f01526119c40152612bec6000f3fe608060405234801561001057600080fd5b5060043610610244576000357c0100000000000000000000000000000000000000000000000000000000900480636a2d094e1161014d5780639da7d8ba116100d5578063e3ab207a11610099578063e3ab207a14610783578063e54d63f7146107b3578063e8095295146107e3578063eda4e6d614610801578063fc958aed1461081f57610244565b80639da7d8ba146106a5578063a9059cbb146106d5578063b470aade14610705578063bf4c16f114610723578063d2ae39911461075357610244565b8063731f237c1161011c578063731f237c146105fd5780638da5cb5b1461061b5780638f1df6bc1461063957806395d89b4114610657578063983b2d561461067557610244565b80636a2d094e1461053d5780636d5055a61461056d5780636ffa8a051461059d57806370a08231146105cd57610244565b8063313ce567116101d0578063449a52f81161019f578063449a52f81461045f57806347a505171461048f5780634abfbba2146104bf578063573cc507146104ef5780636787a9be1461050d57610244565b8063313ce567146103b157806335b16eb8146103cf57806340452d91146103ff57806340fc89f51461042f57610244565b8063216ea5ec11610217578063216ea5ec146102d3578063229ba1971461030357806323b872dd146103215780633092afd514610351578063313334871461038157610244565b806306fdde0314610249578063095ea7b31461026757806318160ddd146102975780631989c6a8146102b5575b600080fd5b61025161083d565b60405161025e9190612805565b60405180910390f35b610281600480360381019061027c919061258c565b6108cb565b60405161028e91906127cf565b60405180910390f35b61029f6109ef565b6040516102ac9190612887565b60405180910390f35b6102bd6109f5565b6040516102ca9190612887565b60405180910390f35b6102ed60048036038101906102e89190612643565b610a01565b6040516102fa9190612887565b60405180910390f35b61030b610a87565b6040516103189190612887565b60405180910390f35b61033b6004803603810190610336919061253d565b610aab565b60405161034891906127cf565b60405180910390f35b61036b60048036038101906103669190612514565b610bd5565b60405161037891906127cf565b60405180910390f35b61039b60048036038101906103969190612643565b610cc8565b6040516103a89190612887565b60405180910390f35b6103b9610d79565b6040516103c69190612887565b60405180910390f35b6103e960048036038101906103e49190612514565b610d7f565b6040516103f691906127cf565b60405180910390f35b610419600480360381019061041491906125f1565b610f93565b60405161042691906127ea565b60405180910390f35b610449600480360381019061044491906125c8565b610fb7565b6040516104569190612887565b60405180910390f35b6104796004803603810190610474919061258c565b610fe8565b60405161048691906127cf565b60405180910390f35b6104a960048036038101906104a49190612514565b6110ea565b6040516104b69190612887565b60405180910390f35b6104d960048036038101906104d491906125f1565b611142565b6040516104e69190612887565b60405180910390f35b6104f76111a2565b6040516105049190612887565b60405180910390f35b610527600480360381019061052291906125f1565b6111a8565b6040516105349190612887565b60405180910390f35b610557600480360381019061055291906125f1565b6111ee565b6040516105649190612887565b60405180910390f35b61058760048036038101906105829190612514565b61120f565b6040516105949190612887565b60405180910390f35b6105b760048036038101906105b291906125c8565b61127a565b6040516105c49190612887565b60405180910390f35b6105e760048036038101906105e29190612514565b6112ad565b6040516105f49190612887565b60405180910390f35b610605611345565b60405161061291906127cf565b60405180910390f35b61062361144a565b60405161063091906127b4565b60405180910390f35b610641611470565b60405161064e91906127cf565b60405180910390f35b61065f611601565b60405161066c9190612805565b60405180910390f35b61068f600480360381019061068a9190612514565b61168f565b60405161069c91906127cf565b60405180910390f35b6106bf60048036038101906106ba91906125c8565b61174c565b6040516106cc9190612887565b60405180910390f35b6106ef60048036038101906106ea919061258c565b611778565b6040516106fc91906127cf565b60405180910390f35b61070d611818565b60405161071a9190612887565b60405180910390f35b61073d600480360381019061073891906125f1565b61183c565b60405161074a9190612887565b60405180910390f35b61076d600480360381019061076891906125f1565b611858565b60405161077a9190612887565b60405180910390f35b61079d600480360381019061079891906125c8565b611893565b6040516107aa9190612887565b60405180910390f35b6107cd60048036038101906107c89190612643565b6118a7565b6040516107da9190612887565b60405180910390f35b6107eb611958565b6040516107f89190612887565b60405180910390f35b6108096119c2565b6040516108169190612887565b60405180910390f35b6108276119e6565b6040516108349190612887565b60405180910390f35b6004805461084a90612a58565b80601f016020809104026020016040519081016040528092919081815260200182805461087690612a58565b80156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b505050505081565b6000806108d6611470565b506108e033610d7f565b506108ea836111a8565b905080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461097891906128be565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040516109dc9190612887565b60405180910390a3600191505092915050565b60075481565b60008080549050905090565b600080600080851415610a49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4090612827565b60405180910390fd5b838510610a5557600080fd5b8484610a619190612914565b91508482610a6f9190612945565b90508084610a7d919061299f565b9250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610ab8611470565b50610ac233610d7f565b50610acc846111a8565b915081600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b5757600080fd5b610b628686846119ec565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610bc19190612887565b60405180910390a380925050509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c5e57503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610c6757600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000610d0d9190612914565b905060005b84811015610d5457620f42408284610d2a9190612945565b610d349190612914565b83610d3f919061299f565b92508080610d4c90612a8a565b915050610d12565b50620f42408583610d659190612945565b610d6f9190612914565b9250505092915050565b60065481565b600080600080600080600080610d948961120f565b91506000821480610dac5750610da8611958565b8210155b15610dc1576000975050505050505050610f8e565b6000600183610dd0919061299f565b81548110610e07577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549650610e1d87610fb7565b94506000851415610e38576000975050505050505050610f8e565b610e418761174c565b9550610e4c8761127a565b90506d04ee2d6d415b85acef8100000000620f42407f0000000000000000000000000000000000000000000000000000000000000000610e8c9190612914565b8688610e989190612914565b610ea29190612945565b610eac9190612914565b9350620f42408185610ebe9190612945565b610ec89190612914565b92506cffffffff00000000000000000019600102600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282541692505081905550610f328984611a7e565b50818973ffffffffffffffffffffffffffffffffffffffff167f9a2a887706623ad3ff7fc85652deeceabe9fe1e00466c597972079ee91ea40d385604051610f7a9190612887565b60405180910390a360019750505050505050505b919050565b60008181548110610fa357600080fd5b906000526020600020016000915090505481565b6000606860ff16710fffffffff00000000000000000000000000836001900416908060020a82049150509050919050565b600080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661104157600080fd5b611049611470565b50829050826007600082825461105f91906128be565b925050819055506110708482611a7e565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f8856040516110ce9190612887565b60405180910390a36110de611bda565b50600191505092915050565b600068ffffffffffffffffff600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460019004169050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826111709190612945565b7f000000000000000000000000000000000000000000000000000000000000000061119b91906128be565b9050919050565b60085481565b60006111b560025461183c565b620f42406d04ee2d6d415b85acef8100000000846111d39190612945565b6111dd9190612945565b6111e79190612914565b9050919050565b6000603c82426111fe919061299f565b6112089190612914565b9050919050565b6000604860ff166cffffffff000000000000000000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900416908060020a82049150509050919050565b6000608c60ff1673fffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b6000806000806000806112bf876110ea565b94506112cc60025461183c565b93506112d9600254611858565b92506112e6600254611858565b6112ee611958565b6112f8919061299f565b90506113048482610cc8565b9150620f42406d04ee2d6d415b85acef81000000006113239190612945565b828661132f9190612945565b6113399190612914565b95505050505050919050565b6000806000806000611355611958565b9350611362600254611858565b8461136d919061299f565b92506000831415611385576000945050505050611447565b61139060025461183c565b915061139c8284610cc8565b905060006002819055506fffffffffffffffffffffffffffffffff81166002600082825417925050819055507fffffffffffffffffffffffffffffffff00000000000000000000000000000000608060ff16859060020a02166002600082825417925050819055508183857fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755846040516114369190612887565b60405180910390a460019450505050505b90565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000806000611489611cc2565b995060006001028a14156114aa5760009a50505050505050505050506115fe565b6114b38a611893565b97506001886114c291906128be565b90506114cd88611142565b91506114d7611345565b506114e360025461183c565b94506114ee826111ee565b92506000831115611523576d04ee2d6d415b85acef810000000061151286856118a7565b61151c9190612914565b9350611540565b6d04ee2d6d415b85acef81000000008561153d9190612914565b93505b61154f60008560075484611de0565b985060008990806001815401808255809150506001900390600052602060002001600090919091909150556115838a610fb7565b9650600087141561159e576115978a611e6c565b95506115b8565b6115aa87600754610a01565b95506115b6868961205f565b505b7f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d675816040516115e79190612887565b60405180910390a160019a50505050505050505050505b90565b6005805461160e90612a58565b80601f016020809104026020016040519081016040528092919081815260200182805461163a90612a58565b80156116875780601f1061165c57610100808354040283529160200191611687565b820191906000526020600020905b81548152906001019060200180831161166a57829003601f168201915b505050505081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116eb57600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b6000806000611785611470565b5061178f33610d7f565b50611799846111a8565b91506117a63386846119ec565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516118059190612887565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006fffffffffffffffffffffffffffffffff82169050919050565b6000608060ff167fffffffffffffffffffffffffffffffff000000000000000000000000000000008316908060020a82049150509050919050565b600063ffffffff8260019004169050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f00000000000000000000000000000000000000000000000000000000000000006118ec9190612914565b905060005b8481101561193357620f424082846119099190612945565b6119139190612914565b8361191e91906128be565b9250808061192b90612a8a565b9150506118f1565b50620f424085836119449190612945565b61194e9190612914565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000426119a9919061299f565b6119b39190612914565b6119bd91906128be565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60025481565b6000806119f98584612195565b50611a048484611a7e565b50611a0d611958565b90506008548310158015611a29575080611a268661120f565b14155b8015611a6157508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15611a7257611a7085826122c6565b505b60019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900490506000851415611adf5760009350505050611bd4565b611ae8866110ea565b92508483611af691906128be565b91508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1611611b66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5d90612867565b60405180910390fd5b68ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60008060006001600080549050611bf1919061299f565b81548110611c28577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900490506cffffffffffffffffff000000001981169050602060ff166007549060020a02811790508060010260006001600080549050611c75919061299f565b81548110611cac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600191505090565b6000806000806001600080549050611cda919061299f565b81548110611d11577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611d8057600080fd5b505afa158015611d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db8919061261a565b9050611dc382611893565b8111611dd757600060010292505050611ddd565b81925050505b90565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b6000806000806000611e7d8661174c565b9350620f42407f000000000000000000000000000000000000000000000000000000000000000085611eaf9190612945565b611eb99190612914565b91507f0000000000000000000000000000000000000000000000000000000000000000620f424083611eeb9190612945565b611ef59190612914565b90508381101561200d57611f0886611893565b9250710fffffffff00000000000000000000000000196001026000600185611f30919061299f565b81548110611f67577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160008282541692505081905550606860ff1660019060020a027f8000000000000000000000000000000000000000000000000000000000000000176001026000600185611fbe919061299f565b81548110611ff5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001600082825417925050819055505b612052600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166d04ee2d6d415b85acef81000000008461204d9190612914565b611a7e565b5081945050505050919050565b600080600084141561207557600091505061218f565b7f800000000000000000000000000000000000000000000000000000000000000060010260006001856120a8919061299f565b815481106120df577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020016000828254179250508190555061214f6000600185612108919061299f565b8154811061213f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015461174c565b9050612188600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168583612183919061299f565b611a7e565b5060019150505b92915050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460019004905060008514156121f657600093505050506122c0565b6121ff866110ea565b925084831015612244576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223b90612847565b60405180910390fd5b8483612250919061299f565b915068ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60006cffffffff00000000000000000019600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825416925050819055506cffffffff000000000000000000604860ff16839060020a0216600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825417925050819055506123976123a2565b506001905092915050565b600080600080600060016000805490506123bc919061299f565b815481106123f3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549250600161240b84610fb7565b61241591906128be565b905082600190049150710fffffffff000000000000000000000000001982169150710fffffffff00000000000000000000000000606860ff16829060020a0216821791508160010260006001600080549050612471919061299f565b815481106124a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055506001935050505090565b6000813590506124cf81612b71565b92915050565b6000813590506124e481612b88565b92915050565b6000813590506124f981612b9f565b92915050565b60008151905061250e81612b9f565b92915050565b60006020828403121561252657600080fd5b6000612534848285016124c0565b91505092915050565b60008060006060848603121561255257600080fd5b6000612560868287016124c0565b9350506020612571868287016124c0565b9250506040612582868287016124ea565b9150509250925092565b6000806040838503121561259f57600080fd5b60006125ad858286016124c0565b92505060206125be858286016124ea565b9150509250929050565b6000602082840312156125da57600080fd5b60006125e8848285016124d5565b91505092915050565b60006020828403121561260357600080fd5b6000612611848285016124ea565b91505092915050565b60006020828403121561262c57600080fd5b600061263a848285016124ff565b91505092915050565b6000806040838503121561265657600080fd5b6000612664858286016124ea565b9250506020612675858286016124ea565b9150509250929050565b612688816129d3565b82525050565b612697816129e5565b82525050565b6126a6816129f1565b82525050565b60006126b7826128a2565b6126c181856128ad565b93506126d1818560208601612a25565b6126da81612b60565b840191505092915050565b60006126f26011836128ad565b91507f4552525f4e554d50415254535f5a45524f0000000000000000000000000000006000830152602082019050919050565b6000612732600d836128ad565b91507f4552525f4f5645525350454e44000000000000000000000000000000000000006000830152602082019050919050565b6000612772600d836128ad565b91507f4552525f574f554c4457524150000000000000000000000000000000000000006000830152602082019050919050565b6127ae81612a1b565b82525050565b60006020820190506127c9600083018461267f565b92915050565b60006020820190506127e4600083018461268e565b92915050565b60006020820190506127ff600083018461269d565b92915050565b6000602082019050818103600083015261281f81846126ac565b905092915050565b60006020820190508181036000830152612840816126e5565b9050919050565b6000602082019050818103600083015261286081612725565b9050919050565b6000602082019050818103600083015261288081612765565b9050919050565b600060208201905061289c60008301846127a5565b92915050565b600081519050919050565b600082825260208201905092915050565b60006128c982612a1b565b91506128d483612a1b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561290957612908612ad3565b5b828201905092915050565b600061291f82612a1b565b915061292a83612a1b565b92508261293a57612939612b02565b5b828204905092915050565b600061295082612a1b565b915061295b83612a1b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561299457612993612ad3565b5b828202905092915050565b60006129aa82612a1b565b91506129b583612a1b565b9250828210156129c8576129c7612ad3565b5b828203905092915050565b60006129de826129fb565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b83811015612a43578082015181840152602081019050612a28565b83811115612a52576000848401525b50505050565b60006002820490506001821680612a7057607f821691505b60208210811415612a8457612a83612b31565b5b50919050565b6000612a9582612a1b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ac857612ac7612ad3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b612b7a816129d3565b8114612b8557600080fd5b50565b612b91816129f1565b8114612b9c57600080fd5b50565b612ba881612a1b565b8114612bb357600080fd5b5056fea2646970667358221220c1bcabc8b6ec1af4be064490954fb126988eba461c8f88ad8e6afa39b6b1610764736f6c63430008000033 \ No newline at end of file +60e06040523480156200001157600080fd5b506040516200378b3803806200378b83398181016040528101906200003791906200048e565b33600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160096000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555085600490805190602001906200010a92919062000327565b5084600590805190602001906200012392919062000327565b508360ff166006819055504260808181525050603c8262000145919062000755565b60a08181525050620f42406d04ee2d6d415b85acef81000000006200016b919062000755565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600260106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508260c0818152505060006200020a6000620f4240600060016200029b640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460ff16600a62000288919062000618565b6008819055505050505050505062000955565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b828054620003359062000837565b90600052602060002090601f016020900481019282620003595760008555620003a5565b82601f106200037457805160ff1916838001178555620003a5565b82800160010185558215620003a5579182015b82811115620003a457825182559160200191906001019062000387565b5b509050620003b49190620003b8565b5090565b5b80821115620003d3576000816000905550600101620003b9565b5090565b6000620003ee620003e8846200058a565b62000556565b9050828152602081018484840111156200040757600080fd5b6200041484828562000801565b509392505050565b6000815190506200042d8162000907565b92915050565b600082601f8301126200044557600080fd5b815162000457848260208601620003d7565b91505092915050565b600081519050620004718162000921565b92915050565b60008151905062000488816200093b565b92915050565b60008060008060008060c08789031215620004a857600080fd5b600087015167ffffffffffffffff811115620004c357600080fd5b620004d189828a0162000433565b965050602087015167ffffffffffffffff811115620004ef57600080fd5b620004fd89828a0162000433565b95505060406200051089828a0162000477565b94505060606200052389828a0162000460565b93505060806200053689828a0162000460565b92505060a06200054989828a016200041c565b9150509295509295509295565b6000604051905081810181811067ffffffffffffffff8211171562000580576200057f620008cb565b5b8060405250919050565b600067ffffffffffffffff821115620005a857620005a7620008cb565b5b601f19601f8301169050602081019050919050565b6000808291508390505b60018511156200060f57808604811115620005e757620005e66200086d565b5b6001851615620005f75780820291505b80810290506200060785620008fa565b9450620005c7565b94509492505050565b60006200062582620007ea565b91506200063283620007ea565b9250620006617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000669565b905092915050565b6000826200067b57600190506200074e565b816200068b57600090506200074e565b8160018114620006a45760028114620006af57620006e5565b60019150506200074e565b60ff841115620006c457620006c36200086d565b5b8360020a915084821115620006de57620006dd6200086d565b5b506200074e565b5060208310610133831016604e8410600b84101617156200071f5782820a9050838111156200071957620007186200086d565b5b6200074e565b6200072e8484846001620005bd565b925090508184048111156200074857620007476200086d565b5b81810290505b9392505050565b60006200076282620007ea565b91506200076f83620007ea565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615620007ab57620007aa6200086d565b5b828202905092915050565b6000620007c382620007ca565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156200082157808201518184015260208101905062000804565b8381111562000831576000848401525b50505050565b600060028204905060018216806200085057607f821691505b602082108114156200086757620008666200089c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000600282049050919050565b6200091281620007b6565b81146200091e57600080fd5b50565b6200092c81620007ea565b81146200093857600080fd5b50565b6200094681620007f4565b81146200095257600080fd5b50565b60805160a05160c051612dc7620009c460003960008181610a5e01528181610cb901528181610e4a015281816119b301528181611f930152611fcb01526000818161112d015281816119610152611a4e01526000818161115901528181611a6f0152611ab40152612dc76000f3fe608060405234801561001057600080fd5b5060043610610239576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be11610142578063983b2d56116100ca578063b470aade11610099578063b470aade14610736578063e3ab207a14610754578063e54d63f714610784578063e8095295146107b4578063eda4e6d6146107d257610239565b8063983b2d56146106885780639da7d8ba146106b8578063a2119e2f146106e8578063a9059cbb1461070657610239565b806370a082311161011157806370a08231146105e0578063731f237c146106105780638da5cb5b1461062e5780638f1df6bc1461064c57806395d89b411461066a57610239565b80636787a9be146105205780636a2d094e146105505780636d5055a6146105805780636ffa8a05146105b057610239565b806331333487116101c557806340fc89f51161019457806340fc89f514610442578063449a52f81461047257806347a50517146104a25780634abfbba2146104d2578063573cc5071461050257610239565b80633133348714610394578063313ce567146103c457806335b16eb8146103e257806340452d911461041257610239565b80631989c6a81161020c5780631989c6a8146102c8578063216ea5ec146102e6578063229ba1971461031657806323b872dd146103345780633092afd51461036457610239565b806306fdde031461023e578063095ea7b31461025c57806309f28f3c1461028c57806318160ddd146102aa575b600080fd5b6102466107f0565b6040516102539190612931565b60405180910390f35b6102766004803603810190610271919061269a565b61087e565b60405161028391906128fb565b60405180910390f35b6102946109a2565b6040516102a191906129b3565b60405180910390f35b6102b26109c4565b6040516102bf91906129e9565b60405180910390f35b6102d06109ca565b6040516102dd91906129e9565b60405180910390f35b61030060048036038101906102fb9190612751565b6109d6565b60405161030d91906129e9565b60405180910390f35b61031e610a5c565b60405161032b91906129e9565b60405180910390f35b61034e6004803603810190610349919061264b565b610a80565b60405161035b91906128fb565b60405180910390f35b61037e60048036038101906103799190612622565b610baa565b60405161038b91906128fb565b60405180910390f35b6103ae60048036038101906103a99190612751565b610c9d565b6040516103bb91906129e9565b60405180910390f35b6103cc610d4e565b6040516103d991906129e9565b60405180910390f35b6103fc60048036038101906103f79190612622565b610d54565b60405161040991906128fb565b60405180910390f35b61042c60048036038101906104279190612728565b610f7a565b6040516104399190612916565b60405180910390f35b61045c600480360381019061045791906126d6565b610f9e565b60405161046991906129e9565b60405180910390f35b61048c6004803603810190610487919061269a565b610fcf565b60405161049991906128fb565b60405180910390f35b6104bc60048036038101906104b79190612622565b6110d1565b6040516104c991906129e9565b60405180910390f35b6104ec60048036038101906104e79190612728565b611129565b6040516104f991906129e9565b60405180910390f35b61050a611189565b60405161051791906129e9565b60405180910390f35b61053a60048036038101906105359190612728565b61118f565b60405161054791906129e9565b60405180910390f35b61056a60048036038101906105659190612728565b6111fb565b60405161057791906129e9565b60405180910390f35b61059a60048036038101906105959190612622565b61121c565b6040516105a791906129e9565b60405180910390f35b6105ca60048036038101906105c591906126d6565b611287565b6040516105d791906129e9565b60405180910390f35b6105fa60048036038101906105f59190612622565b6112ba565b60405161060791906129e9565b60405180910390f35b61061861139b565b60405161062591906128fb565b60405180910390f35b610636611549565b60405161064391906128e0565b60405180910390f35b61065461156f565b60405161066191906128fb565b60405180910390f35b610672611726565b60405161067f9190612931565b60405180910390f35b6106a2600480360381019061069d9190612622565b6117b4565b6040516106af91906128fb565b60405180910390f35b6106d260048036038101906106cd91906126d6565b611871565b6040516106df91906129e9565b60405180910390f35b6106f061189d565b6040516106fd91906129b3565b60405180910390f35b610720600480360381019061071b919061269a565b6118bf565b60405161072d91906128fb565b60405180910390f35b61073e61195f565b60405161074b91906129e9565b60405180910390f35b61076e600480360381019061076991906126d6565b611983565b60405161077b91906129e9565b60405180910390f35b61079e60048036038101906107999190612751565b611997565b6040516107ab91906129e9565b60405180910390f35b6107bc611a48565b6040516107c991906129b3565b60405180910390f35b6107da611ab2565b6040516107e791906129e9565b60405180910390f35b600480546107fd90612c1c565b80601f016020809104026020016040519081016040528092919081815260200182805461082990612c1c565b80156108765780601f1061084b57610100808354040283529160200191610876565b820191906000526020600020905b81548152906001019060200180831161085957829003601f168201915b505050505081565b60008061088961156f565b5061089333610d54565b5061089d8361118f565b905080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461092b9190612a20565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258560405161098f91906129e9565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60075481565b60008080549050905090565b600080600080851415610a1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1590612953565b60405180910390fd5b838510610a2a57600080fd5b8484610a369190612a76565b91508482610a449190612aa7565b90508084610a529190612b35565b9250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610a8d61156f565b50610a9733610d54565b50610aa18461118f565b915081600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610b2c57600080fd5b610b37868684611ad6565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610b9691906129e9565b60405180910390a380925050509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c3357503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610c3c57600080fd5b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000610ce29190612a76565b905060005b84811015610d2957620f42408284610cff9190612aa7565b610d099190612a76565b83610d149190612b35565b92508080610d2190612c4e565b915050610ce7565b50620f42408583610d3a9190612aa7565b610d449190612a76565b9250505092915050565b60065481565b600080600080600080600080610d698961121c565b91506000821480610d935750610d7d611a48565b6fffffffffffffffffffffffffffffffff168210155b15610da8576000975050505050505050610f75565b6000600183610db79190612b35565b81548110610dee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549650610e0487610f9e565b94506000851415610e1f576000975050505050505050610f75565b610e2887611871565b9550610e3387611287565b90506d04ee2d6d415b85acef8100000000620f42407f0000000000000000000000000000000000000000000000000000000000000000610e739190612a76565b8688610e7f9190612a76565b610e899190612aa7565b610e939190612a76565b9350620f42408185610ea59190612aa7565b610eaf9190612a76565b92506cffffffff00000000000000000019600102600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282541692505081905550610f198984611b7a565b50818973ffffffffffffffffffffffffffffffffffffffff167f9a2a887706623ad3ff7fc85652deeceabe9fe1e00466c597972079ee91ea40d385604051610f6191906129e9565b60405180910390a360019750505050505050505b919050565b60008181548110610f8a57600080fd5b906000526020600020016000915090505481565b6000606860ff16710fffffffff00000000000000000000000000836001900416908060020a82049150509050919050565b600080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661102857600080fd5b61103061156f565b5082905082600760008282546110469190612a20565b925050819055506110578482611b7a565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f8856040516110b591906129e9565b60405180910390a36110c5611cd6565b50600191505092915050565b600068ffffffffffffffffff600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460019004169050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826111579190612aa7565b7f00000000000000000000000000000000000000000000000000000000000000006111829190612a20565b9050919050565b60085481565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16620f42406d04ee2d6d415b85acef8100000000846111e09190612aa7565b6111ea9190612aa7565b6111f49190612a76565b9050919050565b6000603c824261120b9190612b35565b6112159190612a76565b9050919050565b6000604860ff166cffffffff000000000000000000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900416908060020a82049150509050919050565b6000608c60ff1673fffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b6000806000806112c9856110d1565b9250600260109054906101000a90046fffffffffffffffffffffffffffffffff166112f2611a48565b6112fc9190612b01565b6fffffffffffffffffffffffffffffffff16905061134a600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610c9d565b6fffffffffffffffffffffffffffffffff169150620f42406d04ee2d6d415b85acef810000000061137b9190612aa7565b82846113879190612aa7565b6113919190612a76565b9350505050919050565b60008060008060006113ab611a48565b9350600260109054906101000a90046fffffffffffffffffffffffffffffffff16846113d79190612b01565b92506000836fffffffffffffffffffffffffffffffff161415611401576000945050505050611546565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16915061145082846fffffffffffffffffffffffffffffffff16610c9d565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555083600260106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555081836fffffffffffffffffffffffffffffffff16856fffffffffffffffffffffffffffffffff167fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff1660405161153591906129ce565b60405180910390a460019450505050505b90565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000806000806000806000611588611dbe565b995060006001028a14156115a95760009a5050505050505050505050611723565b6115b28a611983565b97506001886115c19190612a20565b90506115cc88611129565b91506115d661139b565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611613826111fb565b92506000831115611648576d04ee2d6d415b85acef81000000006116378685611997565b6116419190612a76565b9350611665565b6d04ee2d6d415b85acef8100000000856116629190612a76565b93505b61167460008560075484611eee565b985060008990806001815401808255809150506001900390600052602060002001600090919091909150556116a88a610f9e565b965060008714156116c3576116bc8a611f7a565b95506116dd565b6116cf876007546109d6565b95506116db868961216d565b505b7f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161170c91906129e9565b60405180910390a160019a50505050505050505050505b90565b6005805461173390612c1c565b80601f016020809104026020016040519081016040528092919081815260200182805461175f90612c1c565b80156117ac5780601f10611781576101008083540402835291602001916117ac565b820191906000526020600020905b81548152906001019060200180831161178f57829003601f168201915b505050505081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461181057600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b600260109054906101000a90046fffffffffffffffffffffffffffffffff1681565b60008060006118cc61156f565b506118d633610d54565b506118e08461118f565b91506118ed338684611ad6565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161194c91906129e9565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f00000000000000000000000000000000000000000000000000000000000000006119dc9190612a76565b905060005b84811015611a2357620f424082846119f99190612aa7565b611a039190612a76565b83611a0e9190612a20565b92508080611a1b90612c4e565b9150506119e1565b50620f42408583611a349190612aa7565b611a3e9190612a76565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611a999190612b35565b611aa39190612a76565b611aad9190612a20565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080611ae385846122a3565b50611aee8484611b7a565b50611af7611a48565b6fffffffffffffffffffffffffffffffff1690506008548310158015611b25575080611b228661121c565b14155b8015611b5d57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15611b6e57611b6c85826123d4565b505b60019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900490506000851415611bdb5760009350505050611cd0565b611be4866110d1565b92508483611bf29190612a20565b91508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1611611c62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5990612993565b60405180910390fd5b68ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60008060006001600080549050611ced9190612b35565b81548110611d24577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900490506cffffffffffffffffff000000001981169050602060ff166007549060020a02811790508060010260006001600080549050611d719190612b35565b81548110611da8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600191505090565b6000806000806001600080549050611dd69190612b35565b81548110611e0d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611e7c57600080fd5b505afa158015611e90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb491906126ff565b6fffffffffffffffffffffffffffffffff169050611ed182611983565b8111611ee557600060010292505050611eeb565b81925050505b90565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b6000806000806000611f8b86611871565b9350620f42407f000000000000000000000000000000000000000000000000000000000000000085611fbd9190612aa7565b611fc79190612a76565b91507f0000000000000000000000000000000000000000000000000000000000000000620f424083611ff99190612aa7565b6120039190612a76565b90508381101561211b5761201686611983565b9250710fffffffff0000000000000000000000000019600102600060018561203e9190612b35565b81548110612075577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160008282541692505081905550606860ff1660019060020a027f80000000000000000000000000000000000000000000000000000000000000001760010260006001856120cc9190612b35565b81548110612103577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001600082825417925050819055505b612160600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166d04ee2d6d415b85acef81000000008461215b9190612a76565b611b7a565b5081945050505050919050565b600080600084141561218357600091505061229d565b7f800000000000000000000000000000000000000000000000000000000000000060010260006001856121b69190612b35565b815481106121ed577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020016000828254179250508190555061225d60006001856122169190612b35565b8154811061224d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154611871565b9050612296600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685836122919190612b35565b611b7a565b5060019150505b92915050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600190049050600085141561230457600093505050506123ce565b61230d866110d1565b925084831015612352576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234990612973565b60405180910390fd5b848361235e9190612b35565b915068ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60006cffffffff00000000000000000019600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825416925050819055506cffffffff000000000000000000604860ff16839060020a0216600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825417925050819055506124a56124b0565b506001905092915050565b600080600080600060016000805490506124ca9190612b35565b81548110612501577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549250600161251984610f9e565b6125239190612a20565b905082600190049150710fffffffff000000000000000000000000001982169150710fffffffff00000000000000000000000000606860ff16829060020a021682179150816001026000600160008054905061257f9190612b35565b815481106125b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055506001935050505090565b6000813590506125dd81612d35565b92915050565b6000813590506125f281612d4c565b92915050565b60008151905061260781612d63565b92915050565b60008135905061261c81612d7a565b92915050565b60006020828403121561263457600080fd5b6000612642848285016125ce565b91505092915050565b60008060006060848603121561266057600080fd5b600061266e868287016125ce565b935050602061267f868287016125ce565b92505060406126908682870161260d565b9150509250925092565b600080604083850312156126ad57600080fd5b60006126bb858286016125ce565b92505060206126cc8582860161260d565b9150509250929050565b6000602082840312156126e857600080fd5b60006126f6848285016125e3565b91505092915050565b60006020828403121561271157600080fd5b600061271f848285016125f8565b91505092915050565b60006020828403121561273a57600080fd5b60006127488482850161260d565b91505092915050565b6000806040838503121561276457600080fd5b60006127728582860161260d565b92505060206127838582860161260d565b9150509250929050565b61279681612b69565b82525050565b6127a581612b7b565b82525050565b6127b481612b87565b82525050565b60006127c582612a04565b6127cf8185612a0f565b93506127df818560208601612be9565b6127e881612d24565b840191505092915050565b6000612800601183612a0f565b91507f4552525f4e554d50415254535f5a45524f0000000000000000000000000000006000830152602082019050919050565b6000612840600d83612a0f565b91507f4552525f4f5645525350454e44000000000000000000000000000000000000006000830152602082019050919050565b6000612880600d83612a0f565b91507f4552525f574f554c4457524150000000000000000000000000000000000000006000830152602082019050919050565b6128bc81612b91565b82525050565b6128cb81612bd7565b82525050565b6128da81612bcd565b82525050565b60006020820190506128f5600083018461278d565b92915050565b6000602082019050612910600083018461279c565b92915050565b600060208201905061292b60008301846127ab565b92915050565b6000602082019050818103600083015261294b81846127ba565b905092915050565b6000602082019050818103600083015261296c816127f3565b9050919050565b6000602082019050818103600083015261298c81612833565b9050919050565b600060208201905081810360008301526129ac81612873565b9050919050565b60006020820190506129c860008301846128b3565b92915050565b60006020820190506129e360008301846128c2565b92915050565b60006020820190506129fe60008301846128d1565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612a2b82612bcd565b9150612a3683612bcd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a6b57612a6a612c97565b5b828201905092915050565b6000612a8182612bcd565b9150612a8c83612bcd565b925082612a9c57612a9b612cc6565b5b828204905092915050565b6000612ab282612bcd565b9150612abd83612bcd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612af657612af5612c97565b5b828202905092915050565b6000612b0c82612b91565b9150612b1783612b91565b925082821015612b2a57612b29612c97565b5b828203905092915050565b6000612b4082612bcd565b9150612b4b83612bcd565b925082821015612b5e57612b5d612c97565b5b828203905092915050565b6000612b7482612bad565b9050919050565b60008115159050919050565b6000819050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000612be282612b91565b9050919050565b60005b83811015612c07578082015181840152602081019050612bec565b83811115612c16576000848401525b50505050565b60006002820490506001821680612c3457607f821691505b60208210811415612c4857612c47612cf5565b5b50919050565b6000612c5982612bcd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612c8c57612c8b612c97565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b612d3e81612b69565b8114612d4957600080fd5b50565b612d5581612b87565b8114612d6057600080fd5b50565b612d6c81612b91565b8114612d7757600080fd5b50565b612d8381612bcd565b8114612d8e57600080fd5b5056fea2646970667358221220b4c34b9cd5c1cacc7f5e09ec217e773c17e22b48789448982411cb74ec27c10864736f6c63430008000033 \ No newline at end of file diff --git a/python/sarafu_token/data/RedistributedDemurrageToken.json b/python/sarafu_token/data/RedistributedDemurrageToken.json index b677ce1..c54c7b5 100644 --- a/python/sarafu_token/data/RedistributedDemurrageToken.json +++ b/python/sarafu_token/data/RedistributedDemurrageToken.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint256","name":"_taxLevelMinute","type":"uint256"},{"internalType":"uint256","name":"_periodMinutes","type":"uint256"},{"internalType":"address","name":"_defaultSinkAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_foo","type":"bytes32"}],"name":"Debug","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_period","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_periodCount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newAmount","type":"uint256"}],"name":"Decayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_period","type":"uint256"}],"name":"Period","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":true,"internalType":"uint256","name":"_period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Redistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"accountPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"actualPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"applyDemurrage","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"applyRedistributionOnAccount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"baseBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"changePeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"decayBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_target","type":"uint256"}],"name":"demurrageCycles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"demurrageModifier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodCount","type":"uint256"}],"name":"getPeriodTimeDelta","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"growBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumParticipantSpend","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redistributionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"redistributions","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numParts","type":"uint256"},{"internalType":"uint256","name":"_sumWhole","type":"uint256"}],"name":"remainder","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"toBaseAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_demurrage","type":"uint256"}],"name":"toDemurrageAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_demurrage","type":"uint256"}],"name":"toDemurragePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionDemurrageModifier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionParticipants","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint256","name":"_taxLevelMinute","type":"uint256"},{"internalType":"uint256","name":"_periodMinutes","type":"uint256"},{"internalType":"address","name":"_defaultSinkAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"address","name":"_spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_foo","type":"bytes32"}],"name":"Debug","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_period","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_periodCount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newAmount","type":"uint256"}],"name":"Decayed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_minter","type":"address"},{"indexed":true,"internalType":"address","name":"_beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_period","type":"uint256"}],"name":"Period","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_account","type":"address"},{"indexed":true,"internalType":"uint256","name":"_period","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Redistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"accountPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"actualPeriod","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"addMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"applyDemurrage","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"applyRedistributionOnAccount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_spender","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"baseBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"changePeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"decayBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"demurrageAmount","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_target","type":"uint256"}],"name":"demurrageCycles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"demurragePeriod","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodCount","type":"uint256"}],"name":"getPeriodTimeDelta","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"growBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumParticipantSpend","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redistributionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"redistributions","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_numParts","type":"uint256"},{"internalType":"uint256","name":"_sumWhole","type":"uint256"}],"name":"remainder","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"removeMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"toBaseAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionDemurrageModifier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionParticipants","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"redistribution","type":"bytes32"}],"name":"toRedistributionSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}] diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py index 712fc59..023b0c1 100644 --- a/python/tests/test_basic.py +++ b/python/tests/test_basic.py @@ -71,25 +71,30 @@ class Test(unittest.TestCase): self.assertEqual(self.contract.functions.actualPeriod().call(), 2) - def test_apply_demurrage(self): modifier = 10 * (10 ** 37) - demurrage_modifier = self.contract.functions.demurrageModifier().call() - demurrage_modifier &= (1 << 128) - 1 - self.assertEqual(modifier, demurrage_modifier) + #demurrage_modifier = self.contract.functions.demurrageModifier().call() + #demurrage_modifier &= (1 << 128) - 1 + demurrage_amount = self.contract.functions.demurrageAmount().call() + #self.assertEqual(modifier, demurrage_modifier) + self.assertEqual(modifier, demurrage_amount) self.eth_tester.time_travel(self.start_time + 59) - demurrage_modifier = self.contract.functions.demurrageModifier().call() - demurrage_modifier &= (1 << 128) - 1 - self.assertEqual(modifier, demurrage_modifier) + #demurrage_modifier = self.contract.functions.demurrageModifier().call() + demurrage_amount = self.contract.functions.demurrageAmount().call() + #demurrage_modifier &= (1 << 128) - 1 + #self.assertEqual(modifier, demurrage_modifier) + self.assertEqual(modifier, demurrage_amount) self.eth_tester.time_travel(self.start_time + 61) tx_hash = self.contract.functions.applyDemurrage().transact() r = self.w3.eth.getTransactionReceipt(tx_hash) - demurrage_modifier = self.contract.functions.demurrageModifier().call() - demurrage_modifier &= (1 << 128) - 1 - self.assertEqual(int(98 * (10 ** 36)), demurrage_modifier) + #demurrage_modifier = self.contract.functions.demurrageModifier().call() + demurrage_amount = self.contract.functions.demurrageAmount().call() + #demurrage_modifier &= (1 << 128) - 1 + #self.assertEqual(int(98 * (10 ** 36)), demurrage_modifier) + self.assertEqual(int(98 * (10 ** 36)), demurrage_amount) def test_mint(self): @@ -138,6 +143,7 @@ class Test(unittest.TestCase): with self.assertRaises(eth_tester.exceptions.TransactionFailed): tx_hash = self.contract.functions.mintTo(self.w3.eth.accounts[2], 1024).transact({'from': self.w3.eth.accounts[1]}) + def test_base_amount(self): tx_hash = self.contract.functions.mintTo(self.w3.eth.accounts[1], 1000).transact() r = self.w3.eth.getTransactionReceipt(tx_hash) @@ -146,9 +152,9 @@ class Test(unittest.TestCase): self.eth_tester.time_travel(self.start_time + 61) self.contract.functions.applyDemurrage().transact() - demurrage_modifier = self.contract.functions.demurrageModifier().call() - demurrage_amount = self.contract.functions.toDemurrageAmount(demurrage_modifier).call() - logg.debug('d {} {}'.format(demurrage_modifier.to_bytes(32, 'big').hex(), demurrage_amount)) + #demurrage_modifier = self.contract.functions.demurrageModifier().call() + #demurrage_amount = self.contract.functions.toDemurrageAmount(demurrage_modifier).call() + demurrage_amount = self.contract.functions.demurrageAmount().call() a = self.contract.functions.toBaseAmount(1000).call(); self.assertEqual(a, 1020) diff --git a/solidity/RedistributedDemurrageToken.sol b/solidity/RedistributedDemurrageToken.sol index 67480dd..f420f8a 100644 --- a/solidity/RedistributedDemurrageToken.sol +++ b/solidity/RedistributedDemurrageToken.sol @@ -26,14 +26,11 @@ contract RedistributedDemurrageToken { uint8 constant shiftAccountPeriod = 72; uint256 constant maskAccountPeriod = 0x00000000000000000000000000000000000000ffffffff000000000000000000; // ((1 << 32) - 1) << 72 + // Cached demurrage amount, ppm with 38 digit resolution + uint128 public demurrageAmount; - // TODO: use 2 x uint128 instead - // Demurrage cache bit field, with associated shifts and masks - uint256 public demurrageModifier; // PPM uint128(block) | uint128(periodppm) - uint8 constant shiftDemurrageValue = 0; - uint256 constant maskDemurrageValue = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; - uint8 constant shiftDemurragePeriod = 128; - uint256 constant maskDemurragePeriod = 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000; + // Cached demurrage period; the period for which demurrageAmount was calculated + uint128 public demurragePeriod; // Implements EIP172 address public owner; @@ -109,8 +106,8 @@ contract RedistributedDemurrageToken { // Demurrage setup periodStart = block.timestamp; periodDuration = _periodMinutes * 60; - demurrageModifier = ppmDivider * 1000000; // Represents 38 decimal places - demurrageModifier |= (1 << 128); + demurrageAmount = uint128(ppmDivider * 1000000); // Represents 38 decimal places + demurragePeriod = 1; taxLevel = _taxLevelMinute; // Represents 38 decimal places bytes32 initialRedistribution = toRedistribution(0, 1000000, 0, 1); redistributions.push(initialRedistribution); @@ -137,20 +134,16 @@ contract RedistributedDemurrageToken { /// Implements ERC20 function balanceOf(address _account) public view returns (uint256) { uint256 baseBalance; - uint256 anchorDemurrageAmount; - uint256 anchorDemurragePeriod; - uint256 currentDemurrageAmount; + uint256 currentDemurragedAmount; uint256 periodCount; baseBalance = baseBalanceOf(_account); - anchorDemurrageAmount = toDemurrageAmount(demurrageModifier); - anchorDemurragePeriod = toDemurragePeriod(demurrageModifier); - periodCount = actualPeriod() - toDemurragePeriod(demurrageModifier); + periodCount = actualPeriod() - demurragePeriod; - currentDemurrageAmount = decayBy(anchorDemurrageAmount, periodCount); + currentDemurragedAmount = uint128(decayBy(demurrageAmount, periodCount)); - return (baseBalance * currentDemurrageAmount) / (ppmDivider * 1000000); + return (baseBalance * currentDemurragedAmount) / (ppmDivider * 1000000); } /// Balance unmodified by demurrage @@ -283,8 +276,8 @@ contract RedistributedDemurrageToken { } // Get the demurrage period of the current block number - function actualPeriod() public view returns (uint256) { - return (block.timestamp - periodStart) / periodDuration + 1; + function actualPeriod() public view returns (uint128) { + return uint128((block.timestamp - periodStart) / periodDuration + 1); } // Add an entered demurrage period to the redistribution array @@ -371,34 +364,22 @@ contract RedistributedDemurrageToken { } - // Deserialize demurrage amount from demurrage bitfield - function toDemurrageAmount(uint256 _demurrage) public pure returns (uint256) { - return _demurrage & maskDemurrageValue; - } - - // Deserialize demurrage period from demurrage bitfield - function toDemurragePeriod(uint256 _demurrage) public pure returns (uint256) { - return (_demurrage & maskDemurragePeriod) >> shiftDemurragePeriod; - } - // Calculate and cache the demurrage value corresponding to the (period of the) time of the method call function applyDemurrage() public returns (bool) { - uint256 epochPeriodCount; - uint256 periodCount; + uint128 epochPeriodCount; + uint128 periodCount; uint256 lastDemurrageAmount; uint256 newDemurrageAmount; epochPeriodCount = actualPeriod(); - periodCount = epochPeriodCount - toDemurragePeriod(demurrageModifier); + periodCount = epochPeriodCount - demurragePeriod; if (periodCount == 0) { return false; } - lastDemurrageAmount = toDemurrageAmount(demurrageModifier); - newDemurrageAmount = decayBy(lastDemurrageAmount, periodCount); - demurrageModifier = 0; - demurrageModifier |= (newDemurrageAmount & maskDemurrageValue); - demurrageModifier |= ((epochPeriodCount << shiftDemurragePeriod) & maskDemurragePeriod); - emit Decayed(epochPeriodCount, periodCount, lastDemurrageAmount, newDemurrageAmount); + lastDemurrageAmount = demurrageAmount; + demurrageAmount = uint128(decayBy(lastDemurrageAmount, periodCount)); + demurragePeriod = epochPeriodCount; + emit Decayed(epochPeriodCount, periodCount, lastDemurrageAmount, demurrageAmount); return true; } @@ -436,7 +417,7 @@ contract RedistributedDemurrageToken { periodTimestamp = getPeriodTimeDelta(currentPeriod); applyDemurrage(); - currentDemurrageAmount = toDemurrageAmount(demurrageModifier); + currentDemurrageAmount = demurrageAmount; demurrageCounts = demurrageCycles(periodTimestamp); if (demurrageCounts > 0) { @@ -524,7 +505,8 @@ contract RedistributedDemurrageToken { // Inflates the given amount according to the current demurrage modifier function toBaseAmount(uint256 _value) public view returns (uint256) { - return (_value * ppmDivider * 1000000) / toDemurrageAmount(demurrageModifier); + //return (_value * ppmDivider * 1000000) / toDemurrageAmount(demurrageModifier); + return (_value * ppmDivider * 1000000) / demurrageAmount; } // ERC20, triggers tax and/or redistribution