Skip to content

Commit

Permalink
feat: deploy V2 contracts on Avaxc
Browse files Browse the repository at this point in the history
Ticket: COIN-1712
  • Loading branch information
mullapudipruthvik committed Oct 10, 2024
1 parent f40f4ae commit e021226
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
5 changes: 1 addition & 4 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ const config: HardhatUserConfig = {
},
avaxc: {
url: 'https://api.avax.network/ext/bc/C/rpc',
accounts: [
`${PRIVATE_KEY_FOR_V1_WALLET_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT_BACKUP}`
]
accounts: [`${MAINNET_PRIVATE_KEY_FOR_CONTRACT_DEPLOYMENT}`]
}
},
gasReporter: {
Expand Down
28 changes: 23 additions & 5 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ async function main() {
forwarderFactory: ''
};

const feeData = await ethers.provider.getFeeData();

const gasParams = {
gasPrice: feeData.gasPrice!.mul('2'),
gasLimit: 4500000
};

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

let walletImplementationContractName = '';
let walletFactoryContractName = 'WalletFactory';
const chainId = await deployer.getChainId();
switch (await deployer.getChainId()) {
switch (chainId) {
// https://chainlist.org/
//eth
case 1:
Expand Down Expand Up @@ -48,6 +55,11 @@ async function main() {
case 11155420:
walletImplementationContractName = 'OpethWalletSimple';
break;
//avaxc
case 43114:
//tavaxc
case 43113:
walletImplementationContractName = 'AvaxcWalletSimple';
}

console.log(
Expand All @@ -57,27 +69,33 @@ async function main() {
const WalletSimple = await ethers.getContractFactory(
walletImplementationContractName
);
const walletSimple = await WalletSimple.deploy();
const walletSimple = await WalletSimple.deploy(gasParams);
await walletSimple.deployed();
output.walletImplementation = walletSimple.address;
console.log('WalletSimple deployed at ' + walletSimple.address);

const WalletFactory = await ethers.getContractFactory(
walletFactoryContractName
);
const walletFactory = await WalletFactory.deploy(walletSimple.address);
const walletFactory = await WalletFactory.deploy(
walletSimple.address,
gasParams
);
await walletFactory.deployed();
output.walletFactory = walletFactory.address;
console.log('WalletFactory deployed at ' + walletFactory.address);

const Forwarder = await ethers.getContractFactory('Forwarder');
const forwarder = await Forwarder.deploy();
const forwarder = await Forwarder.deploy(gasParams);
await forwarder.deployed();
output.forwarderImplementation = forwarder.address;
console.log('Forwarder deployed at ' + forwarder.address);

const ForwarderFactory = await ethers.getContractFactory('ForwarderFactory');
const forwarderFactory = await ForwarderFactory.deploy(forwarder.address);
const forwarderFactory = await ForwarderFactory.deploy(
forwarder.address,
gasParams
);
await forwarderFactory.deployed();
output.forwarderFactory = forwarderFactory.address;
console.log('ForwarderFactory deployed at ' + forwarderFactory.address);
Expand Down

0 comments on commit e021226

Please sign in to comment.