An open API service indexing awesome lists of open source software.

https://github.com/balancer/pool-operation-examples-v3

Example scripts for Balancer v3 pool operations
https://github.com/balancer/pool-operation-examples-v3

Last synced: 10 months ago
JSON representation

Example scripts for Balancer v3 pool operations

Awesome Lists containing this project

README

          

# SDK Examples

A collection of example scripts that illustrate how to use the Balancer SDK to create pools, swap tokens, add liquidity, and remove liquidity. Everything is configured to run on a local fork of Ethereum mainnet and use the [Balancer Aave Lido wETH-wstETH pool](https://balancer.fi/pools/ethereum/v3/0xc4ce391d82d164c166df9c8336ddf84206b2f812)

## Getting Started

1. Clone this repo & install dependencies

```
git clone https://github.com/balancer/pool-operation-examples-v3.git
cd pool-operation-examples-v3
pnpm install
```

2. Add a `MAINNET_RPC_URL` to a `.env` file

```
MAINNET_RPC_URL=
```

3. Run an example script

```
npx hardhat run scripts/hardhat/add-liquidity/addLiquidityProportional.ts
```

## Example Scripts

### Create Pool

- createPoolStable.ts
- createPoolStableSurge.ts
- createPoolWeighted.ts

### Swap Tokens

- swapCustomPath.ts
- swapSmartPath.ts

### Add Liquidity

- addLiquidityProportional.ts
- addLiquidityProportionalToERC4626.ts
- addLiquidityUnbalanced.ts
- addLiquidityUnbalancedToERC4626.ts

### Remove Liquidity

- removeLiquidityProportional.ts
- removeLiquidityProportionalFromERC4626Pool.ts
- removeLiquiditySingleTokenExactIn.ts
- removeLiquiditySingleTokenExactOut.ts