erc20-pool

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

commit 561c4b3a7160f580776f03d34e77234a5da9c18f
parent f812790610f01f8f5996323b09886981403136fb
Author: Mohammed Sohail <sohailsameja@gmail.com>
Date:   Mon,  8 Apr 2024 12:13:50 +0800

fixes: fee application to swap quote

commit 4931ef1d700a750c64417997d8d1905fdafb103e
Author: Mohammed Sohail <sohailsameja@gmail.com>
Date:   Tue Mar 26 16:56:44 2024 +0800

    fix: include fees in public liquidity

commit 78844169c5881d9f66bb921e0b4554e07bcda4ba
Author: Mohammed Sohail <sohailsameja@gmail.com>
Date:   Thu Mar 21 17:00:33 2024 +0800

    update: fix-pool builds

commit ab897bf901a76fa783908f9ca6dbfc43ad46df5f
Author: Mohammed Sohail <sohailsameja@gmail.com>
Date:   Thu Mar 21 16:57:06 2024 +0800

    fix: apply fee after quote. Exclude fees from public liquidity

commit c38fb552e9a05956fd1d7477dec1c79827b757e2
Author: Mohammed Sohail <sohailsameja@gmail.com>
Date:   Thu Mar 21 13:09:29 2024 +0800

    feat: make getQuote a public function

    * useful for 3rd part integration. No need to make a 2nd call to the quoter.

