Skip to content

Commit 7b82f13

Browse files
authored
feat: support destination chain relayer fee calculator config overrides (#1564)
* bump sdk Signed-off-by: Gerhard Steenkamp <[email protected]> * support destination chain overrides Signed-off-by: Gerhard Steenkamp <[email protected]> * add comments Signed-off-by: Gerhard Steenkamp <[email protected]> --------- Signed-off-by: Gerhard Steenkamp <[email protected]>
1 parent 3ab0a21 commit 7b82f13

File tree

3 files changed

+48
-38
lines changed

3 files changed

+48
-38
lines changed

api/_constants.ts

+40-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import {
77
import * as constants from "@across-protocol/constants";
88
import { getEnvs } from "./_env";
99

10-
const { GRAPH_API_KEY, RELAYER_FEE_CAPITAL_COST_OVERRIDES } = getEnvs();
10+
const {
11+
GRAPH_API_KEY,
12+
RELAYER_FEE_CAPITAL_COST_ROUTE_OVERRIDES,
13+
RELAYER_FEE_CAPITAL_COST_DESTINATION_CHAIN_OVERRIDES,
14+
} = getEnvs();
1115

1216
export const CHAIN_IDs = constants.CHAIN_IDs;
1317
export const TOKEN_SYMBOLS_MAP = constants.TOKEN_SYMBOLS_MAP;
@@ -157,11 +161,40 @@ export const coinGeckoAssetPlatformLookup: Record<string, number> = {
157161

158162
export const graphAPIKey = GRAPH_API_KEY;
159163

160-
const relayerFeeCapitalCostOverrides: Record<
164+
// {
165+
// "TOKEN_SYMBOL": {
166+
// "ORIGIN_CHAIN_ID": {
167+
// "DESTINATION_CHAIN_ID": {
168+
// "lowerBound": "1000000000000000",
169+
// "upperBound": "5000000000000000",
170+
// "cutoff": "10000000000000000000000",
171+
// "decimals": 18
172+
// }
173+
// }
174+
// }
175+
// }
176+
const relayerFeeCapitalCostRouteOverrides: Record<
161177
string,
162178
Record<string, Record<string, relayFeeCalculator.CapitalCostConfig>>
163-
> = RELAYER_FEE_CAPITAL_COST_OVERRIDES
164-
? JSON.parse(RELAYER_FEE_CAPITAL_COST_OVERRIDES)
179+
> = RELAYER_FEE_CAPITAL_COST_ROUTE_OVERRIDES
180+
? JSON.parse(RELAYER_FEE_CAPITAL_COST_ROUTE_OVERRIDES)
181+
: {};
182+
183+
// {
184+
// "TOKEN_SYMBOL": {
185+
// "DESTINATION_CHAIN_ID": {
186+
// "lowerBound": "1000000000000000",
187+
// "upperBound": "5000000000000000",
188+
// "cutoff": "10000000000000000000000",
189+
// "decimals": 18
190+
// }
191+
// }
192+
// }
193+
const relayerFeeCapitalCostDestinationChainOverrides: Record<
194+
string,
195+
Record<string, relayFeeCalculator.CapitalCostConfig>
196+
> = RELAYER_FEE_CAPITAL_COST_DESTINATION_CHAIN_OVERRIDES
197+
? JSON.parse(RELAYER_FEE_CAPITAL_COST_DESTINATION_CHAIN_OVERRIDES)
165198
: {};
166199

167200
export const relayerFeeCapitalCostConfig: {
@@ -173,7 +206,9 @@ export const relayerFeeCapitalCostConfig: {
173206
token,
174207
{
175208
default: defaultRelayerFeeCapitalCostConfig[token],
176-
routeOverrides: relayerFeeCapitalCostOverrides[token] || {},
209+
routeOverrides: relayerFeeCapitalCostRouteOverrides[token] || {},
210+
destinationChainOverrides:
211+
relayerFeeCapitalCostDestinationChainOverrides[token] || {},
177212
},
178213
];
179214
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dependencies": {
77
"@across-protocol/constants": "^3.1.51",
88
"@across-protocol/contracts": "^4.0.5",
9-
"@across-protocol/sdk": "^4.1.44",
9+
"@across-protocol/sdk": "^4.1.47",
1010
"@amplitude/analytics-browser": "^2.3.5",
1111
"@balancer-labs/sdk": "1.1.6-beta.16",
1212
"@emotion/react": "^11.13.0",

yarn.lock

+7-32
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
yargs "^17.7.2"
6161
zksync-web3 "^0.14.3"
6262

63-
"@across-protocol/sdk@^4.1.44":
64-
version "4.1.44"
65-
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-4.1.44.tgz#5ab120c8d93e87b9b8ca9f71291fb3f1369abb42"
66-
integrity sha512-hH94JUYDCQV6rEcSmqPgqf0iOQSa547j8ykZZePUOC574aYuJ6KMGWvDevYdakA1q/DKQBqoilFUADSejI7eHQ==
63+
"@across-protocol/sdk@^4.1.47":
64+
version "4.1.47"
65+
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-4.1.47.tgz#d67f120800c4959cba491337b2184acaa08245ed"
66+
integrity sha512-3vuKp7M6EjE00ukp82/ludXVJ9LwKFW7MyvAHtJRHPGlb6JoLkT1scMEjoJ9NAarSBUyFM7r1mrThg9gWffidA==
6767
dependencies:
6868
"@across-protocol/across-token" "^1.0.0"
6969
"@across-protocol/constants" "^3.1.51"
@@ -21110,7 +21110,7 @@ string-length@^4.0.1:
2111021110
char-regex "^1.0.2"
2111121111
strip-ansi "^6.0.0"
2111221112

21113-
"string-width-cjs@npm:string-width@^4.2.0":
21113+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
2111421114
version "4.2.3"
2111521115
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
2111621116
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -21145,15 +21145,6 @@ string-width@^3.0.0, string-width@^3.1.0:
2114521145
is-fullwidth-code-point "^2.0.0"
2114621146
strip-ansi "^5.1.0"
2114721147

21148-
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
21149-
version "4.2.3"
21150-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
21151-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
21152-
dependencies:
21153-
emoji-regex "^8.0.0"
21154-
is-fullwidth-code-point "^3.0.0"
21155-
strip-ansi "^6.0.1"
21156-
2115721148
string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2:
2115821149
version "5.1.2"
2115921150
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
@@ -21241,7 +21232,7 @@ string_decoder@~1.1.1:
2124121232
dependencies:
2124221233
safe-buffer "~5.1.0"
2124321234

21244-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
21235+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
2124521236
version "6.0.1"
2124621237
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
2124721238
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -21269,13 +21260,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
2126921260
dependencies:
2127021261
ansi-regex "^4.1.0"
2127121262

21272-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
21273-
version "6.0.1"
21274-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
21275-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
21276-
dependencies:
21277-
ansi-regex "^5.0.1"
21278-
2127921263
strip-ansi@^7.0.1:
2128021264
version "7.0.1"
2128121265
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
@@ -23953,7 +23937,7 @@ [email protected]:
2395323937
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
2395423938
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
2395523939

23956-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
23940+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
2395723941
version "7.0.0"
2395823942
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
2395923943
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -23988,15 +23972,6 @@ wrap-ansi@^6.2.0:
2398823972
string-width "^4.1.0"
2398923973
strip-ansi "^6.0.0"
2399023974

23991-
wrap-ansi@^7.0.0:
23992-
version "7.0.0"
23993-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
23994-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
23995-
dependencies:
23996-
ansi-styles "^4.0.0"
23997-
string-width "^4.1.0"
23998-
strip-ansi "^6.0.0"
23999-
2400023975
wrap-ansi@^8.1.0:
2400123976
version "8.1.0"
2400223977
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)