Skip to content

Commit

Permalink
feat: sonic chain (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoslr authored Jan 16, 2025
1 parent b983b8c commit 9ab9b25
Show file tree
Hide file tree
Showing 17 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/currency/src/chains/evm/data/sonic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const chainId = 146;
2 changes: 2 additions & 0 deletions packages/currency/src/chains/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as SepoliaDefinition from './data/sepolia';
import * as ZkSyncEraTestnetDefinition from './data/zksync-era-testnet';
import * as ZkSyncEraDefinition from './data/zksync-era';
import * as BaseDefinition from './data/base';
import * as SonicDefinition from './data/sonic';

export type EvmChain = CurrencyTypes.Chain & {
chainId: number;
Expand Down Expand Up @@ -62,4 +63,5 @@ export const chains: Record<CurrencyTypes.EvmChainName, EvmChain> = {
zksynceratestnet: ZkSyncEraTestnetDefinition,
zksyncera: ZkSyncEraDefinition,
base: BaseDefinition,
sonic: SonicDefinition,
};
1 change: 1 addition & 0 deletions packages/currency/src/conversion-aggregators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const noConversionNetworks: CurrencyTypes.AggregatorsMap = {
'aurora-testnet': {},
base: {},
celo: {},
sonic: {},
};

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/currency/src/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ export const nativeCurrencies: Record<RequestLogicTypes.CURRENCY.ETH, NativeEthC
name: 'Base Ether',
network: 'base',
},
{
symbol: '$S',
decimals: 18,
name: '$S',
network: 'sonic',
},
],
[RequestLogicTypes.CURRENCY.BTC]: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const networks: Record<string, ethers.providers.Network> = {
core: { chainId: 1116, name: 'core' },
zksynceratestnet: { chainId: 280, name: 'zksynceratestnet' },
zksyncera: { chainId: 324, name: 'zksyncera' },
sonic: { chainId: 146, name: 'sonic' },
};

