Skip to content

Commit 388aa04

Browse files
committed
Merge branch 'development'
2 parents 6056cea + 7b32ed2 commit 388aa04

25 files changed

+2433
-2094
lines changed

.env.template

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ RPC_URL_80084=""
2323
# foundry
2424
RPC_URL_31337=""
2525
# sonic
26-
RPC_URL_146 s=""
26+
RPC_URL_146=""
27+
# bera
28+
RPC_URL_80094=""
29+
# unichain
30+
RPC_URL_130=""
2731

2832
# Provider API keys
2933
LIFI_API_KEY=""
@@ -34,4 +38,6 @@ OKX_API_KEY=""
3438
OKX_PASSPHRASE=""
3539
OKX_SECRET_KEY=""
3640
ODOS_API_KEY=""
37-
ODOS_REFERRAL_CODE=""
41+
ODOS_REFERRAL_CODE=""
42+
OOGABOOGA_API_KEY=""
43+
OX_API_KEY=""

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"dependencies": {
2727
"@asteasolutions/zod-to-openapi": "7.2.0",
2828
"@balmy/sdk": "0.6.8",
29+
"@berachain-foundation/berancer-sdk": "^0.33.2",
2930
"@uniswap/router-sdk": "1.15.0",
3031
"@uniswap/sdk-core": "6.1.1",
3132
"@uniswap/smart-order-router": "4.9.2",

pnpm-lock.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/routes/swap/swapRouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function parseRequest(request: Request): SwapParams {
9999
// TODO
100100
// if (!isSupportedChainId(validatedParams.chainId)) {
101101
// throw new Error("Unsupported chainId")
102-
// }
102+
// }
103103

104104
const chainId = validatedParams.chainId
105105
const tokenIn = findToken(chainId, validatedParams.tokenIn)

src/common/utils/contractBook.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const contractBook: any = {
99
[chains.polygon.id]: "0x3e43F3CE1C364722df6470381Fa1F15ffbFB37E3",
1010
[1923]: "0x05Eb1A647265D974a1B0A57206048312604Ac6C3",
1111
[146]: "0xbAf5B12c92711a3657DD4adA6b3C7801e83Bb56a",
12+
[80094]: "0x4A35e6A872cf35623cd3fD07ebECEDFc0170D705",
13+
[130]: "0x319E8ecd3BaB57fE684ca1aCfaB60c5603087B3A",
1214
},
1315
},
1416
swapVerifier: {
@@ -19,6 +21,8 @@ const contractBook: any = {
1921
[chains.polygon.id]: "0x50C5ca05E916459F32c517932f1b4D78fb11018F",
2022
[1923]: "0x392C1570b3Bf29B113944b759cAa9a9282DA12Fe",
2123
[146]: "0x003ef4048b45a5A79D4499aaBd52108B3Bc9209f",
24+
[80094]: "0x6fFf8Ac4AB123B62FF5e92aBb9fF702DCBD6C939",
25+
[130]: "0x7eaf8C22480129E5D7426e3A33880D7bE19B50a7",
2226
},
2327
},
2428
}

src/common/utils/tokenList.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1+
import fs from "node:fs"
12
import type { Address } from "viem"
2-
import tokenList1 from "../../tokenLists/tokenList_1"
3-
import tokenList146 from "../../tokenLists/tokenList_146"
4-
import tokenList1923 from "../../tokenLists/tokenList_1923"
5-
import tokenList8453 from "../../tokenLists/tokenList_8543"
63

74
export type TokenListItem = {
85
addressInfo: Address
@@ -18,12 +15,19 @@ export type TokenListItem = {
1815
}
1916
}
2017

21-
const cache: Record<number, TokenListItem[]> = {
22-
1: tokenList1 as TokenListItem[],
23-
8453: tokenList8453 as TokenListItem[],
24-
1923: tokenList1923 as TokenListItem[],
25-
146: tokenList146 as TokenListItem[],
26-
}
18+
const cache: Record<number, TokenListItem[]> = {}
19+
;(function buildCache() {
20+
const dir = `${__dirname}/../tokenLists`
21+
const files = fs.readdirSync(dir)
22+
for (const file of files) {
23+
const match = file.match(/(\d+)/g)
24+
if (!match) throw new Error("Invalid tokenlist file")
25+
const chainId = Number(match[0])
26+
cache[chainId] = JSON.parse(
27+
fs.readFileSync(`${dir}/${file}`).toString(),
28+
) as TokenListItem[]
29+
}
30+
})()
2731

2832
export default function getTokenList(chainId: number): TokenListItem[] {
2933
return cache[chainId] || []

src/common/utils/viemClients.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const RPC_URLS: Record<number, string> = {
3838
[chains.arbitrum.id]: process.env.RPC_URL_42161 || "",
3939
[chains.base.id]: process.env.RPC_URL_8453 || "",
4040
[bartio.id]: process.env.RPC_URL_80084 || "",
41+
[80094]: process.env.RPC_URL_80094 || "",
4142
[chains.foundry.id]: process.env.RPC_URL_31337 || "http://localhost:8545",
4243
} as const
4344

src/swapService/config/bera.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { type ChainRoutingConfig, SwapperMode } from "../interface"
2+
import { StrategyBalmySDK, StrategyRepayWrapper } from "../strategies"
3+
4+
const beraRoutingConfig: ChainRoutingConfig = [
5+
// WRAPPERS
6+
{
7+
strategy: StrategyRepayWrapper.name(),
8+
match: {
9+
isRepay: true,
10+
swapperModes: [SwapperMode.EXACT_IN],
11+
},
12+
},
13+
// DEFAULTS
14+
{
15+
strategy: StrategyBalmySDK.name(),
16+
config: {
17+
sourcesFilter: {
18+
includeSources: ["oogabooga"],
19+
},
20+
},
21+
match: {},
22+
},
23+
]
24+
25+
export default beraRoutingConfig

src/swapService/config/default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const defaultRoutingConfig: ChainRoutingConfig = [
2323
"li-fi",
2424
"open-ocean",
2525
"uniswap",
26+
"0x",
2627
],
2728
},
2829
},

src/swapService/config/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { base, mainnet } from "viem/chains"
22
import type { RoutingConfig } from "../interface"
33
import baseRoutingConfig from "./base"
4+
import beraRoutingConfig from "./bera"
45
import defaultRoutingConfig from "./default"
56
import mainnetRoutingConfig from "./mainnet"
67
import swellRoutingConfig from "./swell"
@@ -9,6 +10,7 @@ const routingConfig: RoutingConfig = {
910
[mainnet.id]: mainnetRoutingConfig,
1011
[base.id]: baseRoutingConfig,
1112
[1923]: swellRoutingConfig,
13+
[80094]: beraRoutingConfig,
1214
}
1315

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

0 commit comments

Comments
 (0)