Skip to content

Commit 39fd90e

Browse files
authored
Merge pull request #98 from Interport-Finance/itp/new-vaults
interport: update Fantom vault asset addresses and add CCTP support
2 parents b168d93 + b336007 commit 39fd90e

File tree

2 files changed

+91
-7
lines changed

2 files changed

+91
-7
lines changed

src/adapters/interport-finance/constants.ts

+36-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const VAULT_TYPE_USDC = 1;
22
export const VAULT_TYPE_USDT = 2;
3+
export const VAULT_TYPE_CIRCLE_CCTP = 4;
34

45
export const ACTION_EXECUTOR_ADDRESSES = {
56
ethereum: "0x7b2E3FC7510D1A51b3bef735F985446589219354",
@@ -18,6 +19,23 @@ export const ACTION_EXECUTOR_ADDRESSES = {
1819
fantom: "0x7b2E3FC7510D1A51b3bef735F985446589219354",
1920
} as const;
2021

22+
export const ACTION_EXECUTOR_CCTP_ADDRESSES = {
23+
ethereum: "0x41b84aea119E945f4C275BADA0eD38b8aFE864c8",
24+
arbitrum: "0x41b84aea119E945f4C275BADA0eD38b8aFE864c8",
25+
bsc: "",
26+
era: "",
27+
base: "0x41b84aea119E945f4C275BADA0eD38b8aFE864c8",
28+
scroll: "",
29+
linea: "",
30+
polygon: "0x41b84aea119E945f4C275BADA0eD38b8aFE864c8",
31+
polygon_zkevm: "",
32+
optimism: "0x41b84aea119E945f4C275BADA0eD38b8aFE864c8",
33+
opbnb: "",
34+
avax: "0x41b84aea119E945f4C275BADA0eD38b8aFE864c8",
35+
eon: "",
36+
fantom: "",
37+
} as const;
38+
2139
export const VAULT_ASSET_ADDRESSES = {
2240
[VAULT_TYPE_USDC]: {
2341
ethereum: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
@@ -33,7 +51,7 @@ export const VAULT_ASSET_ADDRESSES = {
3351
opbnb: undefined,
3452
avax: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
3553
eon: '0xCc44eB064CD32AAfEEb2ebb2a47bE0B882383b53',
36-
fantom: '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75',
54+
fantom: '0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf',
3755
},
3856
[VAULT_TYPE_USDT]: {
3957
ethereum: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
@@ -49,6 +67,22 @@ export const VAULT_ASSET_ADDRESSES = {
4967
opbnb: '0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3',
5068
avax: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
5169
eon: '0xA167bcAb6791304EDa9B636C8beEC75b3D2829E6',
52-
fantom: '0x049d68029688eAbF473097a2fC38ef61633A3C7A',
70+
fantom: '0xcc1b99dDAc1a33c201a742A1851662E87BC7f22C',
71+
},
72+
[VAULT_TYPE_CIRCLE_CCTP] : {
73+
ethereum: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
74+
arbitrum: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
75+
bsc: undefined,
76+
era: undefined,
77+
base: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
78+
scroll: undefined,
79+
linea: undefined,
80+
polygon: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
81+
polygon_zkevm: undefined,
82+
optimism: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
83+
opbnb: undefined,
84+
avax: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
85+
eon: undefined,
86+
fantom: undefined,
5387
},
5488
};

src/adapters/interport-finance/index.ts

+55-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import { BridgeAdapter, PartialContractEventParams } from "../../helpers/bridgeAdapter.type";
22
import { BigNumber } from "ethers";
33
import { getTxDataFromEVMEventLogsCustom } from "./processTransactionsCustom";
4-
import {ACTION_EXECUTOR_ADDRESSES, VAULT_TYPE_USDC, VAULT_TYPE_USDT, VAULT_ASSET_ADDRESSES} from "./constants";
4+
import {
5+
ACTION_EXECUTOR_ADDRESSES,
6+
ACTION_EXECUTOR_CCTP_ADDRESSES,
7+
VAULT_TYPE_USDC,
8+
VAULT_TYPE_USDT,
9+
VAULT_TYPE_CIRCLE_CCTP,
10+
VAULT_ASSET_ADDRESSES
11+
} from "./constants";
512

613
type SupportedChains = keyof typeof ACTION_EXECUTOR_ADDRESSES;
714

8-
const depositParams = (chain: SupportedChains): PartialContractEventParams => {
9-
const actionExecutorAddress = ACTION_EXECUTOR_ADDRESSES[chain];
15+
const depositParams = (chain: SupportedChains, isCCTP = false): PartialContractEventParams => {
16+
const actionExecutorAddress =
17+
isCCTP ?
18+
ACTION_EXECUTOR_CCTP_ADDRESSES[chain] :
19+
ACTION_EXECUTOR_ADDRESSES[chain];
1020

1121
return {
1222
target: actionExecutorAddress,
@@ -33,8 +43,11 @@ const depositParams = (chain: SupportedChains): PartialContractEventParams => {
3343
};
3444
};
3545

36-
const withdrawParams = (chain: SupportedChains): PartialContractEventParams => {
37-
const actionExecutorAddress = ACTION_EXECUTOR_ADDRESSES[chain];
46+
const withdrawParams = (chain: SupportedChains, isCCTP = false): PartialContractEventParams => {
47+
const actionExecutorAddress =
48+
isCCTP ?
49+
ACTION_EXECUTOR_CCTP_ADDRESSES[chain] :
50+
ACTION_EXECUTOR_ADDRESSES[chain];
3851

3952
return {
4053
target: actionExecutorAddress,
@@ -114,9 +127,42 @@ const variableBalanceUsdtParams = (chain: SupportedChains): PartialContractEvent
114127
};
115128
};
116129

130+
const variableBalanceCctpParams = (chain: SupportedChains): PartialContractEventParams => {
131+
const actionExecutorAddress = ACTION_EXECUTOR_CCTP_ADDRESSES[chain];
132+
133+
return {
134+
target: actionExecutorAddress,
135+
topic: "VariableBalanceAllocated(uint256,address,uint256,uint256)",
136+
abi: [
137+
"event VariableBalanceAllocated(uint256 indexed actionId, address indexed recipient, uint256 vaultType, uint256 amount)"
138+
],
139+
isDeposit: false,
140+
logKeys: {
141+
blockNumber: "blockNumber",
142+
txHash: "transactionHash",
143+
},
144+
argKeys: {
145+
amount: "amount",
146+
to: "recipient",
147+
},
148+
fixedEventData: {
149+
token: VAULT_ASSET_ADDRESSES[VAULT_TYPE_CIRCLE_CCTP][chain],
150+
from: actionExecutorAddress,
151+
},
152+
filter: {
153+
includeArg: [{ vaultType: BigNumber.from(VAULT_TYPE_CIRCLE_CCTP) as unknown as string }],
154+
},
155+
};
156+
};
157+
117158
const constructParams = (chain: SupportedChains) => {
118159
const eventParams = [depositParams(chain), withdrawParams(chain)];
119160

161+
if (ACTION_EXECUTOR_CCTP_ADDRESSES[chain]) {
162+
eventParams.push(depositParams(chain, true));
163+
eventParams.push(withdrawParams(chain, true));
164+
}
165+
120166
if (VAULT_ASSET_ADDRESSES[VAULT_TYPE_USDC][chain]) {
121167
eventParams.push(variableBalanceUsdcParams(chain));
122168
}
@@ -125,6 +171,10 @@ const constructParams = (chain: SupportedChains) => {
125171
eventParams.push(variableBalanceUsdtParams(chain));
126172
}
127173

174+
if (VAULT_ASSET_ADDRESSES[VAULT_TYPE_CIRCLE_CCTP][chain]) {
175+
eventParams.push(variableBalanceCctpParams(chain));
176+
}
177+
128178
return async (fromBlock: number, toBlock: number) =>
129179
getTxDataFromEVMEventLogsCustom("interport", chain, fromBlock, toBlock, eventParams);
130180
};

0 commit comments

Comments
 (0)