From dc0da4787b0fac90fcfe9c6c85a3490e23f5a936 Mon Sep 17 00:00:00 2001 From: Pierre Aoun Date: Fri, 24 Jan 2025 11:56:11 +0100 Subject: [PATCH] feat: improve swap last pool lisibility --- .../1inch/calldata-AggregationRouterV3.json | 8 ++-- .../1inch/calldata-AggregationRouterV5.json | 43 +++++++++++-------- .../1inch/common-AggregationRouterV4.json | 36 +++++++++------- .../paraswap/calldata-AugustusSwapper.json | 9 ++-- 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/registry/1inch/calldata-AggregationRouterV3.json b/registry/1inch/calldata-AggregationRouterV3.json index ed943b2b..69ecb013 100644 --- a/registry/1inch/calldata-AggregationRouterV3.json +++ b/registry/1inch/calldata-AggregationRouterV3.json @@ -31,6 +31,7 @@ "format": "tokenAmount", "params": { "nativeCurrencyAddress": ["$.metadata.constants.addressAsEth", "$.metadata.constants.addressAsNull"] } }, + "lastPool": { "label": "Last pool", "format": "addressName", "params": { "types": ["contract"] } }, "beneficiary": { "label": "Beneficiary", "format": "addressName" } }, "formats": { @@ -66,10 +67,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "srcToken" } }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "@.from", "$ref": "$.display.definitions.beneficiary" } + { "path": "@.from", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "@.from"], - "excluded": ["pools", "permit"] + "required": ["amount", "minReturn", "@.from", "pools"], + "excluded": ["permit"] } } } diff --git a/registry/1inch/calldata-AggregationRouterV5.json b/registry/1inch/calldata-AggregationRouterV5.json index be2fc442..ef02bc70 100644 --- a/registry/1inch/calldata-AggregationRouterV5.json +++ b/registry/1inch/calldata-AggregationRouterV5.json @@ -33,6 +33,7 @@ "format": "tokenAmount", "params": { "nativeCurrencyAddress": ["$.metadata.constants.addressAsEth", "$.metadata.constants.addressAsNull"] } }, + "lastPool": { "label": "Last pool", "format": "addressName", "params": { "types": ["contract"] } }, "beneficiary": { "label": "Beneficiary", "format": "addressName" }, "expirationTime": { "label": "Expiration time", "format": "date", "params": { "encoding": "timestamp" } } }, @@ -58,10 +59,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "srcToken" } }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "@.from", "$ref": "$.display.definitions.beneficiary" } + { "path": "@.from", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "@.from"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "@.from", "pools"], + "excluded": [] }, "unoswapTo(address recipient, address srcToken, uint256 amount, uint256 minReturn, uint256[] pools)": { "$id": "unoswapTo", @@ -69,10 +71,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "srcToken" } }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "recipient", "$ref": "$.display.definitions.beneficiary" } + { "path": "recipient", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "recipient"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "recipient", "pools"], + "excluded": [] }, "unoswapToWithPermit(address recipient, address srcToken, uint256 amount, uint256 minReturn, uint256[] pools, bytes permit)": { "$id": "unoswapToWithPermit", @@ -80,10 +83,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "srcToken" } }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "recipient", "$ref": "$.display.definitions.beneficiary" } + { "path": "recipient", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "recipient"], - "excluded": ["pools", "permit"] + "required": ["amount", "minReturn", "recipient", "pools"], + "excluded": ["permit"] }, "uniswapV3Swap(uint256 amount, uint256 minReturn, uint256[] pools)": { "$id": "uniswapV3Swap", @@ -91,10 +95,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount" }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "@.from", "$ref": "$.display.definitions.beneficiary" } + { "path": "@.from", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "@.from"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "@.from", "pools"], + "excluded": [] }, "uniswapV3SwapTo(address recipient, uint256 amount, uint256 minReturn, uint256[] pools)": { "$id": "uniswapV3SwapTo", @@ -102,10 +107,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount" }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "recipient", "$ref": "$.display.definitions.beneficiary" } + { "path": "recipient", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "recipient"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "recipient", "pools"], + "excluded": [] }, "uniswapV3SwapToWithPermit(address recipient, address srcToken, uint256 amount, uint256 minReturn, uint256[] pools, bytes permit)": { "$id": "uniswapV3SwapToWithPermit", @@ -113,10 +119,11 @@ "fields": [ { "path": "amount", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "srcToken" } }, { "path": "minReturn", "$ref": "$.display.definitions.minReceiveAmount" }, - { "path": "recipient", "$ref": "$.display.definitions.beneficiary" } + { "path": "recipient", "$ref": "$.display.definitions.beneficiary" }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "recipient"], - "excluded": ["pools", "permit"] + "required": ["amount", "minReturn", "recipient", "pools"], + "excluded": ["permit"] }, "clipperSwap(address clipperExchange, address srcToken, address dstToken, uint256 inputAmount, uint256 outputAmount, uint256 goodUntil, bytes32 r, bytes32 vs)": { "$id": "clipperSwap", diff --git a/registry/1inch/common-AggregationRouterV4.json b/registry/1inch/common-AggregationRouterV4.json index 0709d24c..44ad615b 100644 --- a/registry/1inch/common-AggregationRouterV4.json +++ b/registry/1inch/common-AggregationRouterV4.json @@ -36,6 +36,7 @@ ] } }, + "lastPool": { "label": "Last pool", "format": "addressName", "params": { "types": ["contract"] } }, "beneficiary": { "label": "Beneficiary", "format": "addressName" @@ -80,10 +81,11 @@ { "path": "@.from", "$ref": "$.display.definitions.beneficiary" - } + }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "@.from"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "@.from", "pools"], + "excluded": [] }, "unoswapWithPermit(address srcToken, uint256 amount, uint256 minReturn, bytes32[] pools, bytes permit)" : { "$id": "unoswapWithPermit", @@ -101,10 +103,11 @@ { "path": "@.from", "$ref": "$.display.definitions.beneficiary" - } + }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "@.from"], - "excluded": ["pools", "permit"] + "required": ["amount", "minReturn", "@.from", "pools"], + "excluded": ["permit"] }, "uniswapV3Swap(uint256 amount, uint256 minReturn, uint256[] pools)" : { "$id": "uniswapV3Swap", @@ -121,10 +124,11 @@ { "path": "@.from", "$ref": "$.display.definitions.beneficiary" - } + }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "@.from"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "@.from", "pools"], + "excluded": [] }, "uniswapV3SwapTo(address recipient, uint256 amount, uint256 minReturn, uint256[] pools)" : { "$id": "uniswapV3SwapTo", @@ -141,10 +145,11 @@ { "path": "recipient", "$ref": "$.display.definitions.beneficiary" - } + }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "recipient"], - "excluded": ["pools"] + "required": ["amount", "minReturn", "recipient", "pools"], + "excluded": [] }, "uniswapV3SwapToWithPermit(address recipient, address srcToken, uint256 amount, uint256 minReturn, uint256[] pools, bytes permit)" : { "$id": "uniswapV3SwapToWithPermit", @@ -162,10 +167,11 @@ { "path": "recipient", "$ref": "$.display.definitions.beneficiary" - } + }, + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], - "required": ["amount", "minReturn", "recipient"], - "excluded": ["pools", "permit"] + "required": ["amount", "minReturn", "recipient", "pools"], + "excluded": ["permit"] } } } diff --git a/registry/paraswap/calldata-AugustusSwapper.json b/registry/paraswap/calldata-AugustusSwapper.json index a41bbeac..1d70e08f 100644 --- a/registry/paraswap/calldata-AugustusSwapper.json +++ b/registry/paraswap/calldata-AugustusSwapper.json @@ -34,6 +34,7 @@ "format": "tokenAmount", "params": { "tokenPath": "tokenOut", "nativeCurrencyAddress": "$.metadata.constants.addressAsEth" } }, + "lastPool": { "label": "Last pool", "format": "addressName", "params": { "types": ["contract"] } }, "beneficiary": { "label": "Beneficiary", "format": "addressName", "params": { "types": ["eoa"], "sources": ["local", "ens"] } }, "exchange": { "label": "Exchange", "format": "addressName", "params": { "types": ["contract"], "sources": ["local", "ens"] } }, "factory": { "label": "Uniswap Factory", "format": "addressName", "params": { "types": ["contract"], "sources": ["local", "ens"] } } @@ -88,7 +89,7 @@ "fields": [ { "path": "amountIn", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "tokenIn" } }, { "path": "amountOutMin", "label": "Minimum to Receive", "format": "raw" }, - { "path": "pools.[-1]", "label": "Last pool", "format": "raw" } + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], "required": ["amountIn", "amountOutMin", "pools"] }, @@ -147,7 +148,7 @@ "fields": [ { "path": "amountInMax", "$ref": "$.display.definitions.maxSendAmount", "params": { "tokenPath": "tokenIn" } }, { "path": "amountOut", "label": "Amount to Receive", "format": "raw" }, - { "path": "pools.[-1]", "label": "Last pool", "format": "raw" } + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], "required": ["amountInMax", "amountOut", "pools.[-1]"] }, @@ -157,7 +158,7 @@ "fields": [ { "path": "amountInMax", "$ref": "$.display.definitions.maxSendAmount", "params": { "tokenPath": "tokenIn" } }, { "path": "amountOut", "label": "Amount to Receive", "format": "raw" }, - { "path": "pools.[-1]", "label": "Last pool", "format": "raw" } + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ] }, "0xa94e78ef": { @@ -186,7 +187,7 @@ "fields": [ { "path": "amountIn", "$ref": "$.display.definitions.sendAmount", "params": { "tokenPath": "tokenIn" } }, { "path": "amountOutMin", "label": "Minimum to Receive", "format": "raw" }, - { "path": "pools.[-1]", "label": "Last pool", "format": "raw" } + { "path": "pools.[-1]", "$ref": "$.display.definitions.lastPool" } ], "required": [] }