Skip to content

Commit c69ff2b

Browse files
feat(bsc): add config for deployment
Ticket: BG-68541
1 parent b76b031 commit c69ff2b

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

.github/workflows/deploy_and_release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
2222
ALCHEMY_POLYGON_API_KEY: ${{ secrets.ALCHEMY_POLYGON_API_KEY }}
2323
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
24+
BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }}
2425
get-network:
2526
runs-on: ubuntu-latest
2627
needs: [lint-and-test]
@@ -35,13 +36,13 @@ jobs:
3536
result-encoding: string
3637
script: |
3738
const tag = process.env.GITHUB_REF_NAME;
38-
const regex = /v.*\-(eth|gteth|matic|tmatic)$/;
39+
const regex = /v.*\-(eth|gteth|matic|tmatic|bsc|tbsc)$/;
3940
const network = tag.match(regex);
4041
return network ? network[1] : "gteth";
4142
deploy-to-test:
4243
runs-on: ubuntu-latest
4344
needs: [lint-and-test, get-network]
44-
if: ${{ (needs.get-network.outputs.network == 'gteth' ) || (needs.get-network.outputs.network == 'tmatic' ) }}
45+
if: ${{ (needs.get-network.outputs.network == 'gteth' ) || (needs.get-network.outputs.network == 'tmatic' ) || (needs.get-network.outputs.network == 'tbsc' ) }}
4546
environment: testnet
4647
steps:
4748
- uses: actions/checkout@v2
@@ -58,6 +59,7 @@ jobs:
5859
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
5960
ALCHEMY_POLYGON_API_KEY: ${{ secrets.ALCHEMY_POLYGON_API_KEY }}
6061
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
62+
BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }}
6163
- name: Update release notes
6264
uses: actions/github-script@v6
6365
with:
@@ -89,7 +91,7 @@ jobs:
8991
deploy-to-prod:
9092
runs-on: ubuntu-latest
9193
needs: [lint-and-test, get-network]
92-
if: ${{ (needs.get-network.outputs.network == 'eth' ) || (needs.get-network.outputs.network == 'matic' ) }}
94+
if: ${{ (needs.get-network.outputs.network == 'eth' ) || (needs.get-network.outputs.network == 'matic' ) || (needs.get-network.outputs.network == 'bsc' ) }}
9395
environment: mainnet
9496
steps:
9597
- uses: actions/checkout@v2
@@ -106,6 +108,7 @@ jobs:
106108
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
107109
ALCHEMY_POLYGON_API_KEY: ${{ secrets.ALCHEMY_POLYGON_API_KEY }}
108110
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
111+
BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }}
109112
- name: Update release notes
110113
uses: actions/github-script@v6
111114
with:

hardhat.config.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const {
1414
ALCHEMY_ETHER_API_KEY,
1515
ETHERSCAN_API_KEY,
1616
ALCHEMY_POLYGON_API_KEY,
17-
POLYGONSCAN_API_KEY
17+
POLYGONSCAN_API_KEY,
18+
BSCSCAN_API_KEY
1819
} = process.env;
1920

2021
const config: HardhatUserConfig = {
@@ -55,6 +56,14 @@ const config: HardhatUserConfig = {
5556
//https://polygon-mumbai.g.alchemy.com/
5657
url: `https://polygon-mumbai.g.alchemyapi.io/v2/${ALCHEMY_POLYGON_API_KEY}`,
5758
accounts: [`${PRIVATE_KEY}`]
59+
},
60+
bsc: {
61+
url: `https://bsc-dataseed1.binance.org/`,
62+
accounts: [`${PRIVATE_KEY}`]
63+
},
64+
tbsc: {
65+
url: `https://data-seed-prebsc-1-s1.binance.org:8545/`,
66+
accounts: [`${PRIVATE_KEY}`]
5867
}
5968
},
6069
gasReporter: {
@@ -68,7 +77,9 @@ const config: HardhatUserConfig = {
6877
goerli: `${ETHERSCAN_API_KEY}`,
6978
//polygon
7079
polygon: `${POLYGONSCAN_API_KEY}`,
71-
polygonMumbai: `${POLYGONSCAN_API_KEY}`
80+
polygonMumbai: `${POLYGONSCAN_API_KEY}`,
81+
bscTestnet: `${BSCSCAN_API_KEY}`,
82+
bsc: `${BSCSCAN_API_KEY}`
7283
}
7384
},
7485
mocha: {

scripts/deploy.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,47 @@ async function main() {
1212

1313
const [deployer] = await ethers.getSigners();
1414

15-
let walletContractName = '';
15+
let walletImplementationContractName = '';
16+
let walletFactoryContractName = 'WalletFactory';
17+
const chainId = await deployer.getChainId();
1618
switch (await deployer.getChainId()) {
1719
// https://chainlist.org/
1820
//eth
1921
case 1:
2022
//gteth
2123
case 5:
22-
walletContractName = 'WalletSimple';
24+
walletImplementationContractName = 'WalletSimple';
2325
break;
2426
//matic
2527
case 137:
2628
//tmatic
2729
case 80001:
28-
walletContractName = 'PolygonWalletSimple';
30+
walletImplementationContractName = 'PolygonWalletSimple';
31+
break;
32+
// bsc
33+
case 56:
34+
// tbsc
35+
case 97:
36+
walletImplementationContractName = 'RecoveryWalletSimple';
37+
walletFactoryContractName = 'RecoveryWalletFactory';
2938
break;
3039
}
3140

32-
console.log('Deployed wallet contract called: ' + walletContractName);
41+
console.log(
42+
'Deployed wallet contract called: ' + walletImplementationContractName
43+
);
3344

34-
const WalletSimple = await ethers.getContractFactory(walletContractName);
45+
const WalletSimple = await ethers.getContractFactory(
46+
walletImplementationContractName
47+
);
3548
const walletSimple = await WalletSimple.deploy();
3649
await walletSimple.deployed();
3750
output.walletImplementation = walletSimple.address;
3851
console.log('WalletSimple deployed at ' + walletSimple.address);
3952

40-
const WalletFactory = await ethers.getContractFactory('WalletFactory');
53+
const WalletFactory = await ethers.getContractFactory(
54+
walletFactoryContractName
55+
);
4156
const walletFactory = await WalletFactory.deploy(walletSimple.address);
4257
await walletFactory.deployed();
4358
output.walletFactory = walletFactory.address;

0 commit comments

Comments
 (0)