commit 365c84d88b19d59e5ed3b464d6e9c03fd1a593d2
parent b5fbc778c040b4fdbd17381f5d7eae78dee52ad4
Author: lash <dev@holbrook.no>
Date: Thu, 27 Jul 2023 07:45:15 +0100
Add fee withdraw option
Diffstat:
9 files changed, 143 insertions(+), 20 deletions(-)
diff --git a/python/erc20_pool/data/SwapPool.bin b/python/erc20_pool/data/SwapPool.bin
@@ -1 +1 @@
-60a06040523480156200001157600080fd5b5060405162002a9c38038062002a9c83398181016040528101906200003791906200032a565b846006908162000048919062000641565b5083600790816200005a919062000641565b508260ff166080818152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600581905550505050505062000728565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6200012282620000d7565b810181811067ffffffffffffffff82111715620001445762000143620000e8565b5b80604052505050565b600062000159620000b9565b905062000167828262000117565b919050565b600067ffffffffffffffff8211156200018a5762000189620000e8565b5b6200019582620000d7565b9050602081019050919050565b60005b83811015620001c2578082015181840152602081019050620001a5565b60008484015250505050565b6000620001e5620001df846200016c565b6200014d565b905082815260208101848484011115620002045762000203620000d2565b5b62000211848285620001a2565b509392505050565b600082601f830112620002315762000230620000cd565b5b815162000243848260208601620001ce565b91505092915050565b600060ff82169050919050565b62000264816200024c565b81146200027057600080fd5b50565b600081519050620002848162000259565b92915050565b6000819050919050565b6200029f816200028a565b8114620002ab57600080fd5b50565b600081519050620002bf8162000294565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002f282620002c5565b9050919050565b6200030481620002e5565b81146200031057600080fd5b50565b6000815190506200032481620002f9565b92915050565b600080600080600060a08688031215620003495762000348620000c3565b5b600086015167ffffffffffffffff8111156200036a5762000369620000c8565b5b620003788882890162000219565b955050602086015167ffffffffffffffff8111156200039c576200039b620000c8565b5b620003aa8882890162000219565b9450506040620003bd8882890162000273565b9350506060620003d088828901620002ae565b9250506080620003e38882890162000313565b9150509295509295909350565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200044357607f821691505b602082108103620004595762000458620003fb565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620004c67fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000484565b620004d2868362000484565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200051f620005196200051384620004ea565b620004f4565b620004ea565b9050919050565b6000819050919050565b6200053b83620004fe565b620005536200054a8262000526565b84845462000494565b825550505050565b600090565b6200056a6200055b565b6200057781848462000530565b505050565b5b818110156200059f576200059360008262000560565b6001810190506200057d565b5050565b601f821115620005ee57620005b8816200045f565b620005c38462000474565b81016020851015620005d3578190505b620005eb620005e28562000474565b8301826200057c565b50505b505050565b60008160020a8304905092915050565b60006200061660001984600802620005f3565b1980831691505092915050565b600062000631838362000603565b9150826002028217905092915050565b6200064c82620003f0565b67ffffffffffffffff811115620006685762000667620000e8565b5b6200067482546200042a565b62000681828285620005a3565b600060209050601f831160018114620006b95760008415620006a4578287015190505b620006b0858262000623565b86555062000720565b601f198416620006c9866200045f565b60005b82811015620006f357848901518255600182019150602085019450602081019050620006cc565b868310156200071357848901516200070f601f89168262000603565b8355505b6001600288020188555050505b505050505050565b60805161235862000744600039600061055f01526123586000f3fe608060405234801561001057600080fd5b5060043610610128576000357c01000000000000000000000000000000000000000000000000000000009004806351cff8d9116100bf5780638da5cb5b1161008e5780638da5cb5b146102d757806395d89b41146102f5578063d9caed1214610313578063f2fde38b1461032f578063f3fef3a31461035f57610128565b806351cff8d91461023f57806369fe0e2d1461026f57806386fe212d1461028b5780638705fcd4146102bb57610128565b80632c1758c1116100fb5780632c1758c1146101b7578063313ce567146101e757806331a5995d1461020557806347e7ef241461022357610128565b806301ffc9a71461012d57806306fdde031461015d57806318160ddd1461017b57806318cbbcfc14610199575b600080fd5b610147600480360381019061014291906117ba565b61038f565b6040516101549190611802565b60405180910390f35b610165610491565b60405161017291906118ad565b60405180910390f35b61018361051f565b60405161019091906118e8565b60405180910390f35b6101a1610525565b6040516101ae91906118e8565b60405180910390f35b6101d160048036038101906101cc919061192f565b61052a565b6040516101de9190611802565b60405180910390f35b6101ef61055d565b6040516101fc91906118e8565b60405180910390f35b61020d610581565b60405161021a91906118e8565b60405180910390f35b61023d600480360381019061023891906119ba565b610587565b005b610259600480360381019061025491906119fa565b61076d565b60405161026691906118e8565b60405180910390f35b6102896004803603810190610284919061192f565b6107c4565b005b6102a560048036038101906102a0919061192f565b6108ee565b6040516102b291906118e8565b60405180910390f35b6102d560048036038101906102d091906119fa565b6109d6565b005b6102df610af5565b6040516102ec9190611a36565b60405180910390f35b6102fd610b19565b60405161030a91906118ad565b60405180910390f35b61032d60048036038101906103289190611a51565b610ba7565b005b610349600480360381019061034491906119fa565b610fcd565b6040516103569190611802565b60405180910390f35b610379600480360381019061037491906119ba565b61110f565b60405161038691906118e8565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e3576001905061048c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610435576001905061048c565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610487576001905061048c565b600090505b919050565b6006805461049e90611ad3565b80601f01602080910402602001604051908101604052809291908181526020018280546104ca90611ad3565b80156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b60085481565b600381565b60006003821061053957600080fd5b6000820361054e576003600a54149050610558565b81600a5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600a5481565b600060606105b784600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611369565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016105e393929190611b63565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161066d9190611be1565b6000604051808303816000865af19150503d80600081146106aa576040519150601f19603f3d011682016040523d82523d6000602084013e6106af565b606091505b508092508193505050816106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef90611c44565b60405180910390fd5b8080602001905181019061070c9190611c90565b91508161074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074590611d09565b60405180910390fd5b82600860008282546107609190611d58565b9250508190555050505050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506107bc838261110f565b915050919050565b6107d1600160ff1661052a565b15610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080890611dd8565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461089f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089690611e44565b60405180910390fd5b620f424081106108e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108db90611eb0565b60405180910390fd5b8060038190555050565b60006003821115610934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092b90611f1c565b60405180910390fd5b6000600a5483161461097b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097290611f88565b60405180910390fd5b81600a600082825417925050819055506003600a541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600a546040516109c491906118e8565b60405180910390a2600a549050919050565b6109e3600260ff1661052a565b15610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90611dd8565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ab1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa890611e44565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610b2690611ad3565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5290611ad3565b8015610b9f5780601f10610b7457610100808354040283529160200191610b9f565b820191906000526020600020905b815481529060010190602001808311610b8257829003601f168201915b505050505081565b600060606000806000610bb986611542565b90508086610bc79190611fa8565b9250610bd488888561156f565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610bfe9190611fdc565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610c889190611be1565b6000604051808303816000865af19150503d8060008114610cc5576040519150601f19603f3d011682016040523d82523d6000602084013e610cca565b606091505b50809550819650505084610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a90611c44565b60405180910390fd5b83806020019051810190610d27919061200c565b91508083610d359190611d58565b821015610d77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6e90612085565b60405180910390fd5b610d818787610587565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610dab9291906120a5565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e359190611be1565b6000604051808303816000865af19150503d8060008114610e72576040519150601f19603f3d011682016040523d82523d6000602084013e610e77565b606091505b50809550819650505084610ec0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb790611c44565b60405180910390fd5b83806020019051810190610ed49190611c90565b945084610f16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0d90611d09565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fc35780600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610fbb9190611d58565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461102857600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036111a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119c90611e44565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff1630600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040516024016111f3939291906120ce565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161127d9190611be1565b6000604051808303816000865af19150503d80600081146112ba576040519150601f19603f3d011682016040523d82523d6000602084013e6112bf565b606091505b50809250819350505081611308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ff90611c44565b60405180910390fd5b8080602001905181019061131c9190611c90565b91508161135e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135590611d09565b60405180910390fd5b839250505092915050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113a857505061153e565b8273ffffffffffffffffffffffffffffffffffffffff16846040516024016113d09190611a36565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161145a9190611be1565b6000604051808303816000865af19150503d8060008114611497576040519150601f19603f3d011682016040523d82523d6000602084013e61149c565b606091505b508092508193505050816114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90612151565b60405180910390fd5b808060200190518101906114f99190611c90565b91508161153b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611532906121bd565b60405180910390fd5b50505b5050565b6000806003548361155391906121dd565b9050620f424081611564919061224e565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036115d657849350505050611756565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168787876040516024016116249392919061227f565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116ae9190611be1565b6000604051808303816000865af19150503d80600081146116eb576040519150601f19603f3d011682016040523d82523d6000602084013e6116f0565b606091505b50809350819450505082611739576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173090612302565b60405180910390fd5b8180602001905181019061174d919061200c565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61179781611762565b81146117a257600080fd5b50565b6000813590506117b48161178e565b92915050565b6000602082840312156117d0576117cf61175d565b5b60006117de848285016117a5565b91505092915050565b60008115159050919050565b6117fc816117e7565b82525050565b600060208201905061181760008301846117f3565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561185757808201518184015260208101905061183c565b60008484015250505050565b6000601f19601f8301169050919050565b600061187f8261181d565b6118898185611828565b9350611899818560208601611839565b6118a281611863565b840191505092915050565b600060208201905081810360008301526118c78184611874565b905092915050565b6000819050919050565b6118e2816118cf565b82525050565b60006020820190506118fd60008301846118d9565b92915050565b61190c816118cf565b811461191757600080fd5b50565b60008135905061192981611903565b92915050565b6000602082840312156119455761194461175d565b5b60006119538482850161191a565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006119878261195c565b9050919050565b6119978161197c565b81146119a257600080fd5b50565b6000813590506119b48161198e565b92915050565b600080604083850312156119d1576119d061175d565b5b60006119df858286016119a5565b92505060206119f08582860161191a565b9150509250929050565b600060208284031215611a1057611a0f61175d565b5b6000611a1e848285016119a5565b91505092915050565b611a308161197c565b82525050565b6000602082019050611a4b6000830184611a27565b92915050565b600080600060608486031215611a6a57611a6961175d565b5b6000611a78868287016119a5565b9350506020611a89868287016119a5565b9250506040611a9a8682870161191a565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611aeb57607f821691505b602082108103611afe57611afd611aa4565b5b50919050565b6000819050919050565b6000611b29611b24611b1f8461195c565b611b04565b61195c565b9050919050565b6000611b3b82611b0e565b9050919050565b6000611b4d82611b30565b9050919050565b611b5d81611b42565b82525050565b6000606082019050611b786000830186611a27565b611b856020830185611b54565b611b9260408301846118d9565b949350505050565b600081519050919050565b600081905092915050565b6000611bbb82611b9a565b611bc58185611ba5565b9350611bd5818560208601611839565b80840191505092915050565b6000611bed8284611bb0565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000611c2e600983611828565b9150611c3982611bf8565b602082019050919050565b60006020820190508181036000830152611c5d81611c21565b9050919050565b611c6d816117e7565b8114611c7857600080fd5b50565b600081519050611c8a81611c64565b92915050565b600060208284031215611ca657611ca561175d565b5b6000611cb484828501611c7b565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611cf3600c83611828565b9150611cfe82611cbd565b602082019050919050565b60006020820190508181036000830152611d2281611ce6565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611d63826118cf565b9150611d6e836118cf565b9250828201905080821115611d8657611d85611d29565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000611dc2600883611828565b9150611dcd82611d8c565b602082019050919050565b60006020820190508181036000830152611df181611db5565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000611e2e600783611828565b9150611e3982611df8565b602082019050919050565b60006020820190508181036000830152611e5d81611e21565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b6000611e9a601083611828565b9150611ea582611e64565b602082019050919050565b60006020820190508181036000830152611ec981611e8d565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b6000611f06601183611828565b9150611f1182611ed0565b602082019050919050565b60006020820190508181036000830152611f3581611ef9565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000611f72601283611828565b9150611f7d82611f3c565b602082019050919050565b60006020820190508181036000830152611fa181611f65565b9050919050565b6000611fb3826118cf565b9150611fbe836118cf565b9250828203905081811115611fd657611fd5611d29565b5b92915050565b6000602082019050611ff16000830184611b54565b92915050565b60008151905061200681611903565b92915050565b6000602082840312156120225761202161175d565b5b600061203084828501611ff7565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b600061206f600b83611828565b915061207a82612039565b602082019050919050565b6000602082019050818103600083015261209e81612062565b9050919050565b60006040820190506120ba6000830185611a27565b6120c760208301846118d9565b9392505050565b60006060820190506120e36000830186611b54565b6120f06020830185611a27565b6120fd60408301846118d9565b949350505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b600061213b600c83611828565b915061214682612105565b602082019050919050565b6000602082019050818103600083015261216a8161212e565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b60006121a7601083611828565b91506121b282612171565b602082019050919050565b600060208201905081810360008301526121d68161219a565b9050919050565b60006121e8826118cf565b91506121f3836118cf565b9250828202612201816118cf565b9150828204841483151761221857612217611d29565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612259826118cf565b9150612264836118cf565b9250826122745761227361221f565b5b828204905092915050565b60006060820190506122946000830186611a27565b6122a16020830185611a27565b6122ae60408301846118d9565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b60006122ec600a83611828565b91506122f7826122b6565b602082019050919050565b6000602082019050818103600083015261231b816122df565b905091905056fea2646970667358221220d38fee131e8fea6c9d1b9f58721fb65c2c5eb44a9498caf17e179a79ef7e9b6764736f6c63430008130033
-\ No newline at end of file
+60a06040523480156200001157600080fd5b5060405162002ae838038062002ae883398181016040528101906200003791906200036a565b846006908162000048919062000681565b5083600790816200005a919062000681565b508260ff166080818152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600581905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505062000768565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001628262000117565b810181811067ffffffffffffffff8211171562000184576200018362000128565b5b80604052505050565b600062000199620000f9565b9050620001a7828262000157565b919050565b600067ffffffffffffffff821115620001ca57620001c962000128565b5b620001d58262000117565b9050602081019050919050565b60005b8381101562000202578082015181840152602081019050620001e5565b60008484015250505050565b6000620002256200021f84620001ac565b6200018d565b90508281526020810184848401111562000244576200024362000112565b5b62000251848285620001e2565b509392505050565b600082601f8301126200027157620002706200010d565b5b8151620002838482602086016200020e565b91505092915050565b600060ff82169050919050565b620002a4816200028c565b8114620002b057600080fd5b50565b600081519050620002c48162000299565b92915050565b6000819050919050565b620002df81620002ca565b8114620002eb57600080fd5b50565b600081519050620002ff81620002d4565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003328262000305565b9050919050565b620003448162000325565b81146200035057600080fd5b50565b600081519050620003648162000339565b92915050565b600080600080600060a0868803121562000389576200038862000103565b5b600086015167ffffffffffffffff811115620003aa57620003a962000108565b5b620003b88882890162000259565b955050602086015167ffffffffffffffff811115620003dc57620003db62000108565b5b620003ea8882890162000259565b9450506040620003fd88828901620002b3565b93505060606200041088828901620002ee565b9250506080620004238882890162000353565b9150509295509295909350565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200048357607f821691505b6020821081036200049957620004986200043b565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620005067fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620004c4565b620005128683620004c4565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200055f6200055962000553846200052a565b62000534565b6200052a565b9050919050565b6000819050919050565b6200057b836200053e565b620005936200058a8262000566565b848454620004d4565b825550505050565b600090565b620005aa6200059b565b620005b781848462000570565b505050565b5b81811015620005df57620005d3600082620005a0565b600181019050620005bd565b5050565b601f8211156200062e57620005f8816200049f565b6200060384620004b4565b8101602085101562000613578190505b6200062b6200062285620004b4565b830182620005bc565b50505b505050565b60008160020a8304905092915050565b6000620006566000198460080262000633565b1980831691505092915050565b600062000671838362000643565b9150826002028217905092915050565b6200068c8262000430565b67ffffffffffffffff811115620006a857620006a762000128565b5b620006b482546200046a565b620006c1828285620005e3565b600060209050601f831160018114620006f95760008415620006e4578287015190505b620006f0858262000663565b86555062000760565b601f19841662000709866200049f565b60005b8281101562000733578489015182556001820191506020850194506020810190506200070c565b868310156200075357848901516200074f601f89168262000643565b8355505b6001600288020188555050505b505050505050565b60805161236462000784600039600061055f01526123646000f3fe608060405234801561001057600080fd5b5060043610610128576000357c01000000000000000000000000000000000000000000000000000000009004806351cff8d9116100bf5780638da5cb5b1161008e5780638da5cb5b146102d757806395d89b41146102f5578063d9caed1214610313578063f2fde38b1461032f578063f3fef3a31461035f57610128565b806351cff8d91461023f57806369fe0e2d1461026f57806386fe212d1461028b5780638705fcd4146102bb57610128565b80632c1758c1116100fb5780632c1758c1146101b7578063313ce567146101e757806331a5995d1461020557806347e7ef241461022357610128565b806301ffc9a71461012d57806306fdde031461015d57806318160ddd1461017b57806318cbbcfc14610199575b600080fd5b610147600480360381019061014291906117fd565b61038f565b6040516101549190611845565b60405180910390f35b610165610491565b60405161017291906118f0565b60405180910390f35b61018361051f565b604051610190919061192b565b60405180910390f35b6101a1610525565b6040516101ae919061192b565b60405180910390f35b6101d160048036038101906101cc9190611972565b61052a565b6040516101de9190611845565b60405180910390f35b6101ef61055d565b6040516101fc919061192b565b60405180910390f35b61020d610581565b60405161021a919061192b565b60405180910390f35b61023d600480360381019061023891906119fd565b610587565b005b61025960048036038101906102549190611a3d565b61076d565b604051610266919061192b565b60405180910390f35b61028960048036038101906102849190611972565b610809565b005b6102a560048036038101906102a09190611972565b610933565b6040516102b2919061192b565b60405180910390f35b6102d560048036038101906102d09190611a3d565b610a1b565b005b6102df610b3a565b6040516102ec9190611a79565b60405180910390f35b6102fd610b5e565b60405161030a91906118f0565b60405180910390f35b61032d60048036038101906103289190611a94565b610bec565b005b61034960048036038101906103449190611a3d565b611012565b6040516103569190611845565b60405180910390f35b610379600480360381019061037491906119fd565b611154565b604051610386919061192b565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e3576001905061048c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610435576001905061048c565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610487576001905061048c565b600090505b919050565b6006805461049e90611b16565b80601f01602080910402602001604051908101604052809291908181526020018280546104ca90611b16565b80156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b60085481565b600381565b60006003821061053957600080fd5b6000820361054e576003600a54149050610558565b81600a5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600a5481565b600060606105b784600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166113ac565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016105e393929190611ba6565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161066d9190611c24565b6000604051808303816000865af19150503d80600081146106aa576040519150601f19603f3d011682016040523d82523d6000602084013e6106af565b606091505b508092508193505050816106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef90611c87565b60405180910390fd5b8080602001905181019061070c9190611cd3565b91508161074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074590611d4c565b60405180910390fd5b82600860008282546107609190611d9b565b9250508190555050505050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108018382611154565b915050919050565b610816600160ff1661052a565b15610856576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084d90611e1b565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108db90611e87565b60405180910390fd5b620f42408110610929576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092090611ef3565b60405180910390fd5b8060038190555050565b60006003821115610979576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097090611f5f565b60405180910390fd5b6000600a548316146109c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b790611fcb565b60405180910390fd5b81600a600082825417925050819055506003600a541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600a54604051610a09919061192b565b60405180910390a2600a549050919050565b610a28600260ff1661052a565b15610a68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5f90611e1b565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aed90611e87565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610b6b90611b16565b80601f0160208091040260200160405190810160405280929190818152602001828054610b9790611b16565b8015610be45780601f10610bb957610100808354040283529160200191610be4565b820191906000526020600020905b815481529060010190602001808311610bc757829003601f168201915b505050505081565b600060606000806000610bfe86611585565b90508086610c0c9190611feb565b9250610c198888856115b2565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610c43919061201f565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ccd9190611c24565b6000604051808303816000865af19150503d8060008114610d0a576040519150601f19603f3d011682016040523d82523d6000602084013e610d0f565b606091505b50809550819650505084610d58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4f90611c87565b60405180910390fd5b83806020019051810190610d6c919061204f565b91508083610d7a9190611d9b565b821015610dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db3906120c8565b60405180910390fd5b610dc68787610587565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610df09291906120e8565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e7a9190611c24565b6000604051808303816000865af19150503d8060008114610eb7576040519150601f19603f3d011682016040523d82523d6000602084013e610ebc565b606091505b50809550819650505084610f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efc90611c87565b60405180910390fd5b83806020019051810190610f199190611cd3565b945084610f5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5290611d4c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110085780600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110009190611d9b565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461106d57600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036111ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e190611e87565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040516024016112369291906120e8565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516112c09190611c24565b6000604051808303816000865af19150503d80600081146112fd576040519150601f19603f3d011682016040523d82523d6000602084013e611302565b606091505b5080925081935050508161134b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134290611c87565b60405180910390fd5b8080602001905181019061135f9190611cd3565b9150816113a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139890611d4c565b60405180910390fd5b839250505092915050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113eb575050611581565b8273ffffffffffffffffffffffffffffffffffffffff16846040516024016114139190611a79565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161149d9190611c24565b6000604051808303816000865af19150503d80600081146114da576040519150601f19603f3d011682016040523d82523d6000602084013e6114df565b606091505b50809250819350505081611528576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151f9061215d565b60405180910390fd5b8080602001905181019061153c9190611cd3565b91508161157e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611575906121c9565b60405180910390fd5b50505b5050565b6000806003548361159691906121e9565b9050620f4240816115a7919061225a565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361161957849350505050611799565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168787876040516024016116679392919061228b565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116f19190611c24565b6000604051808303816000865af19150503d806000811461172e576040519150601f19603f3d011682016040523d82523d6000602084013e611733565b606091505b5080935081945050508261177c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117739061230e565b60405180910390fd5b81806020019051810190611790919061204f565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6117da816117a5565b81146117e557600080fd5b50565b6000813590506117f7816117d1565b92915050565b600060208284031215611813576118126117a0565b5b6000611821848285016117e8565b91505092915050565b60008115159050919050565b61183f8161182a565b82525050565b600060208201905061185a6000830184611836565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561189a57808201518184015260208101905061187f565b60008484015250505050565b6000601f19601f8301169050919050565b60006118c282611860565b6118cc818561186b565b93506118dc81856020860161187c565b6118e5816118a6565b840191505092915050565b6000602082019050818103600083015261190a81846118b7565b905092915050565b6000819050919050565b61192581611912565b82525050565b6000602082019050611940600083018461191c565b92915050565b61194f81611912565b811461195a57600080fd5b50565b60008135905061196c81611946565b92915050565b600060208284031215611988576119876117a0565b5b60006119968482850161195d565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006119ca8261199f565b9050919050565b6119da816119bf565b81146119e557600080fd5b50565b6000813590506119f7816119d1565b92915050565b60008060408385031215611a1457611a136117a0565b5b6000611a22858286016119e8565b9250506020611a338582860161195d565b9150509250929050565b600060208284031215611a5357611a526117a0565b5b6000611a61848285016119e8565b91505092915050565b611a73816119bf565b82525050565b6000602082019050611a8e6000830184611a6a565b92915050565b600080600060608486031215611aad57611aac6117a0565b5b6000611abb868287016119e8565b9350506020611acc868287016119e8565b9250506040611add8682870161195d565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611b2e57607f821691505b602082108103611b4157611b40611ae7565b5b50919050565b6000819050919050565b6000611b6c611b67611b628461199f565b611b47565b61199f565b9050919050565b6000611b7e82611b51565b9050919050565b6000611b9082611b73565b9050919050565b611ba081611b85565b82525050565b6000606082019050611bbb6000830186611a6a565b611bc86020830185611b97565b611bd5604083018461191c565b949350505050565b600081519050919050565b600081905092915050565b6000611bfe82611bdd565b611c088185611be8565b9350611c1881856020860161187c565b80840191505092915050565b6000611c308284611bf3565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000611c7160098361186b565b9150611c7c82611c3b565b602082019050919050565b60006020820190508181036000830152611ca081611c64565b9050919050565b611cb08161182a565b8114611cbb57600080fd5b50565b600081519050611ccd81611ca7565b92915050565b600060208284031215611ce957611ce86117a0565b5b6000611cf784828501611cbe565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611d36600c8361186b565b9150611d4182611d00565b602082019050919050565b60006020820190508181036000830152611d6581611d29565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611da682611912565b9150611db183611912565b9250828201905080821115611dc957611dc8611d6c565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000611e0560088361186b565b9150611e1082611dcf565b602082019050919050565b60006020820190508181036000830152611e3481611df8565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000611e7160078361186b565b9150611e7c82611e3b565b602082019050919050565b60006020820190508181036000830152611ea081611e64565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b6000611edd60108361186b565b9150611ee882611ea7565b602082019050919050565b60006020820190508181036000830152611f0c81611ed0565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b6000611f4960118361186b565b9150611f5482611f13565b602082019050919050565b60006020820190508181036000830152611f7881611f3c565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000611fb560128361186b565b9150611fc082611f7f565b602082019050919050565b60006020820190508181036000830152611fe481611fa8565b9050919050565b6000611ff682611912565b915061200183611912565b925082820390508181111561201957612018611d6c565b5b92915050565b60006020820190506120346000830184611b97565b92915050565b60008151905061204981611946565b92915050565b600060208284031215612065576120646117a0565b5b60006120738482850161203a565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b60006120b2600b8361186b565b91506120bd8261207c565b602082019050919050565b600060208201905081810360008301526120e1816120a5565b9050919050565b60006040820190506120fd6000830185611a6a565b61210a602083018461191c565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b6000612147600c8361186b565b915061215282612111565b602082019050919050565b600060208201905081810360008301526121768161213a565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b60006121b360108361186b565b91506121be8261217d565b602082019050919050565b600060208201905081810360008301526121e2816121a6565b9050919050565b60006121f482611912565b91506121ff83611912565b925082820261220d81611912565b9150828204841483151761222457612223611d6c565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061226582611912565b915061227083611912565b9250826122805761227f61222b565b5b828204905092915050565b60006060820190506122a06000830186611a6a565b6122ad6020830185611a6a565b6122ba604083018461191c565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b60006122f8600a8361186b565b9150612303826122c2565b602082019050919050565b60006020820190508181036000830152612327816122eb565b905091905056fea2646970667358221220c637056a8e5faeaf2c485c4909d2752af5d6e0c16fe5c4eccffe73c0e522d71164736f6c63430008130033
+\ No newline at end of file
diff --git a/python/erc20_pool/data/SwapPool.metadata.json b/python/erc20_pool/data/SwapPool.metadata.json
@@ -1 +1 @@
-{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"bytes32","name":"_declaration","type":"bytes32"},{"internalType":"address","name":"_tokenRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"SwapPool.sol":"SwapPool"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"SwapPool.sol":{"keccak256":"0xe353d1255baee8fd9937c51600b0710e041108f041062a0130e6833a51c5c873","license":"AGPL-3.0-or-later","urls":["bzz-raw://56811f458f4310e26fbe8cf177eff3165898f324bfe74a6ca954771d20f3b498","dweb:/ipfs/QmYa1bep3hAvcNr7w1PHjRa65CLUkcJKmZRftKXZGG8wwS"]}},"version":1}
+{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"bytes32","name":"_declaration","type":"bytes32"},{"internalType":"address","name":"_tokenRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_sum","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"SwapPool.sol":"SwapPool"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"SwapPool.sol":{"keccak256":"0x954a98452d67b8c1587a76b94f57a0fb277678a92c40347662cbd36b7b34e245","license":"AGPL-3.0-or-later","urls":["bzz-raw://fe8853bf6e26769186afe48207c968b60c49dbb6fd3beefa0295a6e2284cb80c","dweb:/ipfs/QmW2wruSUAs1x1ufHYQudffBhpW2e5FEcEGBFhHPbg6HmN"]}},"version":1}
diff --git a/python/erc20_pool/pool.py b/python/erc20_pool/pool.py
@@ -116,4 +116,37 @@ class Pool(TxFactory):
return tx
+ def set_fee_address(self, contract_address, sender_address, fee_address, tx_format=TxFormat.JSONRPC, id_generator=None):
+ enc = ABIContractEncoder()
+ enc.method('setFeeAddress')
+ enc.typ(ABIContractType.ADDRESS)
+ enc.address(fee_address)
+ data = add_0x(enc.get())
+ tx = self.template(sender_address, contract_address, use_nonce=True)
+ tx = self.set_code(tx, data)
+ tx = self.finalize(tx, tx_format, id_generator=id_generator)
+ return tx
+
+
+ def set_fee(self, contract_address, sender_address, fee, tx_format=TxFormat.JSONRPC, id_generator=None):
+ enc = ABIContractEncoder()
+ enc.method('setFee')
+ enc.typ(ABIContractType.UINT256)
+ enc.uint256(fee)
+ data = add_0x(enc.get())
+ tx = self.template(sender_address, contract_address, use_nonce=True)
+ tx = self.set_code(tx, data)
+ tx = self.finalize(tx, tx_format, id_generator=id_generator)
+ return tx
+
+ def withdraw(self, contract_address, sender_address, token_address, tx_format=TxFormat.JSONRPC, id_generator=None):
+ enc = ABIContractEncoder()
+ enc.method('withdraw')
+ enc.typ(ABIContractType.ADDRESS)
+ enc.address(token_address)
+ data = add_0x(enc.get())
+ tx = self.template(sender_address, contract_address, use_nonce=True)
+ tx = self.set_code(tx, data)
+ tx = self.finalize(tx, tx_format, id_generator=id_generator)
+ return tx
diff --git a/python/erc20_pool/unittest/base.py b/python/erc20_pool/unittest/base.py
@@ -41,13 +41,13 @@ class TestERC20Pool(TestGiftableToken):
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
(tx_hash, o) = c.mint_to(self.bar_address, self.accounts[0], self.accounts[1], self.initial_supply_bar)
- r = self.conn.do(o)
+ self.conn.do(o)
o = receipt(tx_hash)
r = self.conn.do(o)
self.assertEqual(r['status'], 1)
(tx_hash, o) = c.mint_to(self.baz_address, self.accounts[0], self.accounts[2], self.initial_supply_baz)
- r = self.conn.do(o)
+ self.conn.do(o)
o = receipt(tx_hash)
r = self.conn.do(o)
self.assertEqual(r['status'], 1)
@@ -58,6 +58,6 @@ class TestERC20Pool(TestGiftableToken):
o = receipt(tx_hash)
r = self.rpc.do(o)
self.assertEqual(r['status'], 1)
- self.voter_address = to_checksum_address(r['contract_address'])
+ self.pool_address = to_checksum_address(r['contract_address'])
logg.debug('published bar token {}, baz token {}'.format(self.bar_address, self.baz_address))
- logg.debug('published voter on address {} with hash {}'.format(self.voter_address, tx_hash))
+ logg.debug('published pool on address {} with hash {}'.format(self.pool_address, tx_hash))
diff --git a/python/requirements.txt b/python/requirements.txt
@@ -1,3 +1,3 @@
-eth-erc20~=0.7.3
+eth-erc20~=0.7.5
chainlib-eth~=0.4.22
#chainlib~=0.4.14
diff --git a/python/run_tests.sh b/python/run_tests.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -a
+set -e
+set -x
+default_pythonpath=$PYTHONPATH:.
+export PYTHONPATH=${default_pythonpath:-.}
+>&2 echo using pythonpath $PYTHONPATH
+for f in `ls tests/*.py`; do
+ python $f
+done
+set +x
+set +e
+set +a
diff --git a/python/tests/test_base.py b/python/tests/test_base.py
@@ -25,18 +25,18 @@ class TestPoolBase(TestERC20Pool):
def test_deposit(self):
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.approve(self.foo_address, self.accounts[0], self.voter_address, 1024)
+ (tx_hash, o) = c.approve(self.foo_address, self.accounts[0], self.pool_address, 1024)
self.rpc.do(o)
c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.deposit(self.voter_address, self.accounts[0], self.foo_address, 1024)
+ (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 1024)
self.rpc.do(o)
o = receipt(tx_hash)
r = self.rpc.do(o)
self.assertEqual(r['status'], 1)
c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- o = c.balance_of(self.foo_address, self.voter_address, sender_address=self.accounts[0])
+ o = c.balance_of(self.foo_address, self.pool_address, sender_address=self.accounts[0])
r = self.rpc.do(o)
self.assertEqual(int(r, 16), 1024)
@@ -44,24 +44,20 @@ class TestPoolBase(TestERC20Pool):
def test_swap(self):
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.approve(self.foo_address, self.accounts[0], self.voter_address, 1024)
+ (tx_hash, o) = c.approve(self.foo_address, self.accounts[0], self.pool_address, 1024)
self.rpc.do(o)
c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.deposit(self.voter_address, self.accounts[0], self.foo_address, 1024)
+ (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 1024)
self.rpc.do(o)
nonce_oracle = RPCNonceOracle(self.accounts[1], conn=self.conn)
c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.approve(self.bar_address, self.accounts[1], self.voter_address, 768)
- self.rpc.do(o)
-
- c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.approve(self.foo_address, self.accounts[1], self.voter_address, 768)
+ (tx_hash, o) = c.approve(self.bar_address, self.accounts[1], self.pool_address, 768)
self.rpc.do(o)
c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
- (tx_hash, o) = c.swap(self.voter_address, self.accounts[1], self.foo_address, self.bar_address, 768)
+ (tx_hash, o) = c.swap(self.pool_address, self.accounts[1], self.foo_address, self.bar_address, 768)
self.rpc.do(o)
o = receipt(tx_hash)
r = self.rpc.do(o)
diff --git a/python/tests/test_fee.py b/python/tests/test_fee.py
@@ -0,0 +1,78 @@
+# standard imports
+import unittest
+import logging
+import os
+from chainlib.eth.nonce import RPCNonceOracle
+from chainlib.eth.tx import receipt
+from chainlib.eth.block import block_latest
+from hexathon import same as same_hex
+from eth_erc20 import ERC20
+from giftable_erc20_token import GiftableToken
+
+# local imports
+from erc20_pool.unittest import TestERC20Pool
+from erc20_pool import Pool
+#from evm_tokenvote.unittest.base import hash_of_foo
+#from evm_tokenvote import Voter
+#from evm_tokenvote import ProposalState
+
+
+logging.basicConfig(level=logging.DEBUG)
+logg = logging.getLogger()
+
+class TestPoolBase(TestERC20Pool):
+
+ def test_swap_fee(self):
+ nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
+ c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ (tx_hash, o) = c.set_fee_address(self.pool_address, self.accounts[0], self.accounts[9])
+ self.rpc.do(o)
+ o = receipt(tx_hash)
+ r = self.conn.do(o)
+ self.assertEqual(r['status'], 1)
+
+ (tx_hash, o) = c.set_fee(self.pool_address, self.accounts[0], 10000)
+ self.rpc.do(o)
+ o = receipt(tx_hash)
+ r = self.conn.do(o)
+ self.assertEqual(r['status'], 1)
+
+ nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
+ c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ (tx_hash, o) = c.approve(self.foo_address, self.accounts[0], self.pool_address, 1000)
+ self.rpc.do(o)
+
+ c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ (tx_hash, o) = c.deposit(self.pool_address, self.accounts[0], self.foo_address, 1000)
+ self.rpc.do(o)
+
+ nonce_oracle = RPCNonceOracle(self.accounts[1], conn=self.conn)
+ c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ (tx_hash, o) = c.approve(self.bar_address, self.accounts[1], self.pool_address, 1000)
+ self.rpc.do(o)
+
+ c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ (tx_hash, o) = c.swap(self.pool_address, self.accounts[1], self.foo_address, self.bar_address, 1000)
+ self.rpc.do(o)
+
+ c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ o = c.balance_of(self.foo_address, self.accounts[1], sender_address=self.accounts[0])
+ r = self.rpc.do(o)
+ self.assertEqual(int(r, 16), 990)
+
+ nonce_oracle = RPCNonceOracle(self.accounts[2], conn=self.conn)
+ c = Pool(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ (tx_hash, o) = c.withdraw(self.pool_address, self.accounts[2], self.foo_address)
+ self.rpc.do(o)
+ o = receipt(tx_hash)
+ r = self.conn.do(o)
+ self.assertEqual(r['status'], 1)
+
+ c = ERC20(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
+ o = c.balance_of(self.foo_address, self.accounts[9], sender_address=self.accounts[0])
+ r = self.rpc.do(o)
+ self.assertEqual(int(r, 16), 10)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/solidity/SwapPool.sol b/solidity/SwapPool.sol
@@ -41,6 +41,7 @@ contract SwapPool {
decimals = _decimals;
registry = _tokenRegistry;
declaration = _declaration;
+ owner = msg.sender;
}
function seal(uint256 _state) public returns(uint256) {
@@ -157,6 +158,7 @@ contract SwapPool {
uint256 balance;
balance = fees[_outToken];
+ fees[_outToken] = 0;
return withdraw(_outToken, balance);
}
@@ -167,7 +169,7 @@ contract SwapPool {
require(feeAddress != address(0), "ERR_AXX");
- (r, v) = _outToken.call(abi.encodeWithSignature('transferFrom(address,address,uint256)', this, feeAddress, _value));
+ (r, v) = _outToken.call(abi.encodeWithSignature('transfer(address,uint256)', feeAddress, _value));
require(r, "ERR_TOKEN");
r = abi.decode(v, (bool));
require(r, "ERR_TRANSFER");