Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(eth-multisig-v4): add wemix config for contract deployment #194

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/deploy_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
get-network:
runs-on: ubuntu-latest
needs: [lint-and-test]
Expand All @@ -58,13 +59,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|tavaxc|avaxc|toas|oas|tcoredao|coredao|tflr|flr|tsgb|sgb|txdc|xdc)$/;
const regex = /v.*\-(eth|hteth|matic|tmatic|bsc|tbsc|arbeth|tarbeth|opeth|topeth|zketh|tzketh|baseeth|tbaseeth|tbera|tavaxc|avaxc|toas|oas|tcoredao|coredao|tflr|flr|tsgb|sgb|txdc|xdc|twemix|wemix)$/;
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' ) || (needs.get-network.outputs.network == 'tavaxc' ) || (needs.get-network.outputs.network == 'toas' ) || (needs.get-network.outputs.network == 'tcoredao' ) || (needs.get-network.outputs.network == 'tflr' ) || (needs.get-network.outputs.network == 'tsgb' ) || (needs.get-network.outputs.network == 'txdc' ) }}
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' ) || (needs.get-network.outputs.network == 'toas' ) || (needs.get-network.outputs.network == 'tcoredao' ) || (needs.get-network.outputs.network == 'tflr' ) || (needs.get-network.outputs.network == 'tsgb' ) || (needs.get-network.outputs.network == 'txdc' ) || (needs.get-network.outputs.network == 'twemix' ) }}
environment: testnet
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -104,6 +105,7 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
- name: Update release notes
uses: actions/github-script@v6
with:
Expand Down Expand Up @@ -135,7 +137,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' ) || (needs.get-network.outputs.network == 'avaxc' ) || (needs.get-network.outputs.network == 'coredao' ) || (needs.get-network.outputs.network == 'oas' ) || (needs.get-network.outputs.network == 'flr' ) || (needs.get-network.outputs.network == 'sgb' ) || (needs.get-network.outputs.network == 'xdc' ) }}
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' ) || (needs.get-network.outputs.network == 'coredao' ) || (needs.get-network.outputs.network == 'oas' ) || (needs.get-network.outputs.network == 'flr' ) || (needs.get-network.outputs.network == 'sgb' ) || (needs.get-network.outputs.network == 'xdc' ) || (needs.get-network.outputs.network == 'wemix' ) }}
environment: mainnet
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -175,6 +177,7 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
- name: Update release notes
uses: actions/github-script@v6
with:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/deploy_batcher_contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
get-network:
runs-on: ubuntu-latest
needs: [lint-and-test]
Expand All @@ -58,7 +59,7 @@ 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|bera|tbera|tavaxc|avaxc|toas|oas|tcoredao|coredao|flr|tflr|sgb|tsgb|txdc|xdc)$/;
const regex = /v.*\-(eth|hteth|matic|tmatic|bsc|tbsc|arbeth|tarbeth|opeth|topeth|zketh|tzketh|baseeth|tbaseeth|bera|tbera|tavaxc|avaxc|toas|oas|tcoredao|coredao|flr|tflr|sgb|tsgb|txdc|xdc|twemix|wemix)$/;
const matchedNetwork = tag.match(regex);
if (!matchedNetwork) {
console.log("No match found for the network name, defaulting to 'hteth'.");
Expand All @@ -68,7 +69,7 @@ jobs:
deploy-batcher-contract-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' ) || (needs.get-network.outputs.network == 'tavaxc' ) || (needs.get-network.outputs.network == 'tcoredao' ) || (needs.get-network.outputs.network == 'toas' ) || (needs.get-network.outputs.network == 'tflr' ) || (needs.get-network.outputs.network == 'tsgb' ) || (needs.get-network.outputs.network == 'txdc' ) }}
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' ) || (needs.get-network.outputs.network == 'tcoredao' ) || (needs.get-network.outputs.network == 'toas' ) || (needs.get-network.outputs.network == 'tflr' ) || (needs.get-network.outputs.network == 'tsgb' ) || (needs.get-network.outputs.network == 'txdc' ) || (needs.get-network.outputs.network == 'twemix' ) }}
environment: testnet
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -105,6 +106,7 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
- name: Update release notes
uses: actions/github-script@v7
with:
Expand All @@ -116,7 +118,7 @@ jobs:
deploy-batcher-contract-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' ) || (needs.get-network.outputs.network == 'avaxc' ) || (needs.get-network.outputs.network == 'coredao' ) || (needs.get-network.outputs.network == 'oas' ) || (needs.get-network.outputs.network == 'sgb' ) || (needs.get-network.outputs.network == 'flr' ) || (needs.get-network.outputs.network == 'xdc' ) }}
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' ) || (needs.get-network.outputs.network == 'coredao' ) || (needs.get-network.outputs.network == 'oas' ) || (needs.get-network.outputs.network == 'sgb' ) || (needs.get-network.outputs.network == 'flr' ) || (needs.get-network.outputs.network == 'xdc' ) || (needs.get-network.outputs.network == 'wemix' ) }}
environment: mainnet
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -153,6 +155,7 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
- name: Update release notes
uses: actions/github-script@v7
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ jobs:
FLARE_EXPLORER_API_KEY: ${{ secrets.FLARE_EXPLORER_API_KEY }}
SONGBIRD_EXPLORER_API_KEY: ${{ secrets.SONGBIRD_EXPLORER_API_KEY }}
XDC_EXPLORER_API_KEY: ${{ secrets.XDC_EXPLORER_API_KEY }}
WEMIX_EXPLORER_API_KEY: ${{ secrets.WEMIX_EXPLORER_API_KEY }}
- run: npm run lint
51 changes: 43 additions & 8 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const {
CORE_DAO_MAINNET_EXPLORER_API_KEY,
FLARE_EXPLORER_API_KEY,
SONGBIRD_EXPLORER_API_KEY,
XDC_EXPLORER_API_KEY
XDC_EXPLORER_API_KEY,
WEMIX_EXPLORER_API_KEY
} = process.env;

const config: HardhatUserConfig = {
Expand Down Expand Up @@ -172,31 +173,31 @@ const config: HardhatUserConfig = {
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
},
tflare: {
tflr: {
url: `https://coston2-api.flare.network/ext/C/rpc`,
accounts: [
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
},
tsongbird: {
url: `https://coston-api.flare.network/ext/C/rpc`,
flr: {
url: `https://flare-api.flare.network/ext/C/rpc`,
accounts: [
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
},
flare: {
url: `https://flare-api.flare.network/ext/C/rpc`,
tsgb: {
url: `https://coston-api.flare.network/ext/C/rpc`,
accounts: [
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
},
songbird: {
sgb: {
url: `https://songbird-api.flare.network/ext/C/rpc`,
accounts: [
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
Expand Down Expand Up @@ -227,6 +228,22 @@ const config: HardhatUserConfig = {
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
},
twemix: {
url: `https://api.test.wemix.com`,
accounts: [
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
},
wemix: {
url: `https://api.wemix.com`,
accounts: [
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_V4_CONTRACT_DEPLOYMENT}`,
`${PRIVATE_KEY_FOR_BATCHER_CONTRACT_DEPLOYMENT}`
]
}
},
gasReporter: {
Expand Down Expand Up @@ -276,7 +293,9 @@ const config: HardhatUserConfig = {
avaxcTestnet: 'sampleapikey',
//XDC
xdcTestnet: `${XDC_EXPLORER_API_KEY}`,
xdcMainnet: `${XDC_EXPLORER_API_KEY}`
xdcMainnet: `${XDC_EXPLORER_API_KEY}`,
wemixTestnet: `${WEMIX_EXPLORER_API_KEY}`,
wemixMainnet: `${WEMIX_EXPLORER_API_KEY}`
},
customChains: [
{
Expand Down Expand Up @@ -449,6 +468,22 @@ const config: HardhatUserConfig = {
apiURL: 'https://api-xdc.blocksscan.io/api',
browserURL: 'https://xdcscan.io'
}
},
{
network: 'wemixTestnet',
chainId: 1112,
urls: {
apiURL: 'https://api-testnet.wemixscan.com/api',
browserURL: 'https://testnet.wemixscan.com/'
}
},
{
network: 'wemixMainnet',
chainId: 1111,
urls: {
apiURL: 'https://api.wemixscan.com/api',
browserURL: 'https://wemixscan.com/'
}
}
]
},
Expand Down
24 changes: 22 additions & 2 deletions scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,23 @@ async function main() {
forwarderFactoryContractName = 'ForwarderFactoryV4';
contractPath = `contracts/${walletImplementationContractName}.sol:${walletImplementationContractName}`;
break;
//wemix
case 1112:
case 1111:
if (
eip1559GasParams.maxPriorityFeePerGas?.lt(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Wemix, we are not getting the correct gasFee for eip1559. As a workaround, we are updating the gasFee to be same as gasPrice.

legacyGasParams.gasPrice as BigNumber
)
) {
eip1559GasParams.maxPriorityFeePerGas = legacyGasParams.gasPrice;
eip1559GasParams.maxFeePerGas = legacyGasParams.gasPrice;
}
eip1559GasParams.gasLimit = 3000000;
walletImplementationContractName = 'WalletSimple';
forwarderContractName = 'ForwarderV4';
forwarderFactoryContractName = 'ForwarderFactoryV4';
contractPath = `contracts/${walletImplementationContractName}.sol:${walletImplementationContractName}`;
break;
}

if (deployWalletContracts) {
Expand Down Expand Up @@ -226,15 +243,18 @@ async function main() {
// If we have to deploy contracts for the older coins like eth, avax, polygon, we need to deploy Forwarder and ForwarderFactory
console.log('Deploying Forwarder contracts');
const Forwarder = await ethers.getContractFactory(forwarderContractName);
const forwarder = await Forwarder.deploy();
const forwarder = await Forwarder.deploy(gasParams);
await forwarder.deployed();
output.forwarderImplementation = forwarder.address;
console.log(`${forwarderContractName} deployed at ` + forwarder.address);

const ForwarderFactory = await ethers.getContractFactory(
forwarderFactoryContractName
);
const forwarderFactory = await ForwarderFactory.deploy(forwarder.address);
const forwarderFactory = await ForwarderFactory.deploy(
forwarder.address,
gasParams
);
await forwarderFactory.deployed();
output.forwarderFactory = forwarderFactory.address;
console.log(
Expand Down
33 changes: 32 additions & 1 deletion scripts/deployBatcherContract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { ethers } from 'hardhat';
import { BigNumber } from 'ethers';
import { Overrides } from '@ethersproject/contracts/src.ts';
import { BigNumberish } from '@ethersproject/bignumber';
const hre = require('hardhat');
const fs = require('fs');

Expand All @@ -16,7 +19,35 @@ async function main() {
contractName,
batcherDeployer
);
const batcher = await Batcher.deploy(transferGasLimit);

let gasParams: Overrides | undefined = undefined;

const chainId = await signers[0].getChainId();
switch (chainId) {
//WEMIX
case 1112:
case 1111:
const feeData = await ethers.provider.getFeeData();
gasParams = {
maxFeePerGas: (feeData.maxFeePerGas?.lt(feeData.gasPrice as BigNumber)
? feeData.gasPrice
: feeData.maxFeePerGas) as BigNumberish,
maxPriorityFeePerGas: (feeData.maxFeePerGas?.lt(
feeData.gasPrice as BigNumber
)
? feeData.gasPrice
: feeData.maxPriorityFeePerGas) as BigNumberish,
gasLimit: BigNumber.from('3000000')
};
break;
}

let batcher = null;
if (gasParams != undefined) {
batcher = await Batcher.deploy(transferGasLimit, gasParams);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass gasParams for wemix, as without the gasParams the contract deployment txn is underpriced.

} else {
batcher = await Batcher.deploy(transferGasLimit);
}
await batcher.deployed();
output.batcher = batcher.address;
console.log('Batcher deployed at ' + batcher.address);
Expand Down
Loading