Skip to content

Commit d6856a7

Browse files
Merge pull request #196 from bancorprotocol/hedera-deployment
Hedera deployment
2 parents e0f382c + ecf0d82 commit d6856a7

File tree

7 files changed

+4484
-192
lines changed

7 files changed

+4484
-192
lines changed

data/named-accounts.ts

Lines changed: 39 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -10,200 +10,43 @@ const { TENDERLY_NETWORK_NAME = DeploymentNetwork.Mainnet }: EnvOptions = proces
1010

1111
const TENDERLY_NETWORK_ID = chainIds[TENDERLY_NETWORK_NAME as keyof typeof chainIds];
1212

13-
const mainnet = (address: string) => {
14-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Mainnet]) {
15-
return {
16-
[DeploymentNetwork.Mainnet]: address,
17-
[DeploymentNetwork.Tenderly]: address,
18-
[DeploymentNetwork.TenderlyTestnet]: address
19-
};
20-
}
21-
return {
22-
[DeploymentNetwork.Mainnet]: address
23-
};
24-
};
25-
26-
const base = (address: string) => {
27-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Base]) {
28-
return {
29-
[DeploymentNetwork.Base]: address,
30-
[DeploymentNetwork.Tenderly]: address,
31-
[DeploymentNetwork.TenderlyTestnet]: address
32-
};
33-
}
34-
return {
35-
[DeploymentNetwork.Base]: address
36-
};
37-
};
38-
39-
const arbitrum = (address: string) => {
40-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Arbitrum]) {
41-
return {
42-
[DeploymentNetwork.Arbitrum]: address,
43-
[DeploymentNetwork.Tenderly]: address,
44-
[DeploymentNetwork.TenderlyTestnet]: address
45-
};
46-
}
47-
return {
48-
[DeploymentNetwork.Arbitrum]: address
49-
};
50-
};
51-
52-
const sepolia = (address: string) => {
53-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Sepolia]) {
54-
return {
55-
[DeploymentNetwork.Sepolia]: address,
56-
[DeploymentNetwork.Tenderly]: address,
57-
[DeploymentNetwork.TenderlyTestnet]: address
58-
};
59-
}
60-
return {
61-
[DeploymentNetwork.Sepolia]: address
62-
};
63-
};
6413

65-
const mantle = (address: string) => {
66-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Mantle]) {
14+
// Type for network configuration
15+
type NetworkConfig = Record<string, string>;
16+
17+
// Generic network helper function
18+
const createNetworkHelper = (networkName: string) => {
19+
return (address: string): NetworkConfig => {
20+
if (TENDERLY_NETWORK_ID === chainIds[networkName as keyof typeof chainIds]) {
21+
return {
22+
[networkName]: address,
23+
[DeploymentNetwork.Tenderly]: address,
24+
[DeploymentNetwork.TenderlyTestnet]: address
25+
};
26+
}
6727
return {
68-
[DeploymentNetwork.Mantle]: address,
69-
[DeploymentNetwork.Tenderly]: address,
70-
[DeploymentNetwork.TenderlyTestnet]: address
28+
[networkName]: address
7129
};
72-
}
73-
return {
74-
[DeploymentNetwork.Mantle]: address
75-
};
76-
};
77-
78-
const blast = (address: string) => {
79-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Blast]) {
80-
return {
81-
[DeploymentNetwork.Blast]: address,
82-
[DeploymentNetwork.Tenderly]: address,
83-
[DeploymentNetwork.TenderlyTestnet]: address
84-
};
85-
}
86-
return {
87-
[DeploymentNetwork.Blast]: address
88-
};
89-
};
90-
91-
const celo = (address: string) => {
92-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Celo]) {
93-
return {
94-
[DeploymentNetwork.Celo]: address,
95-
[DeploymentNetwork.Tenderly]: address,
96-
[DeploymentNetwork.TenderlyTestnet]: address
97-
};
98-
}
99-
return {
100-
[DeploymentNetwork.Celo]: address
101-
};
102-
};
103-
104-
const sei = (address: string) => {
105-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Sei]) {
106-
return {
107-
[DeploymentNetwork.Sei]: address,
108-
[DeploymentNetwork.Tenderly]: address,
109-
[DeploymentNetwork.TenderlyTestnet]: address
110-
};
111-
}
112-
return {
113-
[DeploymentNetwork.Sei]: address
11430
};
11531
};
11632

