Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve pool swap lisibility #136

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 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 Down Expand Up @@ -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"]
}
}
}
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
@@ -1,4 +1,4 @@
{

Check notice on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Proxy contract

Contract https://etherscan.io/address/0xdef171fe48cf0115b1d80b88dc8eab59176fee57#code is likely to be a proxy, validation of descriptor ABIs skipped

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.callees.[]` in function 0x2298207a. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.callees.[]` in function 0x54e3f31b. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.deadline` in function 0x2298207a. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.deadline` in function 0x46c67b6d. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.deadline` in function 0x54e3f31b. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.deadline` in function 0xa94e78ef. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.exchangeData.[]` in function 0x2298207a. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.exchangeData.[]` in function 0x54e3f31b. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.exchangeData` in function 0x2298207a. If intentionally excluded, please add it to `excluded` list to avoid this warning.

Check warning on line 1 in registry/paraswap/calldata-AugustusSwapper.json

View workflow job for this annotation

GitHub Actions / 🔎 validate descriptors

Missing Display field

No display field is defined for path `#.data.exchangeData` in function 0x54e3f31b. If intentionally excluded, please add it to `excluded` list to avoid this warning.
"$schema": "../../specs/erc7730-v1.schema.json",
"context": {
"$id": "AugustusSwapper",
Expand Down 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