From aeebdd348b371f8e87bf08fecc0f289045c102f5 Mon Sep 17 00:00:00 2001 From: nolash Date: Sat, 5 Jun 2021 08:45:37 +0200 Subject: [PATCH] Implement selectable deployment --- .../data/DemurrageTokenSingleNocap.bin | 2 +- python/erc20_demurrage_token/token.py | 5 ++ python/tests/base.py | 77 +++++++++++++------ python/tests/test_basic.py | 10 +-- python/tests/test_redistribution.py | 10 +-- python/tests/test_single.py | 30 +++++--- solidity/DemurrageTokenSingleNocap.sol | 2 +- 7 files changed, 88 insertions(+), 48 deletions(-) diff --git a/python/erc20_demurrage_token/data/DemurrageTokenSingleNocap.bin b/python/erc20_demurrage_token/data/DemurrageTokenSingleNocap.bin index d20ecfa..1d3f5b8 100644 --- a/python/erc20_demurrage_token/data/DemurrageTokenSingleNocap.bin +++ b/python/erc20_demurrage_token/data/DemurrageTokenSingleNocap.bin @@ -1 +1 @@ -60e06040523480156200001157600080fd5b50604051620039b5380380620039b583398181016040528101906200003791906200048e565b33600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600a6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555085600590805190602001906200010a92919062000327565b5084600690805190602001906200012392919062000327565b508360ff166007819055504260808181525050603c826200014591906200074d565b60a08181525050620f42406d04ee2d6d415b85acef81000000006200016b91906200074d565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600260106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508260c0818152505060006200020a6000620f4240600060016200029b640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460ff16600a62000288919062000610565b6009819055505050505050505062000994565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b82805462000335906200082f565b90600052602060002090601f016020900481019282620003595760008555620003a5565b82601f106200037457805160ff1916838001178555620003a5565b82800160010185558215620003a5579182015b82811115620003a457825182559160200191906001019062000387565b5b509050620003b49190620003b8565b5090565b5b80821115620003d3576000816000905550600101620003b9565b5090565b6000620003ee620003e8846200057f565b62000556565b9050828152602081018484840111156200040757600080fd5b62000414848285620007f9565b509392505050565b6000815190506200042d8162000946565b92915050565b600082601f8301126200044557600080fd5b815162000457848260208601620003d7565b91505092915050565b600081519050620004718162000960565b92915050565b60008151905062000488816200097a565b92915050565b60008060008060008060c08789031215620004a857600080fd5b600087015167ffffffffffffffff811115620004c357600080fd5b620004d189828a0162000433565b965050602087015167ffffffffffffffff811115620004ef57600080fd5b620004fd89828a0162000433565b95505060406200051089828a0162000477565b94505060606200052389828a0162000460565b93505060806200053689828a0162000460565b92505060a06200054989828a016200041c565b9150509295509295509295565b60006200056262000575565b905062000570828262000865565b919050565b6000604051905090565b600067ffffffffffffffff8211156200059d576200059c620008f9565b5b620005a88262000928565b9050602081019050919050565b6000808291508390505b60018511156200060757808604811115620005df57620005de6200089b565b5b6001851615620005ef5780820291505b8081029050620005ff8562000939565b9450620005bf565b94509492505050565b60006200061d82620007e2565b91506200062a83620007e2565b9250620006597fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000661565b905092915050565b60008262000673576001905062000746565b8162000683576000905062000746565b81600181146200069c5760028114620006a757620006dd565b600191505062000746565b60ff841115620006bc57620006bb6200089b565b5b8360020a915084821115620006d657620006d56200089b565b5b5062000746565b5060208310610133831016604e8410600b8410161715620007175782820a9050838111156200071157620007106200089b565b5b62000746565b620007268484846001620005b5565b9250905081840481111562000740576200073f6200089b565b5b81810290505b9392505050565b60006200075a82620007e2565b91506200076783620007e2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615620007a357620007a26200089b565b5b828202905092915050565b6000620007bb82620007c2565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101562000819578082015181840152602081019050620007fc565b8381111562000829576000848401525b50505050565b600060028204905060018216806200084857607f821691505b602082108114156200085f576200085e620008ca565b5b50919050565b620008708262000928565b810181811067ffffffffffffffff82111715620008925762000891620008f9565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6000600282049050919050565b6200095181620007ae565b81146200095d57600080fd5b50565b6200096b81620007e2565b81146200097757600080fd5b50565b6200098581620007ec565b81146200099157600080fd5b50565b60805160a05160c051612fb9620009fc60003960008181610c9e01528181610eef01528181611bdb01528181612216015261224e0152600081816111eb01528181611b890152611c7601526000818161121701528181611c970152611cdc0152612fb96000f3fe608060405234801561001057600080fd5b506004361061025a576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be11610158578063983b2d56116100d5578063e3ab207a11610099578063e3ab207a146107c3578063e54d63f7146107f3578063e809529514610823578063eda4e6d614610841578063f2fde38b1461085f5761025a565b8063983b2d56146106f75780639da7d8ba14610727578063a2119e2f14610757578063a9059cbb14610775578063b470aade146107a55761025a565b8063731f237c1161011c578063731f237c1461066157806379ba50971461067f5780638da5cb5b1461069d5780638f1df6bc146106bb57806395d89b41146106d95761025a565b80636787a9be146105715780636a2d094e146105a15780636d5055a6146105d15780636ffa8a051461060157806370a08231146106315761025a565b80633092afd5116101e657806340fc89f5116101aa57806340fc89f514610493578063449a52f8146104c357806347a50517146104f35780634abfbba214610523578063573cc507146105535761025a565b80633092afd5146103b557806331333487146103e5578063313ce5671461041557806335b16eb81461043357806340452d91146104635761025a565b806318160ddd1161022d57806318160ddd146102fb5780631989c6a814610319578063216ea5ec14610337578063229ba1971461036757806323b872dd146103855761025a565b806301ffc9a71461025f57806306fdde031461028f578063095ea7b3146102ad57806309f28f3c146102dd575b600080fd5b61027960048036038101906102749190612861565b61088f565b6040516102869190612a2f565b60405180910390f35b610297610a3a565b6040516102a49190612a65565b60405180910390f35b6102c760048036038101906102c291906127fc565b610ac8565b6040516102d49190612a2f565b60405180910390f35b6102e5610be2565b6040516102f29190612ae7565b60405180910390f35b610303610c04565b6040516103109190612b1d565b60405180910390f35b610321610c0a565b60405161032e9190612b1d565b60405180910390f35b610351600480360381019061034c91906128dc565b610c16565b60405161035e9190612b1d565b60405180910390f35b61036f610c9c565b60405161037c9190612b1d565b60405180910390f35b61039f600480360381019061039a91906127ad565b610cc0565b6040516103ac9190612a2f565b60405180910390f35b6103cf60048036038101906103ca9190612784565b610de0565b6040516103dc9190612a2f565b60405180910390f35b6103ff60048036038101906103fa91906128dc565b610ed3565b60405161040c9190612b1d565b60405180910390f35b61041d610f84565b60405161042a9190612b1d565b60405180910390f35b61044d60048036038101906104489190612784565b610f8a565b60405161045a9190612a2f565b60405180910390f35b61047d600480360381019061047891906128b3565b611038565b60405161048a9190612a4a565b60405180910390f35b6104ad60048036038101906104a89190612838565b61105c565b6040516104ba9190612b1d565b60405180910390f35b6104dd60048036038101906104d891906127fc565b61108d565b6040516104ea9190612a2f565b60405180910390f35b61050d60048036038101906105089190612784565b61118f565b60405161051a9190612b1d565b60405180910390f35b61053d600480360381019061053891906128b3565b6111e7565b60405161054a9190612b1d565b60405180910390f35b61055b611247565b6040516105689190612b1d565b60405180910390f35b61058b600480360381019061058691906128b3565b61124d565b6040516105989190612b1d565b60405180910390f35b6105bb60048036038101906105b691906128b3565b6112b9565b6040516105c89190612b1d565b60405180910390f35b6105eb60048036038101906105e69190612784565b6112da565b6040516105f89190612b1d565b60405180910390f35b61061b60048036038101906106169190612838565b611345565b6040516106289190612b1d565b60405180910390f35b61064b60048036038101906106469190612784565b611378565b6040516106589190612b1d565b60405180910390f35b610669611459565b6040516106769190612a2f565b60405180910390f35b610687611607565b6040516106949190612a2f565b60405180910390f35b6106a56117ae565b6040516106b29190612a14565b60405180910390f35b6106c36117d4565b6040516106d09190612a2f565b60405180910390f35b6106e1611958565b6040516106ee9190612a65565b60405180910390f35b610711600480360381019061070c9190612784565b6119e6565b60405161071e9190612a2f565b60405180910390f35b610741600480360381019061073c9190612838565b611aa3565b60405161074e9190612b1d565b60405180910390f35b61075f611acf565b60405161076c9190612ae7565b60405180910390f35b61078f600480360381019061078a91906127fc565b611af1565b60405161079c9190612a2f565b60405180910390f35b6107ad611b87565b6040516107ba9190612b1d565b60405180910390f35b6107dd60048036038101906107d89190612838565b611bab565b6040516107ea9190612b1d565b60405180910390f35b61080d600480360381019061080891906128dc565b611bbf565b60405161081a9190612b1d565b60405180910390f35b61082b611c70565b6040516108389190612ae7565b60405180910390f35b610849611cda565b6040516108569190612b1d565b60405180910390f35b61087960048036038101906108749190612784565b611cfe565b6040516108869190612a2f565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108e45760019050610a35565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109375760019050610a35565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561098a5760019050610a35565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109dd5760019050610a35565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610a305760019050610a35565b600090505b919050565b60058054610a4790612d7c565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7390612d7c565b8015610ac05780601f10610a9557610100808354040283529160200191610ac0565b820191906000526020600020905b815481529060010190602001808311610aa357829003601f168201915b505050505081565b600080610ad36117d4565b50610add8361124d565b905080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b6b9190612b54565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610bcf9190612b1d565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60085481565b60008080549050905090565b600080600080851415610c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5590612a87565b60405180910390fd5b838510610c6a57600080fd5b8484610c769190612baa565b91508482610c849190612bdb565b90508084610c929190612c69565b9250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610ccd6117d4565b50610cd78461124d565b915081600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610d6257600080fd5b610d6d868684611da0565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610dcc9190612b1d565b60405180910390a380925050509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610e6957503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610e7257600080fd5b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000610f189190612baa565b905060005b84811015610f5f57620f42408284610f359190612bdb565b610f3f9190612baa565b83610f4a9190612c69565b92508080610f5790612dae565b915050610f1d565b50620f42408583610f709190612bdb565b610f7a9190612baa565b9250505092915050565b60075481565b600080610f96836112da565b90506000811480610fc05750610faa611c70565b6fffffffffffffffffffffffffffffffff168110155b15610fcf576000915050611033565b6cffffffff00000000000000000019600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254169250508190555060019150505b919050565b6000818154811061104857600080fd5b906000526020600020016000915090505481565b6000606860ff16710fffffffff00000000000000000000000000836001900416908060020a82049150509050919050565b600080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166110e657600080fd5b6110ee6117d4565b5082905082600860008282546111049190612b54565b925050819055506111158482611e44565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f8856040516111739190612b1d565b60405180910390a3611183611f59565b50600191505092915050565b600068ffffffffffffffffff600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460019004169050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826112159190612bdb565b7f00000000000000000000000000000000000000000000000000000000000000006112409190612b54565b9050919050565b60095481565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16620f42406d04ee2d6d415b85acef81000000008461129e9190612bdb565b6112a89190612bdb565b6112b29190612baa565b9050919050565b6000603c82426112c99190612c69565b6112d39190612baa565b9050919050565b6000604860ff166cffffffff000000000000000000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900416908060020a82049150509050919050565b6000608c60ff1673fffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b6000806000806113878561118f565b9250600260109054906101000a90046fffffffffffffffffffffffffffffffff166113b0611c70565b6113ba9190612c35565b6fffffffffffffffffffffffffffffffff169050611408600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610ed3565b6fffffffffffffffffffffffffffffffff169150620f42406d04ee2d6d415b85acef81000000006114399190612bdb565b82846114459190612bdb565b61144f9190612baa565b9350505050919050565b6000806000806000611469611c70565b9350600260109054906101000a90046fffffffffffffffffffffffffffffffff16846114959190612c35565b92506000836fffffffffffffffffffffffffffffffff1614156114bf576000945050505050611604565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16915061150e82846fffffffffffffffffffffffffffffffff16610ed3565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555083600260106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555081836fffffffffffffffffffffffffffffffff16856fffffffffffffffffffffffffffffffff167fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff166040516115f39190612b02565b60405180910390a460019450505050505b90565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461166457600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060008060006117ed612041565b995060006001028a141561180e5760009a5050505050505050505050611955565b6118178a611bab565b97506001886118269190612b54565b9050611831886111e7565b915061183b611459565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611878826112b9565b925060008311156118ad576d04ee2d6d415b85acef810000000061189c8685611bbf565b6118a69190612baa565b93506118ca565b6d04ee2d6d415b85acef8100000000856118c79190612baa565b93505b6118d960008560085484612171565b9850600089908060018154018082558091505060019003906000526020600020016000909190919091505561190d8a6121fd565b95507f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161193e9190612b1d565b60405180910390a160019a50505050505050505050505b90565b6006805461196590612d7c565b80601f016020809104026020016040519081016040528092919081815260200182805461199190612d7c565b80156119de5780601f106119b3576101008083540402835291602001916119de565b820191906000526020600020905b8154815290600101906020018083116119c157829003601f168201915b505050505081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a4257600080fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b600260109054906101000a90046fffffffffffffffffffffffffffffffff1681565b6000806000611afe6117d4565b50611b088461124d565b9150611b15338684611da0565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051611b749190612b1d565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000611c049190612baa565b905060005b84811015611c4b57620f42408284611c219190612bdb565b611c2b9190612baa565b83611c369190612b54565b92508080611c4390612dae565b915050611c09565b50620f42408583611c5c9190612bdb565b611c669190612baa565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611cc19190612c69565b611ccb9190612baa565b611cd59190612b54565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d5a57600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080611dad85846123f0565b50611db88484611e44565b50611dc1611c70565b6fffffffffffffffffffffffffffffffff1690506009548310158015611def575080611dec866112da565b14155b8015611e2757508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15611e3857611e368582612521565b505b60019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900490506000851415611ea55760009350505050611f53565b611eae8661118f565b92508483611ebc9190612b54565b91508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1611611f2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f2390612ac7565b60405180910390fd5b68ffffffffffffffffff198116905068ffffffffffffffffff821681179050600193505050505b92915050565b60008060006001600080549050611f709190612c69565b81548110611fa7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900490506cffffffffffffffffff000000001981169050602060ff166008549060020a02811790508060010260006001600080549050611ff49190612c69565b8154811061202b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600191505090565b60008060008060016000805490506120599190612c69565b81548110612090577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b1580156120ff57600080fd5b505afa158015612113573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612137919061288a565b6fffffffffffffffffffffffffffffffff16905061215482611bab565b81116121685760006001029250505061216e565b81925050505b90565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b600080600080600061220e86611aa3565b9350620f42407f0000000000000000000000000000000000000000000000000000000000000000856122409190612bdb565b61224a9190612baa565b91507f0000000000000000000000000000000000000000000000000000000000000000620f42408361227c9190612bdb565b6122869190612baa565b90508381101561239e5761229986611bab565b9250710fffffffff000000000000000000000000001960010260006001856122c19190612c69565b815481106122f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160008282541692505081905550606860ff1660019060020a027f800000000000000000000000000000000000000000000000000000000000000017600102600060018561234f9190612c69565b81548110612386577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001600082825417925050819055505b6123e3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166d04ee2d6d415b85acef8100000000846123de9190612baa565b611e44565b5081945050505050919050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900490506000851415612451576000935050505061251b565b61245a8661118f565b92508483101561249f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161249690612aa7565b60405180910390fd5b84836124ab9190612c69565b915068ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60006cffffffff00000000000000000019600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825416925050819055506cffffffff000000000000000000604860ff16839060020a0216600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825417925050819055506125f26125fd565b506001905092915050565b600080600080600060016000805490506126179190612c69565b8154811061264e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154925060016126668461105c565b6126709190612b54565b905082600190049150710fffffffff000000000000000000000000001982169150710fffffffff00000000000000000000000000606860ff16829060020a02168217915081600102600060016000805490506126cc9190612c69565b81548110612703577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055506001935050505090565b60008135905061272a81612f10565b92915050565b60008135905061273f81612f27565b92915050565b60008135905061275481612f3e565b92915050565b60008151905061276981612f55565b92915050565b60008135905061277e81612f6c565b92915050565b60006020828403121561279657600080fd5b60006127a48482850161271b565b91505092915050565b6000806000606084860312156127c257600080fd5b60006127d08682870161271b565b93505060206127e18682870161271b565b92505060406127f28682870161276f565b9150509250925092565b6000806040838503121561280f57600080fd5b600061281d8582860161271b565b925050602061282e8582860161276f565b9150509250929050565b60006020828403121561284a57600080fd5b600061285884828501612730565b91505092915050565b60006020828403121561287357600080fd5b600061288184828501612745565b91505092915050565b60006020828403121561289c57600080fd5b60006128aa8482850161275a565b91505092915050565b6000602082840312156128c557600080fd5b60006128d38482850161276f565b91505092915050565b600080604083850312156128ef57600080fd5b60006128fd8582860161276f565b925050602061290e8582860161276f565b9150509250929050565b61292181612c9d565b82525050565b61293081612caf565b82525050565b61293f81612cbb565b82525050565b600061295082612b38565b61295a8185612b43565b935061296a818560208601612d49565b61297381612e84565b840191505092915050565b600061298b601183612b43565b915061299682612e95565b602082019050919050565b60006129ae600d83612b43565b91506129b982612ebe565b602082019050919050565b60006129d1600d83612b43565b91506129dc82612ee7565b602082019050919050565b6129f081612cf1565b82525050565b6129ff81612d37565b82525050565b612a0e81612d2d565b82525050565b6000602082019050612a296000830184612918565b92915050565b6000602082019050612a446000830184612927565b92915050565b6000602082019050612a5f6000830184612936565b92915050565b60006020820190508181036000830152612a7f8184612945565b905092915050565b60006020820190508181036000830152612aa08161297e565b9050919050565b60006020820190508181036000830152612ac0816129a1565b9050919050565b60006020820190508181036000830152612ae0816129c4565b9050919050565b6000602082019050612afc60008301846129e7565b92915050565b6000602082019050612b1760008301846129f6565b92915050565b6000602082019050612b326000830184612a05565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612b5f82612d2d565b9150612b6a83612d2d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612b9f57612b9e612df7565b5b828201905092915050565b6000612bb582612d2d565b9150612bc083612d2d565b925082612bd057612bcf612e26565b5b828204905092915050565b6000612be682612d2d565b9150612bf183612d2d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c2a57612c29612df7565b5b828202905092915050565b6000612c4082612cf1565b9150612c4b83612cf1565b925082821015612c5e57612c5d612df7565b5b828203905092915050565b6000612c7482612d2d565b9150612c7f83612d2d565b925082821015612c9257612c91612df7565b5b828203905092915050565b6000612ca882612d0d565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000612d4282612cf1565b9050919050565b60005b83811015612d67578082015181840152602081019050612d4c565b83811115612d76576000848401525b50505050565b60006002820490506001821680612d9457607f821691505b60208210811415612da857612da7612e55565b5b50919050565b6000612db982612d2d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dec57612deb612df7565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4552525f4e554d50415254535f5a45524f000000000000000000000000000000600082015250565b7f4552525f4f5645525350454e4400000000000000000000000000000000000000600082015250565b7f4552525f574f554c445752415000000000000000000000000000000000000000600082015250565b612f1981612c9d565b8114612f2457600080fd5b50565b612f3081612cbb565b8114612f3b57600080fd5b50565b612f4781612cc5565b8114612f5257600080fd5b50565b612f5e81612cf1565b8114612f6957600080fd5b50565b612f7581612d2d565b8114612f8057600080fd5b5056fea2646970667358221220a418f3836db11876504f1b6d21ca04fa04215e4280eb811bf206fb54db6d0f6564736f6c63430008040033 \ No newline at end of file +60e06040523480156200001157600080fd5b50604051620039fc380380620039fc83398181016040528101906200003791906200048e565b33600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600a6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555085600590805190602001906200010a92919062000327565b5084600690805190602001906200012392919062000327565b508360ff166007819055504260808181525050603c826200014591906200074d565b60a08181525050620f42406d04ee2d6d415b85acef81000000006200016b91906200074d565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506001600260106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055508260c0818152505060006200020a6000620f4240600060016200029b640100000000026401000000009004565b9050600081908060018154018082558091505060019003906000526020600020016000909190919091505581600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508460ff16600a62000288919062000610565b6009819055505050505050505062000994565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b82805462000335906200082f565b90600052602060002090601f016020900481019282620003595760008555620003a5565b82601f106200037457805160ff1916838001178555620003a5565b82800160010185558215620003a5579182015b82811115620003a457825182559160200191906001019062000387565b5b509050620003b49190620003b8565b5090565b5b80821115620003d3576000816000905550600101620003b9565b5090565b6000620003ee620003e8846200057f565b62000556565b9050828152602081018484840111156200040757600080fd5b62000414848285620007f9565b509392505050565b6000815190506200042d8162000946565b92915050565b600082601f8301126200044557600080fd5b815162000457848260208601620003d7565b91505092915050565b600081519050620004718162000960565b92915050565b60008151905062000488816200097a565b92915050565b60008060008060008060c08789031215620004a857600080fd5b600087015167ffffffffffffffff811115620004c357600080fd5b620004d189828a0162000433565b965050602087015167ffffffffffffffff811115620004ef57600080fd5b620004fd89828a0162000433565b95505060406200051089828a0162000477565b94505060606200052389828a0162000460565b93505060806200053689828a0162000460565b92505060a06200054989828a016200041c565b9150509295509295509295565b60006200056262000575565b905062000570828262000865565b919050565b6000604051905090565b600067ffffffffffffffff8211156200059d576200059c620008f9565b5b620005a88262000928565b9050602081019050919050565b6000808291508390505b60018511156200060757808604811115620005df57620005de6200089b565b5b6001851615620005ef5780820291505b8081029050620005ff8562000939565b9450620005bf565b94509492505050565b60006200061d82620007e2565b91506200062a83620007e2565b9250620006597fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000661565b905092915050565b60008262000673576001905062000746565b8162000683576000905062000746565b81600181146200069c5760028114620006a757620006dd565b600191505062000746565b60ff841115620006bc57620006bb6200089b565b5b8360020a915084821115620006d657620006d56200089b565b5b5062000746565b5060208310610133831016604e8410600b8410161715620007175782820a9050838111156200071157620007106200089b565b5b62000746565b620007268484846001620005b5565b9250905081840481111562000740576200073f6200089b565b5b81810290505b9392505050565b60006200075a82620007e2565b91506200076783620007e2565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615620007a357620007a26200089b565b5b828202905092915050565b6000620007bb82620007c2565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101562000819578082015181840152602081019050620007fc565b8381111562000829576000848401525b50505050565b600060028204905060018216806200084857607f821691505b602082108114156200085f576200085e620008ca565b5b50919050565b620008708262000928565b810181811067ffffffffffffffff82111715620008925762000891620008f9565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6000600282049050919050565b6200095181620007ae565b81146200095d57600080fd5b50565b6200096b81620007e2565b81146200097757600080fd5b50565b6200098581620007ec565b81146200099157600080fd5b50565b60805160a05160c051613000620009fc60003960008181610c9e01528181610eef01528181611bdb0152818161225d01526122950152600081816111eb01528181611b890152611c7601526000818161121701528181611c970152611cdc01526130006000f3fe608060405234801561001057600080fd5b506004361061025a576000357c0100000000000000000000000000000000000000000000000000000000900480636787a9be11610158578063983b2d56116100d5578063e3ab207a11610099578063e3ab207a146107c3578063e54d63f7146107f3578063e809529514610823578063eda4e6d614610841578063f2fde38b1461085f5761025a565b8063983b2d56146106f75780639da7d8ba14610727578063a2119e2f14610757578063a9059cbb14610775578063b470aade146107a55761025a565b8063731f237c1161011c578063731f237c1461066157806379ba50971461067f5780638da5cb5b1461069d5780638f1df6bc146106bb57806395d89b41146106d95761025a565b80636787a9be146105715780636a2d094e146105a15780636d5055a6146105d15780636ffa8a051461060157806370a08231146106315761025a565b80633092afd5116101e657806340fc89f5116101aa57806340fc89f514610493578063449a52f8146104c357806347a50517146104f35780634abfbba214610523578063573cc507146105535761025a565b80633092afd5146103b557806331333487146103e5578063313ce5671461041557806335b16eb81461043357806340452d91146104635761025a565b806318160ddd1161022d57806318160ddd146102fb5780631989c6a814610319578063216ea5ec14610337578063229ba1971461036757806323b872dd146103855761025a565b806301ffc9a71461025f57806306fdde031461028f578063095ea7b3146102ad57806309f28f3c146102dd575b600080fd5b610279600480360381019061027491906128a8565b61088f565b6040516102869190612a76565b60405180910390f35b610297610a3a565b6040516102a49190612aac565b60405180910390f35b6102c760048036038101906102c29190612843565b610ac8565b6040516102d49190612a76565b60405180910390f35b6102e5610be2565b6040516102f29190612b2e565b60405180910390f35b610303610c04565b6040516103109190612b64565b60405180910390f35b610321610c0a565b60405161032e9190612b64565b60405180910390f35b610351600480360381019061034c9190612923565b610c16565b60405161035e9190612b64565b60405180910390f35b61036f610c9c565b60405161037c9190612b64565b60405180910390f35b61039f600480360381019061039a91906127f4565b610cc0565b6040516103ac9190612a76565b60405180910390f35b6103cf60048036038101906103ca91906127cb565b610de0565b6040516103dc9190612a76565b60405180910390f35b6103ff60048036038101906103fa9190612923565b610ed3565b60405161040c9190612b64565b60405180910390f35b61041d610f84565b60405161042a9190612b64565b60405180910390f35b61044d600480360381019061044891906127cb565b610f8a565b60405161045a9190612a76565b60405180910390f35b61047d600480360381019061047891906128fa565b611038565b60405161048a9190612a91565b60405180910390f35b6104ad60048036038101906104a8919061287f565b61105c565b6040516104ba9190612b64565b60405180910390f35b6104dd60048036038101906104d89190612843565b61108d565b6040516104ea9190612a76565b60405180910390f35b61050d600480360381019061050891906127cb565b61118f565b60405161051a9190612b64565b60405180910390f35b61053d600480360381019061053891906128fa565b6111e7565b60405161054a9190612b64565b60405180910390f35b61055b611247565b6040516105689190612b64565b60405180910390f35b61058b600480360381019061058691906128fa565b61124d565b6040516105989190612b64565b60405180910390f35b6105bb60048036038101906105b691906128fa565b6112b9565b6040516105c89190612b64565b60405180910390f35b6105eb60048036038101906105e691906127cb565b6112da565b6040516105f89190612b64565b60405180910390f35b61061b6004803603810190610616919061287f565b611345565b6040516106289190612b64565b60405180910390f35b61064b600480360381019061064691906127cb565b611378565b6040516106589190612b64565b60405180910390f35b610669611459565b6040516106769190612a76565b60405180910390f35b610687611607565b6040516106949190612a76565b60405180910390f35b6106a56117ae565b6040516106b29190612a5b565b60405180910390f35b6106c36117d4565b6040516106d09190612a76565b60405180910390f35b6106e1611958565b6040516106ee9190612aac565b60405180910390f35b610711600480360381019061070c91906127cb565b6119e6565b60405161071e9190612a76565b60405180910390f35b610741600480360381019061073c919061287f565b611aa3565b60405161074e9190612b64565b60405180910390f35b61075f611acf565b60405161076c9190612b2e565b60405180910390f35b61078f600480360381019061078a9190612843565b611af1565b60405161079c9190612a76565b60405180910390f35b6107ad611b87565b6040516107ba9190612b64565b60405180910390f35b6107dd60048036038101906107d8919061287f565b611bab565b6040516107ea9190612b64565b60405180910390f35b61080d60048036038101906108089190612923565b611bbf565b60405161081a9190612b64565b60405180910390f35b61082b611c70565b6040516108389190612b2e565b60405180910390f35b610849611cda565b6040516108569190612b64565b60405180910390f35b610879600480360381019061087491906127cb565b611cfe565b6040516108869190612a76565b60405180910390f35b600063c6bb4b707c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156108e45760019050610a35565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109375760019050610a35565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561098a5760019050610a35565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156109dd5760019050610a35565b6337a47be47c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415610a305760019050610a35565b600090505b919050565b60058054610a4790612dc3565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7390612dc3565b8015610ac05780601f10610a9557610100808354040283529160200191610ac0565b820191906000526020600020905b815481529060010190602001808311610aa357829003601f168201915b505050505081565b600080610ad36117d4565b50610add8361124d565b905080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b6b9190612b9b565b925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610bcf9190612b64565b60405180910390a3600191505092915050565b600260009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60085481565b60008080549050905090565b600080600080851415610c5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5590612ace565b60405180910390fd5b838510610c6a57600080fd5b8484610c769190612bf1565b91508482610c849190612c22565b90508084610c929190612cb0565b9250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806000610ccd6117d4565b50610cd78461124d565b915081600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610d6257600080fd5b610d6d868684611da0565b90508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610dcc9190612b64565b60405180910390a380925050509392505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610e6957503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b610e7257600080fd5b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000610f189190612bf1565b905060005b84811015610f5f57620f42408284610f359190612c22565b610f3f9190612bf1565b83610f4a9190612cb0565b92508080610f5790612df5565b915050610f1d565b50620f42408583610f709190612c22565b610f7a9190612bf1565b9250505092915050565b60075481565b600080610f96836112da565b90506000811480610fc05750610faa611c70565b6fffffffffffffffffffffffffffffffff168110155b15610fcf576000915050611033565b6cffffffff00000000000000000019600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254169250508190555060019150505b919050565b6000818154811061104857600080fd5b906000526020600020016000915090505481565b6000606860ff16710fffffffff00000000000000000000000000836001900416908060020a82049150509050919050565b600080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166110e657600080fd5b6110ee6117d4565b5082905082600860008282546111049190612b9b565b925050819055506111158482611e44565b508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f8856040516111739190612b64565b60405180910390a3611183611fa0565b50600191505092915050565b600068ffffffffffffffffff600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460019004169050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000826112159190612c22565b7f00000000000000000000000000000000000000000000000000000000000000006112409190612b9b565b9050919050565b60095481565b6000600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16620f42406d04ee2d6d415b85acef81000000008461129e9190612c22565b6112a89190612c22565b6112b29190612bf1565b9050919050565b6000603c82426112c99190612cb0565b6112d39190612bf1565b9050919050565b6000604860ff166cffffffff000000000000000000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900416908060020a82049150509050919050565b6000608c60ff1673fffff00000000000000000000000000000000000836001900416908060020a82049150509050919050565b6000806000806113878561118f565b9250600260109054906101000a90046fffffffffffffffffffffffffffffffff166113b0611c70565b6113ba9190612c7c565b6fffffffffffffffffffffffffffffffff169050611408600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1682610ed3565b6fffffffffffffffffffffffffffffffff169150620f42406d04ee2d6d415b85acef81000000006114399190612c22565b82846114459190612c22565b61144f9190612bf1565b9350505050919050565b6000806000806000611469611c70565b9350600260109054906101000a90046fffffffffffffffffffffffffffffffff16846114959190612c7c565b92506000836fffffffffffffffffffffffffffffffff1614156114bf576000945050505050611604565b600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16915061150e82846fffffffffffffffffffffffffffffffff16610ed3565b600260006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555083600260106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555081836fffffffffffffffffffffffffffffffff16856fffffffffffffffffffffffffffffffff167fa0717e54e02bd9829db5e6e998aec0ae9de796b8d150a3cc46a92ab869697755600260009054906101000a90046fffffffffffffffffffffffffffffffff166040516115f39190612b49565b60405180910390a460019450505050505b90565b600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461166457600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060008060006117ed612088565b995060006001028a141561180e5760009a5050505050505050505050611955565b6118178a611bab565b97506001886118269190612b9b565b9050611831886111e7565b915061183b611459565b50600260009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169450611878826112b9565b925060008311156118ad576d04ee2d6d415b85acef810000000061189c8685611bbf565b6118a69190612bf1565b93506118ca565b6d04ee2d6d415b85acef8100000000856118c79190612bf1565b93505b6118d9600085600854846121b8565b9850600089908060018154018082558091505060019003906000526020600020016000909190919091505561190d8a612244565b95507f55d243082e019fce4009ccea5368b92e436c17586a1e793c7deda16df4e5d6758160405161193e9190612b64565b60405180910390a160019a50505050505050505050505b90565b6006805461196590612dc3565b80601f016020809104026020016040519081016040528092919081815260200182805461199190612dc3565b80156119de5780601f106119b3576101008083540402835291602001916119de565b820191906000526020600020905b8154815290600101906020018083116119c157829003601f168201915b505050505081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a4257600080fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000602060ff166cffffffffffffffffff00000000836001900416908060020a82049150509050919050565b600260109054906101000a90046fffffffffffffffffffffffffffffffff1681565b6000806000611afe6117d4565b50611b088461124d565b9150611b15338684611da0565b90508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051611b749190612b64565b60405180910390a3809250505092915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600063ffffffff8260019004169050919050565b6000806000620f424091506d04ee2d6d415b85acef81000000007f0000000000000000000000000000000000000000000000000000000000000000611c049190612bf1565b905060005b84811015611c4b57620f42408284611c219190612c22565b611c2b9190612bf1565b83611c369190612b9b565b92508080611c4390612df5565b915050611c09565b50620f42408583611c5c9190612c22565b611c669190612bf1565b9250505092915050565b600060017f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000042611cc19190612cb0565b611ccb9190612bf1565b611cd59190612b9b565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d5a57600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550919050565b600080611dad8584612437565b50611db88484611e44565b50611dc1611c70565b6fffffffffffffffffffffffffffffffff1690506009548310158015611def575080611dec866112da565b14155b8015611e2757508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15611e3857611e368582612568565b505b60019150509392505050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001900490506000851415611ea55760009350505050611f9a565b611eae8661118f565b92508483611ebc9190612b9b565b91508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1611611f2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f2390612b0e565b60405180910390fd5b68ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60008060006001600080549050611fb79190612cb0565b81548110611fee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001546001900490506cffffffffffffffffff000000001981169050602060ff166008549060020a0281179050806001026000600160008054905061203b9190612cb0565b81548110612072577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600191505090565b60008060008060016000805490506120a09190612cb0565b815481106120d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015491503073ffffffffffffffffffffffffffffffffffffffff1663e80952956040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561214657600080fd5b505afa15801561215a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217e91906128d1565b6fffffffffffffffffffffffffffffffff16905061219b82611bab565b81116121af576000600102925050506121b5565b81925050505b90565b60008073fffff00000000000000000000000000000000000608c60ff16869060020a021660010281179050710fffffffff00000000000000000000000000606860ff16879060020a0216600102811790506cffffffffffffffffff00000000602060ff16859060020a02166001028117905063ffffffff83166001028117905080915050949350505050565b600080600080600061225586611aa3565b9350620f42407f0000000000000000000000000000000000000000000000000000000000000000856122879190612c22565b6122919190612bf1565b91507f0000000000000000000000000000000000000000000000000000000000000000620f4240836122c39190612c22565b6122cd9190612bf1565b9050838110156123e5576122e086611bab565b9250710fffffffff000000000000000000000000001960010260006001856123089190612cb0565b8154811061233f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160008282541692505081905550606860ff1660019060020a027f80000000000000000000000000000000000000000000000000000000000000001760010260006001856123969190612cb0565b815481106123cd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001600082825417925050819055505b61242a600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166d04ee2d6d415b85acef8100000000846124259190612bf1565b611e44565b5081945050505050919050565b600080600080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460019004905060008514156124985760009350505050612562565b6124a18661118f565b9250848310156124e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124dd90612aee565b60405180910390fd5b84836124f29190612cb0565b915068ffffffffffffffffff198116905068ffffffffffffffffff82168117905080600102600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600193505050505b92915050565b60006cffffffff00000000000000000019600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825416925050819055506cffffffff000000000000000000604860ff16839060020a0216600102600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282541792505081905550612639612644565b506001905092915050565b6000806000806000600160008054905061265e9190612cb0565b81548110612695577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154925060016126ad8461105c565b6126b79190612b9b565b905082600190049150710fffffffff000000000000000000000000001982169150710fffffffff00000000000000000000000000606860ff16829060020a02168217915081600102600060016000805490506127139190612cb0565b8154811061274a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001819055506001935050505090565b60008135905061277181612f57565b92915050565b60008135905061278681612f6e565b92915050565b60008135905061279b81612f85565b92915050565b6000815190506127b081612f9c565b92915050565b6000813590506127c581612fb3565b92915050565b6000602082840312156127dd57600080fd5b60006127eb84828501612762565b91505092915050565b60008060006060848603121561280957600080fd5b600061281786828701612762565b935050602061282886828701612762565b9250506040612839868287016127b6565b9150509250925092565b6000806040838503121561285657600080fd5b600061286485828601612762565b9250506020612875858286016127b6565b9150509250929050565b60006020828403121561289157600080fd5b600061289f84828501612777565b91505092915050565b6000602082840312156128ba57600080fd5b60006128c88482850161278c565b91505092915050565b6000602082840312156128e357600080fd5b60006128f1848285016127a1565b91505092915050565b60006020828403121561290c57600080fd5b600061291a848285016127b6565b91505092915050565b6000806040838503121561293657600080fd5b6000612944858286016127b6565b9250506020612955858286016127b6565b9150509250929050565b61296881612ce4565b82525050565b61297781612cf6565b82525050565b61298681612d02565b82525050565b600061299782612b7f565b6129a18185612b8a565b93506129b1818560208601612d90565b6129ba81612ecb565b840191505092915050565b60006129d2601183612b8a565b91506129dd82612edc565b602082019050919050565b60006129f5600d83612b8a565b9150612a0082612f05565b602082019050919050565b6000612a18600d83612b8a565b9150612a2382612f2e565b602082019050919050565b612a3781612d38565b82525050565b612a4681612d7e565b82525050565b612a5581612d74565b82525050565b6000602082019050612a70600083018461295f565b92915050565b6000602082019050612a8b600083018461296e565b92915050565b6000602082019050612aa6600083018461297d565b92915050565b60006020820190508181036000830152612ac6818461298c565b905092915050565b60006020820190508181036000830152612ae7816129c5565b9050919050565b60006020820190508181036000830152612b07816129e8565b9050919050565b60006020820190508181036000830152612b2781612a0b565b9050919050565b6000602082019050612b436000830184612a2e565b92915050565b6000602082019050612b5e6000830184612a3d565b92915050565b6000602082019050612b796000830184612a4c565b92915050565b600081519050919050565b600082825260208201905092915050565b6000612ba682612d74565b9150612bb183612d74565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be657612be5612e3e565b5b828201905092915050565b6000612bfc82612d74565b9150612c0783612d74565b925082612c1757612c16612e6d565b5b828204905092915050565b6000612c2d82612d74565b9150612c3883612d74565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c7157612c70612e3e565b5b828202905092915050565b6000612c8782612d38565b9150612c9283612d38565b925082821015612ca557612ca4612e3e565b5b828203905092915050565b6000612cbb82612d74565b9150612cc683612d74565b925082821015612cd957612cd8612e3e565b5b828203905092915050565b6000612cef82612d54565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000612d8982612d38565b9050919050565b60005b83811015612dae578082015181840152602081019050612d93565b83811115612dbd576000848401525b50505050565b60006002820490506001821680612ddb57607f821691505b60208210811415612def57612dee612e9c565b5b50919050565b6000612e0082612d74565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e3357612e32612e3e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f4552525f4e554d50415254535f5a45524f000000000000000000000000000000600082015250565b7f4552525f4f5645525350454e4400000000000000000000000000000000000000600082015250565b7f4552525f574f554c445752415000000000000000000000000000000000000000600082015250565b612f6081612ce4565b8114612f6b57600080fd5b50565b612f7781612d02565b8114612f8257600080fd5b50565b612f8e81612d0c565b8114612f9957600080fd5b50565b612fa581612d38565b8114612fb057600080fd5b50565b612fbc81612d74565b8114612fc757600080fd5b5056fea2646970667358221220c3b4a17d1d7e65ca7b2ba38249fb44fd72317bca4916116373f1016ec7f7f95f64736f6c63430008040033 \ No newline at end of file diff --git a/python/erc20_demurrage_token/token.py b/python/erc20_demurrage_token/token.py index adae5d6..94cda2f 100644 --- a/python/erc20_demurrage_token/token.py +++ b/python/erc20_demurrage_token/token.py @@ -42,6 +42,11 @@ class DemurrageToken(ERC20): __abi = {} __bytecode = {} + valid_modes = [ + 'MultiNocap', + 'SingleNocap', + 'MultiCap', + ] def constructor(self, sender_address, settings, redistribute=True, cap=0, tx_format=TxFormat.JSONRPC): if int(cap) < 0: diff --git a/python/tests/base.py b/python/tests/base.py index 44689ff..79a3ef5 100644 --- a/python/tests/base.py +++ b/python/tests/base.py @@ -1,5 +1,6 @@ # standard imports import logging +import os # external imports from chainlib.eth.unittest.ethtester import EthTesterCase @@ -37,7 +38,7 @@ class TestDemurrage(EthTesterCase): super(TestDemurrage, self).setUp() self.tax_level = TAX_LEVEL - self.period = PERIOD + self.period_seconds = PERIOD * 60 nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) self.settings = DemurrageTokenSettings() @@ -54,12 +55,38 @@ class TestDemurrage(EthTesterCase): o = block_by_number(self.start_block, include_tx=False) r = self.rpc.do(o) - logg.debug('r {}'.format(r)) + try: self.start_time = int(r['timestamp'], 16) except TypeError: self.start_time = int(r['timestamp']) + self.default_supply = 1000000000000 + self.default_supply_cap = self.default_supply * 10 + + + def deploy(self, interface, mode): + tx_hash = None + o = None + if mode == 'MultiNocap': + (tx_hash, o) = interface.constructor(self.accounts[0], self.settings, redistribute=True, cap=0) + elif mode == 'SingleNocap': + (tx_hash, o) = interface.constructor(self.accounts[0], self.settings, redistribute=False, cap=0) + elif mode == 'MultiCap': + (tx_hash, o) = interface.constructor(self.accounts[0], self.settings, redistribute=False, cap=self.default_supply_cap) + else: + raise ValueError('Invalid mode "{}", valid are {}'.format(mode, DeurrageToken.valid_modes)) + + r = self.rpc.do(o) + o = receipt(tx_hash) + r = self.rpc.do(o) + self.assertEqual(r['status'], 1) + self.start_block = r['block_number'] + self.address = r['contract_address'] + + o = block_by_number(r['block_number']) + r = self.rpc.do(o) + self.start_time = r['timestamp'] def tearDown(self): pass @@ -68,31 +95,33 @@ class TestDemurrage(EthTesterCase): class TestDemurrageDefault(TestDemurrage): - def __deploy(self, interface): - self.default_supply = 1000000000000 - self.supply_cap = self.default_supply * 10 - - (tx_hash, o) = interface.constructor(self.accounts[0], self.settings, redistribute=True, cap=0) - r = self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 1) - self.addresses['MultiNocap'] = r['contract_address'] - - (tx_hash, o) = interface.constructor(self.accounts[0], self.settings, redistribute=False, cap=0) - r = self.rpc.do(o) - o = receipt(tx_hash) - r = self.rpc.do(o) - self.assertEqual(r['status'], 1) - self.addresses['SingleNocap'] = r['contract_address'] - - def setUp(self): super(TestDemurrageDefault, self).setUp() nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - self.addresses = {} - self.__deploy(c) - self.address = self.addresses['MultiNocap'] + self.mode = os.environ.get('ERC20_DEMURRAGE_TOKEN_TEST_MODE') + if self.mode == None: + self.mode = 'MultiNocap' + + self.deploy(c, self.mode) + + logg.info('deployed with mode {}'.format(self.mode)) + + +class TestDemurrageSingleNocap(TestDemurrage): + + def setUp(self): + super(TestDemurrageSingleNocap, self).setUp() + + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + + self.mode = 'SingleNocap' + + self.deploy(c, self.mode) + + logg.info('deployed with mode {}'.format(self.mode)) + + diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py index 544dcfd..e30e8ba 100644 --- a/python/tests/test_basic.py +++ b/python/tests/test_basic.py @@ -16,7 +16,7 @@ from erc20_demurrage_token import DemurrageToken # test imports from tests.base import TestDemurrageDefault -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) logg = logging.getLogger() testdir = os.path.dirname(__file__) @@ -25,13 +25,12 @@ 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 + 61) + 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) @@ -47,13 +46,13 @@ class TestBasic(TestDemurrageDefault): demurrage_amount = c.parse_demurrage_amount(r) self.assertEqual(modifier, demurrage_amount) - self.backend.time_travel(self.start_time + 59) + self.backend.time_travel(self.start_time + self.period_seconds - 1) o = c.demurrage_amount(self.address, sender_address=self.accounts[0]) r = self.rpc.do(o) demurrage_amount = c.parse_demurrage_amount(r) self.assertEqual(modifier, demurrage_amount) - self.backend.time_travel(self.start_time + 61) + self.backend.time_travel(self.start_time + self.period_seconds + 1) (tx_hash, o) = c.apply_demurrage(self.address, sender_address=self.accounts[0]) r = self.rpc.do(o) o = c.demurrage_amount(self.address, sender_address=self.accounts[0]) @@ -99,7 +98,6 @@ class TestBasic(TestDemurrageDefault): 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) diff --git a/python/tests/test_redistribution.py b/python/tests/test_redistribution.py index df3b5f9..4aa01c4 100644 --- a/python/tests/test_redistribution.py +++ b/python/tests/test_redistribution.py @@ -77,7 +77,7 @@ class TestRedistribution(TestDemurrageDefault): (tx_hash, o) = c.transfer(self.address, self.accounts[1], external_address, 999999) r = self.rpc.do(o) - self.backend.time_travel(self.start_time + 61) + self.backend.time_travel(self.start_time + self.period_seconds + 1) o = c.redistributions(self.address, 0, sender_address=self.accounts[0]) r = self.rpc.do(o) @@ -106,7 +106,7 @@ class TestRedistribution(TestDemurrageDefault): (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[1], supply) r = self.rpc.do(o) - self.backend.time_travel(self.start_time + 61) + self.backend.time_travel(self.start_time + self.period_seconds + 1) (tx_hash, o) = c.apply_demurrage(self.address, self.accounts[0]) self.rpc.do(o) o = receipt(tx_hash) @@ -198,7 +198,7 @@ class TestRedistribution(TestDemurrageDefault): self.assertEqual(r['status'], 1) - self.backend.time_travel(self.start_time + 61) + self.backend.time_travel(self.start_time + self.period_seconds + 1) (tx_hash, o) = c.apply_demurrage(self.address, self.accounts[4]) self.rpc.do(o) @@ -261,7 +261,3 @@ class TestRedistribution(TestDemurrageDefault): self.assertEqual(spender_actual_balance, spender_new_decayed_balance) -if __name__ == '__main__': - unittest.main() - - diff --git a/python/tests/test_single.py b/python/tests/test_single.py index 76d452a..9399d59 100644 --- a/python/tests/test_single.py +++ b/python/tests/test_single.py @@ -18,7 +18,7 @@ from hexathon import ( from erc20_demurrage_token import DemurrageToken # test imports -from tests.base import TestDemurrageDefault +from tests.base import TestDemurrageSingleNocap logging.basicConfig(level=logging.DEBUG) logg = logging.getLogger() @@ -26,36 +26,48 @@ logg = logging.getLogger() testdir = os.path.dirname(__file__) -class TestRedistributionSingle(TestDemurrageDefault): +class TestRedistributionSingle(TestDemurrageSingleNocap): def test_single_even_if_multiple(self): + + mint_amount = 100000000 + 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], 100000000) - r = self.rpc.do(o) + for i in range(3): + (tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[i+1], mint_amount) + r = self.rpc.do(o) external_address = to_checksum_address('0x' + os.urandom(20).hex()) 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[1], external_address, 10000000) + (tx_hash, o) = c.transfer(self.address, self.accounts[2], external_address, int(mint_amount) * 0.1) r = self.rpc.do(o) nonce_oracle = RPCNonceOracle(self.accounts[3], self.rpc) c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) - (tx_hash, o) = c.transfer(self.address, self.accounts[2], external_address, 20000000) + (tx_hash, o) = c.transfer(self.address, self.accounts[3], external_address, int(mint_amount) * 0.2) r = self.rpc.do(o) - self.backend.time_travel(self.start_time + 61) - (tx_hash, o) = c.apply_demurrage(self.address, self.accounts[0]) + self.backend.time_travel(self.start_time + self.period_seconds + 1) + (tx_hash, o) = c.apply_demurrage(self.address, self.accounts[3]) self.rpc.do(o) o = receipt(tx_hash) rcpt = self.rpc.do(o) self.assertEqual(rcpt['status'], 1) - (tx_hash, o) = c.change_period(self.address, self.accounts[0]) + (tx_hash, o) = c.change_period(self.address, self.accounts[3]) 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, mint_amount - (mint_amount * (self.tax_level / 1000000))) + + +if __name__ == '__main__': + unittest.main() diff --git a/solidity/DemurrageTokenSingleNocap.sol b/solidity/DemurrageTokenSingleNocap.sol index 8369981..8602f8a 100644 --- a/solidity/DemurrageTokenSingleNocap.sol +++ b/solidity/DemurrageTokenSingleNocap.sol @@ -154,7 +154,6 @@ contract DemurrageTokenSingleNocap { /// Balance unmodified by demurrage function baseBalanceOf(address _account) public view returns (uint256) { return uint256(account[_account]) & maskAccountValue; - //return uint256(account[_account]); } /// Increases base balance for a single account @@ -174,6 +173,7 @@ contract DemurrageTokenSingleNocap { require(uint160(newBalance) > uint160(oldBalance), 'ERR_WOULDWRAP'); // revert if increase would result in a wrapped value workAccount &= (~maskAccountValue); workAccount |= (newBalance & maskAccountValue); + account[_account] = bytes32(workAccount); return true; }