erc20-pool

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

commit ceb253bf8f625de493b81a28985b243b89654894
parent cc012256123aee14d43656fcb59bbdb1c6aa8a83
Author: lash <dev@holbrook.no>
Date:   Thu,  3 Aug 2023 15:49:47 +0100

Differentiate revert error message in quoter

Diffstat:
MREADME.md | 2+-
Mpython/erc20_pool/data/DecimalQuote.bin | 4++--
Mpython/erc20_pool/data/DecimalQuote.metadata.json | 2+-
Msolidity/DecimalQuote.sol | 4++--
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -86,7 +86,7 @@ Fee is defined in _parts-per-million_, i.e. `1000000` equals `100%`. Any value l By default, all deducted fees are credited to the pool contract. -Using the `setFeeAddress` method, an external beneficiary for the fees may be defined. That beneficiary will be eligible to receive all fees pending external payment _from that moment on_. Note that this does also include any fees that were not claimed by a previous beneficiary. +Using the `setFeeAddress` method, an external beneficiary for the fees may be defined. That beneficiary will be eligible to receive all fees pending external payment _from that moment on_. Note that this does also include any fees that were not already claimed by a previous beneficiary. #### Withdrawing fees diff --git a/python/erc20_pool/data/DecimalQuote.bin b/python/erc20_pool/data/DecimalQuote.bin @@ -1 +1 @@ -608060405234801561001057600080fd5b506108ed806100206000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063dbb21d401461004d575b600080fd5b6100676004803603810190610062919061044b565b61007d565b60405161007491906104ad565b60405180910390f35b600080600080600060608873ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f313ce567000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161012e9190610539565b6000604051808303816000865af19150503d806000811461016b576040519150601f19603f3d011682016040523d82523d6000602084013e610170565b606091505b508092508193505050816101b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101b0906105ad565b60405180910390fd5b808060200190518101906101cd9190610606565b94508773ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f313ce567000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516102769190610539565b6000604051808303816000865af19150503d80600081146102b3576040519150601f19603f3d011682016040523d82523d6000602084013e6102b8565b606091505b50809250819350505081610301576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102f8906105ad565b60405180910390fd5b808060200190518101906103159190610606565b93508460ff168460ff16036103315786955050505050506103ab565b8460ff168460ff16111561037757848461034b9190610662565b60ff16925082600a61035d91906107ca565b9250828761036b9190610844565b955050505050506103ab565b83856103839190610662565b60ff16925082600a61039591906107ca565b925082876103a39190610875565b955050505050505b9392505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103e2826103b7565b9050919050565b6103f2816103d7565b81146103fd57600080fd5b50565b60008135905061040f816103e9565b92915050565b6000819050919050565b61042881610415565b811461043357600080fd5b50565b6000813590506104458161041f565b92915050565b600080600060608486031215610464576104636103b2565b5b600061047286828701610400565b935050602061048386828701610400565b925050604061049486828701610436565b9150509250925092565b6104a781610415565b82525050565b60006020820190506104c2600083018461049e565b92915050565b600081519050919050565b600081905092915050565b60005b838110156104fc5780820151818401526020810190506104e1565b60008484015250505050565b6000610513826104c8565b61051d81856104d3565b935061052d8185602086016104de565b80840191505092915050565b60006105458284610508565b915081905092915050565b600082825260208201905092915050565b7f4552525f544f4b454e0000000000000000000000000000000000000000000000600082015250565b6000610597600983610550565b91506105a282610561565b602082019050919050565b600060208201905081810360008301526105c68161058a565b9050919050565b600060ff82169050919050565b6105e3816105cd565b81146105ee57600080fd5b50565b600081519050610600816105da565b92915050565b60006020828403121561061c5761061b6103b2565b5b600061062a848285016105f1565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061066d826105cd565b9150610678836105cd565b9250828203905060ff81111561069157610690610633565b5b92915050565b6000600282049050919050565b6000808291508390505b60018511156106ee578086048111156106ca576106c9610633565b5b60018516156106d95780820291505b80810290506106e785610697565b94506106ae565b94509492505050565b60008261070757600190506107c3565b8161071557600090506107c3565b816001811461072b576002811461073557610764565b60019150506107c3565b60ff84111561074757610746610633565b5b8360020a91508482111561075e5761075d610633565b5b506107c3565b5060208310610133831016604e8410600b84101617156107995782820a90508381111561079457610793610633565b5b6107c3565b6107a684848460016106a4565b925090508184048111156107bd576107bc610633565b5b81810290505b9392505050565b60006107d582610415565b91506107e083610415565b925061080d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846106f7565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061084f82610415565b915061085a83610415565b92508261086a57610869610815565b5b828204905092915050565b600061088082610415565b915061088b83610415565b925082820261089981610415565b915082820484148315176108b0576108af610633565b5b509291505056fea26469706673582212201acbf661561a2312e8b64602d749a5af7f05876881796fccdca1072b6ee3bf6664736f6c63430008130033 -\ No newline at end of file +608060405234801561001057600080fd5b50610959806100206000396000f3fe608060405234801561001057600080fd5b5060043610610048576000357c010000000000000000000000000000000000000000000000000000000090048063dbb21d401461004d575b600080fd5b6100676004803603810190610062919061044b565b61007d565b60405161007491906104ad565b60405180910390f35b600080600080600060608873ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f313ce567000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161012e9190610539565b6000604051808303816000865af19150503d806000811461016b576040519150601f19603f3d011682016040523d82523d6000602084013e610170565b606091505b508092508193505050816101b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101b0906105ad565b60405180910390fd5b808060200190518101906101cd9190610606565b94508773ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f313ce567000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516102769190610539565b6000604051808303816000865af19150503d80600081146102b3576040519150601f19603f3d011682016040523d82523d6000602084013e6102b8565b606091505b50809250819350505081610301576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102f89061067f565b60405180910390fd5b808060200190518101906103159190610606565b93508460ff168460ff16036103315786955050505050506103ab565b8460ff168460ff16111561037757848461034b91906106ce565b60ff16925082600a61035d9190610836565b9250828761036b91906108b0565b955050505050506103ab565b838561038391906106ce565b60ff16925082600a6103959190610836565b925082876103a391906108e1565b955050505050505b9392505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006103e2826103b7565b9050919050565b6103f2816103d7565b81146103fd57600080fd5b50565b60008135905061040f816103e9565b92915050565b6000819050919050565b61042881610415565b811461043357600080fd5b50565b6000813590506104458161041f565b92915050565b600080600060608486031215610464576104636103b2565b5b600061047286828701610400565b935050602061048386828701610400565b925050604061049486828701610436565b9150509250925092565b6104a781610415565b82525050565b60006020820190506104c2600083018461049e565b92915050565b600081519050919050565b600081905092915050565b60005b838110156104fc5780820151818401526020810190506104e1565b60008484015250505050565b6000610513826104c8565b61051d81856104d3565b935061052d8185602086016104de565b80840191505092915050565b60006105458284610508565b915081905092915050565b600082825260208201905092915050565b7f4552525f544f4b454e5f4f555400000000000000000000000000000000000000600082015250565b6000610597600d83610550565b91506105a282610561565b602082019050919050565b600060208201905081810360008301526105c68161058a565b9050919050565b600060ff82169050919050565b6105e3816105cd565b81146105ee57600080fd5b50565b600081519050610600816105da565b92915050565b60006020828403121561061c5761061b6103b2565b5b600061062a848285016105f1565b91505092915050565b7f4552525f544f4b454e5f494e0000000000000000000000000000000000000000600082015250565b6000610669600c83610550565b915061067482610633565b602082019050919050565b600060208201905081810360008301526106988161065c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106d9826105cd565b91506106e4836105cd565b9250828203905060ff8111156106fd576106fc61069f565b5b92915050565b6000600282049050919050565b6000808291508390505b600185111561075a578086048111156107365761073561069f565b5b60018516156107455780820291505b808102905061075385610703565b945061071a565b94509492505050565b600082610773576001905061082f565b81610781576000905061082f565b816001811461079757600281146107a1576107d0565b600191505061082f565b60ff8411156107b3576107b261069f565b5b8360020a9150848211156107ca576107c961069f565b5b5061082f565b5060208310610133831016604e8410600b84101617156108055782820a905083811115610800576107ff61069f565b5b61082f565b6108128484846001610710565b925090508184048111156108295761082861069f565b5b81810290505b9392505050565b600061084182610415565b915061084c83610415565b92506108797fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484610763565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006108bb82610415565b91506108c683610415565b9250826108d6576108d5610881565b5b828204905092915050565b60006108ec82610415565b91506108f783610415565b925082820261090581610415565b9150828204841483151761091c5761091b61069f565b5b509291505056fea2646970667358221220d5158317b909ae1dff296180a23a193937699a60bd3432fb19c10b242cd54d4c64736f6c63430008130033 +\ No newline at end of file diff --git a/python/erc20_pool/data/DecimalQuote.metadata.json b/python/erc20_pool/data/DecimalQuote.metadata.json @@ -1 +1 @@ -{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"valueFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"DecimalQuote.sol":"DecimalQuote"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"DecimalQuote.sol":{"keccak256":"0x9e5bc44ea381d6794c6bc992b8cee0b68fb700ab0ad888e5cec390d2261fd5f2","license":"AGPL-3.0-or-later","urls":["bzz-raw://a1d11d7ee1286203963eef4846272465fc7abdeb5c4e054f84fe9dada91b10ee","dweb:/ipfs/QmZQDttgfUBAJxxRpxW8JkwkWi61hNQ79NNrWD64Ak92vw"]}},"version":1} +{"compiler":{"version":"0.8.19+commit.7dd6d404"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_outToken","type":"address"},{"internalType":"address","name":"_inToken","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"valueFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"DecimalQuote.sol":"DecimalQuote"},"evmVersion":"byzantium","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"DecimalQuote.sol":{"keccak256":"0x453d0df7b322f881762fad835815cd2355542655bbff0747ba24733d46ef3efa","license":"AGPL-3.0-or-later","urls":["bzz-raw://0ae7c5b7e66ecdc9c63c4ce71a0a556cae7e9dd9fd8500ed0d8af406e3b2166c","dweb:/ipfs/QmWGJ7mBr14yEn1PnKtMj3PNTtBaCP6TnwPosJ3oXYkUan"]}},"version":1} diff --git a/solidity/DecimalQuote.sol b/solidity/DecimalQuote.sol @@ -15,11 +15,11 @@ contract DecimalQuote { bytes memory v; (r, v) = _outToken.call(abi.encodeWithSignature("decimals()")); - require(r, "ERR_TOKEN"); + require(r, "ERR_TOKEN_OUT"); dout = abi.decode(v, (uint8)); (r, v) = _inToken.call(abi.encodeWithSignature("decimals()")); - require(r, "ERR_TOKEN"); + require(r, "ERR_TOKEN_IN"); din = abi.decode(v, (uint8)); if (din == dout) {