Skip to content

Commit

Permalink
add Sonic mainnet (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
IDIDOS authored Dec 28, 2024
2 parents f50a296 + 161737b commit b18d273
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rubic-sdk",
"version": "5.49.8",
"version": "5.49.9",
"description": "Simplify dApp creation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions src/common/tokens/constants/native-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,5 +699,12 @@ export const nativeTokensList: Record<BlockchainName, Token> = {
name: 'ZIL',
symbol: 'ZIL',
decimals: 18
}),
[BLOCKCHAIN_NAME.SONIC]: new Token({
blockchain: BLOCKCHAIN_NAME.SONIC,
address: EvmWeb3Pure.nativeTokenAddress,
name: 'SONIC',
symbol: 'S',
decimals: 18
})
};
1 change: 1 addition & 0 deletions src/common/tokens/constants/wrapped-addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const wrappedAddress: Partial<Record<EvmBlockchainName, string>> = {
[BLOCKCHAIN_NAME.BAHAMUT]: '0x4084ab20f8ffca76c19aaf854fb5fe9de6217fbb',
[BLOCKCHAIN_NAME.GRAVITY]: '0xBB859E225ac8Fb6BE1C7e38D87b767e95Fef0EbD',
[BLOCKCHAIN_NAME.FLARE]: '0x1d80c49bbbcd1c0911346656b529df9e5c2f783d',
[BLOCKCHAIN_NAME.SONIC]: '0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38',
// Testnet
[BLOCKCHAIN_NAME.GOERLI]: '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6',
[BLOCKCHAIN_NAME.SCROLL_SEPOLIA]: '0x5300000000000000000000000000000000000004',
Expand Down
9 changes: 8 additions & 1 deletion src/common/tokens/constants/wrapped-native-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,16 @@ export const wrappedNativeTokensList: Partial<Record<EvmBlockchainName, Token>>
}),
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: new Token({
blockchain: BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET,
address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
address: '0x4200000000000000000000000000000000000006',
name: 'Wrapped Ether',
symbol: 'WETH',
decimals: 18
}),
[BLOCKCHAIN_NAME.SONIC]: new Token({
blockchain: BLOCKCHAIN_NAME.SONIC,
address: '0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38',
name: 'Wrapped Sonic',
symbol: 'WS',
decimals: 18
})
};
3 changes: 2 additions & 1 deletion src/core/blockchain/models/backend-blockchains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ const BLOCKCHAINS_MAPPING = {
[BLOCKCHAIN_NAME.BAHAMUT]: 'bahamut',
[BLOCKCHAIN_NAME.BITLAYER]: 'bitlayer',
[BLOCKCHAIN_NAME.GRAVITY]: 'gravity',
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: 'unichain-sepolia-testnet'
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: 'unichain-sepolia-testnet',
[BLOCKCHAIN_NAME.SONIC]: 'sonic'
} as const;

export const TO_BACKEND_BLOCKCHAINS: Record<BlockchainName, BackendBlockchain> = {
Expand Down
3 changes: 2 additions & 1 deletion src/core/blockchain/models/blockchain-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const EVM_BLOCKCHAIN_NAME = {
CORE: 'CORE',
BAHAMUT: 'BAHAMUT',
BITLAYER: 'BITLAYER',
GRAVITY: 'GRAVITY'
GRAVITY: 'GRAVITY',
SONIC: 'SONIC'
} as const;

export const BLOCKCHAIN_NAME = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const blockchainId: Record<BlockchainName, number> = {
[BLOCKCHAIN_NAME.BAHAMUT]: 5165,
[BLOCKCHAIN_NAME.BITLAYER]: 200901,
[BLOCKCHAIN_NAME.GRAVITY]: 1625,
[BLOCKCHAIN_NAME.SONIC]: 146,
// Tesnents
[BLOCKCHAIN_NAME.GOERLI]: 5,
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN_TESTNET]: 87,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ export const MULTICALL_ADDRESSES: Record<Web3PublicSupportedBlockchain, string>
[BLOCKCHAIN_NAME.BITLAYER]: '0x5B256fE9e993902eCe49D138a5b1162cBb529474',
[BLOCKCHAIN_NAME.GRAVITY]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[BLOCKCHAIN_NAME.FLARE]: '0xcA11bde05977b3631167028862bE2a173976CA11',
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: '0xca11bde05977b3631167028862be2a173976ca11'
[BLOCKCHAIN_NAME.UNICHAIN_SEPOLIA_TESTNET]: '0xca11bde05977b3631167028862be2a173976ca11',
[BLOCKCHAIN_NAME.SONIC]: '0xcA11bde05977b3631167028862bE2a173976CA11'
};
3 changes: 2 additions & 1 deletion src/features/common/constants/proxy-supported-blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export const proxySupportedBlockchains = [
BLOCKCHAIN_NAME.BAHAMUT,
BLOCKCHAIN_NAME.BITLAYER,
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.FLARE
BLOCKCHAIN_NAME.FLARE,
BLOCKCHAIN_NAME.SONIC
// BLOCKCHAIN_NAME.OKE_X_CHAIN,
// BLOCKCHAIN_NAME.GNOSIS,
// BLOCKCHAIN_NAME.FUSE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const ALTERNATIVE_ROUTER1_NETWORKS = [
BLOCKCHAIN_NAME.CORE,
BLOCKCHAIN_NAME.BAHAMUT,
BLOCKCHAIN_NAME.BITLAYER,
BLOCKCHAIN_NAME.FLARE
BLOCKCHAIN_NAME.FLARE,
BLOCKCHAIN_NAME.SONIC
] as const;

function isAlternativeRouter1Network(blockchain: BlockchainName): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const owlToSupportedBlockchains = [
BLOCKCHAIN_NAME.TAIKO,
BLOCKCHAIN_NAME.CORE,
BLOCKCHAIN_NAME.BITLAYER,
BLOCKCHAIN_NAME.GRAVITY
BLOCKCHAIN_NAME.GRAVITY,
BLOCKCHAIN_NAME.SONIC
] as const;

export type OwlToSupportedBlockchain = (typeof owlToSupportedBlockchains)[number];
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ export const openOceanBlockchainName: Record<OpenoceanOnChainSupportedBlockchain
[BLOCKCHAIN_NAME.BLAST]: 'blast',
[BLOCKCHAIN_NAME.MODE]: 'mode',
[BLOCKCHAIN_NAME.ROOTSTOCK]: 'rootstock',
[BLOCKCHAIN_NAME.MANTLE]: 'mantle'
[BLOCKCHAIN_NAME.MANTLE]: 'mantle',
[BLOCKCHAIN_NAME.SONIC]: 'sonic'
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const openoceanOnChainSupportedBlockchains = [
BLOCKCHAIN_NAME.BLAST,
BLOCKCHAIN_NAME.MODE,
BLOCKCHAIN_NAME.ROOTSTOCK,
BLOCKCHAIN_NAME.MANTLE
BLOCKCHAIN_NAME.MANTLE,
BLOCKCHAIN_NAME.SONIC
] as const;

export type OpenoceanOnChainSupportedBlockchain =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import { OpenOceanApiService } from './services/open-ocean-api-service';
export class OpenOceanProvider extends AggregatorOnChainProvider {
public readonly tradeType = ON_CHAIN_TRADE_TYPE.OPEN_OCEAN;

public static readonly nativeAddress = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';

public isSupportedBlockchain(blockchain: BlockchainName): boolean {
return openoceanOnChainSupportedBlockchains.some(item => item === blockchain);
}
Expand Down

0 comments on commit b18d273

Please sign in to comment.