Skip to content

Commit

Permalink
feat: support avaxc coin
Browse files Browse the repository at this point in the history
Ticket: COIN-1712
  • Loading branch information
mullapudipruthvik committed Sep 10, 2024
1 parent 18e1a8f commit 392c032
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ jobs:
result-encoding: string
script: |
const tag = process.env.GITHUB_REF_NAME;
const regex = /v.*\-(eth|hteth|matic|tmatic|bsc|tbsc|arbeth|tarbeth|opeth|topeth|zketh|tzketh|baseeth|tbaseeth|tbera)$/;
const regex = /v.*\-(eth|hteth|matic|tmatic|bsc|tbsc|arbeth|tarbeth|opeth|topeth|zketh|tzketh|baseeth|tbaseeth|tbera|tavaxc|avaxc)$/;
const network = tag.match(regex);
return network ? network[1] : "hteth";
deploy-to-test:
runs-on: ubuntu-latest
needs: [lint-and-test, get-network]
if: ${{ (needs.get-network.outputs.network == 'hteth' ) || (needs.get-network.outputs.network == 'tmatic' ) || (needs.get-network.outputs.network == 'tbsc' ) || (needs.get-network.outputs.network == 'tarbeth' ) || (needs.get-network.outputs.network == 'topeth' ) || (needs.get-network.outputs.network == 'tzketh' ) || (needs.get-network.outputs.network == 'tbaseeth' ) || (needs.get-network.outputs.network == 'tbera' ) }}
if: ${{ (needs.get-network.outputs.network == 'hteth' ) || (needs.get-network.outputs.network == 'tmatic' ) || (needs.get-network.outputs.network == 'tbsc' ) || (needs.get-network.outputs.network == 'tarbeth' ) || (needs.get-network.outputs.network == 'topeth' ) || (needs.get-network.outputs.network == 'tzketh' ) || (needs.get-network.outputs.network == 'tbaseeth' ) || (needs.get-network.outputs.network == 'tbera' ) || (needs.get-network.outputs.network == 'tavaxc' ) }}
environment: testnet
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
deploy-to-prod:
runs-on: ubuntu-latest
needs: [lint-and-test, get-network]
if: ${{ (needs.get-network.outputs.network == 'eth' ) || (needs.get-network.outputs.network == 'matic' ) || (needs.get-network.outputs.network == 'bsc' ) || (needs.get-network.outputs.network == 'arbeth' ) || (needs.get-network.outputs.network == 'opeth' ) || (needs.get-network.outputs.network == 'zketh' ) || (needs.get-network.outputs.network == 'baseeth' ) || (needs.get-network.outputs.network == 'bera' )}}
if: ${{ (needs.get-network.outputs.network == 'eth' ) || (needs.get-network.outputs.network == 'matic' ) || (needs.get-network.outputs.network == 'bsc' ) || (needs.get-network.outputs.network == 'arbeth' ) || (needs.get-network.outputs.network == 'opeth' ) || (needs.get-network.outputs.network == 'zketh' ) || (needs.get-network.outputs.network == 'baseeth' ) || (needs.get-network.outputs.network == 'bera' ) || (needs.get-network.outputs.network == 'avaxc' )}}
environment: mainnet
steps:
- uses: actions/checkout@v2
Expand Down
34 changes: 32 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const {
OPTIMISTIC_ETHERSCAN_API_KEY,
ZKSYNC_EXPLORER_API_KEY,
BASESCAN_API_KEY,
BARTIO_BERA_EXPLORER_API_KEY
BARTIO_BERA_EXPLORER_API_KEY,
} = process.env;

const config: HardhatUserConfig = {
Expand Down Expand Up @@ -132,6 +132,14 @@ const config: HardhatUserConfig = {
tbera: {
url: `https://bartio.rpc.berachain.com/`,
accounts: [`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`]
},
tavaxc: {
url: 'https://api.avax-test.network/ext/C/rpc',
accounts: [`${TESTNET_PRIVATE_KEY_FOR_CONTRACT_DEPLOYMENT}`]
},
avaxc: {
url: 'https://api.avax.network/ext/bc/C/rpc',
accounts: [`${MAINNET_PRIVATE_KEY_FOR_CONTRACT_DEPLOYMENT}`]
}
},
gasReporter: {
Expand Down Expand Up @@ -162,7 +170,11 @@ const config: HardhatUserConfig = {
baseSepolia: `${BASESCAN_API_KEY}`,
base: `${BASESCAN_API_KEY}`,
// bera
bartioBera: `${BARTIO_BERA_EXPLORER_API_KEY}`
bartioBera: `${BARTIO_BERA_EXPLORER_API_KEY}`,
//avaxc
// there is free api key for avaxc, so make use of 2 req/sec
axaxc: 'sampleapikey',
avaxcTestnet: 'sampleapikey'
},
customChains: [
{
Expand Down Expand Up @@ -237,6 +249,24 @@ const config: HardhatUserConfig = {
apiURL: 'https://api.basescan.org/api',
browserURL: 'https://basescan.org/'
}
},
{
network: 'avaxc',
chainId: 43114,
urls: {
apiURL:
'https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api',
browserURL: 'https://snowtrace.io/'
}
},
{
network: 'avaxcTestnet',
chainId: 43113,
urls: {
apiURL:
'https://api.routescan.io/v2/network/testnet/evm/43113/etherscan/api',
browserURL: 'https://testnet.snowtrace.io/'
}
}
]
},
Expand Down
19 changes: 16 additions & 3 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { use } from 'chai';
import { BigNumber } from 'ethers';
import { ethers } from 'hardhat';
const hre = require('hardhat');
const fs = require('fs');
Expand All @@ -13,11 +13,14 @@ async function main() {

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

const eip1559GasParams = {
const eip1559GasParams: {
maxFeePerGas: BigNumber | null;
maxPriorityFeePerGas: BigNumber | null;
gasLimit?: number;
} = {
maxFeePerGas: feeData.maxFeePerGas,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas
};

let deployWalletContracts = false,
deployForwarderContracts = false;
const [deployer] = await ethers.getSigners();
Expand Down Expand Up @@ -110,6 +113,16 @@ async function main() {
forwarderFactoryContractName = 'ForwarderFactoryV4';
contractPath = `contracts/${walletImplementationContractName}.sol:${walletImplementationContractName}`;
break;
//avaxc
case 43114:
//tavaxc
case 43113:
eip1559GasParams.gasLimit = 3000000;
walletImplementationContractName = 'WalletSimple';
forwarderContractName = 'Forwarder';
forwarderFactoryContractName = 'ForwarderFactory';
contractPath = `contracts/${walletImplementationContractName}.sol:${walletImplementationContractName}`;
break;
}

if (deployWalletContracts) {
Expand Down

0 comments on commit 392c032

Please sign in to comment.