Skip to content

Commit 8c01121

Browse files
authored
feat: Update SpokePoolVerifier address (#1544)
1 parent 041704d commit 8c01121

9 files changed

+75
-80
lines changed

Diff for: api/_utils.ts

-16
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import {
55
SpokePool,
66
SpokePool__factory,
77
} from "@across-protocol/contracts/dist/typechain";
8-
// NOTE: We are still on v3.0.6 of verifier deployments until audit went through. Because the interface changed, we need to use the old factory.
9-
// export { SpokePoolVerifier__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePoolVerifier__factory";
10-
import { SpokePoolVerifier__factory } from "@across-protocol/contracts-v3.0.6/dist/typechain/factories/contracts/SpokePoolVerifier__factory";
118
import acrossDeployments from "@across-protocol/contracts/dist/deployments/deployments.json";
129
import * as sdk from "@across-protocol/sdk";
1310
import {
@@ -2681,19 +2678,6 @@ export function getL1TokenConfigCache(l1TokenAddress: string) {
26812678
return makeCacheGetterAndSetter(cacheKey, ttl, fetchFn);
26822679
}
26832680

2684-
export function getSpokePoolVerifier(chainId: number) {
2685-
const isSpokePoolVerifierDeployed = (
2686-
ENABLED_ROUTES.spokePoolVerifier.enabledChains as number[]
2687-
).includes(chainId);
2688-
2689-
if (!isSpokePoolVerifierDeployed) {
2690-
return undefined;
2691-
}
2692-
2693-
const address = ENABLED_ROUTES.spokePoolVerifier.address;
2694-
return SpokePoolVerifier__factory.connect(address, getProvider(chainId));
2695-
}
2696-
26972681
export function addMarkupToAmount(amount: BigNumber, markup = 0.01) {
26982682
return amount
26992683
.mul(ethers.utils.parseEther((1 + Number(markup)).toString()))

Diff for: package.json

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"dependencies": {
77
"@across-protocol/constants": "^3.1.51",
88
"@across-protocol/contracts": "^4.0.5",
9-
"@across-protocol/contracts-v3.0.6": "npm:@across-protocol/[email protected]",
109
"@across-protocol/sdk": "^4.1.44",
1110
"@amplitude/analytics-browser": "^2.3.5",
1211
"@balancer-labs/sdk": "1.1.6-beta.16",

Diff for: scripts/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If a `SpokePoolVerifier` contract is deployed to the new chain, add the chain to
4747
```diff
4848
// ...
4949
spokePoolVerifier: {
50-
address: "0xB4A8d45647445EA9FC3E1058096142390683dBC2",
50+
address: "0x630b76C7cA96164a5aCbC1105f8BA8B739C82570",
5151
enabledChains: [
5252
CHAIN_IDs.MAINNET,
5353
CHAIN_IDs.OPTIMISM,

Diff for: scripts/generate-routes.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const enabledRoutes = {
8585
claimAndStakeAddress: "0x985e8A89Dd6Af8896Ef075c8dd93512433dc5829",
8686
pools: [],
8787
spokePoolVerifier: {
88-
address: "0xB4A8d45647445EA9FC3E1058096142390683dBC2",
88+
address: "0x630b76C7cA96164a5aCbC1105f8BA8B739C82570",
8989
enabledChains: [
9090
CHAIN_IDs.MAINNET,
9191
CHAIN_IDs.OPTIMISM,
@@ -101,7 +101,6 @@ const enabledRoutes = {
101101
CHAIN_IDs.ZORA,
102102
CHAIN_IDs.WORLD_CHAIN,
103103
CHAIN_IDs.INK,
104-
CHAIN_IDs.LENS,
105104
],
106105
},
107106
// Addresses of token-scoped `SwapAndBridge` contracts, i.e. USDC.e -> USDC swaps

Diff for: src/data/routes_1_0xc186fA914353c44b2E33eBE05f21846F1048bEda.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13475,10 +13475,10 @@
1347513475
],
1347613476
"pools": [],
1347713477
"spokePoolVerifier": {
13478-
"address": "0xB4A8d45647445EA9FC3E1058096142390683dBC2",
13478+
"address": "0x630b76C7cA96164a5aCbC1105f8BA8B739C82570",
1347913479
"enabledChains": [
1348013480
1, 10, 137, 8453, 42161, 59144, 34443, 81457, 1135, 690, 534352, 7777777,
13481-
480, 57073, 232
13481+
480, 57073
1348213482
]
1348313483
}
1348413484
}

Diff for: src/utils/bridge.ts

+25-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
generateHyperLiquidPayload,
1414
getConfig,
1515
isContractDeployedToAddress,
16+
toBytes32,
1617
} from "utils";
1718
import getApiEndpoint from "./serverless-api";
1819
import { BridgeLimitInterface } from "./serverless-api/types";
@@ -207,7 +208,7 @@ export const getConfirmationDepositTime = (
207208
};
208209
};
209210

210-
export type AcrossDepositArgs = {
211+
export type AcrossDepositV3Args = {
211212
fromChain: ChainId;
212213
toChain: ChainId;
213214
toAddress: string;
@@ -220,9 +221,6 @@ export type AcrossDepositArgs = {
220221
referrer?: string;
221222
isNative: boolean;
222223
integratorId: string;
223-
};
224-
225-
export type AcrossDepositV3Args = AcrossDepositArgs & {
226224
inputTokenAddress: string;
227225
outputTokenAddress: string;
228226
fillDeadline: number;
@@ -237,40 +235,53 @@ type NetworkMismatchHandler = (
237235
/**
238236
* Makes a deposit on Across using the `SpokePoolVerifiers` contract's `deposit` function if possible.
239237
* @param signer A valid signer, must be connected to a provider.
240-
* @param depositArgs - An object containing the {@link AcrossDepositArgs arguments} to pass to the deposit function of the bridge contract.
238+
* @param depositArgs - An object containing the {@link AcrossDepositV3Args arguments} to pass to the deposit function of the bridge contract.
241239
* @returns The transaction response obtained after sending the transaction.
242240
*/
243241
export async function sendSpokePoolVerifierDepositTx(
244242
signer: ethers.Signer,
245243
{
246244
fromChain,
247-
tokenAddress,
248245
amount,
249-
maxCount = ethers.constants.MaxUint256,
250246
toAddress: recipient,
251247
toChain: destinationChainId,
252248
relayerFeePct,
253249
timestamp: quoteTimestamp,
254250
message = "0x",
255251
isNative,
256252
referrer,
253+
fillDeadline,
254+
inputTokenAddress,
255+
exclusiveRelayer = ethers.constants.AddressZero,
256+
exclusivityDeadline = 0,
257257
integratorId,
258-
}: AcrossDepositArgs,
258+
}: AcrossDepositV3Args,
259259
spokePool: SpokePool,
260260
spokePoolVerifier: SpokePoolVerifier,
261261
onNetworkMismatch?: NetworkMismatchHandler
262262
): Promise<ethers.providers.TransactionResponse> {
263+
if (!isNative) {
264+
throw new Error(
265+
"SpokePoolVerifier should only be used for native deposits"
266+
);
267+
}
268+
const inputAmount = amount;
269+
const outputAmount = inputAmount.sub(
270+
inputAmount.mul(relayerFeePct).div(fixedPointAdjustment)
271+
);
263272
const tx = await spokePoolVerifier.populateTransaction.deposit(
264273
spokePool.address,
265-
recipient,
266-
tokenAddress,
267-
amount,
274+
toBytes32(recipient),
275+
toBytes32(inputTokenAddress),
276+
inputAmount,
277+
outputAmount,
268278
destinationChainId,
269-
relayerFeePct,
279+
exclusiveRelayer,
270280
quoteTimestamp,
281+
fillDeadline,
282+
exclusivityDeadline,
271283
message,
272-
maxCount,
273-
{ value: isNative ? amount : ethers.constants.Zero }
284+
{ value: inputAmount }
274285
);
275286

276287
return _tagRefAndSignTx(

Diff for: src/utils/typechain.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
77
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
88
export { SpokePool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePool__factory";
9-
// NOTE: We are still on v3.0.6 of verifier deployments until audit went through. Because the interface changed, we need to use the old factory.
10-
// export { SpokePoolVerifier__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePoolVerifier__factory";
11-
export { SpokePoolVerifier__factory } from "@across-protocol/contracts-v3.0.6/dist/typechain/factories/contracts/SpokePoolVerifier__factory";
9+
export { SpokePoolVerifier__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePoolVerifier__factory";
1210
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory";
1311
export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
1412
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
@@ -21,9 +19,7 @@ export type {
2119
SpokePool,
2220
FilledV3RelayEvent,
2321
} from "@across-protocol/contracts/dist/typechain/contracts/SpokePool";
24-
// NOTE: We are still on v3.0.6 of verifier deployments until audit went through. Because the interface changed, we need to use the old type.
25-
// export type { SpokePoolVerifier } from "@across-protocol/contracts/dist/typechain/contracts/SpokePoolVerifier";
26-
export type { SpokePoolVerifier } from "@across-protocol/contracts-v3.0.6/dist/typechain/contracts/SpokePoolVerifier";
22+
export type { SpokePoolVerifier } from "@across-protocol/contracts/dist/typechain/contracts/SpokePoolVerifier";
2723
export type {
2824
UniversalSwapAndBridge,
2925
SwapAndBridge,

Diff for: src/views/Bridge/hooks/useBridgeAction.ts

+12-11
Original file line numberDiff line numberDiff line change
@@ -294,27 +294,28 @@ export function useBridgeAction(
294294
frozenDepositArgs.exclusiveRelayer !== constants.AddressZero;
295295
const { spokePool, shouldUseSpokePoolVerifier, spokePoolVerifier } =
296296
await getSpokePoolAndVerifier(frozenRoute);
297+
const depositArgs = {
298+
...frozenDepositArgs,
299+
inputTokenAddress: frozenRoute.fromTokenAddress,
300+
outputTokenAddress: frozenRoute.toTokenAddress,
301+
fillDeadline: frozenFeeQuote.fillDeadline,
302+
message: externalPayload,
303+
toAddress: externalProjectIsHyperLiquid
304+
? acrossPlusMulticallHandler[frozenRoute.toChain]
305+
: frozenDepositArgs.toAddress,
306+
};
297307
tx =
298308
shouldUseSpokePoolVerifier && !isExclusive && spokePoolVerifier
299309
? await sendSpokePoolVerifierDepositTx(
300310
signer,
301-
frozenDepositArgs,
311+
depositArgs,
302312
spokePool,
303313
spokePoolVerifier,
304314
networkMismatchHandler
305315
)
306316
: await sendDepositV3Tx(
307317
signer,
308-
{
309-
...frozenDepositArgs,
310-
inputTokenAddress: frozenRoute.fromTokenAddress,
311-
outputTokenAddress: frozenRoute.toTokenAddress,
312-
fillDeadline: frozenFeeQuote.fillDeadline,
313-
message: externalPayload,
314-
toAddress: externalProjectIsHyperLiquid
315-
? acrossPlusMulticallHandler[frozenRoute.toChain]
316-
: frozenDepositArgs.toAddress,
317-
},
318+
depositArgs,
318319
spokePool,
319320
networkMismatchHandler
320321
);

Diff for: yarn.lock

+32-27
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,11 @@
1616
"@uma/common" "^2.17.0"
1717
hardhat "^2.9.3"
1818

19-
"@across-protocol/constants@^3.1.46", "@across-protocol/constants@^3.1.51", "@across-protocol/constants@^3.1.9":
19+
"@across-protocol/constants@^3.1.46", "@across-protocol/constants@^3.1.51":
2020
version "3.1.51"
2121
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.51.tgz#992beaba4c7540f62bfcde180403494ea5ac989a"
2222
integrity sha512-XuXZXqbTxt/r+WQKwyMKnlg7z63SdN7AehdD1uWzF+FCM6u9XAECB8RlK1+wBj1RAJuuZGbrNMyfS9szq+X11Q==
2323

24-
"@across-protocol/contracts-v3.0.6@npm:@across-protocol/[email protected]":
25-
version "3.0.6"
26-
resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-3.0.6.tgz#7508fc52db50cfa670edc7c4e9e615ad25cdd56c"
27-
integrity sha512-hN/Qbg3YlZyVnJfqhK97WJHlvUv2Agncm0eaLOPlRy++CZ1rP++cDWPa2souE8iYEl0APj1c4U4REe8qSw9zlA==
28-
dependencies:
29-
"@across-protocol/constants" "^3.1.9"
30-
"@defi-wonderland/smock" "^2.3.4"
31-
"@eth-optimism/contracts" "^0.5.40"
32-
"@ethersproject/abstract-provider" "5.7.0"
33-
"@ethersproject/abstract-signer" "5.7.0"
34-
"@ethersproject/bignumber" "5.7.0"
35-
"@openzeppelin/contracts" "4.9.6"
36-
"@openzeppelin/contracts-upgradeable" "4.9.6"
37-
"@scroll-tech/contracts" "^0.1.0"
38-
"@uma/common" "^2.34.0"
39-
"@uma/contracts-node" "^0.4.17"
40-
"@uma/core" "^2.56.0"
41-
axios "^1.6.2"
42-
zksync-web3 "^0.14.3"
43-
4424
"@across-protocol/contracts@^0.1.4":
4525
version "0.1.4"
4626
resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-0.1.4.tgz#64b3d91e639d2bb120ea94ddef3d160967047fa5"
@@ -7639,7 +7619,7 @@
76397619
"@typescript-eslint/types" "7.13.1"
76407620
eslint-visitor-keys "^3.4.3"
76417621

7642-
"@uma/common@^2.17.0", "@uma/common@^2.34.0", "@uma/common@^2.37.3":
7622+
"@uma/common@^2.17.0", "@uma/common@^2.37.3":
76437623
version "2.37.3"
76447624
resolved "https://registry.yarnpkg.com/@uma/common/-/common-2.37.3.tgz#0d7fda1227e3a05563544bb36f418a790c81129d"
76457625
integrity sha512-DLcM2xtiFWDbty21r2gsL6AJbOc8G/CMqg0iMxssvkKbz8varsWS44zJF85XGxMlY8fE40w0ZS8MR92xpbsu4g==
@@ -7690,7 +7670,7 @@
76907670
resolved "https://registry.yarnpkg.com/@uma/contracts-node/-/contracts-node-0.4.25.tgz#d5c82f1f2c7e0dc2dec26fe876db73ba3f0689d7"
76917671
integrity sha512-WaFojX4qyMmXpy5MBS7g0M0KnWESGusdSfTmlkZpCh65TksGaJwAyOM1YBRLL3xm3xSgxPoG+n6tTilSomUmOw==
76927672

7693-
"@uma/core@^2.18.0", "@uma/core@^2.56.0", "@uma/core@^2.61.0":
7673+
"@uma/core@^2.18.0", "@uma/core@^2.61.0":
76947674
version "2.61.0"
76957675
resolved "https://registry.yarnpkg.com/@uma/core/-/core-2.61.0.tgz#29580736349a47af8fb10beb4bb3b50bfcf912f5"
76967676
integrity sha512-bnk+CWW+uWpRilrgUny/gDXHKomG+h1Ug84OXdx+AAvj1/BtlMDOCNNt1OX8LSAz+a0hkiN9s24/zgHclTC/sg==
@@ -9457,7 +9437,7 @@ axios@^0.27.2:
94579437
follow-redirects "^1.14.9"
94589438
form-data "^4.0.0"
94599439

9460-
axios@^1.5.1, axios@^1.6.0, axios@^1.6.1, axios@^1.6.2, axios@^1.7.4:
9440+
axios@^1.5.1, axios@^1.6.0, axios@^1.6.1, axios@^1.7.4:
94619441
version "1.7.8"
94629442
resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.8.tgz#1997b1496b394c21953e68c14aaa51b7b5de3d6e"
94639443
integrity sha512-Uu0wb7KNqK2t5K+YQyVCLM76prD5sRFjKHbJYCP1J7JFGEQ6nN7HWn9+04LAeiJ3ji54lgS/gZCH1oxyrf1SPw==
@@ -21130,7 +21110,7 @@ string-length@^4.0.1:
2113021110
char-regex "^1.0.2"
2113121111
strip-ansi "^6.0.0"
2113221112

21133-
"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:
21113+
"string-width-cjs@npm:string-width@^4.2.0":
2113421114
version "4.2.3"
2113521115
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
2113621116
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -21165,6 +21145,15 @@ string-width@^3.0.0, string-width@^3.1.0:
2116521145
is-fullwidth-code-point "^2.0.0"
2116621146
strip-ansi "^5.1.0"
2116721147

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+
2116821157
string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2:
2116921158
version "5.1.2"
2117021159
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
@@ -21252,7 +21241,7 @@ string_decoder@~1.1.1:
2125221241
dependencies:
2125321242
safe-buffer "~5.1.0"
2125421243

21255-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
21244+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
2125621245
version "6.0.1"
2125721246
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
2125821247
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -21280,6 +21269,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
2128021269
dependencies:
2128121270
ansi-regex "^4.1.0"
2128221271

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+
2128321279
strip-ansi@^7.0.1:
2128421280
version "7.0.1"
2128521281
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
@@ -23957,7 +23953,7 @@ [email protected]:
2395723953
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
2395823954
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
2395923955

23960-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
23956+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
2396123957
version "7.0.0"
2396223958
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
2396323959
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -23992,6 +23988,15 @@ wrap-ansi@^6.2.0:
2399223988
string-width "^4.1.0"
2399323989
strip-ansi "^6.0.0"
2399423990

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+
2399524000
wrap-ansi@^8.1.0:
2399624001
version "8.1.0"
2399724002
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)