Skip to content

Commit d19c0e5

Browse files
feat: deploy V2 contracts on Avaxc
Ticket: COIN-1712
1 parent f40f4ae commit d19c0e5

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

hardhat.config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ const config: HardhatUserConfig = {
9393
},
9494
avaxc: {
9595
url: 'https://api.avax.network/ext/bc/C/rpc',
96-
accounts: [
97-
`${PRIVATE_KEY_FOR_V1_WALLET_CONTRACT_DEPLOYMENT}`,
98-
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT_BACKUP}`
99-
]
96+
accounts: [`${MAINNET_PRIVATE_KEY_FOR_CONTRACT_DEPLOYMENT}`]
10097
}
10198
},
10299
gasReporter: {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"test": "test"
1010
},
1111
"scripts": {
12-
"deploy-prod": "hardhat run scripts/deployV1FactoryContracts.ts --network",
13-
"deploy-test": "hardhat run scripts/deployV1FactoryContracts.ts --network",
12+
"deploy-prod": "hardhat run scripts/deploy.ts --network",
13+
"deploy-test": "hardhat run scripts/deploy.ts --network",
1414
"test": "hardhat test",
1515
"coverage": "hardhat coverage",
1616
"solhint": "./node_modules/.bin/solhint --fix 'contracts/**/*.sol'",

scripts/deploy.ts

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@ async function main() {
1010
forwarderFactory: ''
1111
};
1212

13+
const feeData = await ethers.provider.getFeeData();
14+
15+
const gasParams = {
16+
gasPrice: feeData.gasPrice!.mul('2'),
17+
gasLimit: 4500000
18+
};
19+
1320
const [deployer] = await ethers.getSigners();
1421

1522
let walletImplementationContractName = '';
1623
let walletFactoryContractName = 'WalletFactory';
1724
const chainId = await deployer.getChainId();
18-
switch (await deployer.getChainId()) {
25+
switch (chainId) {
1926
// https://chainlist.org/
2027
//eth
2128
case 1:
@@ -48,36 +55,47 @@ async function main() {
4855
case 11155420:
4956
walletImplementationContractName = 'OpethWalletSimple';
5057
break;
58+
//avaxc
59+
case 43114:
60+
//tavaxc
61+
case 43113:
62+
walletImplementationContractName = 'AvaxcWalletSimple';
5163
}
5264

5365
console.log(
5466
'Deployed wallet contract called: ' + walletImplementationContractName
5567
);
5668

57-
const WalletSimple = await ethers.getContractFactory(
58-
walletImplementationContractName
59-
);
60-
const walletSimple = await WalletSimple.deploy();
61-
await walletSimple.deployed();
62-
output.walletImplementation = walletSimple.address;
63-
console.log('WalletSimple deployed at ' + walletSimple.address);
69+
// const WalletSimple = await ethers.getContractFactory(
70+
// walletImplementationContractName
71+
// );
72+
// const walletSimple = await WalletSimple.deploy(gasParams);
73+
// await walletSimple.deployed();
74+
// output.walletImplementation = walletSimple.address;
75+
// console.log('WalletSimple deployed at ' + walletSimple.address);
6476

6577
const WalletFactory = await ethers.getContractFactory(
6678
walletFactoryContractName
6779
);
68-
const walletFactory = await WalletFactory.deploy(walletSimple.address);
80+
const walletFactory = await WalletFactory.deploy(
81+
'0xe5DcdC13B628c2df813DB1080367E929c1507Ca0',
82+
gasParams
83+
);
6984
await walletFactory.deployed();
7085
output.walletFactory = walletFactory.address;
7186
console.log('WalletFactory deployed at ' + walletFactory.address);
7287

7388
const Forwarder = await ethers.getContractFactory('Forwarder');
74-
const forwarder = await Forwarder.deploy();
89+
const forwarder = await Forwarder.deploy(gasParams);
7590
await forwarder.deployed();
7691
output.forwarderImplementation = forwarder.address;
7792
console.log('Forwarder deployed at ' + forwarder.address);
7893

7994
const ForwarderFactory = await ethers.getContractFactory('ForwarderFactory');
80-
const forwarderFactory = await ForwarderFactory.deploy(forwarder.address);
95+
const forwarderFactory = await ForwarderFactory.deploy(
96+
forwarder.address,
97+
gasParams
98+
);
8199
await forwarderFactory.deployed();
82100
output.forwarderFactory = forwarderFactory.address;
83101
console.log('ForwarderFactory deployed at ' + forwarderFactory.address);
@@ -89,19 +107,19 @@ async function main() {
89107
await new Promise((r) => setTimeout(r, 1000 * 300));
90108

91109
// We have to wait for a minimum of 10 block confirmations before we can call the etherscan api to verify
92-
await walletSimple.deployTransaction.wait(10);
110+
//await walletSimple.deployTransaction.wait(10);
93111
await walletFactory.deployTransaction.wait(10);
94112
await forwarder.deployTransaction.wait(10);
95113
await forwarderFactory.deployTransaction.wait(10);
96114

97115
console.log('Done waiting, verifying');
98-
await verifyContract(
99-
walletImplementationContractName,
100-
walletSimple.address,
101-
[]
102-
);
116+
// await verifyContract(
117+
// walletImplementationContractName,
118+
// walletSimple.address,
119+
// []
120+
// );
103121
await verifyContract('WalletFactory', walletFactory.address, [
104-
walletSimple.address
122+
'0xe5DcdC13B628c2df813DB1080367E929c1507Ca0'
105123
]);
106124
await verifyContract('Forwarder', forwarder.address, []);
107125
await verifyContract('ForwarderFactory', forwarderFactory.address, [

0 commit comments

Comments
 (0)