Skip to content

Commit 9ab9b25

Browse files
authored
feat: sonic chain (#1545)
1 parent b983b8c commit 9ab9b25

File tree

17 files changed

+81
-0
lines changed

17 files changed

+81
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const chainId = 146;

packages/currency/src/chains/evm/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import * as SepoliaDefinition from './data/sepolia';
2828
import * as ZkSyncEraTestnetDefinition from './data/zksync-era-testnet';
2929
import * as ZkSyncEraDefinition from './data/zksync-era';
3030
import * as BaseDefinition from './data/base';
31+
import * as SonicDefinition from './data/sonic';
3132

3233
export type EvmChain = CurrencyTypes.Chain & {
3334
chainId: number;
@@ -62,4 +63,5 @@ export const chains: Record<CurrencyTypes.EvmChainName, EvmChain> = {
6263
zksynceratestnet: ZkSyncEraTestnetDefinition,
6364
zksyncera: ZkSyncEraDefinition,
6465
base: BaseDefinition,
66+
sonic: SonicDefinition,
6567
};

packages/currency/src/conversion-aggregators.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const noConversionNetworks: CurrencyTypes.AggregatorsMap = {
3535
'aurora-testnet': {},
3636
base: {},
3737
celo: {},
38+
sonic: {},
3839
};
3940

4041
/**

packages/currency/src/native.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ export const nativeCurrencies: Record<RequestLogicTypes.CURRENCY.ETH, NativeEthC
172172
name: 'Base Ether',
173173
network: 'base',
174174
},
175+
{
176+
symbol: '$S',
177+
decimals: 18,
178+
name: '$S',
179+
network: 'sonic',
180+
},
175181
],
176182
[RequestLogicTypes.CURRENCY.BTC]: [
177183
{

packages/payment-detection/src/eth/multichainExplorerApiProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const networks: Record<string, ethers.providers.Network> = {
1717
core: { chainId: 1116, name: 'core' },
1818
zksynceratestnet: { chainId: 280, name: 'zksynceratestnet' },
1919
zksyncera: { chainId: 324, name: 'zksyncera' },
20+
sonic: { chainId: 146, name: 'sonic' },
2021
};
2122

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

37+
// eslint-disable-next-line complexity
3638
getBaseUrl(): string {
3739
switch (this.network.name) {
3840
case 'sokol':
@@ -72,6 +74,10 @@ export class MultichainExplorerApiProvider extends ethers.providers.EtherscanPro
7274
return 'https://goerli.explorer.zksync.io/';
7375
case 'zksyncera':
7476
return 'https://explorer.zksync.io/';
77+
case 'base':
78+
return 'https://api.basescan.org/api';
79+
case 'sonic':
80+
return 'https://api.sonicscan.org/api';
7581
default:
7682
return super.getBaseUrl();
7783
}

packages/smart-contracts/hardhat.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ export default {
204204
chainId: 8453,
205205
accounts,
206206
},
207+
sonic: {
208+
url: url('sonic'),
209+
chainId: 146,
210+
accounts,
211+
},
207212
},
208213
zksolc: {
209214
version: '1.3.16',
@@ -243,6 +248,7 @@ export default {
243248
mantle: 'api-key',
244249
'mantle-testnet': 'api-key',
245250
celo: process.env.CELOSCAN_API_KEY,
251+
sonic: process.env.SONIC_API_KEY,
246252
},
247253
customChains: [
248254
{
@@ -285,6 +291,14 @@ export default {
285291
browserURL: 'https://celoscan.io/',
286292
},
287293
},
294+
{
295+
network: 'sonic',
296+
chainId: 146,
297+
urls: {
298+
apiURL: 'https://api.sonicscan.org/api',
299+
browserURL: 'https://sonicscan.org/',
300+
},
301+
},
288302
],
289303
},
290304
tenderly: {
@@ -317,6 +331,7 @@ export default {
317331
'avalanche',
318332
'optimism',
319333
'moonbeam',
334+
'sonic',
320335
],
321336
gasLimit: undefined,
322337
deployerAddress: requestDeployer,

packages/smart-contracts/src/lib/artifacts/BatchConversionPayments/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ export const batchConversionPaymentsArtifact = new ContractArtifact<BatchConvers
8686
address: '0x02561967c48e87cfB079763F3BEf6424A5A166A7',
8787
creationBlockNumber: 12950451,
8888
},
89+
sonic: {
90+
address: '0x118159B0fD020c5Ba3891fD7B626573E810FB265',
91+
creationBlockNumber: 3974167,
92+
},
8993
},
9094
},
9195
},

packages/smart-contracts/src/lib/artifacts/ChainlinkConversionPath/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ export const chainlinkConversionPath = new ContractArtifact<ChainlinkConversionP
129129
address: '0x3dF89c727eaDF67eeD7b4d09EC4F2b41f8Dec2ca',
130130
creationBlockNumber: 10827258,
131131
},
132+
sonic: {
133+
address: '0x05D782aD6D6556179A6387Ff1D2fA104FD5c515a',
134+
creationBlockNumber: 3973538,
135+
},
132136
},
133137
},
134138
'0.2.1': {
@@ -142,6 +146,10 @@ export const chainlinkConversionPath = new ContractArtifact<ChainlinkConversionP
142146
address: '0x3dF89c727eaDF67eeD7b4d09EC4F2b41f8Dec2ca',
143147
creationBlockNumber: 10827258,
144148
},
149+
sonic: {
150+
address: '0x05D782aD6D6556179A6387Ff1D2fA104FD5c515a',
151+
creationBlockNumber: 3973538,
152+
},
145153
},
146154
},
147155
},

packages/smart-contracts/src/lib/artifacts/ERC20FeeProxy/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ export const erc20FeeProxyArtifact = new ContractArtifact<ERC20FeeProxy>(
163163
address: '0x1892196E80C4c17ea5100Da765Ab48c1fE2Fb814',
164164
creationBlockNumber: 10827274,
165165
},
166+
sonic: {
167+
address: '0x399F5EE127ce7432E4921a61b8CF52b0af52cbfE',
168+
creationBlockNumber: 3974138,
169+
},
166170
},
167171
},
168172
near: {

packages/smart-contracts/src/lib/artifacts/ERC20Proxy/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export const erc20ProxyArtifact = new ContractArtifact<ERC20Proxy>(
4141
address: '0xc31323ea7513799e1e112Dc15a05d5b600Cc357e',
4242
creationBlockNumber: 10827271,
4343
},
44+
sonic: {
45+
address: '0xC8D3FE2A27bB69a85F6973081FdC41103E107595',
46+
creationBlockNumber: 3974125,
47+
},
4448
},
4549
},
4650
},

0 commit comments

Comments
 (0)