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

Adding config for avalanche hardhat node; #513

Merged
merged 1 commit into from
Aug 7, 2023
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: 9 additions & 0 deletions balancer-js/examples/helpers/erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,12 @@ export const getTokenBalance = async (
const erc20 = new Contract(token, iERC20, provider);
return erc20.balanceOf(account);
};

export const getNativeAssetBalance = async (
account: string,
provider: JsonRpcProvider
): Promise<string> => {
return BigNumber.from(
await provider.send('eth_getBalance', [account, 'latest'])
).toString();
};
12 changes: 12 additions & 0 deletions balancer-js/hardhat.config.avalanche.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import '@nomiclabs/hardhat-ethers';

/**
* @type import('hardhat/config').HardhatUserConfig
*/
export default {
networks: {
hardhat: {
chainId: 43114,
},
},
};
1 change: 1 addition & 0 deletions balancer-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"node:arbitrum": "npx hardhat --tsconfig tsconfig.testing.json --config hardhat.config.arbitrum.ts node --fork $(. ./.env && echo $ALCHEMY_URL_ARBITRUM) --port 8161",
"node:gnosis": "npx hardhat --tsconfig tsconfig.testing.json --config hardhat.config.gnosis.ts node --fork $(. ./.env && echo $RPC_URL_GNOSIS) --port 8100",
"node:zkevm": "npx hardhat --tsconfig tsconfig.testing.json --config hardhat.config.zkevm.ts node --fork $(. ./.env && echo $ALCHEMY_URL_ZKEVM) --port 8101",
"node:avalanche": "npx hardhat --tsconfig tsconfig.testing.json --config hardhat.config.avalanche.ts node --fork $(. ./.env && echo $RPC_URL_AVALANCHE) --port 8114",
"typechain:generate": "npx typechain --target ethers-v5 --out-dir src/contracts './src/lib/abi/*.json'"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion balancer-js/src/test/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export async function findTokenBalanceSlot(
const account = await signer.getAddress();
const probeA = encode(['uint256'], [(Math.random() * 10000).toFixed()]);
const probeB = encode(['uint256'], [(Math.random() * 10000).toFixed()]);
for (let i = 0; i < 200; i++) {
for (let i = 0; i < 999; i++) {
let probedSlot = keccak256(['uint256', 'uint256'], [account, i]);
// remove padding for JSON RPC
while (probedSlot.startsWith('0x0'))
Expand Down