@ember-finance/sdk 2.21.0-ccip.0 → 2.22.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/src/abis/index.d.ts +1 -3
- package/dist/src/abis/index.js +1 -4
- package/dist/src/api/v2/models/account-transaction-transaction-data.d.ts +1 -2
- package/dist/src/api/v2/models/account-transaction.d.ts +0 -2
- package/dist/src/api/v2/models/account-transaction.js +1 -3
- package/dist/src/api/v2/models/chain.d.ts +0 -6
- package/dist/src/api/v2/models/evm-contracts.d.ts +0 -9
- package/dist/src/api/v2/models/evm-oftadapter.d.ts +0 -11
- package/dist/src/api/v2/models/evm-oftadapter.js +1 -4
- package/dist/src/api/v2/models/evm-oftpeer.d.ts +0 -12
- package/dist/src/api/v2/models/index.d.ts +0 -4
- package/dist/src/api/v2/models/index.js +0 -4
- package/dist/src/evm-vaults/interfaces/index.d.ts +0 -39
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +1 -15
- package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +0 -36
- package/dist/src/evm-vaults/on-chain-calls/user.d.ts +1 -40
- package/dist/src/evm-vaults/on-chain-calls/user.js +0 -75
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +1 -14
- package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +0 -30
- package/dist/src/evm-vaults/utils/deployment-parser.d.ts +1 -46
- package/dist/src/evm-vaults/utils/deployment-parser.js +0 -74
- package/dist/src/evm-vaults/utils/index.d.ts +0 -1
- package/dist/src/evm-vaults/utils/index.js +0 -1
- package/dist/src/sui-vaults/on-chain-calls/operator.d.ts +10 -64
- package/dist/src/sui-vaults/on-chain-calls/operator.js +22 -92
- package/dist/src/sui-vaults/on-chain-calls/protocol-config-reader.d.ts +8 -0
- package/dist/src/sui-vaults/on-chain-calls/protocol-config-reader.js +10 -0
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.d.ts +7 -120
- package/dist/src/sui-vaults/on-chain-calls/tx-builder.js +32 -357
- package/dist/src/sui-vaults/on-chain-calls/user.d.ts +0 -58
- package/dist/src/sui-vaults/on-chain-calls/user.js +3 -96
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.d.ts +0 -21
- package/dist/src/sui-vaults/on-chain-calls/vault-admin.js +0 -32
- package/package.json +1 -1
- package/dist/src/abis/CcipRouter.json +0 -58
- package/dist/src/api/v2/models/bridge-transaction.d.ts +0 -50
- package/dist/src/api/v2/models/bridge-transaction.js +0 -14
- package/dist/src/api/v2/models/evm-ccip-lane.d.ts +0 -73
- package/dist/src/api/v2/models/evm-ccip-lane.js +0 -14
- package/dist/src/api/v2/models/evm-ccip-rate-limits.d.ts +0 -36
- package/dist/src/api/v2/models/evm-ccip-rate-limits.js +0 -14
- package/dist/src/api/v2/models/evm-ccip-token-pool.d.ts +0 -122
- package/dist/src/api/v2/models/evm-ccip-token-pool.js +0 -17
- package/dist/src/evm-vaults/utils/ccip.d.ts +0 -23
- package/dist/src/evm-vaults/utils/ccip.js +0 -32
package/dist/src/abis/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import EmberProtocolConfigABI from "./EmberProtocolConfig.json";
|
|
|
3
3
|
import ERC20TokenABI from "./ERC20Token.json";
|
|
4
4
|
import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json";
|
|
5
5
|
import OpenCoverVaultABI from "./OpenCoverVault.json";
|
|
6
|
-
import CcipRouterABI from "./CcipRouter.json";
|
|
7
6
|
import { Interface } from "ethers";
|
|
8
7
|
declare const EmberVault: Interface;
|
|
9
8
|
declare const EmberProtocolConfig: Interface;
|
|
@@ -11,5 +10,4 @@ declare const ERC20Token: Interface;
|
|
|
11
10
|
declare const EmberETHVault: Interface;
|
|
12
11
|
declare const EmberVaultOFTAdapter: Interface;
|
|
13
12
|
declare const OpenCoverVault: Interface;
|
|
14
|
-
|
|
15
|
-
export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault, CcipRouterABI, CcipRouter };
|
|
13
|
+
export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault };
|
package/dist/src/abis/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import ERC20TokenABI from "./ERC20Token.json" with { type: "json" };
|
|
|
4
4
|
import EmberETHVaultABI from "./EmberETHVault.json" with { type: "json" };
|
|
5
5
|
import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
6
6
|
import OpenCoverVaultABI from "./OpenCoverVault.json" with { type: "json" };
|
|
7
|
-
import CcipRouterABI from "./CcipRouter.json" with { type: "json" };
|
|
8
7
|
import { Interface } from "ethers";
|
|
9
8
|
const EmberVault = new Interface(EmberVaultABI.abi);
|
|
10
9
|
const EmberProtocolConfig = new Interface(EmberProtocolConfigABI.abi);
|
|
@@ -12,6 +11,4 @@ const ERC20Token = new Interface(ERC20TokenABI.abi);
|
|
|
12
11
|
const EmberETHVault = new Interface(EmberETHVaultABI.abi);
|
|
13
12
|
const EmberVaultOFTAdapter = new Interface(EmberVaultOFTAdapterABI.abi);
|
|
14
13
|
const OpenCoverVault = new Interface(OpenCoverVaultABI.abi);
|
|
15
|
-
|
|
16
|
-
const CcipRouter = new Interface(CcipRouterABI.abi);
|
|
17
|
-
export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault, CcipRouterABI, CcipRouter };
|
|
14
|
+
export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault };
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type { BridgeTransaction } from "./bridge-transaction.js";
|
|
13
12
|
import type { DepositTransaction } from "./deposit-transaction.js";
|
|
14
13
|
import type { EscrowClaimTransaction } from "./escrow-claim-transaction.js";
|
|
15
14
|
import type { HoldbackReleaseTransaction } from "./holdback-release-transaction.js";
|
|
@@ -25,4 +24,4 @@ import type { RedeemRequestTransaction } from "./redeem-request-transaction.js";
|
|
|
25
24
|
* The data of the transaction
|
|
26
25
|
* @export
|
|
27
26
|
*/
|
|
28
|
-
export type AccountTransactionTransactionData =
|
|
27
|
+
export type AccountTransactionTransactionData = DepositTransaction | EscrowClaimTransaction | HoldbackReleaseTransaction | InstantWithdrawTransaction | InstantWithdrawViaSwapTransaction | ParkingLotDepositTransaction | RedeemRequestCancelledTransaction | RedeemRequestProcessedTransaction | RedeemRequestSkippedTransaction | RedeemRequestTransaction;
|
|
@@ -51,7 +51,5 @@ export declare const AccountTransactionTransactionTypeEnum: {
|
|
|
51
51
|
readonly InstantWithdrawSwapHoldbackRelease: "InstantWithdrawSwapHoldbackRelease";
|
|
52
52
|
readonly HoldbackClaimed: "HoldbackClaimed";
|
|
53
53
|
readonly WithdrawalClaimed: "WithdrawalClaimed";
|
|
54
|
-
readonly BridgeIn: "BridgeIn";
|
|
55
|
-
readonly BridgeOut: "BridgeOut";
|
|
56
54
|
};
|
|
57
55
|
export type AccountTransactionTransactionTypeEnum = (typeof AccountTransactionTransactionTypeEnum)[keyof typeof AccountTransactionTransactionTypeEnum];
|
|
@@ -26,7 +26,5 @@ export const AccountTransactionTransactionTypeEnum = {
|
|
|
26
26
|
InstantWithdrawViaSwap: "InstantWithdrawViaSwap",
|
|
27
27
|
InstantWithdrawSwapHoldbackRelease: "InstantWithdrawSwapHoldbackRelease",
|
|
28
28
|
HoldbackClaimed: "HoldbackClaimed",
|
|
29
|
-
WithdrawalClaimed: "WithdrawalClaimed"
|
|
30
|
-
BridgeIn: "BridgeIn",
|
|
31
|
-
BridgeOut: "BridgeOut"
|
|
29
|
+
WithdrawalClaimed: "WithdrawalClaimed"
|
|
32
30
|
};
|
|
@@ -63,12 +63,6 @@ export interface Chain {
|
|
|
63
63
|
* @memberof Chain
|
|
64
64
|
*/
|
|
65
65
|
lzChainId?: number;
|
|
66
|
-
/**
|
|
67
|
-
* The Chainlink CCIP chain selector. A string because the value is a 64-bit integer. Null for a chain CCIP does not reach.
|
|
68
|
-
* @type {string}
|
|
69
|
-
* @memberof Chain
|
|
70
|
-
*/
|
|
71
|
-
ccipChainSelector?: string;
|
|
72
66
|
/**
|
|
73
67
|
* Whether the chain supports AML checks
|
|
74
68
|
* @type {boolean}
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { EvmAtomicLiquidityLib } from "./evm-atomic-liquidity-lib.js";
|
|
13
13
|
import type { EvmAtomicVault } from "./evm-atomic-vault.js";
|
|
14
|
-
import type { EvmCcipTokenPool } from "./evm-ccip-token-pool.js";
|
|
15
14
|
import type { EvmDepositParkingLot } from "./evm-deposit-parking-lot.js";
|
|
16
15
|
import type { EvmDepositToken } from "./evm-deposit-token.js";
|
|
17
16
|
import type { EvmOFTAdapter } from "./evm-oftadapter.js";
|
|
@@ -81,14 +80,6 @@ export interface EvmContracts {
|
|
|
81
80
|
oftAdapters?: {
|
|
82
81
|
[key: string]: EvmOFTAdapter;
|
|
83
82
|
};
|
|
84
|
-
/**
|
|
85
|
-
* Map of CCIP token pools by name
|
|
86
|
-
* @type {{ [key: string]: EvmCcipTokenPool; }}
|
|
87
|
-
* @memberof EvmContracts
|
|
88
|
-
*/
|
|
89
|
-
ccipTokenPools?: {
|
|
90
|
-
[key: string]: EvmCcipTokenPool;
|
|
91
|
-
};
|
|
92
83
|
/**
|
|
93
84
|
*
|
|
94
85
|
* @type {EvmVaultValidator}
|
|
@@ -82,12 +82,6 @@ export interface EvmOFTAdapter {
|
|
|
82
82
|
* @memberof EvmOFTAdapter
|
|
83
83
|
*/
|
|
84
84
|
deploymentBlockNumber?: number;
|
|
85
|
-
/**
|
|
86
|
-
* Which bridge this entry describes. Read this rather than inferring the transport from which map the entry was found in.
|
|
87
|
-
* @type {string}
|
|
88
|
-
* @memberof EvmOFTAdapter
|
|
89
|
-
*/
|
|
90
|
-
bridgeTransport?: EvmOFTAdapterBridgeTransportEnum;
|
|
91
85
|
/**
|
|
92
86
|
* Map of peers by LayerZero endpoint ID
|
|
93
87
|
* @type {{ [key: string]: EvmOFTPeer; }}
|
|
@@ -97,8 +91,3 @@ export interface EvmOFTAdapter {
|
|
|
97
91
|
[key: string]: EvmOFTPeer;
|
|
98
92
|
};
|
|
99
93
|
}
|
|
100
|
-
export declare const EvmOFTAdapterBridgeTransportEnum: {
|
|
101
|
-
readonly LayerZero: "LayerZero";
|
|
102
|
-
readonly Ccip: "CCIP";
|
|
103
|
-
};
|
|
104
|
-
export type EvmOFTAdapterBridgeTransportEnum = (typeof EvmOFTAdapterBridgeTransportEnum)[keyof typeof EvmOFTAdapterBridgeTransportEnum];
|
|
@@ -15,18 +15,6 @@
|
|
|
15
15
|
* @interface EvmOFTPeer
|
|
16
16
|
*/
|
|
17
17
|
export interface EvmOFTPeer {
|
|
18
|
-
/**
|
|
19
|
-
* The remote chain\'s network name, e.g. atlantic. The map key is a LayerZero endpoint ID, which names nothing outside LayerZero, so read this instead.
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof EvmOFTPeer
|
|
22
|
-
*/
|
|
23
|
-
remoteNetwork?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The bridge contract at the far end, as a plain address. Same meaning as remoteAddress on a CCIP lane.
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof EvmOFTPeer
|
|
28
|
-
*/
|
|
29
|
-
remoteAddress?: string;
|
|
30
18
|
/**
|
|
31
19
|
* The peer address in bytes32 format
|
|
32
20
|
* @type {string}
|
|
@@ -14,7 +14,6 @@ export * from "./apy-period-average.js";
|
|
|
14
14
|
export * from "./asset.js";
|
|
15
15
|
export * from "./atomic-vault-info.js";
|
|
16
16
|
export * from "./borrowed.js";
|
|
17
|
-
export * from "./bridge-transaction.js";
|
|
18
17
|
export * from "./chain.js";
|
|
19
18
|
export * from "./chain-vault-details.js";
|
|
20
19
|
export * from "./coin-placement.js";
|
|
@@ -26,9 +25,6 @@ export * from "./ember-position.js";
|
|
|
26
25
|
export * from "./escrow-claim-transaction.js";
|
|
27
26
|
export * from "./evm-atomic-liquidity-lib.js";
|
|
28
27
|
export * from "./evm-atomic-vault.js";
|
|
29
|
-
export * from "./evm-ccip-lane.js";
|
|
30
|
-
export * from "./evm-ccip-rate-limits.js";
|
|
31
|
-
export * from "./evm-ccip-token-pool.js";
|
|
32
28
|
export * from "./evm-contracts.js";
|
|
33
29
|
export * from "./evm-deposit-parking-lot.js";
|
|
34
30
|
export * from "./evm-deposit-token.js";
|
|
@@ -14,7 +14,6 @@ export * from "./apy-period-average.js";
|
|
|
14
14
|
export * from "./asset.js";
|
|
15
15
|
export * from "./atomic-vault-info.js";
|
|
16
16
|
export * from "./borrowed.js";
|
|
17
|
-
export * from "./bridge-transaction.js";
|
|
18
17
|
export * from "./chain.js";
|
|
19
18
|
export * from "./chain-vault-details.js";
|
|
20
19
|
export * from "./coin-placement.js";
|
|
@@ -26,9 +25,6 @@ export * from "./ember-position.js";
|
|
|
26
25
|
export * from "./escrow-claim-transaction.js";
|
|
27
26
|
export * from "./evm-atomic-liquidity-lib.js";
|
|
28
27
|
export * from "./evm-atomic-vault.js";
|
|
29
|
-
export * from "./evm-ccip-lane.js";
|
|
30
|
-
export * from "./evm-ccip-rate-limits.js";
|
|
31
|
-
export * from "./evm-ccip-token-pool.js";
|
|
32
28
|
export * from "./evm-contracts.js";
|
|
33
29
|
export * from "./evm-deposit-parking-lot.js";
|
|
34
30
|
export * from "./evm-deposit-token.js";
|
|
@@ -242,45 +242,6 @@ export interface ICoverVaultCallOptions extends IUserCallOptions {
|
|
|
242
242
|
/**
|
|
243
243
|
* Optional parameters for high-level OFT bridge send calls.
|
|
244
244
|
*/
|
|
245
|
-
/**
|
|
246
|
-
* Parameters for a CCIP bridge send.
|
|
247
|
-
*
|
|
248
|
-
* Deliberately shaped like IOFTSendParam so the two transports read the same
|
|
249
|
-
* way, but CCIP names a destination by chain selector rather than endpoint id,
|
|
250
|
-
* and takes the receiver as a plain address — the SDK encodes it.
|
|
251
|
-
*/
|
|
252
|
-
export interface ICcipSendParam {
|
|
253
|
-
/** CCIP chain selector of the destination. A 64-bit value, so a string. */
|
|
254
|
-
destinationChainSelector: string;
|
|
255
|
-
/** Recipient address on the destination chain */
|
|
256
|
-
receiver: string;
|
|
257
|
-
/** Amount to send in local token decimals */
|
|
258
|
-
amount: bigint;
|
|
259
|
-
/** Fee token; omit to pay in the chain's native currency */
|
|
260
|
-
feeToken?: string;
|
|
261
|
-
/** Destination execution gas. 0 for a plain token transfer. */
|
|
262
|
-
destinationGasLimit?: bigint;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* A CCIP fee quote.
|
|
266
|
-
*
|
|
267
|
-
* CCIP charges one fee, unlike LayerZero's native/LZ token split, and does not
|
|
268
|
-
* quote the received amount separately: a burn-and-mint pool mints exactly what
|
|
269
|
-
* was burned, so the amount received is the amount sent.
|
|
270
|
-
*/
|
|
271
|
-
export interface ICcipFeeQuote {
|
|
272
|
-
/** Fee required to send, in feeToken units (wei when paying natively) */
|
|
273
|
-
fee: bigint;
|
|
274
|
-
/** Token the fee is charged in; the zero address means native currency */
|
|
275
|
-
feeToken: string;
|
|
276
|
-
}
|
|
277
|
-
/** Overrides for a CCIP bridge send. */
|
|
278
|
-
export interface ICcipBridgeSendOptions extends IEvmCallOptions {
|
|
279
|
-
/** Fee token; omit to pay in the chain's native currency */
|
|
280
|
-
feeToken?: string;
|
|
281
|
-
/** Destination execution gas. 0 for a plain token transfer. */
|
|
282
|
-
destinationGasLimit?: bigint;
|
|
283
|
-
}
|
|
284
245
|
export interface IBridgeSendOptions extends IEvmCallOptions {
|
|
285
246
|
/** Minimum amount to receive on destination; defaults to amount */
|
|
286
247
|
minAmount?: bigint;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EVMDeploymentParser } from "../utils/index.js";
|
|
2
|
-
import { EvmProtocolInfo, VaultPauseOperation, ITransactionCall, IPermitSignature, IOFTSendParam, IOFTMessagingFee
|
|
2
|
+
import { EvmProtocolInfo, VaultPauseOperation, ITransactionCall, IPermitSignature, IOFTSendParam, IOFTMessagingFee } from "../interfaces/index.js";
|
|
3
3
|
import { NumStr } from "../../common/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* EVM Transaction Builder for Ember Protocol (ERC-4626 Compatible)
|
|
@@ -543,20 +543,6 @@ export declare class EVMTxBuilder {
|
|
|
543
543
|
* @returns Transaction call object
|
|
544
544
|
*/
|
|
545
545
|
bridgeSend(adapterAddress: string, sendParam: IOFTSendParam, fee: IOFTMessagingFee, refundAddress: string): ITransactionCall;
|
|
546
|
-
/**
|
|
547
|
-
* Builds the CCIP send call.
|
|
548
|
-
*
|
|
549
|
-
* The counterpart to bridgeSend, but the call goes to Chainlink's Router
|
|
550
|
-
* rather than to our own pool: the Router pulls the tokens, charges the fee
|
|
551
|
-
* and hands off to the pool. That is also why the approval for a CCIP bridge
|
|
552
|
-
* goes to the Router and not to the pool.
|
|
553
|
-
*
|
|
554
|
-
* @param routerAddress The CCIP Router on the source chain
|
|
555
|
-
* @param sendParam Destination, receiver and amount
|
|
556
|
-
* @param tokenAddress The receipt token being bridged
|
|
557
|
-
* @param fee Fee from getCcipFeeQuote, sent as value when paying natively
|
|
558
|
-
*/
|
|
559
|
-
ccipSend(routerAddress: string, sendParam: ICcipSendParam, tokenAddress: string, fee: bigint): ITransactionCall;
|
|
560
546
|
private atomicCall;
|
|
561
547
|
/** Claim the caller's own escrowed (deferred) holdback collateral. */
|
|
562
548
|
atomicClaimHoldback(vaultAddress: string): ITransactionCall;
|
|
@@ -4,8 +4,6 @@ import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json"
|
|
|
4
4
|
import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
|
|
5
5
|
import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
|
|
6
6
|
import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
7
|
-
import CcipRouterABI from "../../abis/CcipRouter.json" with { type: "json" };
|
|
8
|
-
import { ZERO_ADDRESS, encodeCcipReceiver, encodeCcipExtraArgs } from "../utils/ccip.js";
|
|
9
7
|
import AtomicLiquidityABI from "../../abis/AtomicLiquidity.json" with { type: "json" };
|
|
10
8
|
import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
|
|
11
9
|
import OpenCoverVaultABI from "../../abis/OpenCoverVault.json" with { type: "json" };
|
|
@@ -1149,40 +1147,6 @@ export class EVMTxBuilder {
|
|
|
1149
1147
|
chainId: this.getChainId()
|
|
1150
1148
|
};
|
|
1151
1149
|
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Builds the CCIP send call.
|
|
1154
|
-
*
|
|
1155
|
-
* The counterpart to bridgeSend, but the call goes to Chainlink's Router
|
|
1156
|
-
* rather than to our own pool: the Router pulls the tokens, charges the fee
|
|
1157
|
-
* and hands off to the pool. That is also why the approval for a CCIP bridge
|
|
1158
|
-
* goes to the Router and not to the pool.
|
|
1159
|
-
*
|
|
1160
|
-
* @param routerAddress The CCIP Router on the source chain
|
|
1161
|
-
* @param sendParam Destination, receiver and amount
|
|
1162
|
-
* @param tokenAddress The receipt token being bridged
|
|
1163
|
-
* @param fee Fee from getCcipFeeQuote, sent as value when paying natively
|
|
1164
|
-
*/
|
|
1165
|
-
ccipSend(routerAddress, sendParam, tokenAddress, fee) {
|
|
1166
|
-
const feeToken = sendParam.feeToken ?? ZERO_ADDRESS;
|
|
1167
|
-
return {
|
|
1168
|
-
to: routerAddress,
|
|
1169
|
-
functionName: "ccipSend",
|
|
1170
|
-
args: [
|
|
1171
|
-
sendParam.destinationChainSelector,
|
|
1172
|
-
{
|
|
1173
|
-
receiver: encodeCcipReceiver(sendParam.receiver),
|
|
1174
|
-
data: "0x",
|
|
1175
|
-
tokenAmounts: [{ token: tokenAddress, amount: sendParam.amount }],
|
|
1176
|
-
feeToken,
|
|
1177
|
-
extraArgs: encodeCcipExtraArgs(sendParam.destinationGasLimit)
|
|
1178
|
-
}
|
|
1179
|
-
],
|
|
1180
|
-
abi: CcipRouterABI.abi,
|
|
1181
|
-
// Paying in a token means the Router pulls it instead, so no value.
|
|
1182
|
-
value: feeToken === ZERO_ADDRESS ? fee : 0n,
|
|
1183
|
-
chainId: this.getChainId()
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
1150
|
// ============================================
|
|
1187
1151
|
// Atomic Liquidity Vault methods (BFE-817/818)
|
|
1188
1152
|
//
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer, Provider } from "ethers";
|
|
2
2
|
import { EVMOnChainCalls } from "./onchain-calls.js";
|
|
3
|
-
import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, ICoverVaultCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote
|
|
3
|
+
import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, ICoverVaultCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote } from "../interfaces/index.js";
|
|
4
4
|
import { NumStr } from "../../common/types.js";
|
|
5
5
|
import { Chain } from "../../api/v2/index.js";
|
|
6
6
|
/**
|
|
@@ -423,45 +423,6 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
|
|
|
423
423
|
* @returns Transaction execution response
|
|
424
424
|
*/
|
|
425
425
|
bridgeSendToken(destinationChain: Chain, tokenAddress: string, amount: NumStr, receiver: string, feeQuote: IOFTFeeQuote, options?: IBridgeSendOptions): Promise<EvmOnChainCallResponse>;
|
|
426
|
-
/**
|
|
427
|
-
* Bridges a receipt token to a destination chain using the vault's CCIP pool.
|
|
428
|
-
*
|
|
429
|
-
* The counterpart to bridgeSendToken. Call getBridgeTransportForVault first
|
|
430
|
-
* and pick the matching method — a vault has exactly one active bridge, and
|
|
431
|
-
* calling the wrong one throws rather than silently doing nothing.
|
|
432
|
-
*
|
|
433
|
-
* One difference from the LayerZero path worth knowing: the allowance goes
|
|
434
|
-
* to the CCIP Router, not to the pool, because the Router is what pulls the
|
|
435
|
-
* tokens. An unconfigured route throws here rather than reverting on chain.
|
|
436
|
-
*
|
|
437
|
-
* @param destinationChain Destination chain metadata (must include ccipChainSelector)
|
|
438
|
-
* @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
|
|
439
|
-
* @param amount Amount to bridge in local token decimals
|
|
440
|
-
* @param receiver Recipient wallet address on the destination chain
|
|
441
|
-
* @param feeQuote Fee quote returned by reader.getCcipFeeQuote
|
|
442
|
-
* @param options Optional bridge/send overrides
|
|
443
|
-
* @returns Transaction execution response
|
|
444
|
-
*/
|
|
445
|
-
bridgeSendTokenViaCcip(destinationChain: Chain, tokenAddress: string, amount: NumStr, receiver: string, feeQuote: ICcipFeeQuote, options?: ICcipBridgeSendOptions): Promise<EvmOnChainCallResponse>;
|
|
446
|
-
/**
|
|
447
|
-
* Reports which bridge a vault uses, or undefined if it has none.
|
|
448
|
-
*
|
|
449
|
-
* A vault has exactly one active bridge, but different vaults use different
|
|
450
|
-
* ones, so branch on this rather than assuming either transport.
|
|
451
|
-
*
|
|
452
|
-
* @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
|
|
453
|
-
*/
|
|
454
|
-
getBridgeTransportForVault(tokenAddress: string): "LayerZero" | "CCIP" | undefined;
|
|
455
|
-
/**
|
|
456
|
-
* Lists the networks a vault can bridge to, whichever transport it uses.
|
|
457
|
-
*
|
|
458
|
-
* Empty for a vault with no bridge, and for a bridged vault with no route
|
|
459
|
-
* configured yet. A network absent from this list cannot be sent to — the
|
|
460
|
-
* send would revert on chain — so drive the destination picker from it.
|
|
461
|
-
*
|
|
462
|
-
* @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
|
|
463
|
-
*/
|
|
464
|
-
getBridgeDestinationsForVault(tokenAddress: string): string[];
|
|
465
426
|
/**
|
|
466
427
|
* Gets the vault contract instance for read operations
|
|
467
428
|
* @param vaultAddress The address of the vault
|
|
@@ -637,81 +637,6 @@ export class EVMUserCalls extends EVMOnChainCalls {
|
|
|
637
637
|
}, refundAddress);
|
|
638
638
|
return this.execCall(txCall, options);
|
|
639
639
|
}
|
|
640
|
-
/**
|
|
641
|
-
* Bridges a receipt token to a destination chain using the vault's CCIP pool.
|
|
642
|
-
*
|
|
643
|
-
* The counterpart to bridgeSendToken. Call getBridgeTransportForVault first
|
|
644
|
-
* and pick the matching method — a vault has exactly one active bridge, and
|
|
645
|
-
* calling the wrong one throws rather than silently doing nothing.
|
|
646
|
-
*
|
|
647
|
-
* One difference from the LayerZero path worth knowing: the allowance goes
|
|
648
|
-
* to the CCIP Router, not to the pool, because the Router is what pulls the
|
|
649
|
-
* tokens. An unconfigured route throws here rather than reverting on chain.
|
|
650
|
-
*
|
|
651
|
-
* @param destinationChain Destination chain metadata (must include ccipChainSelector)
|
|
652
|
-
* @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
|
|
653
|
-
* @param amount Amount to bridge in local token decimals
|
|
654
|
-
* @param receiver Recipient wallet address on the destination chain
|
|
655
|
-
* @param feeQuote Fee quote returned by reader.getCcipFeeQuote
|
|
656
|
-
* @param options Optional bridge/send overrides
|
|
657
|
-
* @returns Transaction execution response
|
|
658
|
-
*/
|
|
659
|
-
async bridgeSendTokenViaCcip(destinationChain, tokenAddress, amount, receiver, feeQuote, options) {
|
|
660
|
-
if (!this.provider) {
|
|
661
|
-
throw new Error("Provider required for bridge send read operations and allowance checks");
|
|
662
|
-
}
|
|
663
|
-
const pool = this.parser.getCcipTokenPoolByVaultAddress(tokenAddress);
|
|
664
|
-
if (!pool?.router) {
|
|
665
|
-
throw new Error(`CCIP token pool not found for token address: ${tokenAddress}`);
|
|
666
|
-
}
|
|
667
|
-
if (destinationChain.ccipChainSelector === undefined ||
|
|
668
|
-
destinationChain.ccipChainSelector === null) {
|
|
669
|
-
throw new Error(`Destination chain "${destinationChain.name ?? destinationChain.identifier}" has no ccipChainSelector — cannot address a CCIP destination`);
|
|
670
|
-
}
|
|
671
|
-
const remoteChainSelector = destinationChain.ccipChainSelector;
|
|
672
|
-
const lane = this.parser.getCcipLaneByVaultAndSelector(tokenAddress, remoteChainSelector);
|
|
673
|
-
if (!lane) {
|
|
674
|
-
throw new Error(`No CCIP lane configured from this chain to "${destinationChain.identifier}" for token ${tokenAddress}`);
|
|
675
|
-
}
|
|
676
|
-
const amountBigInt = BigInt(amount);
|
|
677
|
-
// The Router moves the tokens, so it is the Router that needs approval.
|
|
678
|
-
const token = new ethers.Contract(tokenAddress, ["function allowance(address,address) view returns (uint256)"], this.provider);
|
|
679
|
-
const currentAllowance = await token.allowance(await this.getWalletAddress(), pool.router);
|
|
680
|
-
if (currentAllowance < amountBigInt) {
|
|
681
|
-
throw new Error(`Insufficient allowance for bridge transfer. Current allowance: ${currentAllowance}, required: ${amountBigInt}`);
|
|
682
|
-
}
|
|
683
|
-
const txCall = this.txBuilder.ccipSend(pool.router, {
|
|
684
|
-
destinationChainSelector: remoteChainSelector,
|
|
685
|
-
receiver,
|
|
686
|
-
amount: amountBigInt,
|
|
687
|
-
feeToken: options?.feeToken,
|
|
688
|
-
destinationGasLimit: options?.destinationGasLimit
|
|
689
|
-
}, tokenAddress, feeQuote.fee);
|
|
690
|
-
return this.execCall(txCall, options);
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Reports which bridge a vault uses, or undefined if it has none.
|
|
694
|
-
*
|
|
695
|
-
* A vault has exactly one active bridge, but different vaults use different
|
|
696
|
-
* ones, so branch on this rather than assuming either transport.
|
|
697
|
-
*
|
|
698
|
-
* @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
|
|
699
|
-
*/
|
|
700
|
-
getBridgeTransportForVault(tokenAddress) {
|
|
701
|
-
return this.parser.getBridgeTransportByVaultAddress(tokenAddress);
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Lists the networks a vault can bridge to, whichever transport it uses.
|
|
705
|
-
*
|
|
706
|
-
* Empty for a vault with no bridge, and for a bridged vault with no route
|
|
707
|
-
* configured yet. A network absent from this list cannot be sent to — the
|
|
708
|
-
* send would revert on chain — so drive the destination picker from it.
|
|
709
|
-
*
|
|
710
|
-
* @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
|
|
711
|
-
*/
|
|
712
|
-
getBridgeDestinationsForVault(tokenAddress) {
|
|
713
|
-
return this.parser.getBridgeDestinationsByVaultAddress(tokenAddress);
|
|
714
|
-
}
|
|
715
640
|
// ============================================
|
|
716
641
|
// Read-Only Methods
|
|
717
642
|
// ============================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Provider } from "ethers";
|
|
2
2
|
import { EVMDeploymentParser } from "../utils/deployment-parser.js";
|
|
3
|
-
import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain, IParkingLotInfo
|
|
3
|
+
import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain, IParkingLotInfo } from "../interfaces/index.js";
|
|
4
4
|
import { NumStr } from "../../common/types.js";
|
|
5
5
|
import { Chain, VaultsApi } from "../../api/v2/index.js";
|
|
6
6
|
/**
|
|
@@ -524,17 +524,4 @@ export declare class EVMVaultReader {
|
|
|
524
524
|
* @returns Combined fee quote including native fee and expected amounts
|
|
525
525
|
*/
|
|
526
526
|
getOFTFeeQuote(vaultId: string, sendParam: IOFTSendParam, payInLzToken?: boolean): Promise<IOFTFeeQuote>;
|
|
527
|
-
/**
|
|
528
|
-
* Quotes what a CCIP bridge send will cost.
|
|
529
|
-
*
|
|
530
|
-
* The counterpart to getOFTFeeQuote. CCIP charges one fee rather than
|
|
531
|
-
* LayerZero's native/LZ-token pair, and quotes no received amount: a
|
|
532
|
-
* burn-and-mint pool mints exactly what it burned, so the amount received is
|
|
533
|
-
* the amount sent.
|
|
534
|
-
*
|
|
535
|
-
* @param vaultId The vault (receipt token) address on the source chain
|
|
536
|
-
* @param sendParam Destination, receiver and amount
|
|
537
|
-
* @returns The fee and the token it is charged in
|
|
538
|
-
*/
|
|
539
|
-
getCcipFeeQuote(vaultId: string, sendParam: ICcipSendParam): Promise<ICcipFeeQuote>;
|
|
540
527
|
}
|
|
@@ -4,8 +4,6 @@ import EmberVaultABI from "../../abis/EmberVault.json" with { type: "json" };
|
|
|
4
4
|
import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json" };
|
|
5
5
|
import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
|
|
6
6
|
import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
|
|
7
|
-
import CcipRouterABI from "../../abis/CcipRouter.json" with { type: "json" };
|
|
8
|
-
import { ZERO_ADDRESS, encodeCcipReceiver, encodeCcipExtraArgs } from "../utils/ccip.js";
|
|
9
7
|
import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
|
|
10
8
|
import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
|
|
11
9
|
import { Configuration, VaultsApi } from "../../api/v2/index.js";
|
|
@@ -738,32 +736,4 @@ export class EVMVaultReader {
|
|
|
738
736
|
maxAmountLD: oftQuote.oftLimit.maxAmountLD
|
|
739
737
|
};
|
|
740
738
|
}
|
|
741
|
-
/**
|
|
742
|
-
* Quotes what a CCIP bridge send will cost.
|
|
743
|
-
*
|
|
744
|
-
* The counterpart to getOFTFeeQuote. CCIP charges one fee rather than
|
|
745
|
-
* LayerZero's native/LZ-token pair, and quotes no received amount: a
|
|
746
|
-
* burn-and-mint pool mints exactly what it burned, so the amount received is
|
|
747
|
-
* the amount sent.
|
|
748
|
-
*
|
|
749
|
-
* @param vaultId The vault (receipt token) address on the source chain
|
|
750
|
-
* @param sendParam Destination, receiver and amount
|
|
751
|
-
* @returns The fee and the token it is charged in
|
|
752
|
-
*/
|
|
753
|
-
async getCcipFeeQuote(vaultId, sendParam) {
|
|
754
|
-
const pool = this.parser.getCcipTokenPoolByVaultAddress(vaultId);
|
|
755
|
-
if (!pool?.router) {
|
|
756
|
-
throw new Error(`CCIP token pool not found for vault: ${vaultId}`);
|
|
757
|
-
}
|
|
758
|
-
const feeToken = sendParam.feeToken ?? ZERO_ADDRESS;
|
|
759
|
-
const router = new Contract(pool.router, CcipRouterABI.abi, this.provider);
|
|
760
|
-
const fee = await router.getFee(sendParam.destinationChainSelector, {
|
|
761
|
-
receiver: encodeCcipReceiver(sendParam.receiver),
|
|
762
|
-
data: "0x",
|
|
763
|
-
tokenAmounts: [{ token: vaultId, amount: sendParam.amount }],
|
|
764
|
-
feeToken,
|
|
765
|
-
extraArgs: encodeCcipExtraArgs(sendParam.destinationGasLimit)
|
|
766
|
-
});
|
|
767
|
-
return { fee, feeToken };
|
|
768
|
-
}
|
|
769
739
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EvmOFTAdapter } from "../../api/v2/index.js";
|
|
2
2
|
import { EvmProtocolInfo } from "../interfaces/index.js";
|
|
3
3
|
export declare class EVMDeploymentParser {
|
|
4
4
|
deployment: EvmProtocolInfo;
|
|
@@ -124,49 +124,4 @@ export declare class EVMDeploymentParser {
|
|
|
124
124
|
* @param vaultAddress The vault address (receipt token address in EVM deployment data)
|
|
125
125
|
*/
|
|
126
126
|
getOFTAdapterObjectByVaultAddress(vaultAddress: string): EvmOFTAdapter | undefined;
|
|
127
|
-
/**
|
|
128
|
-
* Finds the CCIP token pool entry for a given vault address.
|
|
129
|
-
* @param vaultAddress The vault address (receipt token address in EVM deployment data)
|
|
130
|
-
*/
|
|
131
|
-
getCcipTokenPoolByVaultAddress(vaultAddress: string): EvmCcipTokenPool | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Reports which bridge a vault uses, or undefined if it has none.
|
|
134
|
-
*
|
|
135
|
-
* A vault has exactly one active bridge, but different vaults use different
|
|
136
|
-
* ones, so call this before choosing between the LayerZero and CCIP send
|
|
137
|
-
* methods rather than assuming either.
|
|
138
|
-
*
|
|
139
|
-
* @param vaultAddress The vault address (receipt token address in EVM deployment data)
|
|
140
|
-
*/
|
|
141
|
-
getBridgeTransportByVaultAddress(vaultAddress: string): "LayerZero" | "CCIP" | undefined;
|
|
142
|
-
/**
|
|
143
|
-
* Lists the networks a vault can bridge to, whichever transport it uses.
|
|
144
|
-
*
|
|
145
|
-
* Returns an empty array for a vault with no bridge, so it is safe to render
|
|
146
|
-
* directly. Names are as the deployment records them, which is what
|
|
147
|
-
* bridgeSendTokenViaCcip takes as its destination.
|
|
148
|
-
*
|
|
149
|
-
* @param vaultAddress The vault address (receipt token address in EVM deployment data)
|
|
150
|
-
*/
|
|
151
|
-
getBridgeDestinationsByVaultAddress(vaultAddress: string): string[];
|
|
152
|
-
/**
|
|
153
|
-
* Finds the configured CCIP lane from a vault to a destination chain selector.
|
|
154
|
-
*
|
|
155
|
-
* A missing lane means the route is not configured and a send would revert.
|
|
156
|
-
*
|
|
157
|
-
* @param vaultAddress The vault address on the source chain
|
|
158
|
-
* @param remoteChainSelector The destination CCIP chain selector
|
|
159
|
-
*/
|
|
160
|
-
getCcipLaneByVaultAndSelector(vaultAddress: string, remoteChainSelector: string): EvmCcipLane | undefined;
|
|
161
|
-
/**
|
|
162
|
-
* Finds the configured CCIP lane from a vault to a destination network.
|
|
163
|
-
*
|
|
164
|
-
* Lanes are keyed by the destination's CCIP chain selector, which nothing
|
|
165
|
-
* outside CCIP knows, so this looks the lane up by network name instead.
|
|
166
|
-
* A missing lane means the route is not configured — sending would revert.
|
|
167
|
-
*
|
|
168
|
-
* @param vaultAddress The vault address on the source chain
|
|
169
|
-
* @param destinationNetwork The destination network name, e.g. "atlantic"
|
|
170
|
-
*/
|
|
171
|
-
getCcipLaneByVaultAndNetwork(vaultAddress: string, destinationNetwork: string): EvmCcipLane | undefined;
|
|
172
127
|
}
|