From 305c44660e9cdce740da43f55fbee27107ea211e Mon Sep 17 00:00:00 2001 From: Mullapudi Pruthvik Date: Mon, 9 Sep 2024 20:12:54 +0530 Subject: [PATCH] feat: support avaxc coin Ticket: COIN-1712 --- .github/workflows/deploy_and_release.yml | 9 ++++--- .github/workflows/push.yml | 1 + hardhat.config.ts | 32 ++++++++++++++++++++++-- scripts/deploy.ts | 10 ++++++++ 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy_and_release.yml b/.github/workflows/deploy_and_release.yml index 9694bc5..314721b 100644 --- a/.github/workflows/deploy_and_release.yml +++ b/.github/workflows/deploy_and_release.yml @@ -37,6 +37,7 @@ jobs: ZKSYNC_EXPLORER_API_KEY: ${{ secrets.ZKSYNC_EXPLORER_API_KEY }} BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }} BARTIO_BERA_EXPLORER_API_KEY: ${{ secrets.BARTIO_BERA_EXPLORER_API_KEY }} + SNOWTRACE_API_KEY: ${{ secrets.SNOWTRACE_API_KEY }} get-network: runs-on: ubuntu-latest needs: [lint-and-test] @@ -51,13 +52,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 @@ -87,6 +88,7 @@ jobs: ZKSYNC_EXPLORER_API_KEY: ${{ secrets.ZKSYNC_EXPLORER_API_KEY }} BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }} BARTIO_BERA_EXPLORER_API_KEY: ${{ secrets.BARTIO_BERA_EXPLORER_API_KEY }} + SNOWTRACE_API_KEY: ${{ secrets.SNOWTRACE_API_KEY }} - name: Update release notes uses: actions/github-script@v6 with: @@ -118,7 +120,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 @@ -147,6 +149,7 @@ jobs: QUICKNODE_ARBITRUM_ONE_API_KEY: ${{ secrets.QUICKNODE_ARBITRUM_ONE_API_KEY }} QUICKNODE_OPTIMISM_API_KEY: ${{ secrets.QUICKNODE_OPTIMISM_API_KEY }} BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }} + SNOWTRACE_API_KEY: ${{ secrets.SNOWTRACE_API_KEY }} - name: Update release notes uses: actions/github-script@v6 with: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ce9c345..ebd52a1 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -45,4 +45,5 @@ jobs: ZKSYNC_EXPLORER_API_KEY: ${{ secrets.ZKSYNC_EXPLORER_API_KEY }} BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }} BARTIO_BERA_EXPLORER_API_KEY: ${{ secrets.BARTIO_BERA_EXPLORER_API_KEY }} + SNOWTRACE_API_KEY: ${{ secrets.SNOWTRACE_API_KEY }} - run: npm run lint diff --git a/hardhat.config.ts b/hardhat.config.ts index 603fbdd..e0b436d 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -29,7 +29,8 @@ const { OPTIMISTIC_ETHERSCAN_API_KEY, ZKSYNC_EXPLORER_API_KEY, BASESCAN_API_KEY, - BARTIO_BERA_EXPLORER_API_KEY + BARTIO_BERA_EXPLORER_API_KEY, + SNOWTRACE_API_KEY } = process.env; const config: HardhatUserConfig = { @@ -132,6 +133,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: { @@ -162,7 +171,10 @@ 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 + axaxc: `${SNOWTRACE_API_KEY}`, + avaxcTestnet: `${SNOWTRACE_API_KEY}` }, customChains: [ { @@ -237,6 +249,22 @@ 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/' + } } ] }, diff --git a/scripts/deploy.ts b/scripts/deploy.ts index 786d0c5..78575fd 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -110,6 +110,16 @@ async function main() { forwarderFactoryContractName = 'ForwarderFactoryV4'; contractPath = `contracts/${walletImplementationContractName}.sol:${walletImplementationContractName}`; break; + //avaxc + case 43114: + //tavaxc + case 43113: + walletImplementationContractName = 'WalletSimple'; + forwarderContractName = 'Forwarder'; + forwarderFactoryContractName = 'ForwarderFactory'; + contractPath = `contracts/${walletImplementationContractName}.sol:${walletImplementationContractName}`; + break; + } if (deployWalletContracts) {