/**
Expand All @@ -33,6 +34,7 @@ export class MultichainExplorerApiProvider extends ethers.providers.EtherscanPro
super(network, apiKey);
}

// eslint-disable-next-line complexity
getBaseUrl(): string {
switch (this.network.name) {
case 'sokol':
Expand Down Expand Up @@ -72,6 +74,10 @@ export class MultichainExplorerApiProvider extends ethers.providers.EtherscanPro
return 'https://goerli.explorer.zksync.io/';
case 'zksyncera':
return 'https://explorer.zksync.io/';
case 'base':
return 'https://api.basescan.org/api';
case 'sonic':
return 'https://api.sonicscan.org/api';
default:
return super.getBaseUrl();
}
Expand Down
15 changes: 15 additions & 0 deletions packages/smart-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ export default {
chainId: 8453,
accounts,
},
sonic: {
url: url('sonic'),
chainId: 146,
accounts,
},
},
zksolc: {
version: '1.3.16',
Expand Down Expand Up @@ -243,6 +248,7 @@ export default {
mantle: 'api-key',
'mantle-testnet': 'api-key',
celo: process.env.CELOSCAN_API_KEY,
sonic: process.env.SONIC_API_KEY,
},
customChains: [
{
Expand Down Expand Up @@ -285,6 +291,14 @@ export default {
browserURL: 'https://celoscan.io/',
},
},
{
network: 'sonic',
chainId: 146,
urls: {
apiURL: 'https://api.sonicscan.org/api',
browserURL: 'https://sonicscan.org/',
},
},
],
},
tenderly: {
Expand Down Expand Up @@ -317,6 +331,7 @@ export default {
'avalanche',
'optimism',
'moonbeam',
'sonic',
],
gasLimit: undefined,
deployerAddress: requestDeployer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ export const batchConversionPaymentsArtifact = new ContractArtifact<BatchConvers
address: '0x02561967c48e87cfB079763F3BEf6424A5A166A7',
creationBlockNumber: 12950451,
},
sonic: {
address: '0x118159B0fD020c5Ba3891fD7B626573E810FB265',
creationBlockNumber: 3974167,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export const chainlinkConversionPath = new ContractArtifact<ChainlinkConversionP
address: '0x3dF89c727eaDF67eeD7b4d09EC4F2b41f8Dec2ca',
creationBlockNumber: 10827258,
},
sonic: {
address: '0x05D782aD6D6556179A6387Ff1D2fA104FD5c515a',
creationBlockNumber: 3973538,
},
},
},
'0.2.1': {
Expand All @@ -142,6 +146,10 @@ export const chainlinkConversionPath = new ContractArtifact<ChainlinkConversionP
address: '0x3dF89c727eaDF67eeD7b4d09EC4F2b41f8Dec2ca',
creationBlockNumber: 10827258,
},
sonic: {
address: '0x05D782aD6D6556179A6387Ff1D2fA104FD5c515a',
creationBlockNumber: 3973538,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ export const erc20FeeProxyArtifact = new ContractArtifact<ERC20FeeProxy>(
address: '0x1892196E80C4c17ea5100Da765Ab48c1fE2Fb814',
creationBlockNumber: 10827274,
},
sonic: {
address: '0x399F5EE127ce7432E4921a61b8CF52b0af52cbfE',
creationBlockNumber: 3974138,
},
},
},
near: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export const erc20ProxyArtifact = new ContractArtifact<ERC20Proxy>(
address: '0xc31323ea7513799e1e112Dc15a05d5b600Cc357e',
creationBlockNumber: 10827271,
},
sonic: {
address: '0xC8D3FE2A27bB69a85F6973081FdC41103E107595',
creationBlockNumber: 3974125,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export const erc20ConversionProxy = new ContractArtifact<Erc20ConversionProxy>(
address: '0x8296D56321cf207925a7804E5A8E3F579838e6Ad',
creationBlockNumber: 10827277,
},
sonic: {
address: '0xe43fd55Da253628Ed7Cad5ab198664F5B3659DA9',
creationBlockNumber: 3974151,
},
},
},
'0.1.1': {
Expand Down Expand Up @@ -137,6 +141,10 @@ export const erc20ConversionProxy = new ContractArtifact<Erc20ConversionProxy>(
address: '0x8296D56321cf207925a7804E5A8E3F579838e6Ad',
creationBlockNumber: 10827277,
},
sonic: {
address: '0xe43fd55Da253628Ed7Cad5ab198664F5B3659DA9',
creationBlockNumber: 3974151,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export const ethConversionArtifact = new ContractArtifact<EthConversionProxy>(
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
creationBlockNumber: 35929105,
},
sonic: {
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
creationBlockNumber: 3974113,
},
},
},
'0.2.1': {
Expand All @@ -126,6 +130,10 @@ export const ethConversionArtifact = new ContractArtifact<EthConversionProxy>(
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
creationBlockNumber: 35929105,
},
sonic: {
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
creationBlockNumber: 3974113,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export const ethereumFeeProxyArtifact = new ContractArtifact<EthereumFeeProxy>(
address: '0xd9C3889eB8DA6ce449bfFE3cd194d08A436e96f2',
creationBlockNumber: 10827264,
},
sonic: {
address: '0x4989F941D62bEEb3548Bf55d0D5291Ec335429f0',
creationBlockNumber: 3974098,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ export const ethereumProxyArtifact = new ContractArtifact<EthereumProxy>(
address: '0x090D3583e3f5953e2CC758b146f4Ae11f8224ad7',
creationBlockNumber: 10827261,
},
sonic: {
address: '0x171Ee0881407d4c0C11eA1a2FB7D5b4cdED71e6e',
creationBlockNumber: 3974083,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export const requestDeployer = new ContractArtifact<RequestDeployer>(
address: '0xE99Ab70a5FAE59551544FA326fA048f7B95A24B2',
creationBlockNumber: 4733269,
},
sonic: {
address: '0xE99Ab70a5FAE59551544FA326fA048f7B95A24B2',
creationBlockNumber: 3970964,
},
},
},
},
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/currency-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type EvmChainName =
| 'private'
| 'rinkeby' // FIXME: Rinkeby is deprecated
| 'sepolia'
| 'sonic'
| 'ronin'
| 'sokol'
| 'tombchain'
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const networkRpcs: Record<string, string> = {
zksyncera: 'https://mainnet.era.zksync.io',
sepolia: 'https://rpc.sepolia.org/',
base: 'https://mainnet.base.org/',
sonic: 'https://rpc.soniclabs.com',
};

/**
Expand Down

0 comments on commit 9ab9b25

Please sign in to comment.