erc20-pool

Permissioned ERC20 swap pool for EVM
Log | Files | Refs | README

commit 377d392558b6fb9d1d27e44ac1e9085d6e699922
parent 2da973151ec4717f71b95c3b5b0a69f4e205ac3c
Author: lash <dev@holbrook.no>
Date:   Thu, 27 Jul 2023 17:31:13 +0100

Add limit registry

Diffstat:
Mpython/erc20_pool/data/SwapPool.bin | 4++--
Mpython/erc20_pool/data/SwapPool.json | 2+-
Mpython/erc20_pool/data/SwapPool.metadata.json | 2+-
Mpython/erc20_pool/pool.py | 9++++++---
Msolidity/SwapPool.sol | 37++++++++++++++++++++++++++++++-------
5 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/python/erc20_pool/data/SwapPool.bin b/python/erc20_pool/data/SwapPool.bin @@ -1 +1 @@ -60a06040523480156200001157600080fd5b5060405162002ae838038062002ae883398181016040528101906200003791906200036a565b846006908162000048919062000681565b5083600790816200005a919062000681565b508260ff166080818152505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600581905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505062000768565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001628262000117565b810181811067ffffffffffffffff8211171562000184576200018362000128565b5b80604052505050565b600062000199620000f9565b9050620001a7828262000157565b919050565b600067ffffffffffffffff821115620001ca57620001c962000128565b5b620001d58262000117565b9050602081019050919050565b60005b8381101562000202578082015181840152602081019050620001e5565b60008484015250505050565b6000620002256200021f84620001ac565b6200018d565b90508281526020810184848401111562000244576200024362000112565b5b62000251848285620001e2565b509392505050565b600082601f8301126200027157620002706200010d565b5b8151620002838482602086016200020e565b91505092915050565b600060ff82169050919050565b620002a4816200028c565b8114620002b057600080fd5b50565b600081519050620002c48162000299565b92915050565b6000819050919050565b620002df81620002ca565b8114620002eb57600080fd5b50565b600081519050620002ff81620002d4565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003328262000305565b9050919050565b620003448162000325565b81146200035057600080fd5b50565b600081519050620003648162000339565b92915050565b600080600080600060a0868803121562000389576200038862000103565b5b600086015167ffffffffffffffff811115620003aa57620003a962000108565b5b620003b88882890162000259565b955050602086015167ffffffffffffffff811115620003dc57620003db62000108565b5b620003ea8882890162000259565b9450506040620003fd88828901620002b3565b93505060606200041088828901620002ee565b9250506080620004238882890162000353565b9150509295509295909350565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200048357607f821691505b6020821081036200049957620004986200043b565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620005067fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620004c4565b620005128683620004c4565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006200055f6200055962000553846200052a565b62000534565b6200052a565b9050919050565b6000819050919050565b6200057b836200053e565b620005936200058a8262000566565b848454620004d4565b825550505050565b600090565b620005aa6200059b565b620005b781848462000570565b505050565b5b81811015620005df57620005d3600082620005a0565b600181019050620005bd565b5050565b601f8211156200062e57620005f8816200049f565b6200060384620004b4565b8101602085101562000613578190505b6200062b6200062285620004b4565b830182620005bc565b50505b505050565b60008160020a8304905092915050565b6000620006566000198460080262000633565b1980831691505092915050565b600062000671838362000643565b9150826002028217905092915050565b6200068c8262000430565b67ffffffffffffffff811115620006a857620006a762000128565b5b620006b482546200046a565b620006c1828285620005e3565b600060209050601f831160018114620006f95760008415620006e4578287015190505b620006f0858262000663565b86555062000760565b601f19841662000709866200049f565b60005b8281101562000733578489015182556001820191506020850194506020810190506200070c565b868310156200075357848901516200074f601f89168262000643565b8355505b6001600288020188555050505b505050505050565b60805161236462000784600039600061055f01526123646000f3fe608060405234801561001057600080fd5b5060043610610128576000357c01000000000000000000000000000000000000000000000000000000009004806351cff8d9116100bf5780638da5cb5b1161008e5780638da5cb5b146102d757806395d89b41146102f5578063d9caed1214610313578063f2fde38b1461032f578063f3fef3a31461035f57610128565b806351cff8d91461023f57806369fe0e2d1461026f57806386fe212d1461028b5780638705fcd4146102bb57610128565b80632c1758c1116100fb5780632c1758c1146101b7578063313ce567146101e757806331a5995d1461020557806347e7ef241461022357610128565b806301ffc9a71461012d57806306fdde031461015d57806318160ddd1461017b57806318cbbcfc14610199575b600080fd5b610147600480360381019061014291906117fd565b61038f565b6040516101549190611845565b60405180910390f35b610165610491565b60405161017291906118f0565b60405180910390f35b61018361051f565b604051610190919061192b565b60405180910390f35b6101a1610525565b6040516101ae919061192b565b60405180910390f35b6101d160048036038101906101cc9190611972565b61052a565b6040516101de9190611845565b60405180910390f35b6101ef61055d565b6040516101fc919061192b565b60405180910390f35b61020d610581565b60405161021a919061192b565b60405180910390f35b61023d600480360381019061023891906119fd565b610587565b005b61025960048036038101906102549190611a3d565b61076d565b604051610266919061192b565b60405180910390f35b61028960048036038101906102849190611972565b610809565b005b6102a560048036038101906102a09190611972565b610933565b6040516102b2919061192b565b60405180910390f35b6102d560048036038101906102d09190611a3d565b610a1b565b005b6102df610b3a565b6040516102ec9190611a79565b60405180910390f35b6102fd610b5e565b60405161030a91906118f0565b60405180910390f35b61032d60048036038101906103289190611a94565b610bec565b005b61034960048036038101906103449190611a3d565b611012565b6040516103569190611845565b60405180910390f35b610379600480360381019061037491906119fd565b611154565b604051610386919061192b565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e3576001905061048c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610435576001905061048c565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610487576001905061048c565b600090505b919050565b6006805461049e90611b16565b80601f01602080910402602001604051908101604052809291908181526020018280546104ca90611b16565b80156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b60085481565b600381565b60006003821061053957600080fd5b6000820361054e576003600a54149050610558565b81600a5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600a5481565b600060606105b784600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166113ac565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016105e393929190611ba6565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161066d9190611c24565b6000604051808303816000865af19150503d80600081146106aa576040519150601f19603f3d011682016040523d82523d6000602084013e6106af565b606091505b508092508193505050816106f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ef90611c87565b60405180910390fd5b8080602001905181019061070c9190611cd3565b91508161074e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074590611d4c565b60405180910390fd5b82600860008282546107609190611d9b565b9250508190555050505050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108018382611154565b915050919050565b610816600160ff1661052a565b15610856576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084d90611e1b565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108db90611e87565b60405180910390fd5b620f42408110610929576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092090611ef3565b60405180910390fd5b8060038190555050565b60006003821115610979576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097090611f5f565b60405180910390fd5b6000600a548316146109c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b790611fcb565b60405180910390fd5b81600a600082825417925050819055506003600a541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600a54604051610a09919061192b565b60405180910390a2600a549050919050565b610a28600260ff1661052a565b15610a68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5f90611e1b565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610af6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aed90611e87565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610b6b90611b16565b80601f0160208091040260200160405190810160405280929190818152602001828054610b9790611b16565b8015610be45780601f10610bb957610100808354040283529160200191610be4565b820191906000526020600020905b815481529060010190602001808311610bc757829003601f168201915b505050505081565b600060606000806000610bfe86611585565b90508086610c0c9190611feb565b9250610c198888856115b2565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610c43919061201f565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ccd9190611c24565b6000604051808303816000865af19150503d8060008114610d0a576040519150601f19603f3d011682016040523d82523d6000602084013e610d0f565b606091505b50809550819650505084610d58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4f90611c87565b60405180910390fd5b83806020019051810190610d6c919061204f565b91508083610d7a9190611d9b565b821015610dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db3906120c8565b60405180910390fd5b610dc68787610587565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610df09291906120e8565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e7a9190611c24565b6000604051808303816000865af19150503d8060008114610eb7576040519150601f19603f3d011682016040523d82523d6000602084013e610ebc565b606091505b50809550819650505084610f05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610efc90611c87565b60405180910390fd5b83806020019051810190610f199190611cd3565b945084610f5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5290611d4c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110085780600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110009190611d9b565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461106d57600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036111ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e190611e87565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040516024016112369291906120e8565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516112c09190611c24565b6000604051808303816000865af19150503d80600081146112fd576040519150601f19603f3d011682016040523d82523d6000602084013e611302565b606091505b5080925081935050508161134b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134290611c87565b60405180910390fd5b8080602001905181019061135f9190611cd3565b9150816113a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139890611d4c565b60405180910390fd5b839250505092915050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113eb575050611581565b8273ffffffffffffffffffffffffffffffffffffffff16846040516024016114139190611a79565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161149d9190611c24565b6000604051808303816000865af19150503d80600081146114da576040519150601f19603f3d011682016040523d82523d6000602084013e6114df565b606091505b50809250819350505081611528576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151f9061215d565b60405180910390fd5b8080602001905181019061153c9190611cd3565b91508161157e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611575906121c9565b60405180910390fd5b50505b5050565b6000806003548361159691906121e9565b9050620f4240816115a7919061225a565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361161957849350505050611799565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168787876040516024016116679392919061228b565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116f19190611c24565b6000604051808303816000865af19150503d806000811461172e576040519150601f19603f3d011682016040523d82523d6000602084013e611733565b606091505b5080935081945050508261177c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117739061230e565b60405180910390fd5b81806020019051810190611790919061204f565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6117da816117a5565b81146117e557600080fd5b50565b6000813590506117f7816117d1565b92915050565b600060208284031215611813576118126117a0565b5b6000611821848285016117e8565b91505092915050565b60008115159050919050565b61183f8161182a565b82525050565b600060208201905061185a6000830184611836565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561189a57808201518184015260208101905061187f565b60008484015250505050565b6000601f19601f8301169050919050565b60006118c282611860565b6118cc818561186b565b93506118dc81856020860161187c565b6118e5816118a6565b840191505092915050565b6000602082019050818103600083015261190a81846118b7565b905092915050565b6000819050919050565b61192581611912565b82525050565b6000602082019050611940600083018461191c565b92915050565b61194f81611912565b811461195a57600080fd5b50565b60008135905061196c81611946565b92915050565b600060208284031215611988576119876117a0565b5b60006119968482850161195d565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006119ca8261199f565b9050919050565b6119da816119bf565b81146119e557600080fd5b50565b6000813590506119f7816119d1565b92915050565b60008060408385031215611a1457611a136117a0565b5b6000611a22858286016119e8565b9250506020611a338582860161195d565b9150509250929050565b600060208284031215611a5357611a526117a0565b5b6000611a61848285016119e8565b91505092915050565b611a73816119bf565b82525050565b6000602082019050611a8e6000830184611a6a565b92915050565b600080600060608486031215611aad57611aac6117a0565b5b6000611abb868287016119e8565b9350506020611acc868287016119e8565b9250506040611add8682870161195d565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611b2e57607f821691505b602082108103611b4157611b40611ae7565b5b50919050565b6000819050919050565b6000611b6c611b67611b628461199f565b611b47565b61199f565b9050919050565b6000611b7e82611b51565b9050919050565b6000611b9082611b73565b9050919050565b611ba081611b85565b82525050565b6000606082019050611bbb6000830186611a6a565b611bc86020830185611b97565b611bd5604083018461191c565b949350505050565b600081519050919050565b600081905092915050565b6000611bfe82611bdd565b611c088185611be8565b9350611c1881856020860161187c565b80840191505092915050565b6000611c308284611bf3565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000611c7160098361186b565b9150611c7c82611c3b565b602082019050919050565b60006020820190508181036000830152611ca081611c64565b9050919050565b611cb08161182a565b8114611cbb57600080fd5b50565b600081519050611ccd81611ca7565b92915050565b600060208284031215611ce957611ce86117a0565b5b6000611cf784828501611cbe565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000611d36600c8361186b565b9150611d4182611d00565b602082019050919050565b60006020820190508181036000830152611d6581611d29565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611da682611912565b9150611db183611912565b9250828201905080821115611dc957611dc8611d6c565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000611e0560088361186b565b9150611e1082611dcf565b602082019050919050565b60006020820190508181036000830152611e3481611df8565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000611e7160078361186b565b9150611e7c82611e3b565b602082019050919050565b60006020820190508181036000830152611ea081611e64565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b6000611edd60108361186b565b9150611ee882611ea7565b602082019050919050565b60006020820190508181036000830152611f0c81611ed0565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b6000611f4960118361186b565b9150611f5482611f13565b602082019050919050565b60006020820190508181036000830152611f7881611f3c565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000611fb560128361186b565b9150611fc082611f7f565b602082019050919050565b60006020820190508181036000830152611fe481611fa8565b9050919050565b6000611ff682611912565b915061200183611912565b925082820390508181111561201957612018611d6c565b5b92915050565b60006020820190506120346000830184611b97565b92915050565b60008151905061204981611946565b92915050565b600060208284031215612065576120646117a0565b5b60006120738482850161203a565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b60006120b2600b8361186b565b91506120bd8261207c565b602082019050919050565b600060208201905081810360008301526120e1816120a5565b9050919050565b60006040820190506120fd6000830185611a6a565b61210a602083018461191c565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b6000612147600c8361186b565b915061215282612111565b602082019050919050565b600060208201905081810360008301526121768161213a565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b60006121b360108361186b565b91506121be8261217d565b602082019050919050565b600060208201905081810360008301526121e2816121a6565b9050919050565b60006121f482611912565b91506121ff83611912565b925082820261220d81611912565b9150828204841483151761222457612223611d6c565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061226582611912565b915061227083611912565b9250826122805761227f61222b565b5b828204905092915050565b60006060820190506122a06000830186611a6a565b6122ad6020830185611a6a565b6122ba604083018461191c565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b60006122f8600a8361186b565b9150612303826122c2565b602082019050919050565b60006020820190508181036000830152612327816122eb565b905091905056fea2646970667358221220c637056a8e5faeaf2c485c4909d2752af5d6e0c16fe5c4eccffe73c0e522d71164736f6c63430008130033 -\ No newline at end of file +60a06040523480156200001157600080fd5b5060405162002f3938038062002f398339818101604052810190620000379190620003ac565b8560079081620000489190620006d7565b5084600890816200005a9190620006d7565b508360ff166080818152505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600681905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050620007be565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001a48262000159565b810181811067ffffffffffffffff82111715620001c657620001c56200016a565b5b80604052505050565b6000620001db6200013b565b9050620001e9828262000199565b919050565b600067ffffffffffffffff8211156200020c576200020b6200016a565b5b620002178262000159565b9050602081019050919050565b60005b838110156200024457808201518184015260208101905062000227565b60008484015250505050565b6000620002676200026184620001ee565b620001cf565b90508281526020810184848401111562000286576200028562000154565b5b6200029384828562000224565b509392505050565b600082601f830112620002b357620002b26200014f565b5b8151620002c584826020860162000250565b91505092915050565b600060ff82169050919050565b620002e681620002ce565b8114620002f257600080fd5b50565b6000815190506200030681620002db565b92915050565b6000819050919050565b62000321816200030c565b81146200032d57600080fd5b50565b600081519050620003418162000316565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003748262000347565b9050919050565b620003868162000367565b81146200039257600080fd5b50565b600081519050620003a6816200037b565b92915050565b60008060008060008060c08789031215620003cc57620003cb62000145565b5b600087015167ffffffffffffffff811115620003ed57620003ec6200014a565b5b620003fb89828a016200029b565b965050602087015167ffffffffffffffff8111156200041f576200041e6200014a565b5b6200042d89828a016200029b565b95505060406200044089828a01620002f5565b94505060606200045389828a0162000330565b93505060806200046689828a0162000395565b92505060a06200047989828a0162000395565b9150509295509295509295565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620004d957607f821691505b602082108103620004ef57620004ee62000491565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b6000600883026200055c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200051a565b6200056886836200051a565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620005b5620005af620005a98462000580565b6200058a565b62000580565b9050919050565b6000819050919050565b620005d18362000594565b620005e9620005e082620005bc565b8484546200052a565b825550505050565b600090565b62000600620005f1565b6200060d818484620005c6565b505050565b5b81811015620006355762000629600082620005f6565b60018101905062000613565b5050565b601f82111562000684576200064e81620004f5565b62000659846200050a565b8101602085101562000669578190505b6200068162000678856200050a565b83018262000612565b50505b505050565b60008160020a8304905092915050565b6000620006ac6000198460080262000689565b1980831691505092915050565b6000620006c7838362000699565b9150826002028217905092915050565b620006e28262000486565b67ffffffffffffffff811115620006fe57620006fd6200016a565b5b6200070a8254620004c0565b6200071782828562000639565b600060209050601f8311600181146200074f57600084156200073a578287015190505b620007468582620006b9565b865550620007b6565b601f1984166200075f86620004f5565b60005b82811015620007895784890151825560018201915060208501945060208101905062000762565b86831015620007a95784890151620007a5601f89168262000699565b8355505b6001600288020188555050505b505050505050565b60805161275f620007da600039600061055f015261275f6000f3fe608060405234801561001057600080fd5b5060043610610128576000357c01000000000000000000000000000000000000000000000000000000009004806351cff8d9116100bf5780638da5cb5b1161008e5780638da5cb5b146102d757806395d89b41146102f5578063d9caed1214610313578063f2fde38b1461032f578063f3fef3a31461035f57610128565b806351cff8d91461023f57806369fe0e2d1461026f57806386fe212d1461028b5780638705fcd4146102bb57610128565b80632c1758c1116100fb5780632c1758c1146101b7578063313ce567146101e757806331a5995d1461020557806347e7ef241461022357610128565b806301ffc9a71461012d57806306fdde031461015d57806318160ddd1461017b57806318cbbcfc14610199575b600080fd5b61014760048036038101906101429190611b8c565b61038f565b6040516101549190611bd4565b60405180910390f35b610165610491565b6040516101729190611c7f565b60405180910390f35b61018361051f565b6040516101909190611cba565b60405180910390f35b6101a1610525565b6040516101ae9190611cba565b60405180910390f35b6101d160048036038101906101cc9190611d01565b61052a565b6040516101de9190611bd4565b60405180910390f35b6101ef61055d565b6040516101fc9190611cba565b60405180910390f35b61020d610581565b60405161021a9190611cba565b60405180910390f35b61023d60048036038101906102389190611d8c565b610587565b005b61025960048036038101906102549190611dcc565b610777565b6040516102669190611cba565b60405180910390f35b61028960048036038101906102849190611d01565b610813565b005b6102a560048036038101906102a09190611d01565b61093d565b6040516102b29190611cba565b60405180910390f35b6102d560048036038101906102d09190611dcc565b610a25565b005b6102df610b44565b6040516102ec9190611e08565b60405180910390f35b6102fd610b68565b60405161030a9190611c7f565b60405180910390f35b61032d60048036038101906103289190611e23565b610bf6565b005b61034960048036038101906103449190611dcc565b61101c565b6040516103569190611bd4565b60405180910390f35b61037960048036038101906103749190611d8c565b61115e565b6040516103869190611cba565b60405180910390f35b60006301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036103e3576001905061048c565b639493f8b27c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610435576001905061048c565b630d7491f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610487576001905061048c565b600090505b919050565b6007805461049e90611ea5565b80601f01602080910402602001604051908101604052809291908181526020018280546104ca90611ea5565b80156105175780601f106104ec57610100808354040283529160200191610517565b820191906000526020600020905b8154815290600101906020018083116104fa57829003601f168201915b505050505081565b60095481565b600381565b60006003821061053957600080fd5b6000820361054e576003600b54149050610558565b81600b5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600b5481565b600060606105b784600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166113b6565b6105c1848461158f565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016105ed93929190611f35565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516106779190611fb3565b6000604051808303816000865af19150503d80600081146106b4576040519150601f19603f3d011682016040523d82523d6000602084013e6106b9565b606091505b50809250819350505081610702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f990612016565b60405180910390fd5b808060200190518101906107169190612062565b915081610758576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074f906120db565b60405180910390fd5b826009600082825461076a919061212a565b9250508190555050505050565b600080600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080b838261115e565b915050919050565b610820600160ff1661052a565b15610860576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610857906121aa565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e590612216565b60405180910390fd5b620f42408110610933576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092a90612282565b60405180910390fd5b8060048190555050565b60006003821115610983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097a906122ee565b60405180910390fd5b6000600b548316146109ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c19061235a565b60405180910390fd5b81600b600082825417925050819055506003600b541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600b54604051610a139190611cba565b60405180910390a2600b549050919050565b610a32600260ff1661052a565b15610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906121aa565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af790612216565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054610b7590611ea5565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba190611ea5565b8015610bee5780601f10610bc357610100808354040283529160200191610bee565b820191906000526020600020905b815481529060010190602001808311610bd157829003601f168201915b505050505081565b600060606000806000610c0886611914565b90508086610c16919061237a565b9250610c23888885611941565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610c4d91906123ae565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610cd79190611fb3565b6000604051808303816000865af19150503d8060008114610d14576040519150601f19603f3d011682016040523d82523d6000602084013e610d19565b606091505b50809550819650505084610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612016565b60405180910390fd5b83806020019051810190610d7691906123de565b91508083610d84919061212a565b821015610dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dbd90612457565b60405180910390fd5b610dd08787610587565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610dfa929190612477565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e849190611fb3565b6000604051808303816000865af19150503d8060008114610ec1576040519150601f19603f3d011682016040523d82523d6000602084013e610ec6565b606091505b50809550819650505084610f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0690612016565b60405180910390fd5b83806020019051810190610f239190612062565b945084610f65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5c906120db565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110125780600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461100a919061212a565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461107757600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036111f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111eb90612216565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685604051602401611240929190612477565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516112ca9190611fb3565b6000604051808303816000865af19150503d8060008114611307576040519150601f19603f3d011682016040523d82523d6000602084013e61130c565b606091505b50809250819350505081611355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134c90612016565b60405180910390fd5b808060200190518101906113699190612062565b9150816113ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a2906120db565b60405180910390fd5b839250505092915050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036113f557505061158b565b8273ffffffffffffffffffffffffffffffffffffffff168460405160240161141d9190611e08565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516114a79190611fb3565b6000604051808303816000865af19150503d80600081146114e4576040519150601f19603f3d011682016040523d82523d6000602084013e6114e9565b606091505b50809250819350505081611532576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611529906124ec565b60405180910390fd5b808060200190518101906115469190612062565b915081611588576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157f90612558565b60405180910390fd5b50505b5050565b60006060600080600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036115f55750505050611910565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660405160240161163f9190611e08565b6040516020818303038152906040527f546a2ca4000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116c99190611fb3565b6000604051808303816000865af19150503d8060008114611706576040519150601f19603f3d011682016040523d82523d6000602084013e61170b565b606091505b50809450819550505083611754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174b90612016565b60405180910390fd5b8280602001905181019061176891906123de565b91508573ffffffffffffffffffffffffffffffffffffffff163060405160240161179291906123ae565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161181c9190611fb3565b6000604051808303816000865af19150503d8060008114611859576040519150601f19603f3d011682016040523d82523d6000602084013e61185e565b606091505b508094508195505050836118a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189e90612016565b60405180910390fd5b828060200190518101906118bb91906123de565b90508185826118ca919061212a565b111561190b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611902906125c4565b60405180910390fd5b505050505b5050565b6000806004548361192591906125e4565b9050620f4240816119369190612655565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036119a857849350505050611b28565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168787876040516024016119f693929190612686565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611a809190611fb3565b6000604051808303816000865af19150503d8060008114611abd576040519150601f19603f3d011682016040523d82523d6000602084013e611ac2565b606091505b50809350819450505082611b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0290612709565b60405180910390fd5b81806020019051810190611b1f91906123de565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611b6981611b34565b8114611b7457600080fd5b50565b600081359050611b8681611b60565b92915050565b600060208284031215611ba257611ba1611b2f565b5b6000611bb084828501611b77565b91505092915050565b60008115159050919050565b611bce81611bb9565b82525050565b6000602082019050611be96000830184611bc5565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611c29578082015181840152602081019050611c0e565b60008484015250505050565b6000601f19601f8301169050919050565b6000611c5182611bef565b611c5b8185611bfa565b9350611c6b818560208601611c0b565b611c7481611c35565b840191505092915050565b60006020820190508181036000830152611c998184611c46565b905092915050565b6000819050919050565b611cb481611ca1565b82525050565b6000602082019050611ccf6000830184611cab565b92915050565b611cde81611ca1565b8114611ce957600080fd5b50565b600081359050611cfb81611cd5565b92915050565b600060208284031215611d1757611d16611b2f565b5b6000611d2584828501611cec565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611d5982611d2e565b9050919050565b611d6981611d4e565b8114611d7457600080fd5b50565b600081359050611d8681611d60565b92915050565b60008060408385031215611da357611da2611b2f565b5b6000611db185828601611d77565b9250506020611dc285828601611cec565b9150509250929050565b600060208284031215611de257611de1611b2f565b5b6000611df084828501611d77565b91505092915050565b611e0281611d4e565b82525050565b6000602082019050611e1d6000830184611df9565b92915050565b600080600060608486031215611e3c57611e3b611b2f565b5b6000611e4a86828701611d77565b9350506020611e5b86828701611d77565b9250506040611e6c86828701611cec565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611ebd57607f821691505b602082108103611ed057611ecf611e76565b5b50919050565b6000819050919050565b6000611efb611ef6611ef184611d2e565b611ed6565b611d2e565b9050919050565b6000611f0d82611ee0565b9050919050565b6000611f1f82611f02565b9050919050565b611f2f81611f14565b82525050565b6000606082019050611f4a6000830186611df9565b611f576020830185611f26565b611f646040830184611cab565b949350505050565b600081519050919050565b600081905092915050565b6000611f8d82611f6c565b611f978185611f77565b9350611fa7818560208601611c0b565b80840191505092915050565b6000611fbf8284611f82565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000612000600983611bfa565b915061200b82611fca565b602082019050919050565b6000602082019050818103600083015261202f81611ff3565b9050919050565b61203f81611bb9565b811461204a57600080fd5b50565b60008151905061205c81612036565b92915050565b60006020828403121561207857612077611b2f565b5b60006120868482850161204d565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b60006120c5600c83611bfa565b91506120d08261208f565b602082019050919050565b600060208201905081810360008301526120f4816120b8565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061213582611ca1565b915061214083611ca1565b9250828201905080821115612158576121576120fb565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000612194600883611bfa565b915061219f8261215e565b602082019050919050565b600060208201905081810360008301526121c381612187565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000612200600783611bfa565b915061220b826121ca565b602082019050919050565b6000602082019050818103600083015261222f816121f3565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b600061226c601083611bfa565b915061227782612236565b602082019050919050565b6000602082019050818103600083015261229b8161225f565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b60006122d8601183611bfa565b91506122e3826122a2565b602082019050919050565b60006020820190508181036000830152612307816122cb565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000612344601283611bfa565b915061234f8261230e565b602082019050919050565b6000602082019050818103600083015261237381612337565b9050919050565b600061238582611ca1565b915061239083611ca1565b92508282039050818111156123a8576123a76120fb565b5b92915050565b60006020820190506123c36000830184611f26565b92915050565b6000815190506123d881611cd5565b92915050565b6000602082840312156123f4576123f3611b2f565b5b6000612402848285016123c9565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b6000612441600b83611bfa565b915061244c8261240b565b602082019050919050565b6000602082019050818103600083015261247081612434565b9050919050565b600060408201905061248c6000830185611df9565b6124996020830184611cab565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b60006124d6600c83611bfa565b91506124e1826124a0565b602082019050919050565b60006020820190508181036000830152612505816124c9565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b6000612542601083611bfa565b915061254d8261250c565b602082019050919050565b6000602082019050818103600083015261257181612535565b9050919050565b7f4552525f4c494d49540000000000000000000000000000000000000000000000600082015250565b60006125ae600983611bfa565b91506125b982612578565b602082019050919050565b600060208201905081810360008301526125dd816125a1565b9050919050565b60006125ef82611ca1565b91506125fa83611ca1565b925082820261260881611ca1565b9150828204841483151761261f5761261e6120fb565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061266082611ca1565b915061266b83611ca1565b92508261267b5761267a612626565b5b828204905092915050565b600060608201905061269b6000830186611df9565b6126a86020830185611df9565b6126b56040830184611cab565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b60006126f3600a83611bfa565b91506126fe826126bd565b602082019050919050565b60006020820190508181036000830152612722816126e6565b905091905056fea264697066735822122098be4e2b552633f76964c6ca47fc4d27dae33b7385b79deb70f03ffcf6dbd97164736f6c63430008130033 +\ No newline at end of file diff --git a/python/erc20_pool/data/SwapPool.json b/python/erc20_pool/data/SwapPool.json @@ -1 +1 @@ -[{"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"}] +[{"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"},{"internalType":"address","name":"_limitRegistry","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"}] 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":"0x954a98452d67b8c1587a76b94f57a0fb277678a92c40347662cbd36b7b34e245","license":"AGPL-3.0-or-later","urls":["bzz-raw://fe8853bf6e26769186afe48207c968b60c49dbb6fd3beefa0295a6e2284cb80c","dweb:/ipfs/QmW2wruSUAs1x1ufHYQudffBhpW2e5FEcEGBFhHPbg6HmN"]}},"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"},{"internalType":"address","name":"_limitRegistry","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":"0x8d5d35d744c8144011bffb199a412190d9e6849b9cbf2b8b37111825434f399b","license":"AGPL-3.0-or-later","urls":["bzz-raw://c0340193ea94afeb5121845b5cff2ac42cb56d9b45cb44a9aeda2fe36cae8883","dweb:/ipfs/QmdfwjtRdKF32HeUguR6sM1E1Q3p6P5vpDC1iys58zW97U"]}},"version":1} diff --git a/python/erc20_pool/pool.py b/python/erc20_pool/pool.py @@ -37,19 +37,21 @@ class Pool(TxFactory): __abi = None __bytecode = None - def constructor(self, sender_address, name, symbol, decimals, declaration=None, accounts_registry=None, tx_format=TxFormat.JSONRPC, version=None): - code = self.cargs(name, symbol, decimals, declaration=declaration, accounts_registry=accounts_registry, version=version) + def constructor(self, sender_address, name, symbol, decimals, declaration=None, accounts_registry=None, limit_registry=None, tx_format=TxFormat.JSONRPC, version=None): + code = self.cargs(name, symbol, decimals, declaration=declaration, accounts_registry=accounts_registry, limit_registry=limit_registry, version=version) tx = self.template(sender_address, None, use_nonce=True) tx = self.set_code(tx, code) return self.finalize(tx, tx_format) @staticmethod - def cargs(name, symbol, decimals, declaration=None, accounts_registry=None, version=None): + def cargs(name, symbol, decimals, declaration=None, accounts_registry=None, limit_registry=None, version=None): if declaration == None: declaration = ZERO_CONTENT if accounts_registry == None: accounts_registry = ZERO_ADDRESS + if limit_registry == None: + limit_registry = ZERO_ADDRESS code = Pool.bytecode(version=version) enc = ABIContractEncoder() enc.string(name) @@ -57,6 +59,7 @@ class Pool(TxFactory): enc.uint256(decimals) enc.bytes32(declaration) enc.address(accounts_registry) + enc.address(limit_registry) args = enc.get() code += args logg.debug('constructor code: ' + args) diff --git a/solidity/SwapPool.sol b/solidity/SwapPool.sol @@ -9,7 +9,8 @@ contract SwapPool { // Implements EIP173 address public owner; - address registry; + address tokenRegistry; + address limitRegistry; address quoter; uint256 feePpm; address feeAddress; @@ -35,11 +36,12 @@ contract SwapPool { // EIP173 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); // EIP173 - constructor(string memory _name, string memory _symbol, uint8 _decimals, bytes32 _declaration, address _tokenRegistry) { + constructor(string memory _name, string memory _symbol, uint8 _decimals, bytes32 _declaration, address _tokenRegistry, address _limitRegistry) { name = _name; symbol = _symbol; decimals = _decimals; - registry = _tokenRegistry; + tokenRegistry = _tokenRegistry; + limitRegistry = _limitRegistry; declaration = _declaration; owner = msg.sender; } @@ -91,7 +93,8 @@ contract SwapPool { bool r; bytes memory v; - mustAllowedToken(_token, registry); + mustAllowedToken(_token, tokenRegistry); + mustWithinLimit(_token, _value); (r, v) = _token.call(abi.encodeWithSignature('transferFrom(address,address,uint256)', msg.sender, this, _value)); require(r, "ERR_TOKEN"); @@ -177,19 +180,39 @@ contract SwapPool { return _value; } - function mustAllowedToken(address _token, address _registry) private { + function mustAllowedToken(address _token, address _tokenRegistry) private { bool r; bytes memory v; - if (_registry == address(0)) { + if (_tokenRegistry == address(0)) { return; } - (r, v) = _registry.call(abi.encodeWithSignature('have(address)', _token)); + (r, v) = _tokenRegistry.call(abi.encodeWithSignature('have(address)', _token)); require(r, "ERR_REGISTRY"); r = abi.decode(v, (bool)); require(r, "ERR_UNAUTH_TOKEN"); } + + function mustWithinLimit(address _token, uint256 _valueDelta) private { + bool r; + bytes memory v; + uint256 limit; + uint256 balance; + + if (limitRegistry == address(0)) { + return; + } + + (r, v) = limitRegistry.call(abi.encodeWithSignature("limitOf(address)", _token)); + require(r, "ERR_TOKEN"); + limit = abi.decode(v, (uint256)); + + (r, v) = _token.call(abi.encodeWithSignature("balanceOf(address)", this)); + require(r, "ERR_TOKEN"); + balance = abi.decode(v, (uint256)); + require(balance + _valueDelta <= limit, "ERR_LIMIT"); + } // Implements EIP165 function supportsInterface(bytes4 _sum) public pure returns (bool) {