Skip to content

Commit 9eb602d

Browse files
committed
feat: add sonic network
1 parent b8689f8 commit 9eb602d

File tree

15 files changed

+734
-13
lines changed

15 files changed

+734
-13
lines changed

src/sdk/chain/chains.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { Chain } from "viem";
2-
import { arbitrum, base, mainnet, optimism } from "viem/chains";
2+
import { arbitrum, base, mainnet, optimism, sonic } from "viem/chains";
33

44
export const SUPPORTED_CHAINS = [
55
"Mainnet",
66
"Arbitrum",
77
"Optimism",
88
"Base",
9-
// "Sonic",
9+
"Sonic",
1010
] as const;
1111

1212
export type NetworkType = (typeof SUPPORTED_CHAINS)[number];
@@ -16,15 +16,15 @@ export const chains: Record<NetworkType, Chain> = {
1616
Arbitrum: arbitrum,
1717
Optimism: optimism,
1818
Base: base,
19-
// Sonic: sonic,
19+
Sonic: sonic,
2020
};
2121

2222
const CHAINS_BY_ID: Record<number, NetworkType> = {
2323
[mainnet.id]: "Mainnet",
2424
[arbitrum.id]: "Arbitrum",
2525
[optimism.id]: "Optimism",
2626
[base.id]: "Base",
27-
// [sonic.id]: "Sonic",
27+
[sonic.id]: "Sonic",
2828
};
2929

3030
export const getNetworkType = (chainId: number): NetworkType => {

src/sdk/constants/address-provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ export const ADDRESS_PROVIDER: Record<NetworkType, Address> = {
4141
Arbitrum: "0x7d04eCdb892Ae074f03B5D0aBA03796F90F3F2af",
4242
Optimism: "0x3761ca4BFAcFCFFc1B8034e69F19116dD6756726",
4343
Base: NOT_DEPLOYED,
44+
Sonic: NOT_DEPLOYED,
4445
};

src/sdk/constants/addresses.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,47 @@ export const USDC: Record<NetworkType, Address> = {
2424
Arbitrum: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
2525
Optimism: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
2626
Base: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
27+
Sonic: "0x29219dd400f2Bf60E5a23d13Be72B486D4038894",
2728
};
2829

2930
export const USDT: Record<NetworkType, Address> = {
3031
Mainnet: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
3132
Arbitrum: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
3233
Optimism: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
3334
Base: NOT_DEPLOYED,
35+
Sonic: NOT_DEPLOYED,
3436
};
3537

3638
export const WETH: Record<NetworkType, Address> = {
3739
Mainnet: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
3840
Arbitrum: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
3941
Optimism: "0x4200000000000000000000000000000000000006",
4042
Base: NOT_DEPLOYED,
43+
Sonic: NOT_DEPLOYED,
4144
};
4245

4346
export const TIMELOCK: Record<NetworkType, Address> = {
4447
Mainnet: "0xa133C9A92Fb8dDB962Af1cbae58b2723A0bdf23b",
4548
Arbitrum: "0x148DD932eCe1155c11006F5650c6Ff428f8D374A",
4649
Optimism: "0x148DD932eCe1155c11006F5650c6Ff428f8D374A",
4750
Base: NOT_DEPLOYED,
51+
Sonic: NOT_DEPLOYED,
4852
};
4953

5054
export const GEARBOX_MULTISIG: Record<NetworkType, Address> = {
5155
Mainnet: "0xA7D5DDc1b8557914F158076b228AA91eF613f1D5",
5256
Arbitrum: "0x57Fd8B1a9213624157786Fff4a7bc532Ce717773",
5357
Optimism: "0x8bA8cd6D00919ceCc19D9B4A2c8669a524883C4c",
5458
Base: NOT_DEPLOYED,
59+
Sonic: "0xacEB9dc6a81f1C9E2d8a86c3bFec3f6EF584139D",
5560
};
5661

5762
export const GEARBOX_RISK_CURATORS: Record<NetworkType, Address[]> = {
5863
Mainnet: [TIMELOCK.Mainnet],
5964
Arbitrum: [TIMELOCK.Arbitrum],
6065
Optimism: [TIMELOCK.Optimism],
6166
Base: [TIMELOCK.Base],
67+
Sonic: [TIMELOCK.Sonic],
6268
};
6369

6470
/**
@@ -71,4 +77,5 @@ export const DEPRECIATED_POOLS = {
7177
Arbitrum: {},
7278
Optimism: {},
7379
Base: {},
80+
Sonic: {},
7481
} as const;

src/sdk/constants/networks.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ export const ADDRESS_PROVIDER_BLOCK: Record<NetworkType, bigint> = {
88
Arbitrum: 184650310n,
99
Optimism: 118410666n,
1010
Base: 0n,
11+
Sonic: 0n,
1112
};
1213

1314
const BLOCK_DURATION_BY_NETWORK: Record<NetworkType, number> = {
1415
Mainnet: 12.16,
1516
Arbitrum: 0.26,
1617
Optimism: 1.64,
1718
Base: 2.01,
19+
// TODO:
20+
Sonic: 1,
1821
};
1922

2023
const RAMP_TIME = 30 * 24 * 60 * 60 * 1.2;
@@ -23,6 +26,7 @@ export const RAMP_DURATION_BY_NETWORK: Record<NetworkType, bigint> = {
2326
Arbitrum: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.Arbitrum)),
2427
Optimism: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.Optimism)),
2528
Base: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.Base)),
29+
Sonic: BigInt(Math.floor(RAMP_TIME / BLOCK_DURATION_BY_NETWORK.Sonic)),
2630
};
2731

2832
const WEEK = 7 * 24 * 60 * 60;
@@ -31,4 +35,5 @@ export const BLOCKS_PER_WEEK_BY_NETWORK: Record<NetworkType, bigint> = {
3135
Arbitrum: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Arbitrum)),
3236
Optimism: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Optimism)),
3337
Base: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Base)),
38+
Sonic: BigInt(Math.floor(WEEK / BLOCK_DURATION_BY_NETWORK.Sonic)),
3439
};

0 commit comments

Comments
 (0)