diff --git a/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin b/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin index 4a3708a..0433fb2 100644 --- a/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin +++ b/python/erc20_demurrage_token/data/DemurrageTokenSingleCap.bin @@ -1 +1 @@ -60e06040523480156200001157600080fd5b50604051620032ec380380620032ec833981810160405281019062000037919062000445565b33600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600c6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555086600690805190602001906200010a929190620002de565b50856007908051906020019062000123929190620002de565b508460ff166008819055504260038190555060035460808181525050603c836200014e91906200071b565b60a0818152505064e8d4a510006a52b7d2dcc80cd2e40000006200017391906200071b565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508360c081815250506000620001dd6000678ac7230489e800006000600162000276640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600a8190555082600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508560ff16600a620002629190620005de565b600b81905550505050505050505062000962565b600080750ffffffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b828054620002ec90620007fd565b90600052602060002090601f0160209004810192826200031057600085556200035c565b82601f106200032b57805160ff19168380011785556200035c565b828001600101855582156200035c579182015b828111156200035b5782518255916020019190600101906200033e565b5b5090506200036b91906200036f565b5090565b5b808211156200038a57600081600090555060010162000370565b5090565b6000620003a56200039f846200054d565b62000524565b905082815260208101848484011115620003be57600080fd5b620003cb848285620007c7565b509392505050565b600081519050620003e48162000914565b92915050565b600082601f830112620003fc57600080fd5b81516200040e8482602086016200038e565b91505092915050565b60008151905062000428816200092e565b92915050565b6000815190506200043f8162000948565b92915050565b600080600080600080600060e0888a0312156200046157600080fd5b600088015167ffffffffffffffff8111156200047c57600080fd5b6200048a8a828b01620003ea565b975050602088015167ffffffffffffffff811115620004a857600080fd5b620004b68a828b01620003ea565b9650506040620004c98a828b016200042e565b9550506060620004dc8a828b0162000417565b9450506080620004ef8a828b0162000417565b93505060a0620005028a828b01620003d3565b92505060c0620005158a828b0162000417565b91505092959891949750929550565b60006200053062000543565b90506200053e828262000833565b919050565b6000604051905090565b600067ffffffffffffffff8211156200056b576200056a620008c7565b5b6200057682620008f6565b9050602081019050919050565b6000808291508390505b6001851115620005d557808604811115620005ad57620005ac62000869565b5b6001851615620005bd5780820291505b8081029050620005cd8562000907565b94506200058d565b94509492505050565b6000620005eb82620007b0565b9150620005f883620007b0565b9250620006277fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846200062f565b905092915050565b60008262000641576001905062000714565b8162000651576000905062000714565b81600181146200066a57600281146200067557620006ab565b600191505062000714565b60ff8411156200068a576200068962000869565b5b8360020a915084821115620006a457620006a362000869565b5b5062000714565b5060208310610133831016604e8410600b8410161715620006e55782820a905083811115620006df57620006de62000869565b5b62000714565b620006f4848484600162000583565b925090508184048111156200070e576200070d62000869565b5b81810290505b9392505050565b60006200072882620007b0565b91506200073583620007b0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161562000771576200077062000869565b5b828202905092915050565b6000620007898262000790565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015620007e7578082015181840152602081019050620007ca565b83811115620007f7576000848401525b50505050565b600060028204905060018216806200081657607f821691505b602082108114156200082d576200082c62000898565b5b50919050565b6200083e82620008f6565b810181811067ffffffffffffffff8211171562000860576200085f620008c7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6000600282049050919050565b6200091f816200077c565b81146200092b57600080fd5b50565b6200093981620007b0565b81146200094557600080fd5b50565b6200095381620007ba565b81146200095f57600080fd5b50565b60805160a05160c051612930620009bc60003960008181610bcb01528181610e2701526119c20152600081816110bd015281816119650152611a5d0152600081816110e901528181611a7e0152611ac301526129306000f3fe608060405234801561001057600080fd5b506004361061024f576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be1161014d57806395d89b41116100d5578063e3ab207a11610099578063e3ab207a14610776578063e54d63f7146107a6578063e8095295146107d6578063eda4e6d6146107f4578063f2fde38b146108125761024f565b806395d89b41146106aa578063983b2d56146106c85780639da7d8ba146106f8578063a9059cbb14610728578063b470aade146107585761024f565b8063731f237c1161011c578063731f237c1461061457806379ba5097146106325780638da5cb5b146106505780638f1df6bc1461066e5780638f770ad01461068c5761024f565b80636787a9be146105545780636a2d094e146105845780636ffa8a05146105b457806370a08231146105e45761024f565b806331333487116101db5780634abfbba21161019f5780634abfbba21461048857806351b4541c146104b8578063573cc507146104e857806358b2833b146105065780636721d4ef146105245761024f565b806331333487146103aa578063313ce567146103da57806340452d91146103f8578063449a52f81461042857806347a50517146104585761024f565b806318160ddd1161022257806318160ddd146102f05780631989c6a81461030e578063229ba1971461032c57806323b872dd1461034a5780633092afd51461037a5761024f565b806301ffc9a71461025457806306fdde0314610284578063095ea7b3146102a257806309f28f3c146102d2575b600080fd5b61026e6004803603810190610269919061220c565b610842565b60405161027b91906123da565b60405180910390f35b61028c6109ed565b6040516102999190612410565b60405180910390f35b6102bc60048036038101906102b791906121a7565b610a7b565b6040516102c991906123da565b60405180910390f35b6102da610b95565b6040516102e79190612492565b60405180910390f35b6102f8610bb7565b60405161030591906124c8565b60405180910390f35b610316610bbd565b60405161032391906124c8565b60405180910390f35b610334610bc9565b60405161034191906124c8565b60405180910390f35b610364600480360381019061035f9190612158565b610bed565b60405161037191906123da565b60405180910390f35b610394600480360381019061038f919061212f565b610d0d565b6040516103a191906123da565b60405180910390f35b6103c460048036038101906103bf9190612287565b610e00565b6040516103d191906124c8565b60405180910390f35b6103e2610ebc565b6040516103ef91906124c8565b60405180910390f35b610412600480360381019061040d919061225e565b610ec2565b60405161041f91906123f5565b60405180910390f35b610442600480360381019061043d91906121a7565b610ee6565b60405161044f91906123da565b60405180910390f35b610472600480360381019061046d919061212f565b611070565b60405161047f91906124c8565b60405180910390f35b6104a2600480360381019061049d919061225e565b6110b9565b6040516104af91906124c8565b60405180910390f35b6104d260048036038101906104cd919061225e565b611119565b6040516104df91906124c8565b60405180910390f35b6104f061113a565b6040516104fd91906124c8565b60405180910390f35b61050e611140565b60405161051b91906124c8565b60405180910390f35b61053e60048036038101906105399190612287565b611146565b60405161054b91906124c8565b60405180910390f35b61056e6004803603810190610569919061225e565b611182565b60405161057b91906124c8565b60405180910390f35b61059e6004803603810190610599919061225e565b6111ed565b6040516105ab91906124c8565b60405180910390f35b6105ce60048036038101906105c991906121e3565b61120e565b6040516105db91906124c8565b60405180910390f35b6105fe60048036038101906105f9919061212f565b611243565b60405161060b91906124c8565b60405180910390f35b61061c6112eb565b60405161062991906123da565b60405180910390f35b61063a61140d565b60405161064791906123da565b60405180910390f35b6106586115b4565b60405161066591906123bf565b60405180910390f35b6106766115da565b60405161068391906123da565b60405180910390f35b610694611750565b6040516106a191906124c8565b60405180910390f35b6106b2611756565b6040516106bf9190612410565b60405180910390f35b6106e260048036038101906106dd919061212f565b6117e4565b6040516106ef91906123da565b60405180910390f35b610712600480360381019061070d91906121e3565b6118a1565b60405161071f91906124c8565b60405180910390f35b610742600480360381019061073d91906121a7565b6118cd565b60405161074f91906123da565b60405180910390f35b610760611963565b60405161076d91906124c8565b60405180910390f35b610790600480360381019061078b91906121e3565b611987565b60405161079d91906124c8565b60405180910390f35b6107c060048036038101906107bb9190612287565b61199b565b6040516107cd91906124c8565b60405180910390f35b6107de611a57565b6040516107eb9190612492565b60405180910390f35b6107fc611ac1565b60405161080991906124c8565b60405180910390f35b61082c6004803603810190610827919061212f565b611ae5565b60405161083991906123da565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561089757600190506109e8565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108ea57600190506109e8565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561093d57600190506109e8565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561099057600190506109e8565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109e357600190506109e8565b600090505b919050565b600680546109fa906126f3565b80601f0160208091040260200160405190810160405280929190818152602001828054610a26906126f3565b8015610a735780601f10610a4857610100808354040283529160200191610a73565b820191906000526020600020905b815481529060010190602001808311610a5657829003601f168201915b505050505081565b600080610a866115da565b50610a9083611182565b905080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e91906124ff565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610b8291906124c8565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60095481565b60008080549050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610bfa6115da565b50610c0484611182565b915081600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c8f57600080fd5b610c9a868684611b87565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610cf991906124c8565b60405180910390a380925050509392505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d9657503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610d9f57600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f42409150620f42406a52b7d2dcc80cd2e4000000610e259190612586565b7f0000000000000000000000000000000000000000000000000000000000000000610e509190612555565b905060005b84811015610e9757620f42408284610e6d9190612586565b610e779190612555565b83610e8291906125e0565b92508080610e8f90612725565b915050610e55565b50620f42408583610ea89190612586565b610eb29190612555565b9250505092915050565b60085481565b60008181548110610ed257600080fd5b906000526020600020016000915090505481565b600080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6c90612452565b60405180910390fd5b600a5460095484610f8691906124ff565b1115610fc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbe90612432565b60405180910390fd5b610fcf6115da565b508290508260096000828254610fe591906124ff565b92505081905550610ff68482611bc8565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f88560405161105491906124c8565b60405180910390a3611064611c8d565b50600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826110e79190612586565b7f000000000000000000000000000000000000000000000000000000000000000061111291906124ff565b9050919050565b6000603c824261112991906125e0565b6111339190612555565b9050919050565b600b5481565b60035481565b600064e8d4a51000826111599190612555565b6a52b7d2dcc80cd2e400000061116f91906125e0565b8361117a9190612586565b905092915050565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1664e8d4a510006a52b7d2dcc80cd2e4000000846111d29190612586565b6111dc9190612586565b6111e69190612555565b9050919050565b6000603c82426111fd91906125e0565b6112079190612555565b9050919050565b6000608c60ff16750ffffffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b60008060008061125285611070565b925061125f600354611119565b905061129b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610e00565b6fffffffffffffffffffffffffffffffff16915064e8d4a510006a52b7d2dcc80cd2e40000006112cb9190612586565b82846112d79190612586565b6112e19190612555565b9350505050919050565b6000806000806112fc600354611119565b91506000821415611313576000935050505061140a565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1690506113508183610e00565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550603c826113959190612586565b6003546113a291906124ff565b60038190555080826003547fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff166040516113fa91906124ad565b60405180910390a4600193505050505b90565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146a57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060006115f0611d85565b9750600060010288141561160f5760009850505050505050505061174d565b61161888611987565b955060018661162791906124ff565b9050611632866110b9565b915061163c6112eb565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611679826111ed565b925060008311156116ab576a52b7d2dcc80cd2e400000061169a868561199b565b6116a49190612555565b93506116c5565b6a52b7d2dcc80cd2e4000000856116c29190612555565b93505b6116d460008560095484611eb5565b9650600087908060018154018082558091505060019003906000526020600020016000909190919091505561170888611f1d565b507f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161173891906124c8565b60405180910390a16001985050505050505050505b90565b600a5481565b60078054611763906126f3565b80601f016020809104026020016040519081016040528092919081815260200182805461178f906126f3565b80156117dc5780601f106117b1576101008083540402835291602001916117dc565b820191906000526020600020905b8154815290600101906020018083116117bf57829003601f168201915b505050505081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461184057600080fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b60008060006118da6115da565b506118e484611182565b91506118f1338684611b87565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161195091906124c8565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b6000806000620f42409150620f42406a52b7d2dcc80cd2e40000006119c09190612586565b7f00000000000000000000000000000000000000000000000000000000000000006119eb9190612555565b905060005b84811015611a3257620f42408284611a089190612586565b611a129190612555565b83611a1d91906124ff565b92508080611a2a90612725565b9150506119f0565b50620f42408583611a439190612586565b611a4d9190612555565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611aa891906125e0565b611ab29190612555565b611abc91906124ff565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b4157600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080611b948584611fbe565b50611b9f8484611bc8565b50611ba8611a57565b6fffffffffffffffffffffffffffffffff16905060019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000851415611c255760009350505050611c87565b611c2e86611070565b92508483611c3c91906124ff565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000806000611c9f600954600161199b565b905060006001600080549050611cb591906125e0565b81548110611cec577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900491506cffffffffffffffffff000000001982169150602060ff16819060020a02821791508160010260006001600080549050611d3791906125e0565b81548110611d6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555060019250505090565b6000806000806001600080549050611d9d91906125e0565b81548110611dd4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611e4357600080fd5b505afa158015611e57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7b9190612235565b6fffffffffffffffffffffffffffffffff169050611e9882611987565b8111611eac57600060010292505050611eb2565b81925050505b90565b600080750ffffffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b6000806000611f2b846118a1565b9150611f6782600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16611146565b9050611fb3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611fae6a52b7d2dcc80cd2e400000084611fa99190612555565b611182565b611bc8565b508092505050919050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600085141561201b57600093505050506120c0565b61202486611070565b925084831015612069576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206090612472565b60405180910390fd5b848361207591906125e0565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000813590506120d581612887565b92915050565b6000813590506120ea8161289e565b92915050565b6000813590506120ff816128b5565b92915050565b600081519050612114816128cc565b92915050565b600081359050612129816128e3565b92915050565b60006020828403121561214157600080fd5b600061214f848285016120c6565b91505092915050565b60008060006060848603121561216d57600080fd5b600061217b868287016120c6565b935050602061218c868287016120c6565b925050604061219d8682870161211a565b9150509250925092565b600080604083850312156121ba57600080fd5b60006121c8858286016120c6565b92505060206121d98582860161211a565b9150509250929050565b6000602082840312156121f557600080fd5b6000612203848285016120db565b91505092915050565b60006020828403121561221e57600080fd5b600061222c848285016120f0565b91505092915050565b60006020828403121561224757600080fd5b600061225584828501612105565b91505092915050565b60006020828403121561227057600080fd5b600061227e8482850161211a565b91505092915050565b6000806040838503121561229a57600080fd5b60006122a88582860161211a565b92505060206122b98582860161211a565b9150509250929050565b6122cc81612614565b82525050565b6122db81612626565b82525050565b6122ea81612632565b82525050565b60006122fb826124e3565b61230581856124ee565b93506123158185602086016126c0565b61231e816127fb565b840191505092915050565b60006123366007836124ee565b91506123418261280c565b602082019050919050565b6000612359600a836124ee565b915061236482612835565b602082019050919050565b600061237c600d836124ee565b91506123878261285e565b602082019050919050565b61239b81612668565b82525050565b6123aa816126ae565b82525050565b6123b9816126a4565b82525050565b60006020820190506123d460008301846122c3565b92915050565b60006020820190506123ef60008301846122d2565b92915050565b600060208201905061240a60008301846122e1565b92915050565b6000602082019050818103600083015261242a81846122f0565b905092915050565b6000602082019050818103600083015261244b81612329565b9050919050565b6000602082019050818103600083015261246b8161234c565b9050919050565b6000602082019050818103600083015261248b8161236f565b9050919050565b60006020820190506124a76000830184612392565b92915050565b60006020820190506124c260008301846123a1565b92915050565b60006020820190506124dd60008301846123b0565b92915050565b600081519050919050565b600082825260208201905092915050565b600061250a826126a4565b9150612515836126a4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561254a5761254961276e565b5b828201905092915050565b6000612560826126a4565b915061256b836126a4565b92508261257b5761257a61279d565b5b828204905092915050565b6000612591826126a4565b915061259c836126a4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125d5576125d461276e565b5b828202905092915050565b60006125eb826126a4565b91506125f6836126a4565b9250828210156126095761260861276e565b5b828203905092915050565b600061261f82612684565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006126b982612668565b9050919050565b60005b838110156126de5780820151818401526020810190506126c3565b838111156126ed576000848401525b50505050565b6000600282049050600182168061270b57607f821691505b6020821081141561271f5761271e6127cc565b5b50919050565b6000612730826126a4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156127635761276261276e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4552525f43415000000000000000000000000000000000000000000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f4f5645525350454e4400000000000000000000000000000000000000600082015250565b61289081612614565b811461289b57600080fd5b50565b6128a781612632565b81146128b257600080fd5b50565b6128be8161263c565b81146128c957600080fd5b50565b6128d581612668565b81146128e057600080fd5b50565b6128ec816126a4565b81146128f757600080fd5b5056fea26469706673582212204aa24cd44bbc01fc24170fdc3f01dba50f80b13edd1a1c51b7873d15eaa70ce664736f6c63430008040033 \ No newline at end of file +60e06040523480156200001157600080fd5b50604051620032e2380380620032e2833981810160405281019062000037919062000445565b33600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600c6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555086600690805190602001906200010a929190620002de565b50856007908051906020019062000123929190620002de565b508460ff166008819055504260038190555060035460808181525050603c836200014e91906200071b565b60a0818152505064e8d4a510006a52b7d2dcc80cd2e40000006200017391906200071b565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508360c081815250506000620001dd6000678ac7230489e800006000600162000276640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600a8190555082600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508560ff16600a620002629190620005de565b600b81905550505050505050505062000962565b600080750ffffffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b828054620002ec90620007fd565b90600052602060002090601f0160209004810192826200031057600085556200035c565b82601f106200032b57805160ff19168380011785556200035c565b828001600101855582156200035c579182015b828111156200035b5782518255916020019190600101906200033e565b5b5090506200036b91906200036f565b5090565b5b808211156200038a57600081600090555060010162000370565b5090565b6000620003a56200039f846200054d565b62000524565b905082815260208101848484011115620003be57600080fd5b620003cb848285620007c7565b509392505050565b600081519050620003e48162000914565b92915050565b600082601f830112620003fc57600080fd5b81516200040e8482602086016200038e565b91505092915050565b60008151905062000428816200092e565b92915050565b6000815190506200043f8162000948565b92915050565b600080600080600080600060e0888a0312156200046157600080fd5b600088015167ffffffffffffffff8111156200047c57600080fd5b6200048a8a828b01620003ea565b975050602088015167ffffffffffffffff811115620004a857600080fd5b620004b68a828b01620003ea565b9650506040620004c98a828b016200042e565b9550506060620004dc8a828b0162000417565b9450506080620004ef8a828b0162000417565b93505060a0620005028a828b01620003d3565b92505060c0620005158a828b0162000417565b91505092959891949750929550565b60006200053062000543565b90506200053e828262000833565b919050565b6000604051905090565b600067ffffffffffffffff8211156200056b576200056a620008c7565b5b6200057682620008f6565b9050602081019050919050565b6000808291508390505b6001851115620005d557808604811115620005ad57620005ac62000869565b5b6001851615620005bd5780820291505b8081029050620005cd8562000907565b94506200058d565b94509492505050565b6000620005eb82620007b0565b9150620005f883620007b0565b9250620006277fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846200062f565b905092915050565b60008262000641576001905062000714565b8162000651576000905062000714565b81600181146200066a57600281146200067557620006ab565b600191505062000714565b60ff8411156200068a576200068962000869565b5b8360020a915084821115620006a457620006a362000869565b5b5062000714565b5060208310610133831016604e8410600b8410161715620006e55782820a905083811115620006df57620006de62000869565b5b62000714565b620006f4848484600162000583565b925090508184048111156200070e576200070d62000869565b5b81810290505b9392505050565b60006200072882620007b0565b91506200073583620007b0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161562000771576200077062000869565b5b828202905092915050565b6000620007898262000790565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015620007e7578082015181840152602081019050620007ca565b83811115620007f7576000848401525b50505050565b600060028204905060018216806200081657607f821691505b602082108114156200082d576200082c62000898565b5b50919050565b6200083e82620008f6565b810181811067ffffffffffffffff8211171562000860576200085f620008c7565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6000600282049050919050565b6200091f816200077c565b81146200092b57600080fd5b50565b6200093981620007b0565b81146200094557600080fd5b50565b6200095381620007ba565b81146200095f57600080fd5b50565b60805160a05160c051612926620009bc60003960008181610bcb01528181610e1b01526119b40152600081816110b5015281816119630152611a530152600081816110e101528181611a740152611ab901526129266000f3fe608060405234801561001057600080fd5b506004361061024f576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be1161014d57806395d89b41116100d5578063e3ab207a11610099578063e3ab207a14610776578063e54d63f7146107a6578063e8095295146107d6578063eda4e6d6146107f4578063f2fde38b146108125761024f565b806395d89b41146106aa578063983b2d56146106c85780639da7d8ba146106f8578063a9059cbb14610728578063b470aade146107585761024f565b8063731f237c1161011c578063731f237c1461061457806379ba5097146106325780638da5cb5b146106505780638f1df6bc1461066e5780638f770ad01461068c5761024f565b80636787a9be146105545780636a2d094e146105845780636ffa8a05146105b457806370a08231146105e45761024f565b806331333487116101db5780634abfbba21161019f5780634abfbba21461048857806351b4541c146104b8578063573cc507146104e857806358b2833b146105065780636721d4ef146105245761024f565b806331333487146103aa578063313ce567146103da57806340452d91146103f8578063449a52f81461042857806347a50517146104585761024f565b806318160ddd1161022257806318160ddd146102f05780631989c6a81461030e578063229ba1971461032c57806323b872dd1461034a5780633092afd51461037a5761024f565b806301ffc9a71461025457806306fdde0314610284578063095ea7b3146102a257806309f28f3c146102d2575b600080fd5b61026e60048036038101906102699190612202565b610842565b60405161027b91906123d0565b60405180910390f35b61028c6109ed565b6040516102999190612406565b60405180910390f35b6102bc60048036038101906102b7919061219d565b610a7b565b6040516102c991906123d0565b60405180910390f35b6102da610b95565b6040516102e79190612488565b60405180910390f35b6102f8610bb7565b60405161030591906124be565b60405180910390f35b610316610bbd565b60405161032391906124be565b60405180910390f35b610334610bc9565b60405161034191906124be565b60405180910390f35b610364600480360381019061035f919061214e565b610bed565b60405161037191906123d0565b60405180910390f35b610394600480360381019061038f9190612125565b610d0d565b6040516103a191906123d0565b60405180910390f35b6103c460048036038101906103bf919061227d565b610e00565b6040516103d191906124be565b60405180910390f35b6103e2610eb4565b6040516103ef91906124be565b60405180910390f35b610412600480360381019061040d9190612254565b610eba565b60405161041f91906123eb565b60405180910390f35b610442600480360381019061043d919061219d565b610ede565b60405161044f91906123d0565b60405180910390f35b610472600480360381019061046d9190612125565b611068565b60405161047f91906124be565b60405180910390f35b6104a2600480360381019061049d9190612254565b6110b1565b6040516104af91906124be565b60405180910390f35b6104d260048036038101906104cd9190612254565b611111565b6040516104df91906124be565b60405180910390f35b6104f0611132565b6040516104fd91906124be565b60405180910390f35b61050e611138565b60405161051b91906124be565b60405180910390f35b61053e6004803603810190610539919061227d565b61113e565b60405161054b91906124be565b60405180910390f35b61056e60048036038101906105699190612254565b611180565b60405161057b91906124be565b60405180910390f35b61059e60048036038101906105999190612254565b6111eb565b6040516105ab91906124be565b60405180910390f35b6105ce60048036038101906105c991906121d9565b61120c565b6040516105db91906124be565b60405180910390f35b6105fe60048036038101906105f99190612125565b611241565b60405161060b91906124be565b60405180910390f35b61061c6112e9565b60405161062991906123d0565b60405180910390f35b61063a61140b565b60405161064791906123d0565b60405180910390f35b6106586115b2565b60405161066591906123b5565b60405180910390f35b6106766115d8565b60405161068391906123d0565b60405180910390f35b61069461174e565b6040516106a191906124be565b60405180910390f35b6106b2611754565b6040516106bf9190612406565b60405180910390f35b6106e260048036038101906106dd9190612125565b6117e2565b6040516106ef91906123d0565b60405180910390f35b610712600480360381019061070d91906121d9565b61189f565b60405161071f91906124be565b60405180910390f35b610742600480360381019061073d919061219d565b6118cb565b60405161074f91906123d0565b60405180910390f35b610760611961565b60405161076d91906124be565b60405180910390f35b610790600480360381019061078b91906121d9565b611985565b60405161079d91906124be565b60405180910390f35b6107c060048036038101906107bb919061227d565b611999565b6040516107cd91906124be565b60405180910390f35b6107de611a4d565b6040516107eb9190612488565b60405180910390f35b6107fc611ab7565b60405161080991906124be565b60405180910390f35b61082c60048036038101906108279190612125565b611adb565b60405161083991906123d0565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561089757600190506109e8565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108ea57600190506109e8565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561093d57600190506109e8565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561099057600190506109e8565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109e357600190506109e8565b600090505b919050565b600680546109fa906126e9565b80601f0160208091040260200160405190810160405280929190818152602001828054610a26906126e9565b8015610a735780601f10610a4857610100808354040283529160200191610a73565b820191906000526020600020905b815481529060010190602001808311610a5657829003601f168201915b505050505081565b600080610a866115d8565b50610a9083611180565b905080600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e91906124f5565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610b8291906124be565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60095481565b60008080549050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610bfa6115d8565b50610c0484611180565b915081600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c8f57600080fd5b610c9a868684611b7d565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610cf991906124be565b60405180910390a380925050509392505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d9657503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610d9f57600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600080600064e8d4a5100091506a52b7d2dcc80cd2e40000007f0000000000000000000000000000000000000000000000000000000000000000610e44919061254b565b905060005b84811015610e8d5764e8d4a510008284610e63919061257c565b610e6d919061254b565b83610e7891906125d6565b92508080610e859061271b565b915050610e49565b5064e8d4a510008583610ea0919061257c565b610eaa919061254b565b9250505092915050565b60085481565b60008181548110610eca57600080fd5b906000526020600020016000915090505481565b600080600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610f6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6490612448565b60405180910390fd5b600a5460095484610f7e91906124f5565b1115610fbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb690612428565b60405180910390fd5b610fc76115d8565b508290508260096000828254610fdd91906124f5565b92505081905550610fee8482611bbe565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f88560405161104c91906124be565b60405180910390a361105c611c83565b50600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826110df919061257c565b7f000000000000000000000000000000000000000000000000000000000000000061110a91906124f5565b9050919050565b6000603c824261112191906125d6565b61112b919061254b565b9050919050565b600b5481565b60035481565b60006a52b7d2dcc80cd2e400000082611157919061254b565b6a52b7d2dcc80cd2e400000061116d91906125d6565b83611178919061257c565b905092915050565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1664e8d4a510006a52b7d2dcc80cd2e4000000846111d0919061257c565b6111da919061257c565b6111e4919061254b565b9050919050565b6000603c82426111fb91906125d6565b611205919061254b565b9050919050565b6000608c60ff16750ffffffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b60008060008061125085611068565b925061125d600354611111565b9050611299600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610e00565b6fffffffffffffffffffffffffffffffff16915064e8d4a510006a52b7d2dcc80cd2e40000006112c9919061257c565b82846112d5919061257c565b6112df919061254b565b9350505050919050565b6000806000806112fa600354611111565b915060008214156113115760009350505050611408565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16905061134e8183610e00565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550603c82611393919061257c565b6003546113a091906124f5565b60038190555080826003547fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff166040516113f891906124a3565b60405180910390a4600193505050505b90565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461146857600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060006115ee611d7b565b9750600060010288141561160d5760009850505050505050505061174b565b61161688611985565b955060018661162591906124f5565b9050611630866110b1565b915061163a6112e9565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611677826111eb565b925060008311156116a9576a52b7d2dcc80cd2e40000006116988685611999565b6116a2919061254b565b93506116c3565b6a52b7d2dcc80cd2e4000000856116c0919061254b565b93505b6116d260008560095484611eab565b9650600087908060018154018082558091505060019003906000526020600020016000909190919091505561170688611f13565b507f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161173691906124be565b60405180910390a16001985050505050505050505b90565b600a5481565b60078054611761906126e9565b80601f016020809104026020016040519081016040528092919081815260200182805461178d906126e9565b80156117da5780601f106117af576101008083540402835291602001916117da565b820191906000526020600020905b8154815290600101906020018083116117bd57829003601f168201915b505050505081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461183e57600080fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b60008060006118d86115d8565b506118e284611180565b91506118ef338684611b7d565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8660405161194e91906124be565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b600080600064e8d4a5100091506a52b7d2dcc80cd2e40000007f00000000000000000000000000000000000000000000000000000000000000006119dd919061254b565b905060005b84811015611a265764e8d4a5100082846119fc919061257c565b611a06919061254b565b83611a1191906124f5565b92508080611a1e9061271b565b9150506119e2565b5064e8d4a510008583611a39919061257c565b611a43919061254b565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611a9e91906125d6565b611aa8919061254b565b611ab291906124f5565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b3757600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080611b8a8584611fb4565b50611b958484611bbe565b50611b9e611a4d565b6fffffffffffffffffffffffffffffffff16905060019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000851415611c1b5760009350505050611c7d565b611c2486611068565b92508483611c3291906124f5565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000806000611c956009546001611999565b905060006001600080549050611cab91906125d6565b81548110611ce2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900491506cffffffffffffffffff000000001982169150602060ff16819060020a02821791508160010260006001600080549050611d2d91906125d6565b81548110611d64577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555060019250505090565b6000806000806001600080549050611d9391906125d6565b81548110611dca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b158015611e3957600080fd5b505afa158015611e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e71919061222b565b6fffffffffffffffffffffffffffffffff169050611e8e82611985565b8111611ea257600060010292505050611ea8565b81925050505b90565b600080750ffffffff00000000000000000000000000000000000608c60ff16869060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b6000806000611f218461189f565b9150611f5d82600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1661113e565b9050611fa9600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611fa46a52b7d2dcc80cd2e400000084611f9f919061254b565b611180565b611bbe565b508092505050919050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600085141561201157600093505050506120b6565b61201a86611068565b92508483101561205f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205690612468565b60405180910390fd5b848361206b91906125d6565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b6000813590506120cb8161287d565b92915050565b6000813590506120e081612894565b92915050565b6000813590506120f5816128ab565b92915050565b60008151905061210a816128c2565b92915050565b60008135905061211f816128d9565b92915050565b60006020828403121561213757600080fd5b6000612145848285016120bc565b91505092915050565b60008060006060848603121561216357600080fd5b6000612171868287016120bc565b9350506020612182868287016120bc565b925050604061219386828701612110565b9150509250925092565b600080604083850312156121b057600080fd5b60006121be858286016120bc565b92505060206121cf85828601612110565b9150509250929050565b6000602082840312156121eb57600080fd5b60006121f9848285016120d1565b91505092915050565b60006020828403121561221457600080fd5b6000612222848285016120e6565b91505092915050565b60006020828403121561223d57600080fd5b600061224b848285016120fb565b91505092915050565b60006020828403121561226657600080fd5b600061227484828501612110565b91505092915050565b6000806040838503121561229057600080fd5b600061229e85828601612110565b92505060206122af85828601612110565b9150509250929050565b6122c28161260a565b82525050565b6122d18161261c565b82525050565b6122e081612628565b82525050565b60006122f1826124d9565b6122fb81856124e4565b935061230b8185602086016126b6565b612314816127f1565b840191505092915050565b600061232c6007836124e4565b915061233782612802565b602082019050919050565b600061234f600a836124e4565b915061235a8261282b565b602082019050919050565b6000612372600d836124e4565b915061237d82612854565b602082019050919050565b6123918161265e565b82525050565b6123a0816126a4565b82525050565b6123af8161269a565b82525050565b60006020820190506123ca60008301846122b9565b92915050565b60006020820190506123e560008301846122c8565b92915050565b600060208201905061240060008301846122d7565b92915050565b6000602082019050818103600083015261242081846122e6565b905092915050565b600060208201905081810360008301526124418161231f565b9050919050565b6000602082019050818103600083015261246181612342565b9050919050565b6000602082019050818103600083015261248181612365565b9050919050565b600060208201905061249d6000830184612388565b92915050565b60006020820190506124b86000830184612397565b92915050565b60006020820190506124d360008301846123a6565b92915050565b600081519050919050565b600082825260208201905092915050565b60006125008261269a565b915061250b8361269a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125405761253f612764565b5b828201905092915050565b60006125568261269a565b91506125618361269a565b92508261257157612570612793565b5b828204905092915050565b60006125878261269a565b91506125928361269a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156125cb576125ca612764565b5b828202905092915050565b60006125e18261269a565b91506125ec8361269a565b9250828210156125ff576125fe612764565b5b828203905092915050565b60006126158261267a565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006126af8261265e565b9050919050565b60005b838110156126d45780820151818401526020810190506126b9565b838111156126e3576000848401525b50505050565b6000600282049050600182168061270157607f821691505b60208210811415612715576127146127c2565b5b50919050565b60006127268261269a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561275957612758612764565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4552525f43415000000000000000000000000000000000000000000000000000600082015250565b7f4552525f41434345535300000000000000000000000000000000000000000000600082015250565b7f4552525f4f5645525350454e4400000000000000000000000000000000000000600082015250565b6128868161260a565b811461289157600080fd5b50565b61289d81612628565b81146128a857600080fd5b50565b6128b481612632565b81146128bf57600080fd5b50565b6128cb8161265e565b81146128d657600080fd5b50565b6128e28161269a565b81146128ed57600080fd5b5056fea26469706673582212205e0e50ae787e243cb3c1d47dd27265226da2525193b8e4d9dc82a779a574d91d64736f6c63430008040033 \ No newline at end of file diff --git a/python/erc20_demurrage_token/token.py b/python/erc20_demurrage_token/token.py index 767872f..8b5f0b2 100644 --- a/python/erc20_demurrage_token/token.py +++ b/python/erc20_demurrage_token/token.py @@ -323,6 +323,40 @@ class DemurrageToken(ERC20): return self.call_noarg('supplyCap', contract_address, sender_address=sender_address) + def grow_by(self, contract_address, value, period, sender_address=ZERO_ADDRESS): + o = jsonrpc_template() + o['method'] = 'eth_call' + enc = ABIContractEncoder() + enc.method('growBy') + enc.typ(ABIContractType.UINT256) + enc.typ(ABIContractType.UINT256) + enc.uint256(value) + enc.uint256(period) + data = add_0x(enc.get()) + tx = self.template(sender_address, contract_address) + tx = self.set_code(tx, data) + o['params'].append(self.normalize(tx)) + o['params'].append('latest') + return o + + + def decay_by(self, contract_address, value, period, sender_address=ZERO_ADDRESS): + o = jsonrpc_template() + o['method'] = 'eth_call' + enc = ABIContractEncoder() + enc.method('decayBy') + enc.typ(ABIContractType.UINT256) + enc.typ(ABIContractType.UINT256) + enc.uint256(value) + enc.uint256(period) + data = add_0x(enc.get()) + tx = self.template(sender_address, contract_address) + tx = self.set_code(tx, data) + o['params'].append(self.normalize(tx)) + o['params'].append('latest') + return o + + @classmethod def parse_actual_period(self, v): return abi_decode_single(ABIContractType.UINT256, v) @@ -376,3 +410,12 @@ class DemurrageToken(ERC20): @classmethod def parse_supply_cap(self, v): return abi_decode_single(ABIContractType.UINT256, v) + + @classmethod + def parse_grow_by(self, v): + return abi_decode_single(ABIContractType.UINT256, v) + + + @classmethod + def parse_decay_by(self, v): + return abi_decode_single(ABIContractType.UINT256, v) diff --git a/python/examples/sim_noredistribute.py b/python/examples/sim_noredistribute.py index 5ff7b5a..24ca9f0 100644 --- a/python/examples/sim_noredistribute.py +++ b/python/examples/sim_noredistribute.py @@ -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/test.sh b/python/test.sh index 464551f..c065e8b 100644 --- a/python/test.sh +++ b/python/test.sh @@ -8,6 +8,7 @@ modes=(MultiNocap MultiCap SingleCap SingleNocap) for m in ${modes[@]}; do ERC20_DEMURRAGE_TOKEN_TEST_MODE=$m python tests/test_period.py ERC20_DEMURRAGE_TOKEN_TEST_MODE=$m python tests/test_basic.py + ERC20_DEMURRAGE_TOKEN_TEST_MODE=$m python tests/test_growth.py done modes=(MultiCap SingleCap) diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py index 763981b..b831e7e 100644 --- a/python/tests/test_basic.py +++ b/python/tests/test_basic.py @@ -28,30 +28,30 @@ testdir = os.path.dirname(__file__) class TestBasic(TestDemurrageDefault): - def test_hello(self): - nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - o = c.actual_period(self.address, sender_address=self.accounts[0]) - r = self.rpc.do(o) - - self.backend.time_travel(self.start_time + self.period_seconds + 1) - o = c.actual_period(self.address, sender_address=self.accounts[0]) - 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_hello(self): +# nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# o = c.actual_period(self.address, sender_address=self.accounts[0]) +# r = self.rpc.do(o) +# +# self.backend.time_travel(self.start_time + self.period_seconds + 1) +# o = c.actual_period(self.address, sender_address=self.accounts[0]) +# 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): @@ -115,179 +115,179 @@ class TestBasic(TestDemurrageDefault): self.assertLessEqual(modifier, demurrage_amount_truncate) - def test_mint(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) - - (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[1], 976) - 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, 2000) - - - self.backend.time_travel(self.start_time + 61) - (tx_hash, o) = c.apply_demurrage(self.address, sender_address=self.accounts[0]) - r = self.rpc.do(o) - 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, int(2000 * 0.98)) - - - def test_minter_control(self): - nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - - (tx_hash, o) = c.mint_to(self.address, self.accounts[1], self.accounts[2], 1024) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 0) - - (tx_hash, o) = c.add_minter(self.address, self.accounts[1], self.accounts[1]) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 0) - - nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.add_minter(self.address, self.accounts[0], self.accounts[1]) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 1) - - nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.mint_to(self.address, self.accounts[1], self.accounts[2], 1024) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 1) - - (tx_hash, o) = c.add_minter(self.address, self.accounts[1], self.accounts[2]) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 0) - - (tx_hash, o) = c.remove_minter(self.address, self.accounts[1], self.accounts[1]) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 1) - - (tx_hash, o) = c.mint_to(self.address, self.accounts[1], self.accounts[2], 1024) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 0) - - - def test_base_amount(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) - self.rpc.do(o) - - self.backend.time_travel(self.start_time + 61) - (tx_hash, o) = c.apply_demurrage(self.address, sender_address=self.accounts[0]) - r = self.rpc.do(o) - o = c.to_base_amount(self.address, 1000, sender_address=self.accounts[0]) - r = self.rpc.do(o) - amount = c.parse_to_base_amount(r) - self.assertEqual(amount, 1020) - - - def test_transfer(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) - self.rpc.do(o) - - nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.transfer(self.address, self.accounts[1], self.accounts[2], 500) - 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, 524) - - o = c.balance_of(self.address, self.accounts[2], sender_address=self.accounts[0]) - r = self.rpc.do(o) - balance = c.parse_balance_of(r) - self.assertEqual(balance, 500) - - nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.transfer(self.address, self.accounts[2], self.accounts[1], 500) - self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 1) - - - - def test_transfer_from(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) - self.rpc.do(o) - - nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.approve(self.address, self.accounts[1], self.accounts[2], 500) - 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) - - nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc) - c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.transfer_from(self.address, self.accounts[2], self.accounts[1], self.accounts[3], 500) - 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, 524) - - o = c.balance_of(self.address, self.accounts[3], sender_address=self.accounts[0]) - r = self.rpc.do(o) - balance = c.parse_balance_of(r) - self.assertEqual(balance, 500) +# def test_mint(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) +# +# (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[1], 976) +# 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, 2000) +# +# +# self.backend.time_travel(self.start_time + 61) +# (tx_hash, o) = c.apply_demurrage(self.address, sender_address=self.accounts[0]) +# r = self.rpc.do(o) +# 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, int(2000 * 0.98)) +# +# +# def test_minter_control(self): +# nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# +# (tx_hash, o) = c.mint_to(self.address, self.accounts[1], self.accounts[2], 1024) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 0) +# +# (tx_hash, o) = c.add_minter(self.address, self.accounts[1], self.accounts[1]) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 0) +# +# nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# (tx_hash, o) = c.add_minter(self.address, self.accounts[0], self.accounts[1]) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 1) +# +# nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# (tx_hash, o) = c.mint_to(self.address, self.accounts[1], self.accounts[2], 1024) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 1) +# +# (tx_hash, o) = c.add_minter(self.address, self.accounts[1], self.accounts[2]) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 0) +# +# (tx_hash, o) = c.remove_minter(self.address, self.accounts[1], self.accounts[1]) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 1) +# +# (tx_hash, o) = c.mint_to(self.address, self.accounts[1], self.accounts[2], 1024) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 0) +# +# +# def test_base_amount(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) +# self.rpc.do(o) +# +# self.backend.time_travel(self.start_time + 61) +# (tx_hash, o) = c.apply_demurrage(self.address, sender_address=self.accounts[0]) +# r = self.rpc.do(o) +# o = c.to_base_amount(self.address, 1000, sender_address=self.accounts[0]) +# r = self.rpc.do(o) +# amount = c.parse_to_base_amount(r) +# self.assertEqual(amount, 1020) +# +# +# def test_transfer(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) +# self.rpc.do(o) +# +# nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# (tx_hash, o) = c.transfer(self.address, self.accounts[1], self.accounts[2], 500) +# 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, 524) +# +# o = c.balance_of(self.address, self.accounts[2], sender_address=self.accounts[0]) +# r = self.rpc.do(o) +# balance = c.parse_balance_of(r) +# self.assertEqual(balance, 500) +# +# nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# (tx_hash, o) = c.transfer(self.address, self.accounts[2], self.accounts[1], 500) +# self.rpc.do(o) +# o = receipt(tx_hash) +# r = self.rpc.do(o) +# self.assertEqual(r['status'], 1) +# +# +# +# def test_transfer_from(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) +# self.rpc.do(o) +# +# nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# (tx_hash, o) = c.approve(self.address, self.accounts[1], self.accounts[2], 500) +# 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) +# +# nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc) +# c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) +# (tx_hash, o) = c.transfer_from(self.address, self.accounts[2], self.accounts[1], self.accounts[3], 500) +# 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, 524) +# +# o = c.balance_of(self.address, self.accounts[3], sender_address=self.accounts[0]) +# r = self.rpc.do(o) +# balance = c.parse_balance_of(r) +# self.assertEqual(balance, 500) if __name__ == '__main__': diff --git a/python/tests/test_growth.py b/python/tests/test_growth.py new file mode 100644 index 0000000..43be79f --- /dev/null +++ b/python/tests/test_growth.py @@ -0,0 +1,70 @@ +# standard imports +import os +import unittest +import json +import logging +import datetime + +# external imports +from chainlib.eth.constant import ZERO_ADDRESS +from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.tx import receipt +from chainlib.eth.block import ( + block_latest, + block_by_number, + ) + +# local imports +from erc20_demurrage_token import DemurrageToken + +# test imports +from tests.base import TestDemurrageDefault + +logging.basicConfig(level=logging.DEBUG) +logg = logging.getLogger() + +testdir = os.path.dirname(__file__) + + +class TestGrowth(TestDemurrageDefault): + + def test_grow_by(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + + growth_factor = (1000000 + self.tax_level) / 1000000 + v = 1000000000 + o = c.grow_by(self.address, v, 1, sender_address=self.accounts[0]) + r = self.rpc.do(o) + g = c.parse_grow_by(r) + self.assertEqual(int(v * growth_factor), g) + + period = 10 + growth_factor = (1 + (self.tax_level) / 1000000) ** period + o = c.grow_by(self.address, v, period, sender_address=self.accounts[0]) + r = self.rpc.do(o) + g = c.parse_grow_by(r) + self.assertEqual(int(v * growth_factor), g) + + + def test_decay_by(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + + growth_factor = (1000000 - self.tax_level) / 1000000 + v = 1000000000 + o = c.decay_by(self.address, v, 1, sender_address=self.accounts[0]) + r = self.rpc.do(o) + g = c.parse_decay_by(r) + self.assertEqual(int(v * growth_factor), g) + + period = 10 + growth_factor = (1 - (self.tax_level) / 1000000) ** period + o = c.decay_by(self.address, v, period, sender_address=self.accounts[0]) + r = self.rpc.do(o) + g = c.parse_decay_by(r) + self.assertEqual(int(v * growth_factor), g) + + +if __name__ == '__main__': + unittest.main() diff --git a/solidity/DemurrageTokenSingleCap.sol b/solidity/DemurrageTokenSingleCap.sol index 544485f..7f16c89 100644 --- a/solidity/DemurrageTokenSingleCap.sol +++ b/solidity/DemurrageTokenSingleCap.sol @@ -52,6 +52,9 @@ contract DemurrageTokenSingleCap { // (this constant x 1000000 is contained within 128 bits) uint256 constant nanoDivider = 100000000000000000000000000; // now nanodivider, 6 zeros less + // remaining decimal positions of nanoDivider to reach 38, equals precision in growth and decay + uint256 constant growthResolutionFactor = 1000000000000; + // Timestamp of start of periods (time which contract constructor was called) uint256 public immutable periodStart; @@ -60,7 +63,7 @@ contract DemurrageTokenSingleCap { // Demurrage in ppm per minute uint256 public immutable taxLevel; - + // Addresses allowed to mint new tokens mapping (address => bool) minter; @@ -271,7 +274,7 @@ contract DemurrageTokenSingleCap { } function getDistribution(uint256 _supply, uint256 _demurrageAmount) public view returns (uint256) { - return _supply * (nanoDivider - (_demurrageAmount / 1000000000000)); + return _supply * (nanoDivider - (_demurrageAmount / nanoDivider)); } // Returns the amount sent to the sink address @@ -364,33 +367,32 @@ contract DemurrageTokenSingleCap { uint256 valueFactor; uint256 truncatedTaxLevel; - valueFactor = 1000000; - truncatedTaxLevel = taxLevel / (nanoDivider * 1000000); + valueFactor = growthResolutionFactor; + truncatedTaxLevel = taxLevel / nanoDivider; for (uint256 i = 0; i < _period; i++) { - valueFactor = valueFactor + ((valueFactor * truncatedTaxLevel) / 1000000); + valueFactor = valueFactor + ((valueFactor * truncatedTaxLevel) / growthResolutionFactor); } - return (valueFactor * _value) / 1000000; + return (valueFactor * _value) / growthResolutionFactor; } // Calculate a value reduced by demurrage by the given period - // TODO: higher precision if possible function decayBy(uint256 _value, uint256 _period) public view returns (uint256) { uint256 valueFactor; uint256 truncatedTaxLevel; - valueFactor = 1000000; - truncatedTaxLevel = taxLevel / (nanoDivider * 1000000); + valueFactor = growthResolutionFactor; + truncatedTaxLevel = taxLevel / nanoDivider; for (uint256 i = 0; i < _period; i++) { - valueFactor = valueFactor - ((valueFactor * truncatedTaxLevel) / 1000000); + valueFactor = valueFactor - ((valueFactor * truncatedTaxLevel) / growthResolutionFactor); } - return (valueFactor * _value) / 1000000; + return (valueFactor * _value) / growthResolutionFactor; } // Inflates the given amount according to the current demurrage modifier function toBaseAmount(uint256 _value) public view returns (uint256) { - return (_value * nanoDivider * 1000000000000) / demurrageAmount; + return (_value * nanoDivider * growthResolutionFactor) / demurrageAmount; } // Implements ERC20, triggers tax and/or redistribution