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
},

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export const erc20ConversionProxy = new ContractArtifact<Erc20ConversionProxy>(
8787
address: '0x8296D56321cf207925a7804E5A8E3F579838e6Ad',
8888
creationBlockNumber: 10827277,
8989
},
90+
sonic: {
91+
address: '0xe43fd55Da253628Ed7Cad5ab198664F5B3659DA9',
92+
creationBlockNumber: 3974151,
93+
},
9094
},
9195
},
9296
'0.1.1': {
@@ -137,6 +141,10 @@ export const erc20ConversionProxy = new ContractArtifact<Erc20ConversionProxy>(
137141
address: '0x8296D56321cf207925a7804E5A8E3F579838e6Ad',
138142
creationBlockNumber: 10827277,
139143
},
144+
sonic: {
145+
address: '0xe43fd55Da253628Ed7Cad5ab198664F5B3659DA9',
146+
creationBlockNumber: 3974151,
147+
},
140148
},
141149
},
142150
},

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ export const ethConversionArtifact = new ContractArtifact<EthConversionProxy>(
108108
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
109109
creationBlockNumber: 35929105,
110110
},
111+
sonic: {
112+
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
113+
creationBlockNumber: 3974113,
114+
},
111115
},
112116
},
113117
'0.2.1': {
@@ -126,6 +130,10 @@ export const ethConversionArtifact = new ContractArtifact<EthConversionProxy>(
126130
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
127131
creationBlockNumber: 35929105,
128132
},
133+
sonic: {
134+
address: '0x3E3B04e1bF170522a5c5DDE628C4d365c0342239',
135+
creationBlockNumber: 3974113,
136+
},
129137
},
130138
},
131139
},

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ export const ethereumFeeProxyArtifact = new ContractArtifact<EthereumFeeProxy>(
150150
address: '0xd9C3889eB8DA6ce449bfFE3cd194d08A436e96f2',
151151
creationBlockNumber: 10827264,
152152
},
153+
sonic: {
154+
address: '0x4989F941D62bEEb3548Bf55d0D5291Ec335429f0',
155+
creationBlockNumber: 3974098,
156+
},
153157
},
154158
},
155159
},

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ export const ethereumProxyArtifact = new ContractArtifact<EthereumProxy>(
204204
address: '0x090D3583e3f5953e2CC758b146f4Ae11f8224ad7',
205205
creationBlockNumber: 10827261,
206206
},
207+
sonic: {
208+
address: '0x171Ee0881407d4c0C11eA1a2FB7D5b4cdED71e6e',
209+
creationBlockNumber: 3974083,
210+
},
207211
},
208212
},
209213
},

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ export const requestDeployer = new ContractArtifact<RequestDeployer>(
8989
address: '0xE99Ab70a5FAE59551544FA326fA048f7B95A24B2',
9090
creationBlockNumber: 4733269,
9191
},
92+
sonic: {
93+
address: '0xE99Ab70a5FAE59551544FA326fA048f7B95A24B2',
94+
creationBlockNumber: 3970964,
95+
},
9296
},
9397
},
9498
},

packages/types/src/currency-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type EvmChainName =
2626
| 'private'
2727
| 'rinkeby' // FIXME: Rinkeby is deprecated
2828
| 'sepolia'
29+
| 'sonic'
2930
| 'ronin'
3031
| 'sokol'
3132
| 'tombchain'

packages/utils/src/providers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const networkRpcs: Record<string, string> = {
5353
zksyncera: 'https://mainnet.era.zksync.io',
5454
sepolia: 'https://rpc.sepolia.org/',
5555
base: 'https://mainnet.base.org/',
56+
sonic: 'https://rpc.soniclabs.com',
5657
};
5758

5859
/**

0 commit comments

Comments
 (0)