Skip to content

Commit

Permalink
feat: improve swap last pool lisibility
Browse files Browse the repository at this point in the history
  • Loading branch information
paoun-ledger committed Jan 24, 2025
1 parent 38ac6d4 commit 09dfd08
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 43 deletions.
15 changes: 9 additions & 6 deletions registry/1inch/calldata-AggregationRouterV3.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -55,21 +56,23 @@
"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": []
},
"unoswapWithPermit(address srcToken, uint256 amount, uint256 minReturn, bytes32[] pools, bytes permit)": {
"$id": "unoswapWithPermit",
"intent": "Swap",
"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"]
}
}
}
Expand Down
43 changes: 25 additions & 18 deletions registry/1inch/calldata-AggregationRouterV5.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" } }
},
Expand All @@ -58,65 +59,71 @@
"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",
"intent": "Swap",
"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",
"intent": "Swap",
"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",
"intent": "Swap",
"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",
"intent": "Swap",
"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",
"intent": "Swap",
"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",
Expand Down
36 changes: 21 additions & 15 deletions registry/1inch/common-AggregationRouterV4.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
]
}
},
"lastPool": { "label": "Last pool", "format": "addressName", "params": { "types": ["contract"] } },
"beneficiary": {
"label": "Beneficiary",
"format": "addressName"
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"]
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions registry/paraswap/calldata-AugustusSwapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"] } }
Expand Down Expand Up @@ -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"]
},
Expand Down Expand Up @@ -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]"]
},
Expand All @@ -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": {
Expand Down Expand Up @@ -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": []
}
Expand Down

0 comments on commit 09dfd08

Please sign in to comment.