Skip to content

Commit

Permalink
Merge pull request #146 from clober-dex/feat/add-sonic
Browse files Browse the repository at this point in the history
feat: add sonic mainnet
  • Loading branch information
Dorvin authored Dec 12, 2024
2 parents 23eb2b7 + 3d40786 commit 7202846
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@clober/v2-sdk",
"version": "0.0.91",
"version": "0.0.92",
"description": "🛠 An SDK for building applications on top of Clober V2",
"files": [
"dist"
Expand Down
12 changes: 12 additions & 0 deletions src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ export const CONTRACT_ADDRESSES: {
ElectionGovernor: zeroAddress,
KeepersRegistry: zeroAddress,
},
[CHAIN_IDS.SONIC_MAINNET]: {
Controller: getAddress('0xADc0CC0c3Ea12e57b8BcB7d7C8ac03222487E337'),
BookManager: getAddress('0xD4aD5Ed9E1436904624b6dB8B1BE31f36317C636'),
BookViewer: getAddress('0xe81e78f946e34d13Dcb6fd46a78713E0FFDA5613'),
Rebalancer: zeroAddress,
Strategy: zeroAddress,
Minter: zeroAddress,
Operator: zeroAddress,
VoteLockedCloberToken: zeroAddress,
ElectionGovernor: zeroAddress,
KeepersRegistry: zeroAddress,
},
[CHAIN_IDS.ZKSYNC]: {
Controller: getAddress('0x2Bd904F455928833F8E8C706d1cf01Eb5daaee7C'),
BookManager: getAddress('0xAc6AdB2727F99C309acd511D942c0b2812e03614'),
Expand Down
3 changes: 3 additions & 0 deletions src/constants/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { arbitrumSepolia, base, type Chain, zkSync } from 'viem/chains'
import { cloberTestChain, cloberTestChain2 } from './test-chain'
import { berachainBartioTestnet } from './bera-bartio-chain'
import { mitosisTestnet } from './mitosis-testnet-chain'
import { sonicMainnet } from './sonic-mainnet-chain'

export enum CHAIN_IDS {
CLOBER_TESTNET = cloberTestChain.id,
Expand All @@ -11,6 +12,7 @@ export enum CHAIN_IDS {
BASE = base.id,
BERACHAIN_TESTNET = berachainBartioTestnet.id,
MITOSIS_TESTNET = mitosisTestnet.id,
SONIC_MAINNET = sonicMainnet.id,
ZKSYNC = zkSync.id,
}

Expand All @@ -23,6 +25,7 @@ export const CHAIN_MAP: {
[CHAIN_IDS.BASE]: base,
[CHAIN_IDS.BERACHAIN_TESTNET]: berachainBartioTestnet,
[CHAIN_IDS.MITOSIS_TESTNET]: mitosisTestnet,
[CHAIN_IDS.SONIC_MAINNET]: sonicMainnet,
[CHAIN_IDS.ZKSYNC]: zkSync,
}

Expand Down
15 changes: 15 additions & 0 deletions src/constants/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export const MITO: Currency = {
decimals: 18,
}

export const S: Currency = {
address: zeroAddress,
name: 'Sonic',
symbol: 'S',
decimals: 18,
}

export const NATIVE_CURRENCY: {
[chain in CHAIN_IDS]: Currency
} = {
Expand All @@ -34,6 +41,7 @@ export const NATIVE_CURRENCY: {
[CHAIN_IDS.BASE]: ETH,
[CHAIN_IDS.BERACHAIN_TESTNET]: BERA,
[CHAIN_IDS.MITOSIS_TESTNET]: MITO,
[CHAIN_IDS.SONIC_MAINNET]: S,
[CHAIN_IDS.ZKSYNC]: ETH,
}

Expand All @@ -54,6 +62,9 @@ export const WETH_ADDRESSES: {
[CHAIN_IDS.MITOSIS_TESTNET]: [
'0x8B71fD76b23721d0D73CA14Ea6464AAD70149B67', // WMITO
],
[CHAIN_IDS.SONIC_MAINNET]: [
'0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38', // wS
],
[CHAIN_IDS.ZKSYNC]: ['0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91'],
}

Expand All @@ -76,6 +87,7 @@ export const STABLE_COIN_ADDRESSES: {
'0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDbC
'0x4621b7A9c75199271F773Ebd9A499dbd165c3191', // DOLA
'0xB79DD08EA68A908A97220C76d19A6aA9cBDE4376', // USD+
'0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', // DAI
],
[CHAIN_IDS.BERACHAIN_TESTNET]: [
'0x0E4aaF1351de4c0264C5c7056Ef3777b41BD8e03', // HONEY
Expand All @@ -86,6 +98,9 @@ export const STABLE_COIN_ADDRESSES: {
'0xCB0CedF61be0Bf4d5F6596b8ab296614b154db91', // USDT
'0xb8f230Ea91516787F2cbB2c63b147Ec79988E3ED', // USDe
],
[CHAIN_IDS.SONIC_MAINNET]: [
// TODO: add stable coin at day 1
],
[CHAIN_IDS.ZKSYNC]: [
'0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // USDC
],
Expand Down
2 changes: 2 additions & 0 deletions src/constants/fee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const MAKER_DEFAULT_POLICY: {
[CHAIN_IDS.BASE]: new FeePolicy(true, 0n), // 0%,
[CHAIN_IDS.BERACHAIN_TESTNET]: new FeePolicy(true, 0n), // 0%,
[CHAIN_IDS.MITOSIS_TESTNET]: new FeePolicy(true, 0n), // 0%,
[CHAIN_IDS.SONIC_MAINNET]: new FeePolicy(true, 0n), // 0%,
[CHAIN_IDS.ZKSYNC]: new FeePolicy(true, 0n), // 0%,
}

Expand All @@ -23,5 +24,6 @@ export const TAKER_DEFAULT_POLICY: {
[CHAIN_IDS.BASE]: new FeePolicy(true, 100n), // 0.01%
[CHAIN_IDS.BERACHAIN_TESTNET]: new FeePolicy(true, 100n), // 0.01%
[CHAIN_IDS.MITOSIS_TESTNET]: new FeePolicy(true, 100n), // 0.01%
[CHAIN_IDS.SONIC_MAINNET]: new FeePolicy(true, 100n), // 0.01%
[CHAIN_IDS.ZKSYNC]: new FeePolicy(true, 100n), // 0.01%
}
27 changes: 27 additions & 0 deletions src/constants/sonic-mainnet-chain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineChain } from 'viem'

export const sonicMainnet = /*#__PURE__*/ defineChain({
id: 146,
name: 'Sonic Mainnet',
nativeCurrency: {
decimals: 18,
name: 'Sonic',
symbol: 'S',
},
rpcUrls: {
default: { http: ['https://rpc.soniclabs.com'] },
},
blockExplorers: {
default: {
name: 'Sonic Mainnet',
url: 'https://sonicscan.org',
},
},
testnet: false,
contracts: {
multicall3: {
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
blockCreated: 60,
},
},
})
2 changes: 2 additions & 0 deletions src/constants/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const SUBGRAPH_URL: {
'https://api.goldsky.com/api/public/project_clsljw95chutg01w45cio46j0/subgraphs/v2-core-subgraph-berachain-bartio/v1.8.1/gn',
[CHAIN_IDS.MITOSIS_TESTNET]:
'https://api.goldsky.com/api/public/project_clsljw95chutg01w45cio46j0/subgraphs/v2-core-subgraph-mitosis-testnet/v1.8.1/gn',
[CHAIN_IDS.SONIC_MAINNET]:
'https://subgraph.satsuma-prod.com/f6a8c4889b7b/clober/v2-core-subgraph-sonic-mainnet/api',
[CHAIN_IDS.ZKSYNC]:
'https://api.goldsky.com/api/public/project_clsljw95chutg01w45cio46j0/subgraphs/v2-core-subgraph-zksync-era/v1.5.5/gn',
}
Expand Down

0 comments on commit 7202846

Please sign in to comment.