@cowprotocol/sdk-bridging 0.1.0-monorepo.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2924 @@
1
+ // src/types.ts
2
+ var BridgeStatus = /* @__PURE__ */ ((BridgeStatus2) => {
3
+ BridgeStatus2["NOT_INITIATED"] = "not_initiated";
4
+ BridgeStatus2["IN_PROGRESS"] = "in_progress";
5
+ BridgeStatus2["EXECUTED"] = "executed";
6
+ BridgeStatus2["FAILED"] = "failed";
7
+ BridgeStatus2["EXPIRED"] = "expired";
8
+ return BridgeStatus2;
9
+ })(BridgeStatus || {});
10
+
11
+ // src/errors.ts
12
+ var BridgeProviderQuoteError = class extends Error {
13
+ constructor(message, context) {
14
+ super(message);
15
+ this.context = context;
16
+ this.name = "BridgeProviderQuoteError";
17
+ }
18
+ };
19
+
20
+ // src/utils.ts
21
+ function isBridgeQuoteAndPost(quote) {
22
+ return "bridge" in quote;
23
+ }
24
+ function isQuoteAndPost(quote) {
25
+ return !isBridgeQuoteAndPost(quote);
26
+ }
27
+ function assertIsBridgeQuoteAndPost(quote) {
28
+ if (!isBridgeQuoteAndPost(quote)) {
29
+ throw new Error("Quote result is not of type BridgeQuoteAndPost. Are you sure the sell and buy chains different?");
30
+ }
31
+ }
32
+ function assertIsQuoteAndPost(quote) {
33
+ if (!isQuoteAndPost(quote)) {
34
+ throw new Error("Quote result is not of type QuoteAndPost. Are you sure the sell and buy chains are the same?");
35
+ }
36
+ }
37
+ function getPostHooks(fullAppData) {
38
+ if (!fullAppData) {
39
+ return [];
40
+ }
41
+ const appData = JSON.parse(fullAppData);
42
+ if (!isAppDoc(appData)) {
43
+ return [];
44
+ }
45
+ if (!appData.metadata.hooks) {
46
+ return [];
47
+ }
48
+ return appData.metadata.hooks.post || [];
49
+ }
50
+ function isAppDoc(appData) {
51
+ return typeof appData === "object" && appData !== null && "version" in appData && "metadata" in appData;
52
+ }
53
+
54
+ // src/hooks/utils.ts
55
+ function getHookMockForCostEstimation(gasLimit) {
56
+ return {
57
+ callData: "0x00",
58
+ gasLimit: gasLimit.toString(),
59
+ target: "0x0000000000000000000000000000000000000000"
60
+ };
61
+ }
62
+ function areHooksEqual(hookA, hookB) {
63
+ return hookA.callData === hookB.callData && hookA.gasLimit === hookB.gasLimit && hookA.target === hookB.target;
64
+ }
65
+
66
+ // src/BridgingSdk/BridgingSdk.ts
67
+ import { TradingSdk as TradingSdk2 } from "@cowprotocol/sdk-trading";
68
+ import {
69
+ ALL_SUPPORTED_CHAINS
70
+ } from "@cowprotocol/sdk-config";
71
+
72
+ // src/BridgingSdk/getQuoteWithoutBridge.ts
73
+ import { jsonWithBigintReplacer } from "@cowprotocol/sdk-common";
74
+ import { log } from "@cowprotocol/sdk-common";
75
+ function getQuoteWithoutBridge(params) {
76
+ const { quoteBridgeRequest, advancedSettings, tradingSdk } = params;
77
+ const { sellTokenAddress, buyTokenAddress, amount, ...rest } = quoteBridgeRequest;
78
+ const swapParams = {
79
+ ...rest,
80
+ chainId: quoteBridgeRequest.sellTokenChainId,
81
+ sellToken: sellTokenAddress,
82
+ buyToken: buyTokenAddress,
83
+ amount: amount.toString()
84
+ };
85
+ const { signer: _, ...paramsToLog } = swapParams;
86
+ log(`Single-chain swap: Delegate to trading SDK with params ${JSON.stringify(paramsToLog, jsonWithBigintReplacer)}`);
87
+ return tradingSdk.getQuote(swapParams, advancedSettings);
88
+ }
89
+
90
+ // src/BridgingSdk/getQuoteWithBridge.ts
91
+ import {
92
+ mergeAppDataDoc,
93
+ postSwapOrderFromQuote
94
+ } from "@cowprotocol/sdk-trading";
95
+ import { log as log2, jsonWithBigintReplacer as jsonWithBigintReplacer2, getGlobalAdapter } from "@cowprotocol/sdk-common";
96
+ import { OrderKind } from "@cowprotocol/sdk-order-book";
97
+ import { getTradeParametersAfterQuote } from "@cowprotocol/sdk-trading";
98
+ async function getQuoteWithBridge(params) {
99
+ const { provider, swapAndBridgeRequest, advancedSettings, getErc20Decimals, tradingSdk, bridgeHookSigner } = params;
100
+ const {
101
+ kind,
102
+ sellTokenChainId,
103
+ sellTokenAddress,
104
+ buyTokenChainId,
105
+ buyTokenAddress,
106
+ amount,
107
+ signer: signerLike,
108
+ ...rest
109
+ } = swapAndBridgeRequest;
110
+ const adapter = getGlobalAdapter();
111
+ const signer = signerLike ? adapter.createSigner(signerLike) : adapter.signer;
112
+ if (kind !== OrderKind.SELL) {
113
+ throw new Error("Bridging only support SELL orders");
114
+ }
115
+ log2(
116
+ `Cross-chain ${kind} ${amount} ${sellTokenAddress} (source chain ${sellTokenChainId}) for ${buyTokenAddress} (target chain ${buyTokenChainId})`
117
+ );
118
+ const bridgeRequestWithoutAmount = await getBaseBridgeQuoteRequest({
119
+ swapAndBridgeRequest,
120
+ provider,
121
+ getErc20Decimals
122
+ });
123
+ const hookEstimatedGasLimit = provider.getGasLimitEstimationForHook(bridgeRequestWithoutAmount);
124
+ const mockedHook = getHookMockForCostEstimation(hookEstimatedGasLimit);
125
+ log2(`Using mocked hook for swap gas estimation: ${JSON.stringify(mockedHook)}`);
126
+ const { sellTokenAddress: intermediateToken, sellTokenDecimals: intermediaryTokenDecimals } = bridgeRequestWithoutAmount;
127
+ const swapParams = {
128
+ ...rest,
129
+ kind,
130
+ chainId: sellTokenChainId,
131
+ sellToken: sellTokenAddress,
132
+ buyToken: intermediateToken,
133
+ buyTokenDecimals: intermediaryTokenDecimals,
134
+ amount: amount.toString(),
135
+ signer
136
+ };
137
+ const { signer: _, ...swapParamsToLog } = swapParams;
138
+ log2(
139
+ `Getting a quote for the swap (sell token to buy intermediate token). Delegate to trading SDK with params: ${JSON.stringify(
140
+ swapParamsToLog,
141
+ jsonWithBigintReplacer2
142
+ )}`
143
+ );
144
+ const advancedSettingsHooks = advancedSettings?.appData?.metadata?.hooks;
145
+ const { result: swapResult, orderBookApi } = await tradingSdk.getQuoteResults(swapParams, {
146
+ ...advancedSettings,
147
+ appData: {
148
+ ...advancedSettings?.appData,
149
+ metadata: {
150
+ hooks: {
151
+ pre: advancedSettingsHooks?.pre,
152
+ post: [...advancedSettingsHooks?.post || [], mockedHook]
153
+ }
154
+ }
155
+ }
156
+ });
157
+ const intermediateTokenAmount = swapResult.amountsAndCosts.afterSlippage.buyAmount;
158
+ log2(
159
+ `Expected to receive ${intermediateTokenAmount} of the intermediate token (${adapter.utils.parseUnits(intermediateTokenAmount.toString(), intermediaryTokenDecimals).toString()})`
160
+ );
161
+ async function signHooksAndSetSwapResult(signer2, defaultGasLimit, advancedSettings2) {
162
+ const appDataOverride = advancedSettings2?.appData;
163
+ const receiverOverride = advancedSettings2?.quoteRequest?.receiver;
164
+ const {
165
+ bridgeHook,
166
+ appDataInfo: { doc: appData, fullAppData, appDataKeccak256 },
167
+ bridgeResult
168
+ } = await getBridgeResult({
169
+ swapAndBridgeRequest: { ...swapAndBridgeRequest, kind: OrderKind.SELL },
170
+ swapResult,
171
+ bridgeRequestWithoutAmount: {
172
+ ...bridgeRequestWithoutAmount,
173
+ receiver: receiverOverride || bridgeRequestWithoutAmount.receiver
174
+ },
175
+ provider,
176
+ intermediateTokenAmount,
177
+ signer: signer2,
178
+ mockedHook,
179
+ appDataOverride,
180
+ defaultGasLimit
181
+ });
182
+ log2(`Bridge hook for swap: ${JSON.stringify(bridgeHook)}`);
183
+ swapResult.tradeParameters.receiver = bridgeHook.recipient;
184
+ log2(`App data for swap: appDataKeccak256=${appDataKeccak256}, fullAppData="${fullAppData}"`);
185
+ swapResult.appDataInfo = {
186
+ fullAppData,
187
+ appDataKeccak256,
188
+ doc: appData
189
+ };
190
+ return {
191
+ bridgeResult,
192
+ swapResult: {
193
+ ...swapResult,
194
+ tradeParameters: {
195
+ ...swapResult.tradeParameters,
196
+ receiver: bridgeHook.recipient
197
+ }
198
+ }
199
+ };
200
+ }
201
+ const result = await signHooksAndSetSwapResult(
202
+ // Sign the hooks with bridgeHookSigner if provided
203
+ bridgeHookSigner ? adapter.createSigner(bridgeHookSigner) : signer,
204
+ // Use estimated hook gas limit if bridgeHookSigner is provided, so we don't have to estimate the hook gas limit twice
205
+ // Moreover, since bridgeHookSigner is not the real signer, the estimation will fail
206
+ bridgeHookSigner ? BigInt(hookEstimatedGasLimit) : void 0
207
+ );
208
+ return {
209
+ swap: result.swapResult,
210
+ bridge: result.bridgeResult,
211
+ async postSwapOrderFromQuote(advancedSettings2) {
212
+ const { swapResult: swapResult2 } = await signHooksAndSetSwapResult(signer, void 0, advancedSettings2);
213
+ const quoteResults = {
214
+ result: {
215
+ ...swapResult2,
216
+ tradeParameters: getTradeParametersAfterQuote({
217
+ quoteParameters: swapResult2.tradeParameters,
218
+ sellToken: sellTokenAddress
219
+ }),
220
+ signer
221
+ },
222
+ orderBookApi
223
+ };
224
+ return postSwapOrderFromQuote(quoteResults, {
225
+ ...advancedSettings2,
226
+ appData: swapResult2.appDataInfo.doc,
227
+ quoteRequest: {
228
+ ...advancedSettings2?.quoteRequest,
229
+ // Changing receiver back to account proxy
230
+ receiver: swapResult2.tradeParameters.receiver
231
+ }
232
+ });
233
+ }
234
+ };
235
+ }
236
+ async function getBaseBridgeQuoteRequest(params) {
237
+ const { provider, getErc20Decimals, swapAndBridgeRequest: quoteBridgeRequest } = params;
238
+ const { sellTokenChainId } = quoteBridgeRequest;
239
+ const intermediateTokens = await provider.getIntermediateTokens(quoteBridgeRequest);
240
+ const intermediateTokenAddress = intermediateTokens[0];
241
+ log2(`Using ${intermediateTokenAddress} as intermediate tokens`);
242
+ if (!intermediateTokenAddress) {
243
+ throw new BridgeProviderQuoteError("No path found (not intermediate token for bridging)", {});
244
+ }
245
+ const intermediaryTokenDecimals = await getErc20Decimals(sellTokenChainId, intermediateTokenAddress);
246
+ return {
247
+ ...quoteBridgeRequest,
248
+ sellTokenAddress: intermediateTokenAddress,
249
+ sellTokenDecimals: intermediaryTokenDecimals
250
+ };
251
+ }
252
+ async function getBridgeResult(context) {
253
+ const {
254
+ swapResult,
255
+ bridgeRequestWithoutAmount,
256
+ provider,
257
+ intermediateTokenAmount,
258
+ signer,
259
+ mockedHook,
260
+ appDataOverride,
261
+ defaultGasLimit
262
+ } = context;
263
+ const bridgeRequest = {
264
+ ...bridgeRequestWithoutAmount,
265
+ amount: intermediateTokenAmount
266
+ };
267
+ const bridgingQuote = await provider.getQuote(bridgeRequest);
268
+ const unsignedBridgeCall = await provider.getUnsignedBridgeCall(bridgeRequest, bridgingQuote);
269
+ const bridgeHook = await provider.getSignedHook(
270
+ bridgeRequest.sellTokenChainId,
271
+ unsignedBridgeCall,
272
+ defaultGasLimit,
273
+ signer
274
+ );
275
+ const swapAppData = await mergeAppDataDoc(swapResult.appDataInfo.doc, appDataOverride || {});
276
+ const swapResultHooks = swapAppData.doc.metadata.hooks;
277
+ const postHooks = swapResultHooks?.post || [];
278
+ const isBridgeHookAlreadyPresent = postHooks.some((hook) => areHooksEqual(hook, bridgeHook.postHook));
279
+ const appDataInfo = await mergeAppDataDoc(swapAppData.doc, {
280
+ metadata: {
281
+ hooks: {
282
+ pre: swapResultHooks?.pre,
283
+ // Remove the mocked hook from the post hooks after receiving quote
284
+ post: [...swapResultHooks?.post || [], ...isBridgeHookAlreadyPresent ? [] : [bridgeHook.postHook]].filter(
285
+ (hook) => !areHooksEqual(hook, mockedHook)
286
+ )
287
+ }
288
+ }
289
+ });
290
+ const bridgeResult = {
291
+ providerInfo: provider.info,
292
+ tradeParameters: bridgeRequest,
293
+ // Just the bridge (not the swap & bridge)
294
+ bridgeCallDetails: {
295
+ unsignedBridgeCall,
296
+ preAuthorizedBridgingHook: bridgeHook
297
+ },
298
+ isSell: bridgingQuote.isSell,
299
+ expectedFillTimeSeconds: bridgingQuote.expectedFillTimeSeconds,
300
+ fees: bridgingQuote.fees,
301
+ limits: bridgingQuote.limits,
302
+ quoteTimestamp: bridgingQuote.quoteTimestamp,
303
+ amountsAndCosts: bridgingQuote.amountsAndCosts
304
+ };
305
+ return { bridgeResult, bridgeHook, appDataInfo };
306
+ }
307
+
308
+ // src/BridgingSdk/getErc20Decimals.ts
309
+ import { getGlobalAdapter as getGlobalAdapter2 } from "@cowprotocol/sdk-common";
310
+ var ERC20_DECIMALS_ABI = ["function decimals() external view returns (uint8)"];
311
+ function factoryGetErc20Decimals() {
312
+ return (_chainId, tokenAddress) => {
313
+ const adapter = getGlobalAdapter2();
314
+ const contract = adapter.getContract(tokenAddress, ERC20_DECIMALS_ABI);
315
+ return contract.decimals();
316
+ };
317
+ }
318
+
319
+ // src/BridgingSdk/BridgingSdk.ts
320
+ import { CowError, enableLogging, setGlobalAdapter } from "@cowprotocol/sdk-common";
321
+ import { OrderBookApi } from "@cowprotocol/sdk-order-book";
322
+
323
+ // src/providers/across/const/misc.ts
324
+ var HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
325
+
326
+ // src/BridgingSdk/getCrossChainOrder.ts
327
+ async function getCrossChainOrder(params) {
328
+ const { orderId, chainId, orderBookApi, providers, env } = params;
329
+ const chainContext = { chainId, env };
330
+ const order = await orderBookApi.getOrder(orderId, chainContext);
331
+ const postHooks = getPostHooks(order.fullAppData ?? void 0);
332
+ const bridgingHook = postHooks.find((hook) => {
333
+ return hook.dappId?.startsWith(HOOK_DAPP_BRIDGE_PROVIDER_PREFIX);
334
+ });
335
+ if (!bridgingHook) {
336
+ throw new Error(`Order ${orderId} is not a cross-chain order`);
337
+ }
338
+ const bridgeProviderName = bridgingHook.dappId?.split(HOOK_DAPP_BRIDGE_PROVIDER_PREFIX).pop();
339
+ const provider = providers.find((provider2) => provider2.info.name === bridgeProviderName);
340
+ if (!provider) {
341
+ throw new Error(
342
+ `Unknown Bridge provider: ${bridgeProviderName}. Add provider to the SDK config to be able to decode the order`
343
+ );
344
+ }
345
+ const trades = await orderBookApi.getTrades({ orderUid: order.uid }, chainContext);
346
+ if (trades.length > 0) {
347
+ const firstTrade = trades[0];
348
+ if (!firstTrade?.txHash) {
349
+ throw new Error(`No tx hash found for order ${orderId} . First trade, with log index ${firstTrade?.logIndex}`);
350
+ }
351
+ const bridgingId = await provider.getBridgingId(orderId, firstTrade.txHash, firstTrade.logIndex);
352
+ const { status, fillTimeInSeconds } = await provider.getStatus(bridgingId);
353
+ const explorerUrl = provider.getExplorerUrl(bridgingId);
354
+ return {
355
+ chainId,
356
+ order,
357
+ status,
358
+ bridgingId,
359
+ explorerUrl,
360
+ fillTimeInSeconds
361
+ };
362
+ } else {
363
+ return {
364
+ chainId,
365
+ order,
366
+ status: "not_initiated" /* NOT_INITIATED */
367
+ };
368
+ }
369
+ }
370
+
371
+ // src/BridgingSdk/BridgingSdk.ts
372
+ var BridgingSdk = class {
373
+ constructor(options, adapter) {
374
+ this.options = options;
375
+ if (adapter) {
376
+ setGlobalAdapter(adapter);
377
+ }
378
+ const { providers, ...restOptions } = options;
379
+ if (!providers || providers.length !== 1) {
380
+ throw new Error("Current implementation only supports a single bridge provider");
381
+ }
382
+ if (options.enableLogging !== void 0) {
383
+ enableLogging(options.enableLogging);
384
+ }
385
+ const tradingSdk = options.tradingSdk ?? new TradingSdk2();
386
+ const orderBookApi = tradingSdk?.options.orderBookApi ?? new OrderBookApi();
387
+ this.config = {
388
+ ...restOptions,
389
+ providers,
390
+ tradingSdk,
391
+ orderBookApi
392
+ };
393
+ }
394
+ config;
395
+ get provider() {
396
+ const { providers } = this.config;
397
+ if (!providers[0]) {
398
+ throw new CowError("No provider found");
399
+ }
400
+ return providers[0];
401
+ }
402
+ /**
403
+ * Get the providers for the bridging.
404
+ */
405
+ getProviders() {
406
+ return this.config.providers;
407
+ }
408
+ /**
409
+ * Get the available sources networks for the bridging.
410
+ */
411
+ async getSourceNetworks() {
412
+ return ALL_SUPPORTED_CHAINS;
413
+ }
414
+ /**
415
+ * Get the available target networks for the bridging.
416
+ */
417
+ async getTargetNetworks() {
418
+ return this.provider.getNetworks();
419
+ }
420
+ /**
421
+ * Get the available buy tokens for buying in a specific target chain
422
+ *
423
+ * @param param
424
+ * @returns
425
+ */
426
+ async getBuyTokens(targetChainId) {
427
+ return this.provider.getBuyTokens(targetChainId);
428
+ }
429
+ /**
430
+ * Get quote details, including a callback function to post the order on-chain.
431
+ *
432
+ * This method support both, cross-chain swaps and single-chain swap.
433
+ *
434
+ * The return type will be either `QuoteAndPost` or `BridgeQuoteAndPost`.
435
+ *
436
+ * To safely assert the type in Typescript, you can use:
437
+ * - `isBridgeQuoteAndPost(result)` utility.
438
+ * - `isQuoteAndPost(result)` utility.
439
+ * - `assertIsBridgeQuoteAndPost(result)` assertion.
440
+ * - `assertIsQuoteAndPost(result)` assertion.
441
+ *
442
+ * @throws Error if no path is found
443
+ */
444
+ async getQuote(quoteBridgeRequest, advancedSettings) {
445
+ const { sellTokenChainId, buyTokenChainId } = quoteBridgeRequest;
446
+ const tradingSdk = this.config.tradingSdk;
447
+ if (sellTokenChainId !== buyTokenChainId) {
448
+ const getErc20Decimals = this.config.getErc20Decimals ?? factoryGetErc20Decimals();
449
+ return getQuoteWithBridge({
450
+ swapAndBridgeRequest: quoteBridgeRequest,
451
+ advancedSettings,
452
+ tradingSdk,
453
+ provider: this.provider,
454
+ getErc20Decimals,
455
+ bridgeHookSigner: advancedSettings?.quoteSigner
456
+ });
457
+ } else {
458
+ return getQuoteWithoutBridge({
459
+ quoteBridgeRequest,
460
+ advancedSettings,
461
+ tradingSdk
462
+ });
463
+ }
464
+ }
465
+ async getOrder(params) {
466
+ const { orderBookApi } = this.config;
467
+ const { orderId, chainId, env } = params;
468
+ return getCrossChainOrder({
469
+ orderId,
470
+ chainId,
471
+ orderBookApi,
472
+ providers: this.config.providers,
473
+ env: env || orderBookApi.context.env
474
+ });
475
+ }
476
+ };
477
+
478
+ // src/providers/mock/MockBridgeProvider.ts
479
+ import { OrderKind as OrderKind2 } from "@cowprotocol/sdk-order-book";
480
+ import {
481
+ sepolia,
482
+ optimism,
483
+ mainnet,
484
+ AdditionalTargetChainId,
485
+ SupportedChainId as SupportedChainId2
486
+ } from "@cowprotocol/sdk-config";
487
+
488
+ // src/const.ts
489
+ import { RAW_FILES_PATH } from "@cowprotocol/sdk-config";
490
+ var RAW_PROVIDERS_FILES_PATH = `${RAW_FILES_PATH}/src/bridging/providers`;
491
+ var DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION = 2e5;
492
+
493
+ // src/providers/mock/MockBridgeProvider.ts
494
+ var BRIDGING_ID = "123456789asdfg";
495
+ var MOCK_CALL = {
496
+ to: "0x0000000000000000000000000000000000000001",
497
+ data: "0x0",
498
+ value: BigInt(0)
499
+ };
500
+ var BUY_TOKENS = [
501
+ {
502
+ chainId: SupportedChainId2.MAINNET,
503
+ address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
504
+ logoUrl: "https://swap.cow.fi/assets/network-mainnet-logo-BJe1wK_m.svg",
505
+ name: "USD Coin",
506
+ symbol: "USDC",
507
+ decimals: 6
508
+ },
509
+ {
510
+ chainId: SupportedChainId2.MAINNET,
511
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
512
+ logoUrl: "https://swap.cow.fi/assets/network-gnosis-chain-logo-Do_DEWQv.svg",
513
+ name: "Wrapped Ether",
514
+ symbol: "WETH",
515
+ decimals: 18
516
+ },
517
+ {
518
+ chainId: SupportedChainId2.SEPOLIA,
519
+ address: "0x0625aFB445C3B6B7B929342a04A22599fd5dBB59",
520
+ logoUrl: "https://swap.cow.fi/assets/network-mainnet-logo-BJe1wK_m.svg",
521
+ name: "CoW Protocol Token",
522
+ symbol: "COW",
523
+ decimals: 18
524
+ },
525
+ {
526
+ chainId: AdditionalTargetChainId.OPTIMISM,
527
+ address: "0x4200000000000000000000000000000000000006",
528
+ logoUrl: "https://swap.cow.fi/assets/network-mainnet-logo-BJe1wK_m.svg",
529
+ name: "Wrapped Ether",
530
+ symbol: "WETH",
531
+ decimals: 18
532
+ }
533
+ ];
534
+ var INTERMEDIATE_TOKENS = {
535
+ [SupportedChainId2.MAINNET]: ["0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB"],
536
+ [AdditionalTargetChainId.OPTIMISM]: ["0x68f180fcCe6836688e9084f035309E29Bf0A2095"],
537
+ [SupportedChainId2.SEPOLIA]: ["0xB4F1737Af37711e9A5890D9510c9bB60e170CB0D"]
538
+ };
539
+ var MockBridgeProvider = class {
540
+ info = {
541
+ name: "Mock",
542
+ logoUrl: `${RAW_PROVIDERS_FILES_PATH}/mock/mock-logo.png`
543
+ };
544
+ async getNetworks() {
545
+ return [mainnet, optimism, sepolia];
546
+ }
547
+ async getBuyTokens(targetChainId) {
548
+ return BUY_TOKENS.filter((token) => token.chainId === targetChainId);
549
+ }
550
+ async getIntermediateTokens({ sellTokenChainId }) {
551
+ return INTERMEDIATE_TOKENS[sellTokenChainId] ?? [];
552
+ }
553
+ async getQuote(_request) {
554
+ return {
555
+ isSell: true,
556
+ amountsAndCosts: {
557
+ costs: {
558
+ bridgingFee: {
559
+ feeBps: 10,
560
+ amountInSellCurrency: 123456n,
561
+ amountInBuyCurrency: 123456n
562
+ }
563
+ },
564
+ beforeFee: {
565
+ sellAmount: 123456n,
566
+ buyAmount: 123456n
567
+ },
568
+ afterFee: {
569
+ sellAmount: 123456n,
570
+ buyAmount: 123456n
571
+ },
572
+ afterSlippage: {
573
+ sellAmount: 123456n,
574
+ buyAmount: 123456n
575
+ },
576
+ slippageBps: 0
577
+ },
578
+ quoteTimestamp: Date.now(),
579
+ expectedFillTimeSeconds: 128,
580
+ fees: {
581
+ bridgeFee: 1n,
582
+ destinationGasFee: 2n
583
+ },
584
+ limits: {
585
+ minDeposit: 1n,
586
+ maxDeposit: 100000n
587
+ }
588
+ };
589
+ }
590
+ getGasLimitEstimationForHook(_request) {
591
+ return 11e4;
592
+ }
593
+ async getUnsignedBridgeCall(_request, _quote) {
594
+ return MOCK_CALL;
595
+ }
596
+ async getSignedHook(_chainId, _unsignedCall, _signer) {
597
+ return {
598
+ recipient: "0x0000000000000000000000000000000000000001",
599
+ postHook: {
600
+ target: "0x0000000000000000000000000000000000000002",
601
+ callData: "0x1",
602
+ gasLimit: "0x2",
603
+ dappId: "MockBridgeProvider"
604
+ }
605
+ };
606
+ }
607
+ async decodeBridgeHook(_hook) {
608
+ return {
609
+ kind: OrderKind2.SELL,
610
+ provider: this.info,
611
+ account: "0x0000000000000000000000000000000000000001",
612
+ sellTokenChainId: 1,
613
+ sellTokenAddress: "0x0000000000000000000000000000000000000001",
614
+ sellTokenAmount: "123456",
615
+ sellTokenDecimals: 18,
616
+ buyTokenChainId: 1,
617
+ buyTokenAddress: "0x0000000000000000000000000000000000000002",
618
+ buyTokenDecimals: 18,
619
+ minBuyAmount: "123456",
620
+ receiver: "0x0000000000000000000000000000000000000001",
621
+ signer: "",
622
+ appCode: "MOCK"
623
+ };
624
+ }
625
+ async getBridgingId(_orderUid, _settlementTx, _logIndex) {
626
+ return BRIDGING_ID;
627
+ }
628
+ getExplorerUrl(bridgingId) {
629
+ return "https://www.google.com/search?q=" + bridgingId;
630
+ }
631
+ async getStatus(_bridgingId) {
632
+ return {
633
+ status: "in_progress" /* IN_PROGRESS */,
634
+ fillTimeInSeconds: 67
635
+ };
636
+ }
637
+ async getCancelBridgingTx(_bridgingId) {
638
+ return MOCK_CALL;
639
+ }
640
+ async getRefundBridgingTx(_bridgingId) {
641
+ return MOCK_CALL;
642
+ }
643
+ };
644
+
645
+ // src/providers/across/AcrossBridgeProvider.ts
646
+ import { setGlobalAdapter as setGlobalAdapter2 } from "@cowprotocol/sdk-common";
647
+ import {
648
+ mainnet as mainnet2,
649
+ polygon,
650
+ arbitrumOne,
651
+ base,
652
+ optimism as optimism2
653
+ } from "@cowprotocol/sdk-config";
654
+
655
+ // src/providers/across/const/tokens.ts
656
+ import { SupportedChainId as SupportedChainId3, AdditionalTargetChainId as AdditionalTargetChainId2 } from "@cowprotocol/sdk-config";
657
+ var ACROSS_CHAIN_CONFIGS = [
658
+ {
659
+ chainId: SupportedChainId3.MAINNET,
660
+ tokens: {
661
+ usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
662
+ weth: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
663
+ wbtc: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
664
+ dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
665
+ usdt: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
666
+ }
667
+ },
668
+ {
669
+ chainId: SupportedChainId3.POLYGON,
670
+ tokens: {
671
+ usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
672
+ weth: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
673
+ wbtc: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
674
+ dai: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
675
+ usdt: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
676
+ }
677
+ },
678
+ {
679
+ chainId: SupportedChainId3.ARBITRUM_ONE,
680
+ tokens: {
681
+ usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
682
+ weth: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
683
+ wbtc: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
684
+ dai: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
685
+ usdt: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"
686
+ }
687
+ },
688
+ {
689
+ chainId: SupportedChainId3.BASE,
690
+ tokens: {
691
+ usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
692
+ weth: "0x4200000000000000000000000000000000000006",
693
+ dai: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb"
694
+ }
695
+ },
696
+ {
697
+ chainId: AdditionalTargetChainId2.OPTIMISM,
698
+ tokens: {
699
+ usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
700
+ weth: "0x4200000000000000000000000000000000000006",
701
+ wbtc: "0x68f180fcCe6836688e9084f035309E29Bf0A2095",
702
+ dai: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
703
+ usdt: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"
704
+ }
705
+ }
706
+ ];
707
+ var ACROSS_TOKEN_MAPPING = ACROSS_CHAIN_CONFIGS.reduce(
708
+ (acc, config) => {
709
+ acc[config.chainId] = config;
710
+ return acc;
711
+ },
712
+ {}
713
+ );
714
+
715
+ // src/providers/across/AcrossApi.ts
716
+ import { log as log3 } from "@cowprotocol/sdk-common";
717
+ var ACROSS_API_URL = "https://app.across.to/api";
718
+ var AcrossApi = class {
719
+ constructor(options = {}) {
720
+ this.options = options;
721
+ }
722
+ /**
723
+ * Retrieve available routes for transfers
724
+ *
725
+ * Returns available routes based on specified parameters. If no parameters are provided, available routes on all
726
+ * chains are returned.
727
+ *
728
+ * See https://docs.across.to/reference/api-reference#available-routes
729
+ */
730
+ async getAvailableRoutes({
731
+ originChainId,
732
+ originToken,
733
+ destinationChainId,
734
+ destinationToken
735
+ }) {
736
+ const params = {};
737
+ if (originChainId)
738
+ params.originChainId = originChainId;
739
+ if (originToken)
740
+ params.originToken = originToken;
741
+ if (destinationChainId)
742
+ params.destinationChainId = destinationChainId;
743
+ if (destinationToken)
744
+ params.destinationToken = destinationToken;
745
+ return this.fetchApi("/available-routes", params, isValidRoutes);
746
+ }
747
+ /**
748
+ * Retrieve suggested fee quote for a deposit.
749
+ *
750
+ * Returns suggested fees based inputToken+outputToken, originChainId, destinationChainId, and amount.
751
+ * Also includes data used to compute the fees.
752
+ *
753
+ * * See https://docs.across.to/reference/api-reference#suggested-fees
754
+ */
755
+ async getSuggestedFees(request) {
756
+ const params = {
757
+ token: request.token,
758
+ originChainId: request.originChainId.toString(),
759
+ destinationChainId: request.destinationChainId.toString(),
760
+ amount: request.amount.toString()
761
+ };
762
+ if (request.recipient) {
763
+ params.recipient = request.recipient;
764
+ }
765
+ return this.fetchApi("/suggested-fees", params, isValidSuggestedFeesResponse);
766
+ }
767
+ async fetchApi(path, params, isValidResponse) {
768
+ const baseUrl = this.options.apiBaseUrl || ACROSS_API_URL;
769
+ const url = `${baseUrl}${path}?${new URLSearchParams(params).toString()}`;
770
+ log3(`Fetching Across API: GET ${url}. Params: ${JSON.stringify(params)}`);
771
+ const response = await fetch(url, {
772
+ method: "GET"
773
+ });
774
+ if (!response.ok) {
775
+ const errorBody = await response.json();
776
+ throw new BridgeProviderQuoteError("Across Api Error", errorBody);
777
+ }
778
+ const json = await response.json();
779
+ if (isValidResponse) {
780
+ if (isValidResponse(json)) {
781
+ return json;
782
+ } else {
783
+ throw new BridgeProviderQuoteError(
784
+ `Invalid response for Across API call ${path}. The response doesn't pass the validation. Did the API change?`,
785
+ json
786
+ );
787
+ }
788
+ }
789
+ return json;
790
+ }
791
+ };
792
+ function isValidSuggestedFeesResponse(response) {
793
+ return typeof response === "object" && response !== null && "totalRelayFee" in response && isValidPctFee(response.totalRelayFee) && "relayerCapitalFee" in response && isValidPctFee(response.relayerCapitalFee) && "relayerGasFee" in response && isValidPctFee(response.relayerGasFee) && "lpFee" in response && isValidPctFee(response.lpFee) && "timestamp" in response && "isAmountTooLow" in response && "quoteBlock" in response && "spokePoolAddress" in response && "exclusiveRelayer" in response && "exclusivityDeadline" in response && "estimatedFillTimeSec" in response && "fillDeadline" in response && "limits" in response && isValidSuggestedFeeLimits(response.limits);
794
+ }
795
+ function isValidPctFee(pctFee) {
796
+ return typeof pctFee === "object" && pctFee !== null && "pct" in pctFee && "total" in pctFee;
797
+ }
798
+ function isValidSuggestedFeeLimits(limits) {
799
+ return typeof limits === "object" && limits !== null && "minDeposit" in limits && "maxDeposit" in limits && "maxDepositInstant" in limits && "maxDepositShortDelay" in limits && "recommendedDepositInstant" in limits;
800
+ }
801
+ function isValidRoutes(response) {
802
+ if (!Array.isArray(response)) {
803
+ return false;
804
+ }
805
+ return response.every((item) => isValidRoute(item));
806
+ }
807
+ function isValidRoute(item) {
808
+ return typeof item === "object" && item !== null && "originChainId" in item && "originToken" in item && "destinationChainId" in item && "destinationToken" in item && "originTokenSymbol" in item && "destinationTokenSymbol" in item;
809
+ }
810
+
811
+ // src/providers/across/util.ts
812
+ import { getBigNumber } from "@cowprotocol/sdk-order-book";
813
+ import { ContractsOrderKind as OrderKind3 } from "@cowprotocol/sdk-contracts-ts";
814
+ var PCT_100_PERCENT = 10n ** 18n;
815
+ function getChainConfigs(sourceChainId, targetChainId) {
816
+ const sourceChainConfig = getChainConfig(sourceChainId);
817
+ const targetChainConfig = getChainConfig(targetChainId);
818
+ if (!sourceChainConfig || !targetChainConfig)
819
+ return;
820
+ return { sourceChainConfig, targetChainConfig };
821
+ }
822
+ function getChainConfig(chainId) {
823
+ return ACROSS_TOKEN_MAPPING[chainId];
824
+ }
825
+ function getTokenSymbol(tokenAddress, chainConfig) {
826
+ return Object.keys(chainConfig.tokens).find((key) => chainConfig.tokens[key] === tokenAddress);
827
+ }
828
+ function getTokenAddress(tokenSymbol, chainConfig) {
829
+ return chainConfig.tokens[tokenSymbol];
830
+ }
831
+ function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
832
+ const { kind } = request;
833
+ return {
834
+ isSell: kind === OrderKind3.SELL,
835
+ amountsAndCosts: toAmountsAndCosts(request, slippageBps, suggestedFees),
836
+ quoteTimestamp: Number(suggestedFees.timestamp),
837
+ expectedFillTimeSeconds: Number(suggestedFees.estimatedFillTimeSec),
838
+ fees: {
839
+ bridgeFee: BigInt(suggestedFees.relayerCapitalFee.total),
840
+ destinationGasFee: BigInt(suggestedFees.relayerGasFee.total)
841
+ },
842
+ limits: {
843
+ minDeposit: BigInt(suggestedFees.limits.minDeposit),
844
+ maxDeposit: BigInt(suggestedFees.limits.maxDeposit)
845
+ },
846
+ suggestedFees
847
+ };
848
+ }
849
+ function toAmountsAndCosts(request, slippageBps, suggestedFees) {
850
+ const { amount, sellTokenDecimals, buyTokenDecimals } = request;
851
+ const sellAmountBeforeFeeBig = getBigNumber(amount, sellTokenDecimals);
852
+ const sellAmountBeforeFee = sellAmountBeforeFeeBig.big;
853
+ const buyAmountBeforeFee = getBigNumber(sellAmountBeforeFeeBig.num, buyTokenDecimals).big;
854
+ const totalRelayerFeePct = BigInt(suggestedFees.totalRelayFee.pct);
855
+ const buyAmountAfterFee = applyPctFee(buyAmountBeforeFee, totalRelayerFeePct);
856
+ const feeSellToken = sellAmountBeforeFee - applyPctFee(sellAmountBeforeFee, totalRelayerFeePct);
857
+ const feeBuyToken = buyAmountBeforeFee - buyAmountAfterFee;
858
+ const buyAmountAfterSlippage = applyBps(buyAmountAfterFee, slippageBps);
859
+ return {
860
+ beforeFee: {
861
+ sellAmount: sellAmountBeforeFee,
862
+ buyAmount: buyAmountBeforeFee
863
+ // Assuming the price is 1:1 (before fee). This is because we are exchanging the same asset
864
+ },
865
+ afterFee: {
866
+ sellAmount: sellAmountBeforeFee,
867
+ // Sell amount does't change (fee is applied to the buy amount)
868
+ buyAmount: buyAmountAfterFee
869
+ },
870
+ afterSlippage: {
871
+ sellAmount: sellAmountBeforeFee,
872
+ // Sell amount does't change (slippage is applied to the buy amount)
873
+ buyAmount: buyAmountAfterSlippage
874
+ },
875
+ costs: {
876
+ bridgingFee: {
877
+ feeBps: pctToBps(totalRelayerFeePct),
878
+ amountInSellCurrency: feeSellToken,
879
+ amountInBuyCurrency: feeBuyToken
880
+ }
881
+ },
882
+ slippageBps
883
+ };
884
+ }
885
+ function assertValidPct(pct) {
886
+ if (pct > PCT_100_PERCENT || pct < 0n) {
887
+ throw new Error("Fee cannot exceed 100% or be negative");
888
+ }
889
+ }
890
+ function pctToBps(pct) {
891
+ assertValidPct(pct);
892
+ return Number(pct * 10000n / PCT_100_PERCENT);
893
+ }
894
+ function applyPctFee(amount, pct) {
895
+ assertValidPct(pct);
896
+ return amount * (PCT_100_PERCENT - pct) / PCT_100_PERCENT;
897
+ }
898
+ function applyBps(amount, bps) {
899
+ return amount * BigInt(1e4 - bps) / 10000n;
900
+ }
901
+
902
+ // src/providers/across/AcrossBridgeProvider.ts
903
+ import { CowShedSdk } from "@cowprotocol/sdk-cow-shed";
904
+
905
+ // src/providers/across/const/contracts.ts
906
+ import { AdditionalTargetChainId as AdditionalTargetChainId3, SupportedChainId as SupportedChainId4 } from "@cowprotocol/sdk-config";
907
+ var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
908
+ // https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
909
+ [SupportedChainId4.MAINNET]: "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
910
+ // https://docs.across.to/reference/contract-addresses/arbitrum-chain-id-42161-1
911
+ [SupportedChainId4.ARBITRUM_ONE]: "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
912
+ // https://docs.across.to/reference/contract-addresses/base-chain-id-8453
913
+ [SupportedChainId4.BASE]: "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64",
914
+ // // https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
915
+ [SupportedChainId4.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
916
+ // https://docs.across.to/reference/contract-addresses/polygon-chain-id-137
917
+ [SupportedChainId4.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
918
+ // Not supported chains
919
+ // TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
920
+ [SupportedChainId4.GNOSIS_CHAIN]: void 0,
921
+ [SupportedChainId4.AVALANCHE]: void 0,
922
+ [AdditionalTargetChainId3.OPTIMISM]: void 0
923
+ };
924
+ var ACROSS_MATH_CONTRACT_ADDRESSES = {
925
+ [SupportedChainId4.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
926
+ [SupportedChainId4.ARBITRUM_ONE]: "0x5771A4b4029832e79a75De7B485E5fBbec28848f",
927
+ [SupportedChainId4.BASE]: "0xd4e943dc6ddc885f6229ce33c2e3dfe402a12c81",
928
+ // Not supported chains
929
+ // TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
930
+ [SupportedChainId4.GNOSIS_CHAIN]: void 0,
931
+ [SupportedChainId4.SEPOLIA]: void 0,
932
+ [SupportedChainId4.POLYGON]: void 0,
933
+ [AdditionalTargetChainId3.OPTIMISM]: void 0,
934
+ [SupportedChainId4.AVALANCHE]: void 0
935
+ };
936
+
937
+ // src/providers/across/createAcrossDepositCall.ts
938
+ import { WeirollCommandFlags, createWeirollContract, createWeirollDelegateCall } from "@cowprotocol/sdk-weiroll";
939
+
940
+ // src/providers/across/abi.ts
941
+ var ACROSS_MATH_ABI = [
942
+ {
943
+ inputs: [
944
+ { internalType: "uint256", name: "_a", type: "uint256" },
945
+ { internalType: "uint256", name: "_b", type: "uint256" }
946
+ ],
947
+ name: "multiplyAndSubtract",
948
+ outputs: [{ internalType: "uint256", name: "result", type: "uint256" }],
949
+ stateMutability: "pure",
950
+ type: "function"
951
+ }
952
+ ];
953
+ var ACROSS_SPOKE_POOL_ABI = [
954
+ {
955
+ inputs: [
956
+ {
957
+ internalType: "address",
958
+ name: "_wrappedNativeTokenAddress",
959
+ type: "address"
960
+ },
961
+ {
962
+ internalType: "uint32",
963
+ name: "_depositQuoteTimeBuffer",
964
+ type: "uint32"
965
+ },
966
+ { internalType: "uint32", name: "_fillDeadlineBuffer", type: "uint32" }
967
+ ],
968
+ stateMutability: "nonpayable",
969
+ type: "constructor"
970
+ },
971
+ { inputs: [], name: "ClaimedMerkleLeaf", type: "error" },
972
+ { inputs: [], name: "DepositsArePaused", type: "error" },
973
+ { inputs: [], name: "DisabledRoute", type: "error" },
974
+ { inputs: [], name: "ExpiredFillDeadline", type: "error" },
975
+ { inputs: [], name: "FillsArePaused", type: "error" },
976
+ {
977
+ inputs: [],
978
+ name: "InsufficientSpokePoolBalanceToExecuteLeaf",
979
+ type: "error"
980
+ },
981
+ { inputs: [], name: "InvalidBytes32", type: "error" },
982
+ { inputs: [], name: "InvalidChainId", type: "error" },
983
+ { inputs: [], name: "InvalidCrossDomainAdmin", type: "error" },
984
+ { inputs: [], name: "InvalidDepositorSignature", type: "error" },
985
+ { inputs: [], name: "InvalidExclusiveRelayer", type: "error" },
986
+ { inputs: [], name: "InvalidFillDeadline", type: "error" },
987
+ { inputs: [], name: "InvalidMerkleLeaf", type: "error" },
988
+ { inputs: [], name: "InvalidMerkleProof", type: "error" },
989
+ { inputs: [], name: "InvalidPayoutAdjustmentPct", type: "error" },
990
+ { inputs: [], name: "InvalidQuoteTimestamp", type: "error" },
991
+ { inputs: [], name: "InvalidRelayerFeePct", type: "error" },
992
+ { inputs: [], name: "InvalidSlowFillRequest", type: "error" },
993
+ { inputs: [], name: "InvalidWithdrawalRecipient", type: "error" },
994
+ {
995
+ inputs: [{ internalType: "bytes", name: "data", type: "bytes" }],
996
+ name: "LowLevelCallFailed",
997
+ type: "error"
998
+ },
999
+ { inputs: [], name: "MaxTransferSizeExceeded", type: "error" },
1000
+ { inputs: [], name: "MsgValueDoesNotMatchInputAmount", type: "error" },
1001
+ { inputs: [], name: "NoRelayerRefundToClaim", type: "error" },
1002
+ { inputs: [], name: "NoSlowFillsInExclusivityWindow", type: "error" },
1003
+ { inputs: [], name: "NotEOA", type: "error" },
1004
+ { inputs: [], name: "NotExclusiveRelayer", type: "error" },
1005
+ { inputs: [], name: "RelayFilled", type: "error" },
1006
+ { inputs: [], name: "WrongERC7683OrderId", type: "error" },
1007
+ {
1008
+ anonymous: false,
1009
+ inputs: [
1010
+ {
1011
+ indexed: false,
1012
+ internalType: "address",
1013
+ name: "previousAdmin",
1014
+ type: "address"
1015
+ },
1016
+ {
1017
+ indexed: false,
1018
+ internalType: "address",
1019
+ name: "newAdmin",
1020
+ type: "address"
1021
+ }
1022
+ ],
1023
+ name: "AdminChanged",
1024
+ type: "event"
1025
+ },
1026
+ {
1027
+ anonymous: false,
1028
+ inputs: [
1029
+ {
1030
+ indexed: true,
1031
+ internalType: "address",
1032
+ name: "beacon",
1033
+ type: "address"
1034
+ }
1035
+ ],
1036
+ name: "BeaconUpgraded",
1037
+ type: "event"
1038
+ },
1039
+ {
1040
+ anonymous: false,
1041
+ inputs: [
1042
+ {
1043
+ indexed: true,
1044
+ internalType: "bytes32",
1045
+ name: "l2TokenAddress",
1046
+ type: "bytes32"
1047
+ },
1048
+ {
1049
+ indexed: true,
1050
+ internalType: "bytes32",
1051
+ name: "refundAddress",
1052
+ type: "bytes32"
1053
+ },
1054
+ {
1055
+ indexed: false,
1056
+ internalType: "uint256",
1057
+ name: "amount",
1058
+ type: "uint256"
1059
+ },
1060
+ {
1061
+ indexed: true,
1062
+ internalType: "address",
1063
+ name: "caller",
1064
+ type: "address"
1065
+ }
1066
+ ],
1067
+ name: "ClaimedRelayerRefund",
1068
+ type: "event"
1069
+ },
1070
+ {
1071
+ anonymous: false,
1072
+ inputs: [
1073
+ {
1074
+ indexed: true,
1075
+ internalType: "uint256",
1076
+ name: "rootBundleId",
1077
+ type: "uint256"
1078
+ }
1079
+ ],
1080
+ name: "EmergencyDeletedRootBundle",
1081
+ type: "event"
1082
+ },
1083
+ {
1084
+ anonymous: false,
1085
+ inputs: [
1086
+ {
1087
+ indexed: true,
1088
+ internalType: "address",
1089
+ name: "originToken",
1090
+ type: "address"
1091
+ },
1092
+ {
1093
+ indexed: true,
1094
+ internalType: "uint256",
1095
+ name: "destinationChainId",
1096
+ type: "uint256"
1097
+ },
1098
+ { indexed: false, internalType: "bool", name: "enabled", type: "bool" }
1099
+ ],
1100
+ name: "EnabledDepositRoute",
1101
+ type: "event"
1102
+ },
1103
+ {
1104
+ anonymous: false,
1105
+ inputs: [
1106
+ {
1107
+ indexed: false,
1108
+ internalType: "uint256",
1109
+ name: "amountToReturn",
1110
+ type: "uint256"
1111
+ },
1112
+ {
1113
+ indexed: true,
1114
+ internalType: "uint256",
1115
+ name: "chainId",
1116
+ type: "uint256"
1117
+ },
1118
+ {
1119
+ indexed: false,
1120
+ internalType: "uint256[]",
1121
+ name: "refundAmounts",
1122
+ type: "uint256[]"
1123
+ },
1124
+ {
1125
+ indexed: true,
1126
+ internalType: "uint32",
1127
+ name: "rootBundleId",
1128
+ type: "uint32"
1129
+ },
1130
+ { indexed: true, internalType: "uint32", name: "leafId", type: "uint32" },
1131
+ {
1132
+ indexed: false,
1133
+ internalType: "address",
1134
+ name: "l2TokenAddress",
1135
+ type: "address"
1136
+ },
1137
+ {
1138
+ indexed: false,
1139
+ internalType: "address[]",
1140
+ name: "refundAddresses",
1141
+ type: "address[]"
1142
+ },
1143
+ {
1144
+ indexed: false,
1145
+ internalType: "bool",
1146
+ name: "deferredRefunds",
1147
+ type: "bool"
1148
+ },
1149
+ {
1150
+ indexed: false,
1151
+ internalType: "address",
1152
+ name: "caller",
1153
+ type: "address"
1154
+ }
1155
+ ],
1156
+ name: "ExecutedRelayerRefundRoot",
1157
+ type: "event"
1158
+ },
1159
+ {
1160
+ anonymous: false,
1161
+ inputs: [
1162
+ {
1163
+ indexed: false,
1164
+ internalType: "bytes32",
1165
+ name: "inputToken",
1166
+ type: "bytes32"
1167
+ },
1168
+ {
1169
+ indexed: false,
1170
+ internalType: "bytes32",
1171
+ name: "outputToken",
1172
+ type: "bytes32"
1173
+ },
1174
+ {
1175
+ indexed: false,
1176
+ internalType: "uint256",
1177
+ name: "inputAmount",
1178
+ type: "uint256"
1179
+ },
1180
+ {
1181
+ indexed: false,
1182
+ internalType: "uint256",
1183
+ name: "outputAmount",
1184
+ type: "uint256"
1185
+ },
1186
+ {
1187
+ indexed: false,
1188
+ internalType: "uint256",
1189
+ name: "repaymentChainId",
1190
+ type: "uint256"
1191
+ },
1192
+ {
1193
+ indexed: true,
1194
+ internalType: "uint256",
1195
+ name: "originChainId",
1196
+ type: "uint256"
1197
+ },
1198
+ {
1199
+ indexed: true,
1200
+ internalType: "uint256",
1201
+ name: "depositId",
1202
+ type: "uint256"
1203
+ },
1204
+ {
1205
+ indexed: false,
1206
+ internalType: "uint32",
1207
+ name: "fillDeadline",
1208
+ type: "uint32"
1209
+ },
1210
+ {
1211
+ indexed: false,
1212
+ internalType: "uint32",
1213
+ name: "exclusivityDeadline",
1214
+ type: "uint32"
1215
+ },
1216
+ {
1217
+ indexed: false,
1218
+ internalType: "bytes32",
1219
+ name: "exclusiveRelayer",
1220
+ type: "bytes32"
1221
+ },
1222
+ {
1223
+ indexed: true,
1224
+ internalType: "bytes32",
1225
+ name: "relayer",
1226
+ type: "bytes32"
1227
+ },
1228
+ {
1229
+ indexed: false,
1230
+ internalType: "bytes32",
1231
+ name: "depositor",
1232
+ type: "bytes32"
1233
+ },
1234
+ {
1235
+ indexed: false,
1236
+ internalType: "bytes32",
1237
+ name: "recipient",
1238
+ type: "bytes32"
1239
+ },
1240
+ {
1241
+ indexed: false,
1242
+ internalType: "bytes32",
1243
+ name: "messageHash",
1244
+ type: "bytes32"
1245
+ },
1246
+ {
1247
+ components: [
1248
+ {
1249
+ internalType: "bytes32",
1250
+ name: "updatedRecipient",
1251
+ type: "bytes32"
1252
+ },
1253
+ {
1254
+ internalType: "bytes32",
1255
+ name: "updatedMessageHash",
1256
+ type: "bytes32"
1257
+ },
1258
+ {
1259
+ internalType: "uint256",
1260
+ name: "updatedOutputAmount",
1261
+ type: "uint256"
1262
+ },
1263
+ {
1264
+ internalType: "enum V3SpokePoolInterface.FillType",
1265
+ name: "fillType",
1266
+ type: "uint8"
1267
+ }
1268
+ ],
1269
+ indexed: false,
1270
+ internalType: "struct V3SpokePoolInterface.V3RelayExecutionEventInfo",
1271
+ name: "relayExecutionInfo",
1272
+ type: "tuple"
1273
+ }
1274
+ ],
1275
+ name: "FilledRelay",
1276
+ type: "event"
1277
+ },
1278
+ {
1279
+ anonymous: false,
1280
+ inputs: [
1281
+ {
1282
+ indexed: false,
1283
+ internalType: "address",
1284
+ name: "inputToken",
1285
+ type: "address"
1286
+ },
1287
+ {
1288
+ indexed: false,
1289
+ internalType: "address",
1290
+ name: "outputToken",
1291
+ type: "address"
1292
+ },
1293
+ {
1294
+ indexed: false,
1295
+ internalType: "uint256",
1296
+ name: "inputAmount",
1297
+ type: "uint256"
1298
+ },
1299
+ {
1300
+ indexed: false,
1301
+ internalType: "uint256",
1302
+ name: "outputAmount",
1303
+ type: "uint256"
1304
+ },
1305
+ {
1306
+ indexed: false,
1307
+ internalType: "uint256",
1308
+ name: "repaymentChainId",
1309
+ type: "uint256"
1310
+ },
1311
+ {
1312
+ indexed: true,
1313
+ internalType: "uint256",
1314
+ name: "originChainId",
1315
+ type: "uint256"
1316
+ },
1317
+ {
1318
+ indexed: true,
1319
+ internalType: "uint32",
1320
+ name: "depositId",
1321
+ type: "uint32"
1322
+ },
1323
+ {
1324
+ indexed: false,
1325
+ internalType: "uint32",
1326
+ name: "fillDeadline",
1327
+ type: "uint32"
1328
+ },
1329
+ {
1330
+ indexed: false,
1331
+ internalType: "uint32",
1332
+ name: "exclusivityDeadline",
1333
+ type: "uint32"
1334
+ },
1335
+ {
1336
+ indexed: false,
1337
+ internalType: "address",
1338
+ name: "exclusiveRelayer",
1339
+ type: "address"
1340
+ },
1341
+ {
1342
+ indexed: true,
1343
+ internalType: "address",
1344
+ name: "relayer",
1345
+ type: "address"
1346
+ },
1347
+ {
1348
+ indexed: false,
1349
+ internalType: "address",
1350
+ name: "depositor",
1351
+ type: "address"
1352
+ },
1353
+ {
1354
+ indexed: false,
1355
+ internalType: "address",
1356
+ name: "recipient",
1357
+ type: "address"
1358
+ },
1359
+ { indexed: false, internalType: "bytes", name: "message", type: "bytes" },
1360
+ {
1361
+ components: [
1362
+ {
1363
+ internalType: "address",
1364
+ name: "updatedRecipient",
1365
+ type: "address"
1366
+ },
1367
+ { internalType: "bytes", name: "updatedMessage", type: "bytes" },
1368
+ {
1369
+ internalType: "uint256",
1370
+ name: "updatedOutputAmount",
1371
+ type: "uint256"
1372
+ },
1373
+ {
1374
+ internalType: "enum V3SpokePoolInterface.FillType",
1375
+ name: "fillType",
1376
+ type: "uint8"
1377
+ }
1378
+ ],
1379
+ indexed: false,
1380
+ internalType: "struct V3SpokePoolInterface.LegacyV3RelayExecutionEventInfo",
1381
+ name: "relayExecutionInfo",
1382
+ type: "tuple"
1383
+ }
1384
+ ],
1385
+ name: "FilledV3Relay",
1386
+ type: "event"
1387
+ },
1388
+ {
1389
+ anonymous: false,
1390
+ inputs: [
1391
+ {
1392
+ indexed: false,
1393
+ internalType: "bytes32",
1394
+ name: "inputToken",
1395
+ type: "bytes32"
1396
+ },
1397
+ {
1398
+ indexed: false,
1399
+ internalType: "bytes32",
1400
+ name: "outputToken",
1401
+ type: "bytes32"
1402
+ },
1403
+ {
1404
+ indexed: false,
1405
+ internalType: "uint256",
1406
+ name: "inputAmount",
1407
+ type: "uint256"
1408
+ },
1409
+ {
1410
+ indexed: false,
1411
+ internalType: "uint256",
1412
+ name: "outputAmount",
1413
+ type: "uint256"
1414
+ },
1415
+ {
1416
+ indexed: true,
1417
+ internalType: "uint256",
1418
+ name: "destinationChainId",
1419
+ type: "uint256"
1420
+ },
1421
+ {
1422
+ indexed: true,
1423
+ internalType: "uint256",
1424
+ name: "depositId",
1425
+ type: "uint256"
1426
+ },
1427
+ {
1428
+ indexed: false,
1429
+ internalType: "uint32",
1430
+ name: "quoteTimestamp",
1431
+ type: "uint32"
1432
+ },
1433
+ {
1434
+ indexed: false,
1435
+ internalType: "uint32",
1436
+ name: "fillDeadline",
1437
+ type: "uint32"
1438
+ },
1439
+ {
1440
+ indexed: false,
1441
+ internalType: "uint32",
1442
+ name: "exclusivityDeadline",
1443
+ type: "uint32"
1444
+ },
1445
+ {
1446
+ indexed: true,
1447
+ internalType: "bytes32",
1448
+ name: "depositor",
1449
+ type: "bytes32"
1450
+ },
1451
+ {
1452
+ indexed: false,
1453
+ internalType: "bytes32",
1454
+ name: "recipient",
1455
+ type: "bytes32"
1456
+ },
1457
+ {
1458
+ indexed: false,
1459
+ internalType: "bytes32",
1460
+ name: "exclusiveRelayer",
1461
+ type: "bytes32"
1462
+ },
1463
+ { indexed: false, internalType: "bytes", name: "message", type: "bytes" }
1464
+ ],
1465
+ name: "FundsDeposited",
1466
+ type: "event"
1467
+ },
1468
+ {
1469
+ anonymous: false,
1470
+ inputs: [{ indexed: false, internalType: "uint8", name: "version", type: "uint8" }],
1471
+ name: "Initialized",
1472
+ type: "event"
1473
+ },
1474
+ {
1475
+ anonymous: false,
1476
+ inputs: [
1477
+ {
1478
+ indexed: true,
1479
+ internalType: "address",
1480
+ name: "previousOwner",
1481
+ type: "address"
1482
+ },
1483
+ {
1484
+ indexed: true,
1485
+ internalType: "address",
1486
+ name: "newOwner",
1487
+ type: "address"
1488
+ }
1489
+ ],
1490
+ name: "OwnershipTransferred",
1491
+ type: "event"
1492
+ },
1493
+ {
1494
+ anonymous: false,
1495
+ inputs: [{ indexed: false, internalType: "bool", name: "isPaused", type: "bool" }],
1496
+ name: "PausedDeposits",
1497
+ type: "event"
1498
+ },
1499
+ {
1500
+ anonymous: false,
1501
+ inputs: [{ indexed: false, internalType: "bool", name: "isPaused", type: "bool" }],
1502
+ name: "PausedFills",
1503
+ type: "event"
1504
+ },
1505
+ {
1506
+ anonymous: false,
1507
+ inputs: [
1508
+ {
1509
+ indexed: true,
1510
+ internalType: "uint32",
1511
+ name: "rootBundleId",
1512
+ type: "uint32"
1513
+ },
1514
+ {
1515
+ indexed: true,
1516
+ internalType: "bytes32",
1517
+ name: "relayerRefundRoot",
1518
+ type: "bytes32"
1519
+ },
1520
+ {
1521
+ indexed: true,
1522
+ internalType: "bytes32",
1523
+ name: "slowRelayRoot",
1524
+ type: "bytes32"
1525
+ }
1526
+ ],
1527
+ name: "RelayedRootBundle",
1528
+ type: "event"
1529
+ },
1530
+ {
1531
+ anonymous: false,
1532
+ inputs: [
1533
+ {
1534
+ indexed: false,
1535
+ internalType: "bytes32",
1536
+ name: "inputToken",
1537
+ type: "bytes32"
1538
+ },
1539
+ {
1540
+ indexed: false,
1541
+ internalType: "bytes32",
1542
+ name: "outputToken",
1543
+ type: "bytes32"
1544
+ },
1545
+ {
1546
+ indexed: false,
1547
+ internalType: "uint256",
1548
+ name: "inputAmount",
1549
+ type: "uint256"
1550
+ },
1551
+ {
1552
+ indexed: false,
1553
+ internalType: "uint256",
1554
+ name: "outputAmount",
1555
+ type: "uint256"
1556
+ },
1557
+ {
1558
+ indexed: true,
1559
+ internalType: "uint256",
1560
+ name: "originChainId",
1561
+ type: "uint256"
1562
+ },
1563
+ {
1564
+ indexed: true,
1565
+ internalType: "uint256",
1566
+ name: "depositId",
1567
+ type: "uint256"
1568
+ },
1569
+ {
1570
+ indexed: false,
1571
+ internalType: "uint32",
1572
+ name: "fillDeadline",
1573
+ type: "uint32"
1574
+ },
1575
+ {
1576
+ indexed: false,
1577
+ internalType: "uint32",
1578
+ name: "exclusivityDeadline",
1579
+ type: "uint32"
1580
+ },
1581
+ {
1582
+ indexed: false,
1583
+ internalType: "bytes32",
1584
+ name: "exclusiveRelayer",
1585
+ type: "bytes32"
1586
+ },
1587
+ {
1588
+ indexed: false,
1589
+ internalType: "bytes32",
1590
+ name: "depositor",
1591
+ type: "bytes32"
1592
+ },
1593
+ {
1594
+ indexed: false,
1595
+ internalType: "bytes32",
1596
+ name: "recipient",
1597
+ type: "bytes32"
1598
+ },
1599
+ {
1600
+ indexed: false,
1601
+ internalType: "bytes32",
1602
+ name: "messageHash",
1603
+ type: "bytes32"
1604
+ }
1605
+ ],
1606
+ name: "RequestedSlowFill",
1607
+ type: "event"
1608
+ },
1609
+ {
1610
+ anonymous: false,
1611
+ inputs: [
1612
+ {
1613
+ indexed: false,
1614
+ internalType: "uint256",
1615
+ name: "updatedOutputAmount",
1616
+ type: "uint256"
1617
+ },
1618
+ {
1619
+ indexed: true,
1620
+ internalType: "uint256",
1621
+ name: "depositId",
1622
+ type: "uint256"
1623
+ },
1624
+ {
1625
+ indexed: true,
1626
+ internalType: "bytes32",
1627
+ name: "depositor",
1628
+ type: "bytes32"
1629
+ },
1630
+ {
1631
+ indexed: false,
1632
+ internalType: "bytes32",
1633
+ name: "updatedRecipient",
1634
+ type: "bytes32"
1635
+ },
1636
+ {
1637
+ indexed: false,
1638
+ internalType: "bytes",
1639
+ name: "updatedMessage",
1640
+ type: "bytes"
1641
+ },
1642
+ {
1643
+ indexed: false,
1644
+ internalType: "bytes",
1645
+ name: "depositorSignature",
1646
+ type: "bytes"
1647
+ }
1648
+ ],
1649
+ name: "RequestedSpeedUpDeposit",
1650
+ type: "event"
1651
+ },
1652
+ {
1653
+ anonymous: false,
1654
+ inputs: [
1655
+ {
1656
+ indexed: false,
1657
+ internalType: "uint256",
1658
+ name: "updatedOutputAmount",
1659
+ type: "uint256"
1660
+ },
1661
+ {
1662
+ indexed: true,
1663
+ internalType: "uint32",
1664
+ name: "depositId",
1665
+ type: "uint32"
1666
+ },
1667
+ {
1668
+ indexed: true,
1669
+ internalType: "address",
1670
+ name: "depositor",
1671
+ type: "address"
1672
+ },
1673
+ {
1674
+ indexed: false,
1675
+ internalType: "address",
1676
+ name: "updatedRecipient",
1677
+ type: "address"
1678
+ },
1679
+ {
1680
+ indexed: false,
1681
+ internalType: "bytes",
1682
+ name: "updatedMessage",
1683
+ type: "bytes"
1684
+ },
1685
+ {
1686
+ indexed: false,
1687
+ internalType: "bytes",
1688
+ name: "depositorSignature",
1689
+ type: "bytes"
1690
+ }
1691
+ ],
1692
+ name: "RequestedSpeedUpV3Deposit",
1693
+ type: "event"
1694
+ },
1695
+ {
1696
+ anonymous: false,
1697
+ inputs: [
1698
+ {
1699
+ indexed: false,
1700
+ internalType: "address",
1701
+ name: "inputToken",
1702
+ type: "address"
1703
+ },
1704
+ {
1705
+ indexed: false,
1706
+ internalType: "address",
1707
+ name: "outputToken",
1708
+ type: "address"
1709
+ },
1710
+ {
1711
+ indexed: false,
1712
+ internalType: "uint256",
1713
+ name: "inputAmount",
1714
+ type: "uint256"
1715
+ },
1716
+ {
1717
+ indexed: false,
1718
+ internalType: "uint256",
1719
+ name: "outputAmount",
1720
+ type: "uint256"
1721
+ },
1722
+ {
1723
+ indexed: true,
1724
+ internalType: "uint256",
1725
+ name: "originChainId",
1726
+ type: "uint256"
1727
+ },
1728
+ {
1729
+ indexed: true,
1730
+ internalType: "uint32",
1731
+ name: "depositId",
1732
+ type: "uint32"
1733
+ },
1734
+ {
1735
+ indexed: false,
1736
+ internalType: "uint32",
1737
+ name: "fillDeadline",
1738
+ type: "uint32"
1739
+ },
1740
+ {
1741
+ indexed: false,
1742
+ internalType: "uint32",
1743
+ name: "exclusivityDeadline",
1744
+ type: "uint32"
1745
+ },
1746
+ {
1747
+ indexed: false,
1748
+ internalType: "address",
1749
+ name: "exclusiveRelayer",
1750
+ type: "address"
1751
+ },
1752
+ {
1753
+ indexed: false,
1754
+ internalType: "address",
1755
+ name: "depositor",
1756
+ type: "address"
1757
+ },
1758
+ {
1759
+ indexed: false,
1760
+ internalType: "address",
1761
+ name: "recipient",
1762
+ type: "address"
1763
+ },
1764
+ { indexed: false, internalType: "bytes", name: "message", type: "bytes" }
1765
+ ],
1766
+ name: "RequestedV3SlowFill",
1767
+ type: "event"
1768
+ },
1769
+ {
1770
+ anonymous: false,
1771
+ inputs: [
1772
+ {
1773
+ indexed: true,
1774
+ internalType: "address",
1775
+ name: "newWithdrawalRecipient",
1776
+ type: "address"
1777
+ }
1778
+ ],
1779
+ name: "SetWithdrawalRecipient",
1780
+ type: "event"
1781
+ },
1782
+ {
1783
+ anonymous: false,
1784
+ inputs: [
1785
+ {
1786
+ indexed: true,
1787
+ internalType: "address",
1788
+ name: "newAdmin",
1789
+ type: "address"
1790
+ }
1791
+ ],
1792
+ name: "SetXDomainAdmin",
1793
+ type: "event"
1794
+ },
1795
+ {
1796
+ anonymous: false,
1797
+ inputs: [
1798
+ {
1799
+ indexed: false,
1800
+ internalType: "uint256",
1801
+ name: "amountToReturn",
1802
+ type: "uint256"
1803
+ },
1804
+ {
1805
+ indexed: true,
1806
+ internalType: "uint256",
1807
+ name: "chainId",
1808
+ type: "uint256"
1809
+ },
1810
+ { indexed: true, internalType: "uint32", name: "leafId", type: "uint32" },
1811
+ {
1812
+ indexed: true,
1813
+ internalType: "bytes32",
1814
+ name: "l2TokenAddress",
1815
+ type: "bytes32"
1816
+ },
1817
+ {
1818
+ indexed: false,
1819
+ internalType: "address",
1820
+ name: "caller",
1821
+ type: "address"
1822
+ }
1823
+ ],
1824
+ name: "TokensBridged",
1825
+ type: "event"
1826
+ },
1827
+ {
1828
+ anonymous: false,
1829
+ inputs: [
1830
+ {
1831
+ indexed: true,
1832
+ internalType: "address",
1833
+ name: "implementation",
1834
+ type: "address"
1835
+ }
1836
+ ],
1837
+ name: "Upgraded",
1838
+ type: "event"
1839
+ },
1840
+ {
1841
+ anonymous: false,
1842
+ inputs: [
1843
+ {
1844
+ indexed: false,
1845
+ internalType: "address",
1846
+ name: "inputToken",
1847
+ type: "address"
1848
+ },
1849
+ {
1850
+ indexed: false,
1851
+ internalType: "address",
1852
+ name: "outputToken",
1853
+ type: "address"
1854
+ },
1855
+ {
1856
+ indexed: false,
1857
+ internalType: "uint256",
1858
+ name: "inputAmount",
1859
+ type: "uint256"
1860
+ },
1861
+ {
1862
+ indexed: false,
1863
+ internalType: "uint256",
1864
+ name: "outputAmount",
1865
+ type: "uint256"
1866
+ },
1867
+ {
1868
+ indexed: true,
1869
+ internalType: "uint256",
1870
+ name: "destinationChainId",
1871
+ type: "uint256"
1872
+ },
1873
+ {
1874
+ indexed: true,
1875
+ internalType: "uint32",
1876
+ name: "depositId",
1877
+ type: "uint32"
1878
+ },
1879
+ {
1880
+ indexed: false,
1881
+ internalType: "uint32",
1882
+ name: "quoteTimestamp",
1883
+ type: "uint32"
1884
+ },
1885
+ {
1886
+ indexed: false,
1887
+ internalType: "uint32",
1888
+ name: "fillDeadline",
1889
+ type: "uint32"
1890
+ },
1891
+ {
1892
+ indexed: false,
1893
+ internalType: "uint32",
1894
+ name: "exclusivityDeadline",
1895
+ type: "uint32"
1896
+ },
1897
+ {
1898
+ indexed: true,
1899
+ internalType: "address",
1900
+ name: "depositor",
1901
+ type: "address"
1902
+ },
1903
+ {
1904
+ indexed: false,
1905
+ internalType: "address",
1906
+ name: "recipient",
1907
+ type: "address"
1908
+ },
1909
+ {
1910
+ indexed: false,
1911
+ internalType: "address",
1912
+ name: "exclusiveRelayer",
1913
+ type: "address"
1914
+ },
1915
+ { indexed: false, internalType: "bytes", name: "message", type: "bytes" }
1916
+ ],
1917
+ name: "V3FundsDeposited",
1918
+ type: "event"
1919
+ },
1920
+ {
1921
+ inputs: [],
1922
+ name: "EMPTY_RELAYER",
1923
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
1924
+ stateMutability: "view",
1925
+ type: "function"
1926
+ },
1927
+ {
1928
+ inputs: [],
1929
+ name: "EMPTY_REPAYMENT_CHAIN_ID",
1930
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1931
+ stateMutability: "view",
1932
+ type: "function"
1933
+ },
1934
+ {
1935
+ inputs: [],
1936
+ name: "INFINITE_FILL_DEADLINE",
1937
+ outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
1938
+ stateMutability: "view",
1939
+ type: "function"
1940
+ },
1941
+ {
1942
+ inputs: [],
1943
+ name: "MAX_EXCLUSIVITY_PERIOD_SECONDS",
1944
+ outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
1945
+ stateMutability: "view",
1946
+ type: "function"
1947
+ },
1948
+ {
1949
+ inputs: [],
1950
+ name: "MAX_TRANSFER_SIZE",
1951
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1952
+ stateMutability: "view",
1953
+ type: "function"
1954
+ },
1955
+ {
1956
+ inputs: [],
1957
+ name: "UPDATE_ADDRESS_DEPOSIT_DETAILS_HASH",
1958
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
1959
+ stateMutability: "view",
1960
+ type: "function"
1961
+ },
1962
+ {
1963
+ inputs: [],
1964
+ name: "UPDATE_BYTES32_DEPOSIT_DETAILS_HASH",
1965
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
1966
+ stateMutability: "view",
1967
+ type: "function"
1968
+ },
1969
+ {
1970
+ inputs: [
1971
+ { internalType: "uint32", name: "_initialDepositId", type: "uint32" },
1972
+ { internalType: "address", name: "_crossDomainAdmin", type: "address" },
1973
+ {
1974
+ internalType: "address",
1975
+ name: "_withdrawalRecipient",
1976
+ type: "address"
1977
+ }
1978
+ ],
1979
+ name: "__SpokePool_init",
1980
+ outputs: [],
1981
+ stateMutability: "nonpayable",
1982
+ type: "function"
1983
+ },
1984
+ {
1985
+ inputs: [],
1986
+ name: "chainId",
1987
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1988
+ stateMutability: "view",
1989
+ type: "function"
1990
+ },
1991
+ {
1992
+ inputs: [
1993
+ { internalType: "bytes32", name: "l2TokenAddress", type: "bytes32" },
1994
+ { internalType: "bytes32", name: "refundAddress", type: "bytes32" }
1995
+ ],
1996
+ name: "claimRelayerRefund",
1997
+ outputs: [],
1998
+ stateMutability: "nonpayable",
1999
+ type: "function"
2000
+ },
2001
+ {
2002
+ inputs: [],
2003
+ name: "crossDomainAdmin",
2004
+ outputs: [{ internalType: "address", name: "", type: "address" }],
2005
+ stateMutability: "view",
2006
+ type: "function"
2007
+ },
2008
+ {
2009
+ inputs: [
2010
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2011
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2012
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2013
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2014
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2015
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2016
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2017
+ { internalType: "bytes32", name: "exclusiveRelayer", type: "bytes32" },
2018
+ { internalType: "uint32", name: "quoteTimestamp", type: "uint32" },
2019
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2020
+ { internalType: "uint32", name: "exclusivityParameter", type: "uint32" },
2021
+ { internalType: "bytes", name: "message", type: "bytes" }
2022
+ ],
2023
+ name: "deposit",
2024
+ outputs: [],
2025
+ stateMutability: "payable",
2026
+ type: "function"
2027
+ },
2028
+ {
2029
+ inputs: [
2030
+ { internalType: "address", name: "recipient", type: "address" },
2031
+ { internalType: "address", name: "originToken", type: "address" },
2032
+ { internalType: "uint256", name: "amount", type: "uint256" },
2033
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2034
+ { internalType: "int64", name: "relayerFeePct", type: "int64" },
2035
+ { internalType: "uint32", name: "quoteTimestamp", type: "uint32" },
2036
+ { internalType: "bytes", name: "message", type: "bytes" },
2037
+ { internalType: "uint256", name: "", type: "uint256" }
2038
+ ],
2039
+ name: "depositDeprecated_5947912356",
2040
+ outputs: [],
2041
+ stateMutability: "payable",
2042
+ type: "function"
2043
+ },
2044
+ {
2045
+ inputs: [
2046
+ { internalType: "address", name: "depositor", type: "address" },
2047
+ { internalType: "address", name: "recipient", type: "address" },
2048
+ { internalType: "address", name: "originToken", type: "address" },
2049
+ { internalType: "uint256", name: "amount", type: "uint256" },
2050
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2051
+ { internalType: "int64", name: "relayerFeePct", type: "int64" },
2052
+ { internalType: "uint32", name: "quoteTimestamp", type: "uint32" },
2053
+ { internalType: "bytes", name: "message", type: "bytes" },
2054
+ { internalType: "uint256", name: "", type: "uint256" }
2055
+ ],
2056
+ name: "depositFor",
2057
+ outputs: [],
2058
+ stateMutability: "payable",
2059
+ type: "function"
2060
+ },
2061
+ {
2062
+ inputs: [
2063
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2064
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2065
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2066
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2067
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2068
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2069
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2070
+ { internalType: "bytes32", name: "exclusiveRelayer", type: "bytes32" },
2071
+ { internalType: "uint32", name: "fillDeadlineOffset", type: "uint32" },
2072
+ { internalType: "uint32", name: "exclusivityParameter", type: "uint32" },
2073
+ { internalType: "bytes", name: "message", type: "bytes" }
2074
+ ],
2075
+ name: "depositNow",
2076
+ outputs: [],
2077
+ stateMutability: "payable",
2078
+ type: "function"
2079
+ },
2080
+ {
2081
+ inputs: [],
2082
+ name: "depositQuoteTimeBuffer",
2083
+ outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
2084
+ stateMutability: "view",
2085
+ type: "function"
2086
+ },
2087
+ {
2088
+ inputs: [
2089
+ { internalType: "address", name: "depositor", type: "address" },
2090
+ { internalType: "address", name: "recipient", type: "address" },
2091
+ { internalType: "address", name: "inputToken", type: "address" },
2092
+ { internalType: "address", name: "outputToken", type: "address" },
2093
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2094
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2095
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2096
+ { internalType: "address", name: "exclusiveRelayer", type: "address" },
2097
+ { internalType: "uint32", name: "quoteTimestamp", type: "uint32" },
2098
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2099
+ { internalType: "uint32", name: "exclusivityParameter", type: "uint32" },
2100
+ { internalType: "bytes", name: "message", type: "bytes" }
2101
+ ],
2102
+ name: "depositV3",
2103
+ outputs: [],
2104
+ stateMutability: "payable",
2105
+ type: "function"
2106
+ },
2107
+ {
2108
+ inputs: [
2109
+ { internalType: "address", name: "depositor", type: "address" },
2110
+ { internalType: "address", name: "recipient", type: "address" },
2111
+ { internalType: "address", name: "inputToken", type: "address" },
2112
+ { internalType: "address", name: "outputToken", type: "address" },
2113
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2114
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2115
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2116
+ { internalType: "address", name: "exclusiveRelayer", type: "address" },
2117
+ { internalType: "uint32", name: "fillDeadlineOffset", type: "uint32" },
2118
+ { internalType: "uint32", name: "exclusivityParameter", type: "uint32" },
2119
+ { internalType: "bytes", name: "message", type: "bytes" }
2120
+ ],
2121
+ name: "depositV3Now",
2122
+ outputs: [],
2123
+ stateMutability: "payable",
2124
+ type: "function"
2125
+ },
2126
+ {
2127
+ inputs: [{ internalType: "uint256", name: "rootBundleId", type: "uint256" }],
2128
+ name: "emergencyDeleteRootBundle",
2129
+ outputs: [],
2130
+ stateMutability: "nonpayable",
2131
+ type: "function"
2132
+ },
2133
+ {
2134
+ inputs: [
2135
+ { internalType: "address", name: "", type: "address" },
2136
+ { internalType: "uint256", name: "", type: "uint256" }
2137
+ ],
2138
+ name: "enabledDepositRoutes",
2139
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2140
+ stateMutability: "view",
2141
+ type: "function"
2142
+ },
2143
+ {
2144
+ inputs: [
2145
+ { internalType: "uint32", name: "rootBundleId", type: "uint32" },
2146
+ {
2147
+ components: [
2148
+ { internalType: "uint256", name: "amountToReturn", type: "uint256" },
2149
+ { internalType: "uint256", name: "chainId", type: "uint256" },
2150
+ {
2151
+ internalType: "uint256[]",
2152
+ name: "refundAmounts",
2153
+ type: "uint256[]"
2154
+ },
2155
+ { internalType: "uint32", name: "leafId", type: "uint32" },
2156
+ { internalType: "address", name: "l2TokenAddress", type: "address" },
2157
+ {
2158
+ internalType: "address[]",
2159
+ name: "refundAddresses",
2160
+ type: "address[]"
2161
+ }
2162
+ ],
2163
+ internalType: "struct SpokePoolInterface.RelayerRefundLeaf",
2164
+ name: "relayerRefundLeaf",
2165
+ type: "tuple"
2166
+ },
2167
+ { internalType: "bytes32[]", name: "proof", type: "bytes32[]" }
2168
+ ],
2169
+ name: "executeRelayerRefundLeaf",
2170
+ outputs: [],
2171
+ stateMutability: "payable",
2172
+ type: "function"
2173
+ },
2174
+ {
2175
+ inputs: [
2176
+ {
2177
+ components: [
2178
+ {
2179
+ components: [
2180
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2181
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2182
+ {
2183
+ internalType: "bytes32",
2184
+ name: "exclusiveRelayer",
2185
+ type: "bytes32"
2186
+ },
2187
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2188
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2189
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2190
+ {
2191
+ internalType: "uint256",
2192
+ name: "outputAmount",
2193
+ type: "uint256"
2194
+ },
2195
+ {
2196
+ internalType: "uint256",
2197
+ name: "originChainId",
2198
+ type: "uint256"
2199
+ },
2200
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2201
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2202
+ {
2203
+ internalType: "uint32",
2204
+ name: "exclusivityDeadline",
2205
+ type: "uint32"
2206
+ },
2207
+ { internalType: "bytes", name: "message", type: "bytes" }
2208
+ ],
2209
+ internalType: "struct V3SpokePoolInterface.V3RelayData",
2210
+ name: "relayData",
2211
+ type: "tuple"
2212
+ },
2213
+ { internalType: "uint256", name: "chainId", type: "uint256" },
2214
+ {
2215
+ internalType: "uint256",
2216
+ name: "updatedOutputAmount",
2217
+ type: "uint256"
2218
+ }
2219
+ ],
2220
+ internalType: "struct V3SpokePoolInterface.V3SlowFill",
2221
+ name: "slowFillLeaf",
2222
+ type: "tuple"
2223
+ },
2224
+ { internalType: "uint32", name: "rootBundleId", type: "uint32" },
2225
+ { internalType: "bytes32[]", name: "proof", type: "bytes32[]" }
2226
+ ],
2227
+ name: "executeSlowRelayLeaf",
2228
+ outputs: [],
2229
+ stateMutability: "nonpayable",
2230
+ type: "function"
2231
+ },
2232
+ {
2233
+ inputs: [
2234
+ { internalType: "bytes32", name: "orderId", type: "bytes32" },
2235
+ { internalType: "bytes", name: "originData", type: "bytes" },
2236
+ { internalType: "bytes", name: "fillerData", type: "bytes" }
2237
+ ],
2238
+ name: "fill",
2239
+ outputs: [],
2240
+ stateMutability: "nonpayable",
2241
+ type: "function"
2242
+ },
2243
+ {
2244
+ inputs: [],
2245
+ name: "fillDeadlineBuffer",
2246
+ outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
2247
+ stateMutability: "view",
2248
+ type: "function"
2249
+ },
2250
+ {
2251
+ inputs: [
2252
+ {
2253
+ components: [
2254
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2255
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2256
+ {
2257
+ internalType: "bytes32",
2258
+ name: "exclusiveRelayer",
2259
+ type: "bytes32"
2260
+ },
2261
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2262
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2263
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2264
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2265
+ { internalType: "uint256", name: "originChainId", type: "uint256" },
2266
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2267
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2268
+ {
2269
+ internalType: "uint32",
2270
+ name: "exclusivityDeadline",
2271
+ type: "uint32"
2272
+ },
2273
+ { internalType: "bytes", name: "message", type: "bytes" }
2274
+ ],
2275
+ internalType: "struct V3SpokePoolInterface.V3RelayData",
2276
+ name: "relayData",
2277
+ type: "tuple"
2278
+ },
2279
+ { internalType: "uint256", name: "repaymentChainId", type: "uint256" },
2280
+ { internalType: "bytes32", name: "repaymentAddress", type: "bytes32" }
2281
+ ],
2282
+ name: "fillRelay",
2283
+ outputs: [],
2284
+ stateMutability: "nonpayable",
2285
+ type: "function"
2286
+ },
2287
+ {
2288
+ inputs: [
2289
+ {
2290
+ components: [
2291
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2292
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2293
+ {
2294
+ internalType: "bytes32",
2295
+ name: "exclusiveRelayer",
2296
+ type: "bytes32"
2297
+ },
2298
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2299
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2300
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2301
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2302
+ { internalType: "uint256", name: "originChainId", type: "uint256" },
2303
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2304
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2305
+ {
2306
+ internalType: "uint32",
2307
+ name: "exclusivityDeadline",
2308
+ type: "uint32"
2309
+ },
2310
+ { internalType: "bytes", name: "message", type: "bytes" }
2311
+ ],
2312
+ internalType: "struct V3SpokePoolInterface.V3RelayData",
2313
+ name: "relayData",
2314
+ type: "tuple"
2315
+ },
2316
+ { internalType: "uint256", name: "repaymentChainId", type: "uint256" },
2317
+ { internalType: "bytes32", name: "repaymentAddress", type: "bytes32" },
2318
+ { internalType: "uint256", name: "updatedOutputAmount", type: "uint256" },
2319
+ { internalType: "bytes32", name: "updatedRecipient", type: "bytes32" },
2320
+ { internalType: "bytes", name: "updatedMessage", type: "bytes" },
2321
+ { internalType: "bytes", name: "depositorSignature", type: "bytes" }
2322
+ ],
2323
+ name: "fillRelayWithUpdatedDeposit",
2324
+ outputs: [],
2325
+ stateMutability: "nonpayable",
2326
+ type: "function"
2327
+ },
2328
+ {
2329
+ inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
2330
+ name: "fillStatuses",
2331
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2332
+ stateMutability: "view",
2333
+ type: "function"
2334
+ },
2335
+ {
2336
+ inputs: [
2337
+ {
2338
+ components: [
2339
+ { internalType: "address", name: "depositor", type: "address" },
2340
+ { internalType: "address", name: "recipient", type: "address" },
2341
+ {
2342
+ internalType: "address",
2343
+ name: "exclusiveRelayer",
2344
+ type: "address"
2345
+ },
2346
+ { internalType: "address", name: "inputToken", type: "address" },
2347
+ { internalType: "address", name: "outputToken", type: "address" },
2348
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2349
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2350
+ { internalType: "uint256", name: "originChainId", type: "uint256" },
2351
+ { internalType: "uint32", name: "depositId", type: "uint32" },
2352
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2353
+ {
2354
+ internalType: "uint32",
2355
+ name: "exclusivityDeadline",
2356
+ type: "uint32"
2357
+ },
2358
+ { internalType: "bytes", name: "message", type: "bytes" }
2359
+ ],
2360
+ internalType: "struct V3SpokePoolInterface.V3RelayDataLegacy",
2361
+ name: "relayData",
2362
+ type: "tuple"
2363
+ },
2364
+ { internalType: "uint256", name: "repaymentChainId", type: "uint256" }
2365
+ ],
2366
+ name: "fillV3Relay",
2367
+ outputs: [],
2368
+ stateMutability: "nonpayable",
2369
+ type: "function"
2370
+ },
2371
+ {
2372
+ inputs: [],
2373
+ name: "getCurrentTime",
2374
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2375
+ stateMutability: "view",
2376
+ type: "function"
2377
+ },
2378
+ {
2379
+ inputs: [
2380
+ { internalType: "address", name: "l2TokenAddress", type: "address" },
2381
+ { internalType: "address", name: "refundAddress", type: "address" }
2382
+ ],
2383
+ name: "getRelayerRefund",
2384
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2385
+ stateMutability: "view",
2386
+ type: "function"
2387
+ },
2388
+ {
2389
+ inputs: [
2390
+ { internalType: "address", name: "msgSender", type: "address" },
2391
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2392
+ { internalType: "uint256", name: "depositNonce", type: "uint256" }
2393
+ ],
2394
+ name: "getUnsafeDepositId",
2395
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2396
+ stateMutability: "pure",
2397
+ type: "function"
2398
+ },
2399
+ {
2400
+ inputs: [
2401
+ {
2402
+ components: [
2403
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2404
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2405
+ {
2406
+ internalType: "bytes32",
2407
+ name: "exclusiveRelayer",
2408
+ type: "bytes32"
2409
+ },
2410
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2411
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2412
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2413
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2414
+ { internalType: "uint256", name: "originChainId", type: "uint256" },
2415
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2416
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2417
+ {
2418
+ internalType: "uint32",
2419
+ name: "exclusivityDeadline",
2420
+ type: "uint32"
2421
+ },
2422
+ { internalType: "bytes", name: "message", type: "bytes" }
2423
+ ],
2424
+ internalType: "struct V3SpokePoolInterface.V3RelayData",
2425
+ name: "relayData",
2426
+ type: "tuple"
2427
+ }
2428
+ ],
2429
+ name: "getV3RelayHash",
2430
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
2431
+ stateMutability: "view",
2432
+ type: "function"
2433
+ },
2434
+ {
2435
+ inputs: [
2436
+ { internalType: "uint32", name: "_initialDepositId", type: "uint32" },
2437
+ {
2438
+ internalType: "address",
2439
+ name: "_withdrawalRecipient",
2440
+ type: "address"
2441
+ }
2442
+ ],
2443
+ name: "initialize",
2444
+ outputs: [],
2445
+ stateMutability: "nonpayable",
2446
+ type: "function"
2447
+ },
2448
+ {
2449
+ inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }],
2450
+ name: "multicall",
2451
+ outputs: [{ internalType: "bytes[]", name: "results", type: "bytes[]" }],
2452
+ stateMutability: "nonpayable",
2453
+ type: "function"
2454
+ },
2455
+ {
2456
+ inputs: [],
2457
+ name: "numberOfDeposits",
2458
+ outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
2459
+ stateMutability: "view",
2460
+ type: "function"
2461
+ },
2462
+ {
2463
+ inputs: [],
2464
+ name: "owner",
2465
+ outputs: [{ internalType: "address", name: "", type: "address" }],
2466
+ stateMutability: "view",
2467
+ type: "function"
2468
+ },
2469
+ {
2470
+ inputs: [{ internalType: "bool", name: "pause", type: "bool" }],
2471
+ name: "pauseDeposits",
2472
+ outputs: [],
2473
+ stateMutability: "nonpayable",
2474
+ type: "function"
2475
+ },
2476
+ {
2477
+ inputs: [{ internalType: "bool", name: "pause", type: "bool" }],
2478
+ name: "pauseFills",
2479
+ outputs: [],
2480
+ stateMutability: "nonpayable",
2481
+ type: "function"
2482
+ },
2483
+ {
2484
+ inputs: [],
2485
+ name: "pausedDeposits",
2486
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2487
+ stateMutability: "view",
2488
+ type: "function"
2489
+ },
2490
+ {
2491
+ inputs: [],
2492
+ name: "pausedFills",
2493
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2494
+ stateMutability: "view",
2495
+ type: "function"
2496
+ },
2497
+ {
2498
+ inputs: [],
2499
+ name: "proxiableUUID",
2500
+ outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
2501
+ stateMutability: "view",
2502
+ type: "function"
2503
+ },
2504
+ {
2505
+ inputs: [
2506
+ { internalType: "bytes32", name: "relayerRefundRoot", type: "bytes32" },
2507
+ { internalType: "bytes32", name: "slowRelayRoot", type: "bytes32" }
2508
+ ],
2509
+ name: "relayRootBundle",
2510
+ outputs: [],
2511
+ stateMutability: "nonpayable",
2512
+ type: "function"
2513
+ },
2514
+ {
2515
+ inputs: [
2516
+ { internalType: "address", name: "", type: "address" },
2517
+ { internalType: "address", name: "", type: "address" }
2518
+ ],
2519
+ name: "relayerRefund",
2520
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2521
+ stateMutability: "view",
2522
+ type: "function"
2523
+ },
2524
+ {
2525
+ inputs: [],
2526
+ name: "renounceOwnership",
2527
+ outputs: [],
2528
+ stateMutability: "nonpayable",
2529
+ type: "function"
2530
+ },
2531
+ {
2532
+ inputs: [
2533
+ {
2534
+ components: [
2535
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2536
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2537
+ {
2538
+ internalType: "bytes32",
2539
+ name: "exclusiveRelayer",
2540
+ type: "bytes32"
2541
+ },
2542
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2543
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2544
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2545
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2546
+ { internalType: "uint256", name: "originChainId", type: "uint256" },
2547
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2548
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2549
+ {
2550
+ internalType: "uint32",
2551
+ name: "exclusivityDeadline",
2552
+ type: "uint32"
2553
+ },
2554
+ { internalType: "bytes", name: "message", type: "bytes" }
2555
+ ],
2556
+ internalType: "struct V3SpokePoolInterface.V3RelayData",
2557
+ name: "relayData",
2558
+ type: "tuple"
2559
+ }
2560
+ ],
2561
+ name: "requestSlowFill",
2562
+ outputs: [],
2563
+ stateMutability: "nonpayable",
2564
+ type: "function"
2565
+ },
2566
+ {
2567
+ inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2568
+ name: "rootBundles",
2569
+ outputs: [
2570
+ { internalType: "bytes32", name: "slowRelayRoot", type: "bytes32" },
2571
+ { internalType: "bytes32", name: "relayerRefundRoot", type: "bytes32" }
2572
+ ],
2573
+ stateMutability: "view",
2574
+ type: "function"
2575
+ },
2576
+ {
2577
+ inputs: [{ internalType: "address", name: "newCrossDomainAdmin", type: "address" }],
2578
+ name: "setCrossDomainAdmin",
2579
+ outputs: [],
2580
+ stateMutability: "nonpayable",
2581
+ type: "function"
2582
+ },
2583
+ {
2584
+ inputs: [
2585
+ { internalType: "address", name: "originToken", type: "address" },
2586
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2587
+ { internalType: "bool", name: "enabled", type: "bool" }
2588
+ ],
2589
+ name: "setEnableRoute",
2590
+ outputs: [],
2591
+ stateMutability: "nonpayable",
2592
+ type: "function"
2593
+ },
2594
+ {
2595
+ inputs: [
2596
+ {
2597
+ internalType: "address",
2598
+ name: "newWithdrawalRecipient",
2599
+ type: "address"
2600
+ }
2601
+ ],
2602
+ name: "setWithdrawalRecipient",
2603
+ outputs: [],
2604
+ stateMutability: "nonpayable",
2605
+ type: "function"
2606
+ },
2607
+ {
2608
+ inputs: [
2609
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2610
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2611
+ { internalType: "uint256", name: "updatedOutputAmount", type: "uint256" },
2612
+ { internalType: "bytes32", name: "updatedRecipient", type: "bytes32" },
2613
+ { internalType: "bytes", name: "updatedMessage", type: "bytes" },
2614
+ { internalType: "bytes", name: "depositorSignature", type: "bytes" }
2615
+ ],
2616
+ name: "speedUpDeposit",
2617
+ outputs: [],
2618
+ stateMutability: "nonpayable",
2619
+ type: "function"
2620
+ },
2621
+ {
2622
+ inputs: [
2623
+ { internalType: "address", name: "depositor", type: "address" },
2624
+ { internalType: "uint256", name: "depositId", type: "uint256" },
2625
+ { internalType: "uint256", name: "updatedOutputAmount", type: "uint256" },
2626
+ { internalType: "address", name: "updatedRecipient", type: "address" },
2627
+ { internalType: "bytes", name: "updatedMessage", type: "bytes" },
2628
+ { internalType: "bytes", name: "depositorSignature", type: "bytes" }
2629
+ ],
2630
+ name: "speedUpV3Deposit",
2631
+ outputs: [],
2632
+ stateMutability: "nonpayable",
2633
+ type: "function"
2634
+ },
2635
+ {
2636
+ inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
2637
+ name: "transferOwnership",
2638
+ outputs: [],
2639
+ stateMutability: "nonpayable",
2640
+ type: "function"
2641
+ },
2642
+ {
2643
+ inputs: [{ internalType: "bytes[]", name: "data", type: "bytes[]" }],
2644
+ name: "tryMulticall",
2645
+ outputs: [
2646
+ {
2647
+ components: [
2648
+ { internalType: "bool", name: "success", type: "bool" },
2649
+ { internalType: "bytes", name: "returnData", type: "bytes" }
2650
+ ],
2651
+ internalType: "struct MultiCallerUpgradeable.Result[]",
2652
+ name: "results",
2653
+ type: "tuple[]"
2654
+ }
2655
+ ],
2656
+ stateMutability: "nonpayable",
2657
+ type: "function"
2658
+ },
2659
+ {
2660
+ inputs: [
2661
+ { internalType: "bytes32", name: "depositor", type: "bytes32" },
2662
+ { internalType: "bytes32", name: "recipient", type: "bytes32" },
2663
+ { internalType: "bytes32", name: "inputToken", type: "bytes32" },
2664
+ { internalType: "bytes32", name: "outputToken", type: "bytes32" },
2665
+ { internalType: "uint256", name: "inputAmount", type: "uint256" },
2666
+ { internalType: "uint256", name: "outputAmount", type: "uint256" },
2667
+ { internalType: "uint256", name: "destinationChainId", type: "uint256" },
2668
+ { internalType: "bytes32", name: "exclusiveRelayer", type: "bytes32" },
2669
+ { internalType: "uint256", name: "depositNonce", type: "uint256" },
2670
+ { internalType: "uint32", name: "quoteTimestamp", type: "uint32" },
2671
+ { internalType: "uint32", name: "fillDeadline", type: "uint32" },
2672
+ { internalType: "uint32", name: "exclusivityParameter", type: "uint32" },
2673
+ { internalType: "bytes", name: "message", type: "bytes" }
2674
+ ],
2675
+ name: "unsafeDeposit",
2676
+ outputs: [],
2677
+ stateMutability: "payable",
2678
+ type: "function"
2679
+ },
2680
+ {
2681
+ inputs: [{ internalType: "address", name: "newImplementation", type: "address" }],
2682
+ name: "upgradeTo",
2683
+ outputs: [],
2684
+ stateMutability: "nonpayable",
2685
+ type: "function"
2686
+ },
2687
+ {
2688
+ inputs: [
2689
+ { internalType: "address", name: "newImplementation", type: "address" },
2690
+ { internalType: "bytes", name: "data", type: "bytes" }
2691
+ ],
2692
+ name: "upgradeToAndCall",
2693
+ outputs: [],
2694
+ stateMutability: "payable",
2695
+ type: "function"
2696
+ },
2697
+ {
2698
+ inputs: [],
2699
+ name: "withdrawalRecipient",
2700
+ outputs: [{ internalType: "address", name: "", type: "address" }],
2701
+ stateMutability: "view",
2702
+ type: "function"
2703
+ },
2704
+ {
2705
+ inputs: [],
2706
+ name: "wrappedNativeToken",
2707
+ outputs: [{ internalType: "contract WETH9Interface", name: "", type: "address" }],
2708
+ stateMutability: "view",
2709
+ type: "function"
2710
+ },
2711
+ { stateMutability: "payable", type: "receive" }
2712
+ ];
2713
+
2714
+ // src/providers/across/createAcrossDepositCall.ts
2715
+ import { getGlobalAdapter as getGlobalAdapter3 } from "@cowprotocol/sdk-common";
2716
+ var ERC20_BALANCE_OF_ABI = ["function balanceOf(address account) external view returns (uint256)"];
2717
+ var ERC20_APPROVE_OF_ABI = ["function approve(address spender, uint256 amount) external returns (bool)"];
2718
+ function getSpookPoolContract(sellTokenChainId) {
2719
+ const adapter = getGlobalAdapter3();
2720
+ const spokePoolAddress = ACROSS_SPOOK_CONTRACT_ADDRESSES[sellTokenChainId];
2721
+ if (!spokePoolAddress) {
2722
+ throw new Error("Spoke pool address not found for chain: " + sellTokenChainId);
2723
+ }
2724
+ return createWeirollContract(
2725
+ adapter.getContract(spokePoolAddress, ACROSS_SPOKE_POOL_ABI),
2726
+ WeirollCommandFlags.CALL
2727
+ );
2728
+ }
2729
+ function getMathContract(sellTokenChainId) {
2730
+ const adapter = getGlobalAdapter3();
2731
+ const mathContractAddress = ACROSS_MATH_CONTRACT_ADDRESSES[sellTokenChainId];
2732
+ if (!mathContractAddress) {
2733
+ throw new Error("Math contract address not found for chain: " + sellTokenChainId);
2734
+ }
2735
+ return createWeirollContract(
2736
+ adapter.getContract(mathContractAddress, ACROSS_MATH_ABI),
2737
+ WeirollCommandFlags.CALL
2738
+ );
2739
+ }
2740
+ function getBalanceOfSellTokenContract(sellTokenAddress) {
2741
+ const adapter = getGlobalAdapter3();
2742
+ return createWeirollContract(
2743
+ adapter.getContract(sellTokenAddress, ERC20_BALANCE_OF_ABI),
2744
+ WeirollCommandFlags.STATICCALL
2745
+ );
2746
+ }
2747
+ function getApproveSellTokenContract(sellTokenAddress) {
2748
+ const adapter = getGlobalAdapter3();
2749
+ return createWeirollContract(adapter.getContract(sellTokenAddress, ERC20_APPROVE_OF_ABI), WeirollCommandFlags.CALL);
2750
+ }
2751
+ function createAcrossDepositCall(params) {
2752
+ const { request, quote, cowShedSdk } = params;
2753
+ const { sellTokenChainId, sellTokenAddress, buyTokenChainId, buyTokenAddress, account, receiver } = request;
2754
+ const spokePoolContract = getSpookPoolContract(sellTokenChainId);
2755
+ const mathContract = getMathContract(sellTokenChainId);
2756
+ const balanceOfSellTokenContract = getBalanceOfSellTokenContract(sellTokenAddress);
2757
+ const approveSellTokenContract = getApproveSellTokenContract(sellTokenAddress);
2758
+ const cowShedAccount = cowShedSdk.getCowShedAccount(sellTokenChainId, account);
2759
+ const { suggestedFees } = quote;
2760
+ const depositCall = createWeirollDelegateCall((planner) => {
2761
+ const sourceAmountIncludingSurplus = planner.add(balanceOfSellTokenContract.balanceOf(cowShedAccount));
2762
+ const relayFeePercentage = BigInt(suggestedFees.totalRelayFee.pct);
2763
+ const outputAmountIncludingSurplus = planner.add(
2764
+ mathContract.multiplyAndSubtract(sourceAmountIncludingSurplus, relayFeePercentage)
2765
+ );
2766
+ planner.add(approveSellTokenContract.approve(spokePoolContract.address, sourceAmountIncludingSurplus));
2767
+ const quoteTimestamp = BigInt(suggestedFees.timestamp);
2768
+ const fillDeadline = suggestedFees.fillDeadline;
2769
+ const exclusivityDeadline = suggestedFees.exclusivityDeadline;
2770
+ const exclusiveRelayer = suggestedFees.exclusiveRelayer;
2771
+ const message = "0x";
2772
+ planner.add(
2773
+ spokePoolContract.depositV3(
2774
+ cowShedAccount,
2775
+ receiver || account,
2776
+ sellTokenAddress,
2777
+ buyTokenAddress,
2778
+ sourceAmountIncludingSurplus,
2779
+ outputAmountIncludingSurplus,
2780
+ buyTokenChainId,
2781
+ exclusiveRelayer,
2782
+ quoteTimestamp,
2783
+ fillDeadline,
2784
+ exclusivityDeadline,
2785
+ message
2786
+ )
2787
+ );
2788
+ });
2789
+ return depositCall;
2790
+ }
2791
+
2792
+ // src/providers/across/AcrossBridgeProvider.ts
2793
+ import { ContractsOrderKind as OrderKind4 } from "@cowprotocol/sdk-contracts-ts";
2794
+ var HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/across`;
2795
+ var ACROSS_SUPPORTED_NETWORKS = [mainnet2, polygon, arbitrumOne, base, optimism2];
2796
+ var SLIPPAGE_TOLERANCE_BPS = 0;
2797
+ var AcrossBridgeProvider = class {
2798
+ constructor(options = {}, adapter) {
2799
+ this.options = options;
2800
+ if (adapter) {
2801
+ setGlobalAdapter2(adapter);
2802
+ }
2803
+ this.api = new AcrossApi(options.apiOptions);
2804
+ this.cowShedSdk = new CowShedSdk(adapter, options.cowShedOptions?.factoryOptions);
2805
+ }
2806
+ api;
2807
+ cowShedSdk;
2808
+ info = {
2809
+ name: "Across",
2810
+ logoUrl: `${RAW_PROVIDERS_FILES_PATH}/across/across-logo.png`
2811
+ };
2812
+ async getNetworks() {
2813
+ return ACROSS_SUPPORTED_NETWORKS;
2814
+ }
2815
+ async getBuyTokens(targetChainId) {
2816
+ if (!this.options.getTokenInfos) {
2817
+ throw new Error("'getTokenInfos' parameter is required for AcrossBridgeProvider constructor");
2818
+ }
2819
+ const chainConfig = ACROSS_TOKEN_MAPPING[targetChainId];
2820
+ if (!chainConfig) {
2821
+ return [];
2822
+ }
2823
+ const tokenAddresses = Object.values(chainConfig.tokens).filter((address) => Boolean(address));
2824
+ return this.options.getTokenInfos(targetChainId, tokenAddresses);
2825
+ }
2826
+ async getIntermediateTokens(request) {
2827
+ if (request.kind !== OrderKind4.SELL) {
2828
+ throw new Error("Only SELL is supported for now");
2829
+ }
2830
+ const { sellTokenChainId, buyTokenChainId, buyTokenAddress } = request;
2831
+ const chainConfigs = getChainConfigs(sellTokenChainId, buyTokenChainId);
2832
+ if (!chainConfigs)
2833
+ return [];
2834
+ const { sourceChainConfig, targetChainConfig } = chainConfigs;
2835
+ const targetTokenSymbol = getTokenSymbol(buyTokenAddress, targetChainConfig);
2836
+ if (!targetTokenSymbol)
2837
+ return [];
2838
+ const intermediateToken = getTokenAddress(targetTokenSymbol, sourceChainConfig);
2839
+ return intermediateToken ? [intermediateToken] : [];
2840
+ }
2841
+ async getQuote(request) {
2842
+ const { sellTokenAddress, sellTokenChainId, buyTokenChainId, amount, receiver } = request;
2843
+ const suggestedFees = await this.api.getSuggestedFees({
2844
+ token: sellTokenAddress,
2845
+ // inputToken: sellTokenAddress,
2846
+ // outputToken: buyTokenAddress,
2847
+ originChainId: sellTokenChainId,
2848
+ destinationChainId: buyTokenChainId,
2849
+ amount,
2850
+ recipient: receiver ?? void 0
2851
+ });
2852
+ return toBridgeQuoteResult(request, SLIPPAGE_TOLERANCE_BPS, suggestedFees);
2853
+ }
2854
+ async getUnsignedBridgeCall(request, quote) {
2855
+ return createAcrossDepositCall({
2856
+ request,
2857
+ quote,
2858
+ cowShedSdk: this.cowShedSdk
2859
+ });
2860
+ }
2861
+ getGasLimitEstimationForHook(_request) {
2862
+ return DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION;
2863
+ }
2864
+ async getSignedHook(chainId, unsignedCall, defaultGasLimit, signer) {
2865
+ const { signedMulticall, cowShedAccount, gasLimit } = await this.cowShedSdk.signCalls({
2866
+ calls: [
2867
+ {
2868
+ target: unsignedCall.to,
2869
+ value: unsignedCall.value,
2870
+ callData: unsignedCall.data,
2871
+ allowFailure: false,
2872
+ isDelegateCall: true
2873
+ }
2874
+ ],
2875
+ chainId,
2876
+ signer,
2877
+ defaultGasLimit
2878
+ });
2879
+ const { to, data } = signedMulticall;
2880
+ return {
2881
+ postHook: {
2882
+ target: to,
2883
+ callData: data,
2884
+ gasLimit: gasLimit.toString(),
2885
+ dappId: HOOK_DAPP_ID
2886
+ // TODO: I think we should have some additional parameter to type the hook (using dappId for now)
2887
+ },
2888
+ recipient: cowShedAccount
2889
+ };
2890
+ }
2891
+ async decodeBridgeHook(_hook) {
2892
+ throw new Error("Not implemented");
2893
+ }
2894
+ async getBridgingId(_orderUid, _settlementTx, _logIndex) {
2895
+ throw new Error("Not implemented");
2896
+ }
2897
+ getExplorerUrl(bridgingId) {
2898
+ return `https://app.across.to/transactions/${bridgingId}`;
2899
+ }
2900
+ async getStatus(_bridgingId) {
2901
+ throw new Error("Not implemented");
2902
+ }
2903
+ async getCancelBridgingTx(_bridgingId) {
2904
+ throw new Error("Not implemented");
2905
+ }
2906
+ async getRefundBridgingTx(_bridgingId) {
2907
+ throw new Error("Not implemented");
2908
+ }
2909
+ };
2910
+ export {
2911
+ AcrossBridgeProvider,
2912
+ BridgeProviderQuoteError,
2913
+ BridgeStatus,
2914
+ BridgingSdk,
2915
+ MockBridgeProvider,
2916
+ areHooksEqual,
2917
+ assertIsBridgeQuoteAndPost,
2918
+ assertIsQuoteAndPost,
2919
+ getHookMockForCostEstimation,
2920
+ getPostHooks,
2921
+ isAppDoc,
2922
+ isBridgeQuoteAndPost,
2923
+ isQuoteAndPost
2924
+ };