117-
const fantom = (address: string) => {
118-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Fantom]) {
119-
return {
120-
[DeploymentNetwork.Fantom]: address,
121-
[DeploymentNetwork.Tenderly]: address,
122-
[DeploymentNetwork.TenderlyTestnet]: address
123-
};
124-
}
125-
return {
126-
[DeploymentNetwork.Fantom]: address
127-
};
128-
};
129-
130-
const linea = (address: string) => {
131-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Linea]) {
132-
return {
133-
[DeploymentNetwork.Linea]: address,
134-
[DeploymentNetwork.Tenderly]: address,
135-
[DeploymentNetwork.TenderlyTestnet]: address
136-
};
137-
}
138-
return {
139-
[DeploymentNetwork.Linea]: address
140-
};
141-
};
142-
143-
const telos = (address: string) => {
144-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Telos]) {
145-
return {
146-
[DeploymentNetwork.Telos]: address,
147-
[DeploymentNetwork.Tenderly]: address,
148-
[DeploymentNetwork.TenderlyTestnet]: address
149-
};
150-
}
151-
return {
152-
[DeploymentNetwork.Telos]: address
153-
};
154-
};
155-
156-
const berachain = (address: string) => {
157-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Berachain]) {
158-
return {
159-
[DeploymentNetwork.Berachain]: address,
160-
[DeploymentNetwork.Tenderly]: address,
161-
[DeploymentNetwork.TenderlyTestnet]: address
162-
};
163-
}
164-
return {
165-
[DeploymentNetwork.Berachain]: address
166-
};
167-
};
168-
169-
const coti = (address: string) => {
170-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Coti]) {
171-
return {
172-
[DeploymentNetwork.Coti]: address,
173-
[DeploymentNetwork.Tenderly]: address,
174-
[DeploymentNetwork.TenderlyTestnet]: address
175-
};
176-
}
177-
return {
178-
[DeploymentNetwork.Coti]: address
179-
};
180-
};
181-
182-
const tac = (address: string) => {
183-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.Tac]) {
184-
return {
185-
[DeploymentNetwork.Tac]: address,
186-
[DeploymentNetwork.Tenderly]: address,
187-
[DeploymentNetwork.TenderlyTestnet]: address
188-
};
189-
}
190-
return {
191-
[DeploymentNetwork.Tac]: address
192-
};
193-
};
194-
195-
const bsc = (address: string) => {
196-
if (TENDERLY_NETWORK_ID === chainIds[DeploymentNetwork.BSC]) {
197-
return {
198-
[DeploymentNetwork.BSC]: address,
199-
[DeploymentNetwork.Tenderly]: address,
200-
[DeploymentNetwork.TenderlyTestnet]: address
201-
};
202-
}
203-
return {
204-
[DeploymentNetwork.BSC]: address
205-
};
206-
};
33+
// Network helper functions
34+
const mainnet = createNetworkHelper(DeploymentNetwork.Mainnet);
35+
const base = createNetworkHelper(DeploymentNetwork.Base);
36+
const arbitrum = createNetworkHelper(DeploymentNetwork.Arbitrum);
37+
const sepolia = createNetworkHelper(DeploymentNetwork.Sepolia);
38+
const fantom = createNetworkHelper(DeploymentNetwork.Fantom);
39+
const mantle = createNetworkHelper(DeploymentNetwork.Mantle);
40+
const linea = createNetworkHelper(DeploymentNetwork.Linea);
41+
const sei = createNetworkHelper(DeploymentNetwork.Sei);
42+
const blast = createNetworkHelper(DeploymentNetwork.Blast);
43+
const berachain = createNetworkHelper(DeploymentNetwork.Berachain);
44+
const celo = createNetworkHelper(DeploymentNetwork.Celo);
45+
const telos = createNetworkHelper(DeploymentNetwork.Telos);
46+
const coti = createNetworkHelper(DeploymentNetwork.Coti);
47+
const tac = createNetworkHelper(DeploymentNetwork.Tac);
48+
const bsc = createNetworkHelper(DeploymentNetwork.BSC);
49+
const hedera = createNetworkHelper(DeploymentNetwork.Hedera);
20750

20851
const TestNamedAccounts = {
20952
ethWhale: {
@@ -299,7 +142,8 @@ const BancorNamedAccounts = {
299142
...getAddress(coti, '0x3F086F628678cF136C4fA7d2901ff5EBE2623435'),
300143
...getAddress(arbitrum, '0x8cE318919438982514F9f479FDfB40D32C6ab749'),
301144
...getAddress(tac, '0xBBAFF3Bf6eC4C15992c0Fb37F12491Fd62C5B496'),
302-
...getAddress(bsc, '0x45d2e25C04F43A06f6C3e21e4f39B860D05a7aC8')
145+
...getAddress(bsc, '0x45d2e25C04F43A06f6C3e21e4f39B860D05a7aC8'),
146+
...getAddress(hedera, '0xb0d39990E1C38B50D0b7f6911525535Fbacb4C26')
303147
}
304148
};
305149

@@ -308,18 +152,21 @@ const VortexNamedAccounts = {
308152
...getAddress(mainnet, NATIVE_TOKEN_ADDRESS),
309153
...getAddress(coti, '0x639aCc80569c5FC83c6FBf2319A6Cc38bBfe26d1'), // weth
310154
...getAddress(tac, NATIVE_TOKEN_ADDRESS), // tac
311-
...getAddress(bsc, NATIVE_TOKEN_ADDRESS) // bnb
155+
...getAddress(bsc, NATIVE_TOKEN_ADDRESS), // bnb
156+
...getAddress(hedera, NATIVE_TOKEN_ADDRESS) // hbar
312157
},
313158
finalTargetToken: {
314159
...getAddress(mainnet, '0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C'),
315160
...getAddress(tac, '0x61D66bC21fED820938021B06e9b2291f3FB91945'), // weth
316-
...getAddress(bsc, '0x4DB5a66E937A9F4473fA95b1cAF1d1E1D62E29EA') // wormhole weth
161+
...getAddress(bsc, '0x4DB5a66E937A9F4473fA95b1cAF1d1E1D62E29EA'), // wormhole weth
162+
...getAddress(hedera, '0xca367694cdac8f152e33683bb36cc9d6a73f1ef2') // stargate weth
317163
},
318164
transferAddress: {
319165
...getAddress(mainnet, '0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C'),
320166
...getAddress(coti, ZERO_ADDRESS),
321167
...getAddress(tac, ZERO_ADDRESS),
322-
...getAddress(bsc, ZERO_ADDRESS)
168+
...getAddress(bsc, ZERO_ADDRESS),
169+
...getAddress(hedera, ZERO_ADDRESS)
323170
}
324171
};
325172

deployments/hedera/.chainId

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
295
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"0001-ProxyAdmin": 1762509150,
3+
"0002-CarbonVortex": 1762509231
4+
}

0 commit comments

Comments
 (0)