script/interactions folder that can be used to interact with the deployed factory and pools step by step. These are useful to interact with the deployed contracts and to test the pool and factory transaction by transaction or in small group of transactions.
Take into account th
Any time the <NETWORK> variable shows up in a script it means that it is possible to have one of the following values which correspond to the supported networks:
- local
- amoy
- sepolia
Environment Variable Configuration
Before using the scripts, ensure that the 2 environment variables are set for the target network:Factory
Recap of Factory Configuration
In order to deploy a pool, the factory must be configured with the following parameters:- The deployer address must be in the allowed deployer list.
- The collateral token of the pool must be in the allowed collateral list.
Scripts
Run these scripts in the terminal at the project’s root directory if needed.addAllowedDeployerAndCollateralToken.sh
Adds a deployer and collateral token address to the allow lists: usage:createALTBCPool.sh
A custom pool could also be deployed through the factory with a script:Pool
Recap of a Pool Initialization
Once a pool has been deployed, it needs 3 steps to be initialized by the pool owner:- Approve the pool to take all the supply of the x token.
- Add liquidity for x token.
- Enable swaps.
Scripts
Run these scripts in the terminal at the project’s root directory if needed.InitializePool.sh
Approves the pool to take the liquidity, adds liquidity to the pool and then enables swaps:approvePool.sh
Approves a pool to take a certain amount of a token. This can be used to approve any token and any pool. Use before swaps to approve the pool to take your y or x token.swap.sh
Tells the pool how much token to sell in exchange for the other one. The script internally computes the amount expected to be received which will be passed into theswap function as a parementer to calculate slippage.
Internal Scripts
Most of the aforementioned scripts use other scripts to work. These scripts can be found in the subdirectories of thescript/interactions folder. The documentation for these scripts can be found inside the sctipt itself.