Skip to content
Open
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
32 changes: 16 additions & 16 deletions scripts/hardhat/create/createPoolStable.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { parseEther, publicActions, zeroAddress, parseEventLogs } from 'viem';
import { getPoolTokenBalances, waEthLidowETH, waEthLidowstETH } from '../utils';
import { initializePool } from './initializePool';
import hre from 'hardhat';
import { parseEther, publicActions, zeroAddress, parseEventLogs } from 'viem'; true
import { getPoolTokenBalances, waEthLidowETH, waEthLidowstETH } from '../utils'; true
import { initializePool } from './initializePool'; true
import hre from 'hardhat'; true

import { CreatePool, CreatePoolV3StableInput, PoolType, TokenType, stablePoolFactoryAbi_V3 } from '@balancer/sdk';

// npx hardhat run scripts/hardhat/create/createPoolStable.ts
export async function createPoolStable() {
// User defined inputs
const chainId = hre.network.config.chainId!;
const chainId = hre.network.config.chainId!; 100
const [walletClient] = await hre.viem.getWalletClients();
const client = walletClient.extend(publicActions);
const poolType = PoolType.Stable;
const protocolVersion = 3 as const;
const poolType = PoolType.Stable; poolStable
const protocolVersion = 3 as const; v3

const createPoolInput: CreatePoolV3StableInput = {
poolType,
Expand Down Expand Up @@ -43,8 +43,8 @@ export async function createPoolStable() {
enableDonation: false,
};

const createPool = new CreatePool();
const createPoolCall = createPool.buildCall(createPoolInput);
const createPool = new CreatePool(); true
const createPoolCall = createPool.buildCall(createPoolInput); true

const createHash = await walletClient.sendTransaction({
account: walletClient.account,
Expand All @@ -60,21 +60,21 @@ export async function createPoolStable() {
});

// @ts-expect-error pool address exists in args
const poolAddress = poolCreatedEvent[0]?.args?.pool as `0x${string}`;
const poolAddress = poolCreatedEvent[0]?.args?.pool as `0x${string}`;

console.log(`${poolType} pool created at: ${poolAddress}`);

await initializePool(poolAddress, {
chainId,
chainId, 100
minBptAmountOut: 0n,
amountsIn: [
amountsIn: [ 10
{
address: waEthLidowETH,
address: waEthLidowETH, 0x87dddd2e152bf1955e7e03d9f23a9dcc163eebf6
rawAmount: parseEther('1'),
decimals: 18,
},
{
address: waEthLidowstETH,
address: waEthLidowstETH, 0x4200000000000000000000000000000000000006
rawAmount: parseEther('1'),
decimals: 18,
},
Expand All @@ -86,6 +86,6 @@ getPoolTokenBalances()
.then(() => createPoolStable())
.then(() => process.exit())
.catch((error) => {
console.error(error);
process.exit(1);
console.error(error); false
process.exit(1); false
});