Skip to content

Commit dd7cc83

Browse files
committed
update unichain config
1 parent ce24c55 commit dd7cc83

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed

src/common/utils/viemClients.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@ export const bartio = defineChain({
3232
},
3333
})
3434

35+
export const unichain = defineChain({
36+
id: 130,
37+
name: "Unichain",
38+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
39+
rpcUrls: {
40+
default: {
41+
http: ["https://mainnet.unichain.org/"],
42+
},
43+
},
44+
blockExplorers: {
45+
default: {
46+
name: "Uniscan",
47+
url: "https://uniscan.xyz",
48+
apiUrl: "https://api.uniscan.xyz/api",
49+
},
50+
},
51+
contracts: {
52+
multicall3: {
53+
address: "0xca11bde05977b3631167028862be2a173976ca11",
54+
blockCreated: 0,
55+
},
56+
},
57+
})
58+
3559
export const berachain = defineChain({
3660
id: 80094,
3761
name: "Berachain",
@@ -87,6 +111,7 @@ export const RPC_URLS: Record<number, string> = {
87111
[berachain.id]: process.env.RPC_URL_80094 || "",
88112
[chains.avalanche.id]: process.env.RPC_URL_43114 || "",
89113
[146]: process.env.RPC_URL_146 || "",
114+
[130]: process.env.RPC_URL_130 || "",
90115
[chains.foundry.id]: process.env.RPC_URL_31337 || "http://localhost:8545",
91116
} as const
92117

@@ -128,6 +153,7 @@ export const createClients = (): Record<number, Client<Transport, Chain>> => ({
128153
chain: chains.avalanche,
129154
transport: http(RPC_URLS[chains.avalanche.id]),
130155
}),
156+
[unichain.id]: createChainConfig(unichain),
131157
})
132158

133159
export const viemClients = createClients()

src/swapService/config/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import defaultRoutingConfig from "./default"
99
import mainnetRoutingConfig from "./mainnet"
1010
import sonicRoutingConfig from "./sonic"
1111
import swellRoutingConfig from "./swell"
12+
import unichainRoutingConfig from "./unichain"
1213

1314
const routingConfig: RoutingConfig = {
1415
[mainnet.id]: mainnetRoutingConfig,
@@ -19,6 +20,7 @@ const routingConfig: RoutingConfig = {
1920
[80094]: berachainRoutingConfig,
2021
[60808]: bobRoutingConfig,
2122
[146]: sonicRoutingConfig,
23+
[130]: unichainRoutingConfig,
2224
}
2325

2426
export const getRoutingConfig = (chainId: number) => {

src/swapService/config/unichain.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { type ChainRoutingConfig, SwapperMode } from "../interface"
2+
import {
3+
StrategyBalmySDK,
4+
StrategyERC4626Wrapper,
5+
StrategyRepayWrapper,
6+
} from "../strategies"
7+
8+
const SUSDC_UNICHAIN = "0x14d9143BEcC348920b68D123687045db49a016C6"
9+
10+
const unichainRoutingConfig: ChainRoutingConfig = [
11+
// WRAPPERS
12+
{
13+
strategy: StrategyRepayWrapper.name(),
14+
match: {
15+
isRepay: true,
16+
swapperModes: [SwapperMode.EXACT_IN],
17+
},
18+
},
19+
{
20+
strategy: StrategyERC4626Wrapper.name(),
21+
match: {
22+
tokensInOrOut: [SUSDC_UNICHAIN],
23+
},
24+
},
25+
// DEFAULTS
26+
{
27+
strategy: StrategyBalmySDK.name(),
28+
config: {
29+
sourcesFilter: {
30+
includeSources: ["kyberswap", "li-fi", "open-ocean", "uniswap", "enso"],
31+
},
32+
},
33+
match: {},
34+
},
35+
]
36+
37+
export default unichainRoutingConfig

src/swapService/strategies/strategyERC4626Wrapper.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ const defaultConfig: {
140140
asset: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
141141
assetDustEVault: "0xf524d75b7Fedf6301996A21337FFA45D330e60EF",
142142
},
143+
{
144+
chainId: 130,
145+
protocol: "sUSDC",
146+
vault: "0x14d9143BEcC348920b68D123687045db49a016C6",
147+
asset: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
148+
assetDustEVault: "0x2888F098157162EC4a4274F7ad2c69921e95834D",
149+
},
143150
],
144151
}
145152

0 commit comments

Comments
 (0)