Diffstat:
M.gitignore | 2++
Mpython/erc20_pool/data/SwapPool.bin | 4++--
Mpython/erc20_pool/data/SwapPool.json | 2+-
Mpython/erc20_pool/data/SwapPool.metadata.json | 2+-
Msolidity/SwapPool.sol | 19++++++++++++-------
5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -5,3 +5,4 @@ build/ dist/ solidity/*.json solidity/*.bin +.venv +\ No newline at end of file diff --git a/python/erc20_pool/data/SwapPool.bin b/python/erc20_pool/data/SwapPool.bin @@ -1 +1 @@ -60a060405234801561001057600080fd5b5060405161312c38038061312c83398181016040528101906100329190610335565b84600690816100419190610609565b5083600790816100519190610609565b508260ff166080818152505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050506106db565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61019082610147565b810181811067ffffffffffffffff821117156101af576101ae610158565b5b80604052505050565b60006101c2610129565b90506101ce8282610187565b919050565b600067ffffffffffffffff8211156101ee576101ed610158565b5b6101f782610147565b9050602081019050919050565b60005b83811015610222578082015181840152602081019050610207565b60008484015250505050565b600061024161023c846101d3565b6101b8565b90508281526020810184848401111561025d5761025c610142565b5b610268848285610204565b509392505050565b600082601f8301126102855761028461013d565b5b815161029584826020860161022e565b91505092915050565b600060ff82169050919050565b6102b48161029e565b81146102bf57600080fd5b50565b6000815190506102d1816102ab565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610302826102d7565b9050919050565b610312816102f7565b811461031d57600080fd5b50565b60008151905061032f81610309565b92915050565b600080600080600060a0868803121561035157610350610133565b5b600086015167ffffffffffffffff81111561036f5761036e610138565b5b61037b88828901610270565b955050602086015167ffffffffffffffff81111561039c5761039b610138565b5b6103a888828901610270565b94505060406103b9888289016102c2565b93505060606103ca88828901610320565b92505060806103db88828901610320565b9150509295509295909350565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061043a57607f821691505b60208210810361044d5761044c6103f3565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104b57fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610478565b6104bf8683610478565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006105066105016104fc846104d7565b6104e1565b6104d7565b9050919050565b6000819050919050565b610520836104eb565b61053461052c8261050d565b848454610485565b825550505050565b600090565b61054961053c565b610554818484610517565b505050565b5b818110156105785761056d600082610541565b60018101905061055a565b5050565b601f8211156105bd5761058e81610453565b61059784610468565b810160208510156105a6578190505b6105ba6105b285610468565b830182610559565b50505b505050565b600082821c905092915050565b60006105e0600019846008026105c2565b1980831691505092915050565b60006105f983836105cf565b9150826002028217905092915050565b610612826103e8565b67ffffffffffffffff81111561062b5761062a610158565b5b6106358254610422565b61064082828561057c565b600060209050601f8311600181146106735760008415610661578287015190505b61066b85826105ed565b8655506106d3565b601f19841661068186610453565b60005b828110156106a957848901518255600182019150602085019450602081019050610684565b868310156106c657848901516106c2601f8916826105cf565b8355505b6001600288020188555050505b505050505050565b608051612a366106f660003960006105e20152612a366000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c806369fe0e2d116100c3578063a534150c1161007c578063a534150c14610392578063c6bbd5a7146103b0578063d9caed12146103ce578063f2fde38b146103ea578063f3fef3a31461041a578063f912c64b1461044a5761014d565b806369fe0e2d146102d057806386fe212d146102ec5780638705fcd41461031c5780638da5cb5b1461033857806395d89b41146103565780639d23c4c7146103745761014d565b8063313ce56711610115578063313ce5671461020c57806331a5995d1461022a578063412753581461024857806347e7ef241461026657806351cff8d91461028257806353799c57146102b25761014d565b806301ffc9a71461015257806306fdde031461018257806318160ddd146101a057806318cbbcfc146101be5780632c1758c1146101dc575b600080fd5b61016c60048036038101906101679190611dce565b610466565b6040516101799190611e16565b60405180910390f35b61018a610514565b6040516101979190611ec1565b60405180910390f35b6101a86105a2565b6040516101b59190611efc565b60405180910390f35b6101c66105a8565b6040516101d39190611efc565b60405180910390f35b6101f660048036038101906101f19190611f43565b6105ad565b6040516102039190611e16565b60405180910390f35b6102146105e0565b6040516102219190611efc565b60405180910390f35b610232610604565b60405161023f9190611efc565b60405180910390f35b61025061060a565b60405161025d9190611fb1565b60405180910390f35b610280600480360381019061027b9190611ff8565b610630565b005b61029c60048036038101906102979190612038565b610820565b6040516102a99190611efc565b60405180910390f35b6102ba6108bc565b6040516102c79190611fb1565b60405180910390f35b6102ea60048036038101906102e59190611f43565b6108e2565b005b61030660048036038101906103019190611f43565b610a0c565b6040516103139190611efc565b60405180910390f35b61033660048036038101906103319190612038565b610af4565b005b610340610c13565b60405161034d9190611fb1565b60405180910390f35b61035e610c37565b60405161036b9190611ec1565b60405180910390f35b61037c610cc5565b6040516103899190611fb1565b60405180910390f35b61039a610ceb565b6040516103a79190611efc565b60405180910390f35b6103b8610cf1565b6040516103c59190611fb1565b60405180910390f35b6103e860048036038101906103e39190612065565b610d17565b005b61040460048036038101906103ff9190612038565b61113d565b6040516104119190611e16565b60405180910390f35b610434600480360381019061042f9190611ff8565b61127f565b6040516104419190611efc565b60405180910390f35b610464600480360381019061045f9190612038565b6114d7565b005b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361049e576001905061050f565b639493f8b260e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104d4576001905061050f565b630d7491f860e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361050a576001905061050f565b600090505b919050565b60068054610521906120e7565b80601f016020809104026020016040519081016040528092919081815260200182805461054d906120e7565b801561059a5780601f1061056f5761010080835404028352916020019161059a565b820191906000526020600020905b81548152906001019060200180831161057d57829003601f168201915b505050505081565b60085481565b600781565b6000600782106105bc57600080fd5b600082036105d1576007600a541490506105db565b81600a5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600a5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000606061066084600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166115f6565b61066a84846117cf565b8373ffffffffffffffffffffffffffffffffffffffff1633308560405160240161069693929190612177565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161072091906121f5565b6000604051808303816000865af19150503d806000811461075d576040519150601f19603f3d011682016040523d82523d6000602084013e610762565b606091505b508092508193505050816107ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a290612258565b60405180910390fd5b808060200190518101906107bf91906122a4565b915081610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f89061231d565b60405180910390fd5b8260086000828254610813919061236c565b9250508190555050505050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b4838261127f565b915050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108ef600160ff166105ad565b1561092f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610926906123ec565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b490612458565b60405180910390fd5b620f42408110610a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f9906124c4565b60405180910390fd5b8060048190555050565b60006007821115610a52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4990612530565b60405180910390fd5b6000600a54831614610a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a909061259c565b60405180910390fd5b81600a600082825417925050819055506007600a541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600a54604051610ae29190611efc565b60405180910390a2600a549050919050565b610b01600260ff166105ad565b15610b41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b38906123ec565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bcf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc690612458565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610c44906120e7565b80601f0160208091040260200160405190810160405280929190818152602001828054610c70906120e7565b8015610cbd5780601f10610c9257610100808354040283529160200191610cbd565b820191906000526020600020905b815481529060010190602001808311610ca057829003601f168201915b505050505081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060606000806000610d2986611b56565b90508086610d3791906125bc565b9250610d44888885611b83565b92508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610d6e91906125f0565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610df891906121f5565b6000604051808303816000865af19150503d8060008114610e35576040519150601f19603f3d011682016040523d82523d6000602084013e610e3a565b606091505b50809550819650505084610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a90612258565b60405180910390fd5b83806020019051810190610e979190612620565b91508083610ea5919061236c565b821015610ee7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ede90612699565b60405180910390fd5b610ef18787610630565b8773ffffffffffffffffffffffffffffffffffffffff163384604051602401610f1b9291906126b9565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610fa591906121f5565b6000604051808303816000865af19150503d8060008114610fe2576040519150601f19603f3d011682016040523d82523d6000602084013e610fe7565b606091505b50809550819650505084611030576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102790612258565b60405180910390fd5b8380602001905181019061104491906122a4565b945084611086576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107d9061231d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111335780600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461112b919061236c565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461119857600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611315576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130c90612458565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040516024016113619291906126b9565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516113eb91906121f5565b6000604051808303816000865af19150503d8060008114611428576040519150601f19603f3d011682016040523d82523d6000602084013e61142d565b606091505b50809250819350505081611476576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146d90612258565b60405180910390fd5b8080602001905181019061148a91906122a4565b9150816114cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c39061231d565b60405180910390fd5b839250505092915050565b6114e4600460ff166105ad565b15611524576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151b906123ec565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a990612458565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036116355750506117cb565b8273ffffffffffffffffffffffffffffffffffffffff168460405160240161165d9190611fb1565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116e791906121f5565b6000604051808303816000865af19150503d8060008114611724576040519150601f19603f3d011682016040523d82523d6000602084013e611729565b606091505b50809250819350505081611772576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117699061272e565b60405180910390fd5b8080602001905181019061178691906122a4565b9150816117c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117bf9061279a565b60405180910390fd5b50505b5050565b60006060600080600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036118355750505050611b52565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1686306040516024016118819291906127ba565b6040516020818303038152906040527f23778613000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161190b91906121f5565b6000604051808303816000865af19150503d8060008114611948576040519150601f19603f3d011682016040523d82523d6000602084013e61194d565b606091505b50809450819550505083611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198d9061282f565b60405180910390fd5b828060200190518101906119aa9190612620565b91508573ffffffffffffffffffffffffffffffffffffffff16306040516024016119d491906125f0565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611a5e91906121f5565b6000604051808303816000865af19150503d8060008114611a9b576040519150601f19603f3d011682016040523d82523d6000602084013e611aa0565b606091505b50809450819550505083611ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae090612258565b60405180910390fd5b82806020019051810190611afd9190612620565b9050818582611b0c919061236c565b1115611b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b449061289b565b60405180910390fd5b505050505b5050565b60008060045483611b6791906128bb565b9050620f424081611b78919061292c565b905080915050919050565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611bea57849350505050611d6a565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16878787604051602401611c389392919061295d565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611cc291906121f5565b6000604051808303816000865af19150503d8060008114611cff576040519150601f19603f3d011682016040523d82523d6000602084013e611d04565b606091505b50809350819450505082611d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d44906129e0565b60405180910390fd5b81806020019051810190611d619190612620565b90508093505050505b9392505050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611dab81611d76565b8114611db657600080fd5b50565b600081359050611dc881611da2565b92915050565b600060208284031215611de457611de3611d71565b5b6000611df284828501611db9565b91505092915050565b60008115159050919050565b611e1081611dfb565b82525050565b6000602082019050611e2b6000830184611e07565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611e6b578082015181840152602081019050611e50565b60008484015250505050565b6000601f19601f8301169050919050565b6000611e9382611e31565b611e9d8185611e3c565b9350611ead818560208601611e4d565b611eb681611e77565b840191505092915050565b60006020820190508181036000830152611edb8184611e88565b905092915050565b6000819050919050565b611ef681611ee3565b82525050565b6000602082019050611f116000830184611eed565b92915050565b611f2081611ee3565b8114611f2b57600080fd5b50565b600081359050611f3d81611f17565b92915050565b600060208284031215611f5957611f58611d71565b5b6000611f6784828501611f2e565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611f9b82611f70565b9050919050565b611fab81611f90565b82525050565b6000602082019050611fc66000830184611fa2565b92915050565b611fd581611f90565b8114611fe057600080fd5b50565b600081359050611ff281611fcc565b92915050565b6000806040838503121561200f5761200e611d71565b5b600061201d85828601611fe3565b925050602061202e85828601611f2e565b9150509250929050565b60006020828403121561204e5761204d611d71565b5b600061205c84828501611fe3565b91505092915050565b60008060006060848603121561207e5761207d611d71565b5b600061208c86828701611fe3565b935050602061209d86828701611fe3565b92505060406120ae86828701611f2e565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806120ff57607f821691505b602082108103612112576121116120b8565b5b50919050565b6000819050919050565b600061213d61213861213384611f70565b612118565b611f70565b9050919050565b600061214f82612122565b9050919050565b600061216182612144565b9050919050565b61217181612156565b82525050565b600060608201905061218c6000830186611fa2565b6121996020830185612168565b6121a66040830184611eed565b949350505050565b600081519050919050565b600081905092915050565b60006121cf826121ae565b6121d981856121b9565b93506121e9818560208601611e4d565b80840191505092915050565b600061220182846121c4565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000612242600983611e3c565b915061224d8261220c565b602082019050919050565b6000602082019050818103600083015261227181612235565b9050919050565b61228181611dfb565b811461228c57600080fd5b50565b60008151905061229e81612278565b92915050565b6000602082840312156122ba576122b9611d71565b5b60006122c88482850161228f565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000612307600c83611e3c565b9150612312826122d1565b602082019050919050565b60006020820190508181036000830152612336816122fa565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061237782611ee3565b915061238283611ee3565b925082820190508082111561239a5761239961233d565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b60006123d6600883611e3c565b91506123e1826123a0565b602082019050919050565b60006020820190508181036000830152612405816123c9565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000612442600783611e3c565b915061244d8261240c565b602082019050919050565b6000602082019050818103600083015261247181612435565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b60006124ae601083611e3c565b91506124b982612478565b602082019050919050565b600060208201905081810360008301526124dd816124a1565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b600061251a601183611e3c565b9150612525826124e4565b602082019050919050565b600060208201905081810360008301526125498161250d565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000612586601283611e3c565b915061259182612550565b602082019050919050565b600060208201905081810360008301526125b581612579565b9050919050565b60006125c782611ee3565b91506125d283611ee3565b92508282039050818111156125ea576125e961233d565b5b92915050565b60006020820190506126056000830184612168565b92915050565b60008151905061261a81611f17565b92915050565b60006020828403121561263657612635611d71565b5b60006126448482850161260b565b91505092915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b6000612683600b83611e3c565b915061268e8261264d565b602082019050919050565b600060208201905081810360008301526126b281612676565b9050919050565b60006040820190506126ce6000830185611fa2565b6126db6020830184611eed565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b6000612718600c83611e3c565b9150612723826126e2565b602082019050919050565b600060208201905081810360008301526127478161270b565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b6000612784601083611e3c565b915061278f8261274e565b602082019050919050565b600060208201905081810360008301526127b381612777565b9050919050565b60006040820190506127cf6000830185611fa2565b6127dc6020830184612168565b9392505050565b7f4552525f4c494d49544552000000000000000000000000000000000000000000600082015250565b6000612819600b83611e3c565b9150612824826127e3565b602082019050919050565b600060208201905081810360008301526128488161280c565b9050919050565b7f4552525f4c494d49540000000000000000000000000000000000000000000000600082015250565b6000612885600983611e3c565b91506128908261284f565b602082019050919050565b600060208201905081810360008301526128b481612878565b9050919050565b60006128c682611ee3565b91506128d183611ee3565b92508282026128df81611ee3565b915082820484148315176128f6576128f561233d565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061293782611ee3565b915061294283611ee3565b925082612952576129516128fd565b5b828204905092915050565b60006060820190506129726000830186611fa2565b61297f6020830185611fa2565b61298c6040830184611eed565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b60006129ca600a83611e3c565b91506129d582612994565b602082019050919050565b600060208201905081810360008301526129f9816129bd565b905091905056fea264697066735822122095bffcc276f241676547404f8faac049211ef18e0223c2c18e8c3afc5c660c3164736f6c63430008190033 -\ No newline at end of file +60a060405234801561001057600080fd5b5060405161315c38038061315c83398181016040528101906100329190610335565b84600690816100419190610609565b5083600790816100519190610609565b508260ff166080818152505081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050506106db565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61019082610147565b810181811067ffffffffffffffff821117156101af576101ae610158565b5b80604052505050565b60006101c2610129565b90506101ce8282610187565b919050565b600067ffffffffffffffff8211156101ee576101ed610158565b5b6101f782610147565b9050602081019050919050565b60005b83811015610222578082015181840152602081019050610207565b60008484015250505050565b600061024161023c846101d3565b6101b8565b90508281526020810184848401111561025d5761025c610142565b5b610268848285610204565b509392505050565b600082601f8301126102855761028461013d565b5b815161029584826020860161022e565b91505092915050565b600060ff82169050919050565b6102b48161029e565b81146102bf57600080fd5b50565b6000815190506102d1816102ab565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610302826102d7565b9050919050565b610312816102f7565b811461031d57600080fd5b50565b60008151905061032f81610309565b92915050565b600080600080600060a0868803121561035157610350610133565b5b600086015167ffffffffffffffff81111561036f5761036e610138565b5b61037b88828901610270565b955050602086015167ffffffffffffffff81111561039c5761039b610138565b5b6103a888828901610270565b94505060406103b9888289016102c2565b93505060606103ca88828901610320565b92505060806103db88828901610320565b9150509295509295909350565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061043a57607f821691505b60208210810361044d5761044c6103f3565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026104b57fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610478565b6104bf8683610478565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b60006105066105016104fc846104d7565b6104e1565b6104d7565b9050919050565b6000819050919050565b610520836104eb565b61053461052c8261050d565b848454610485565b825550505050565b600090565b61054961053c565b610554818484610517565b505050565b5b818110156105785761056d600082610541565b60018101905061055a565b5050565b601f8211156105bd5761058e81610453565b61059784610468565b810160208510156105a6578190505b6105ba6105b285610468565b830182610559565b50505b505050565b600082821c905092915050565b60006105e0600019846008026105c2565b1980831691505092915050565b60006105f983836105cf565b9150826002028217905092915050565b610612826103e8565b67ffffffffffffffff81111561062b5761062a610158565b5b6106358254610422565b61064082828561057c565b600060209050601f8311600181146106735760008415610661578287015190505b61066b85826105ed565b8655506106d3565b601f19841661068186610453565b60005b828110156106a957848901518255600182019150602085019450602081019050610684565b868310156106c657848901516106c2601f8916826105cf565b8355505b6001600288020188555050505b505050505050565b608051612a666106f6600039600061061d0152612a666000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c806386fe212d116100c3578063c515ee231161007c578063c515ee23146103bb578063c6bbd5a7146103eb578063d9caed1214610409578063f2fde38b14610425578063f3fef3a314610455578063f912c64b1461048557610158565b806386fe212d146102f75780638705fcd4146103275780638da5cb5b1461034357806395d89b41146103615780639d23c4c71461037f578063a534150c1461039d57610158565b806331a5995d1161011557806331a5995d14610235578063412753581461025357806347e7ef241461027157806351cff8d91461028d57806353799c57146102bd57806369fe0e2d146102db57610158565b806301ffc9a71461015d57806306fdde031461018d57806318160ddd146101ab57806318cbbcfc146101c95780632c1758c1146101e7578063313ce56714610217575b600080fd5b61017760048036038101906101729190611dfe565b6104a1565b6040516101849190611e46565b60405180910390f35b61019561054f565b6040516101a29190611ef1565b60405180910390f35b6101b36105dd565b6040516101c09190611f2c565b60405180910390f35b6101d16105e3565b6040516101de9190611f2c565b60405180910390f35b61020160048036038101906101fc9190611f73565b6105e8565b60405161020e9190611e46565b60405180910390f35b61021f61061b565b60405161022c9190611f2c565b60405180910390f35b61023d61063f565b60405161024a9190611f2c565b60405180910390f35b61025b610645565b6040516102689190611fe1565b60405180910390f35b61028b60048036038101906102869190612028565b61066b565b005b6102a760048036038101906102a29190612068565b61085b565b6040516102b49190611f2c565b60405180910390f35b6102c56108f7565b6040516102d29190611fe1565b60405180910390f35b6102f560048036038101906102f09190611f73565b61091d565b005b610311600480360381019061030c9190611f73565b610a47565b60405161031e9190611f2c565b60405180910390f35b610341600480360381019061033c9190612068565b610b2f565b005b61034b610c4e565b6040516103589190611fe1565b60405180910390f35b610369610c72565b6040516103769190611ef1565b60405180910390f35b610387610d00565b6040516103949190611fe1565b60405180910390f35b6103a5610d26565b6040516103b29190611f2c565b60405180910390f35b6103d560048036038101906103d09190612095565b610d2c565b6040516103e29190611f2c565b60405180910390f35b6103f3610f1a565b6040516104009190611fe1565b60405180910390f35b610423600480360381019061041e9190612095565b610f40565b005b61043f600480360381019061043a9190612068565b61135b565b60405161044c9190611e46565b60405180910390f35b61046f600480360381019061046a9190612028565b61149d565b60405161047c9190611f2c565b60405180910390f35b61049f600480360381019061049a9190612068565b6116f5565b005b60006301ffc9a760e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916036104d9576001905061054a565b639493f8b260e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19160361050f576001905061054a565b630d7491f860e01b827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191603610545576001905061054a565b600090505b919050565b6006805461055c90612117565b80601f016020809104026020016040519081016040528092919081815260200182805461058890612117565b80156105d55780601f106105aa576101008083540402835291602001916105d5565b820191906000526020600020905b8154815290600101906020018083116105b857829003601f168201915b505050505081565b60085481565b600781565b6000600782106105f757600080fd5b6000820361060c576007600a54149050610616565b81600a5483161490505b919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600a5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000606061069b84600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611814565b6106a584846119ed565b8373ffffffffffffffffffffffffffffffffffffffff163330856040516024016106d1939291906121a7565b6040516020818303038152906040527f23b872dd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161075b9190612225565b6000604051808303816000865af19150503d8060008114610798576040519150601f19603f3d011682016040523d82523d6000602084013e61079d565b606091505b508092508193505050816107e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107dd90612288565b60405180910390fd5b808060200190518101906107fa91906122d4565b91508161083c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108339061234d565b60405180910390fd5b826008600082825461084e919061239c565b9250508190555050505050565b600080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ef838261149d565b915050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61092a600160ff166105e8565b1561096a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109619061241c565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ef90612488565b60405180910390fd5b620f42408110610a3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a34906124f4565b60405180910390fd5b8060048190555050565b60006007821115610a8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8490612560565b60405180910390fd5b6000600a54831614610ad4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610acb906125cc565b60405180910390fd5b81600a600082825417925050819055506007600a541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600a54604051610b1d9190611f2c565b60405180910390a2600a549050919050565b610b3c600260ff166105e8565b15610b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b739061241c565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612488565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054610c7f90612117565b80601f0160208091040260200160405190810160405280929190818152602001828054610cab90612117565b8015610cf85780601f10610ccd57610100808354040283529160200191610cf8565b820191906000526020600020905b815481529060010190602001808311610cdb57829003601f168201915b505050505081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b600080606060008073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603610d9357849350505050610f13565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16878787604051602401610de1939291906125ec565b6040516020818303038152906040527fdbb21d40000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610e6b9190612225565b6000604051808303816000865af19150503d8060008114610ea8576040519150601f19603f3d011682016040523d82523d6000602084013e610ead565b606091505b50809350819450505082610ef6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eed9061266f565b60405180910390fd5b81806020019051810190610f0a91906126a4565b90508093505050505b9392505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060606000806000610f54888888610d2c565b90508773ffffffffffffffffffffffffffffffffffffffff1630604051602401610f7e91906126d1565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516110089190612225565b6000604051808303816000865af19150503d8060008114611045576040519150601f19603f3d011682016040523d82523d6000602084013e61104a565b606091505b50809550819650505084611093576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108a90612288565b60405180910390fd5b838060200190518101906110a791906126a4565b92506110b281611d74565b915081816110c091906126ec565b905080831015611105576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fc9061276c565b60405180910390fd5b61110f878761066b565b8773ffffffffffffffffffffffffffffffffffffffff16338260405160240161113992919061278c565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516111c39190612225565b6000604051808303816000865af19150503d8060008114611200576040519150601f19603f3d011682016040523d82523d6000602084013e611205565b606091505b5080955081965050508461124e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124590612288565b60405180910390fd5b8380602001905181019061126291906122d4565b9450846112a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161129b9061234d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113515781600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611349919061239c565b925050819055505b5050505050505050565b60008060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113b657600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001915050919050565b6000806060600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152a90612488565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560405160240161157f92919061278c565b6040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516116099190612225565b6000604051808303816000865af19150503d8060008114611646576040519150601f19603f3d011682016040523d82523d6000602084013e61164b565b606091505b50809250819350505081611694576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168b90612288565b60405180910390fd5b808060200190518101906116a891906122d4565b9150816116ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e19061234d565b60405180910390fd5b839250505092915050565b611702600460ff166105e8565b15611742576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117399061241c565b60405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c790612488565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006060600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036118535750506119e9565b8273ffffffffffffffffffffffffffffffffffffffff168460405160240161187b9190611fe1565b6040516020818303038152906040527f3ef25013000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516119059190612225565b6000604051808303816000865af19150503d8060008114611942576040519150601f19603f3d011682016040523d82523d6000602084013e611947565b606091505b50809250819350505081611990576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198790612801565b60405180910390fd5b808060200190518101906119a491906122d4565b9150816119e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119dd9061286d565b60405180910390fd5b50505b5050565b60006060600080600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611a535750505050611d70565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168630604051602401611a9f92919061288d565b6040516020818303038152906040527f23778613000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611b299190612225565b6000604051808303816000865af19150503d8060008114611b66576040519150601f19603f3d011682016040523d82523d6000602084013e611b6b565b606091505b50809450819550505083611bb4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bab90612902565b60405180910390fd5b82806020019051810190611bc891906126a4565b91508573ffffffffffffffffffffffffffffffffffffffff1630604051602401611bf291906126d1565b6040516020818303038152906040527f70a08231000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611c7c9190612225565b6000604051808303816000865af19150503d8060008114611cb9576040519150601f19603f3d011682016040523d82523d6000602084013e611cbe565b606091505b50809450819550505083611d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cfe90612288565b60405180910390fd5b82806020019051810190611d1b91906126a4565b9050818582611d2a919061239c565b1115611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d629061296e565b60405180910390fd5b505050505b5050565b60008060045483611d85919061298e565b9050620f424081611d9691906129ff565b905080915050919050565b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611ddb81611da6565b8114611de657600080fd5b50565b600081359050611df881611dd2565b92915050565b600060208284031215611e1457611e13611da1565b5b6000611e2284828501611de9565b91505092915050565b60008115159050919050565b611e4081611e2b565b82525050565b6000602082019050611e5b6000830184611e37565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611e9b578082015181840152602081019050611e80565b60008484015250505050565b6000601f19601f8301169050919050565b6000611ec382611e61565b611ecd8185611e6c565b9350611edd818560208601611e7d565b611ee681611ea7565b840191505092915050565b60006020820190508181036000830152611f0b8184611eb8565b905092915050565b6000819050919050565b611f2681611f13565b82525050565b6000602082019050611f416000830184611f1d565b92915050565b611f5081611f13565b8114611f5b57600080fd5b50565b600081359050611f6d81611f47565b92915050565b600060208284031215611f8957611f88611da1565b5b6000611f9784828501611f5e565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611fcb82611fa0565b9050919050565b611fdb81611fc0565b82525050565b6000602082019050611ff66000830184611fd2565b92915050565b61200581611fc0565b811461201057600080fd5b50565b60008135905061202281611ffc565b92915050565b6000806040838503121561203f5761203e611da1565b5b600061204d85828601612013565b925050602061205e85828601611f5e565b9150509250929050565b60006020828403121561207e5761207d611da1565b5b600061208c84828501612013565b91505092915050565b6000806000606084860312156120ae576120ad611da1565b5b60006120bc86828701612013565b93505060206120cd86828701612013565b92505060406120de86828701611f5e565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061212f57607f821691505b602082108103612142576121416120e8565b5b50919050565b6000819050919050565b600061216d61216861216384611fa0565b612148565b611fa0565b9050919050565b600061217f82612152565b9050919050565b600061219182612174565b9050919050565b6121a181612186565b82525050565b60006060820190506121bc6000830186611fd2565b6121c96020830185612198565b6121d66040830184611f1d565b949350505050565b600081519050919050565b600081905092915050565b60006121ff826121de565b61220981856121e9565b9350612219818560208601611e7d565b80840191505092915050565b600061223182846121f4565b915081905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000612272600983611e6c565b915061227d8261223c565b602082019050919050565b600060208201905081810360008301526122a181612265565b9050919050565b6122b181611e2b565b81146122bc57600080fd5b50565b6000815190506122ce816122a8565b92915050565b6000602082840312156122ea576122e9611da1565b5b60006122f8848285016122bf565b91505092915050565b7f4552525f5452414e534645520000000000000000000000000000000000000000600082015250565b6000612337600c83611e6c565b915061234282612301565b602082019050919050565b600060208201905081810360008301526123668161232a565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006123a782611f13565b91506123b283611f13565b92508282019050808211156123ca576123c961236d565b5b92915050565b7f4552525f5345414c000000000000000000000000000000000000000000000000600082015250565b6000612406600883611e6c565b9150612411826123d0565b602082019050919050565b60006020820190508181036000830152612435816123f9565b9050919050565b7f4552525f41585800000000000000000000000000000000000000000000000000600082015250565b6000612472600783611e6c565b915061247d8261243c565b602082019050919050565b600060208201905081810360008301526124a181612465565b9050919050565b7f4552525f4645455f544f4f5f4849474800000000000000000000000000000000600082015250565b60006124de601083611e6c565b91506124e9826124a8565b602082019050919050565b6000602082019050818103600083015261250d816124d1565b9050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b600061254a601183611e6c565b915061255582612514565b602082019050919050565b600060208201905081810360008301526125798161253d565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b60006125b6601283611e6c565b91506125c182612580565b602082019050919050565b600060208201905081810360008301526125e5816125a9565b9050919050565b60006060820190506126016000830186611fd2565b61260e6020830185611fd2565b61261b6040830184611f1d565b949350505050565b7f4552525f51554f54455200000000000000000000000000000000000000000000600082015250565b6000612659600a83611e6c565b915061266482612623565b602082019050919050565b600060208201905081810360008301526126888161264c565b9050919050565b60008151905061269e81611f47565b92915050565b6000602082840312156126ba576126b9611da1565b5b60006126c88482850161268f565b91505092915050565b60006020820190506126e66000830184612198565b92915050565b60006126f782611f13565b915061270283611f13565b925082820390508181111561271a5761271961236d565b5b92915050565b7f4552525f42414c414e4345000000000000000000000000000000000000000000600082015250565b6000612756600b83611e6c565b915061276182612720565b602082019050919050565b6000602082019050818103600083015261278581612749565b9050919050565b60006040820190506127a16000830185611fd2565b6127ae6020830184611f1d565b9392505050565b7f4552525f52454749535452590000000000000000000000000000000000000000600082015250565b60006127eb600c83611e6c565b91506127f6826127b5565b602082019050919050565b6000602082019050818103600083015261281a816127de565b9050919050565b7f4552525f554e415554485f544f4b454e00000000000000000000000000000000600082015250565b6000612857601083611e6c565b915061286282612821565b602082019050919050565b600060208201905081810360008301526128868161284a565b9050919050565b60006040820190506128a26000830185611fd2565b6128af6020830184612198565b9392505050565b7f4552525f4c494d49544552000000000000000000000000000000000000000000600082015250565b60006128ec600b83611e6c565b91506128f7826128b6565b602082019050919050565b6000602082019050818103600083015261291b816128df565b9050919050565b7f4552525f4c494d49540000000000000000000000000000000000000000000000600082015250565b6000612958600983611e6c565b915061296382612922565b602082019050919050565b600060208201905081810360008301526129878161294b565b9050919050565b600061299982611f13565b91506129a483611f13565b92508282026129b281611f13565b915082820484148315176129c9576129c861236d565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612a0a82611f13565b9150612a1583611f13565b925082612a2557612a246129d0565b5b82820490509291505056fea2646970667358221220f040764414fa76afbd581fbb19ad7bcd16ab510c5013c8e9fcdbf3011b93844164736f6c63430008190033 +\ 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":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_tokenLimiter","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":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePpm","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"quoter","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":"address","name":"_quoter","type":"address"}],"name":"setQuoter","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":"tokenLimiter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_tokenLimiter","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":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePpm","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"getQuote","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"quoter","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":"address","name":"_quoter","type":"address"}],"name":"setQuoter","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":"tokenLimiter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"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.25+commit.b61c2a91"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_tokenLimiter","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":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePpm","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[],"name":"quoter","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":"address","name":"_quoter","type":"address"}],"name":"setQuoter","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":"tokenLimiter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"SwapPool.sol":{"keccak256":"0x9ee02ec01e20567b3826d24a59ca9dd2a44370c2677d9fe3bb63fb8e825ea144","license":"AGPL-3.0-or-later","urls":["bzz-raw://7212535e790c2e2d7a1b32748a44bce7eea05e4f07afb3fcaf095565bc3be061","dweb:/ipfs/QmSBfXW4XnYSUU7ZgzfgkmSmPD28p1CCqpkrtQHbpGsNKB"]}},"version":1} +{"compiler":{"version":"0.8.25+commit.b61c2a91"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"address","name":"_tokenRegistry","type":"address"},{"internalType":"address","name":"_tokenLimiter","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":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feePpm","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"getQuote","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"quoter","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":"address","name":"_quoter","type":"address"}],"name":"setQuoter","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":"tokenLimiter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"SwapPool.sol":{"keccak256":"0x0bc00214f3016c65c77d2b5148a9b83020d8dc7613f396c4637351579095ff1e","license":"AGPL-3.0-or-later","urls":["bzz-raw://1ea9a924be3a74c39712e96a69f06c1f3a858ff324341d4bba654f9d257e24cf","dweb:/ipfs/QmXHPfTiWQAWtLGXjvJcmsDQi8EDnwX3uQA7o9387Dts1U"]}},"version":1} diff --git a/solidity/SwapPool.sol b/solidity/SwapPool.sol @@ -119,7 +119,7 @@ contract SwapPool { return fee; } - function getQuote(address _outToken, address _inToken, uint256 _value) private returns (uint256) { + function getQuote(address _outToken, address _inToken, uint256 _value) public returns (uint256) { bool r; bytes memory v; uint256 quote; @@ -137,22 +137,26 @@ contract SwapPool { function withdraw(address _outToken, address _inToken, uint256 _value) public { bool r; bytes memory v; - uint256 netValue; uint256 balance; uint256 fee; + uint256 outValue; - fee = getFee(_value); - netValue = _value - fee; - netValue = getQuote(_outToken, _inToken, netValue); + outValue = getQuote(_outToken, _inToken, _value); (r, v) = _outToken.call(abi.encodeWithSignature("balanceOf(address)", this)); require(r, "ERR_TOKEN"); balance = abi.decode(v, (uint256)); - require(balance >= netValue + fee, "ERR_BALANCE"); + + // deduct the fees from the quoted outValue + fee = getFee(outValue); + outValue -= fee; + + // pool should have enough balance to cover the final outValue (fees already deducted) + require(balance >= outValue, "ERR_BALANCE"); deposit(_inToken, _value); - (r, v) = _outToken.call(abi.encodeWithSignature('transfer(address,uint256)', msg.sender, netValue)); + (r, v) = _outToken.call(abi.encodeWithSignature('transfer(address,uint256)', msg.sender, outValue)); require(r, "ERR_TOKEN"); r = abi.decode(v, (bool)); require(r, "ERR_TRANSFER"); @@ -235,3 +239,4 @@ contract SwapPool { return false; } } +