PoolTogether V5 production Moonwell prize vault deployment scripts.
You may have to install the following tools to use this repository:
- Node.js to run scripts
- yarn to install node.js dependencies
- Foundry to compile and test contracts
- direnv (or a similar tool) to set environment variables
Install dependencies:
yarn install
Make a copy of .envrc.example
and write down the env variables needed to run this project.
cp .envrc.example .envrc
Once your env variables are setup, load them with:
direnv allow
Run the following command to compile the contracts:
yarn compile
Each Moonwell prize vault deployment share some configuration parameters across each chain, but have some unique params that must be set on deployment time such as the prize vault name, symbol, owner, and deposit asset.
All chain-specific configurable parameters are located in the config folder and are separated by chain name. If the target chain does not have it's own configuration file, then a new one can be created an modified based on the deployment requirements.
All deployment-specific config parameters will be input on deployment through the CLI.
The following is a list of each final parameter (chain-specific and deployment-specific params).
The LP Factory is the TPDA Liquidation Pair factory that will be used to deploy the liquidation pair for the prize vault AND each reward liquidation pair that will be deployed through the associated reward liquidator.
This is the target liquidation frequency for the prize vault liquidations.
This is the starting target liquidation price for the prize vault liquidations.
This is the liquidation smoothing factor for the prize vault liquidations.
This is the RewardLiquidatorFactory
contract that will be used to deploy a new reward liquidator for the new yield vault.
This is the target liquidation frequency for the reward liquidations.
This is the starting target liquidation price for the reward liquidations.
This is the smoothing factor for the reward liquidations.
This is the moonwell comptroller that will be used to harvest rewards for the yield vault.
This is the prize pool that the prize vault will contribute to.
This is the factory that will be used to deploy the new prize vault.
This is the claimer contract that will be permitted to claim prizes for the prize vault.
This is the deposit asset that will be used to generate yield on Moonwell.
This is the name of the new prize vault share token.
This is the symbol of the new prize vault share token.
This is the owner of the new prize vault contract. Ownership will have to be accepted after the contract is deployed to complete the transfer from the deployer address.
This is the 9 decimal fraction that represents how much yield will be reserved for the yield fee recipient.
This is the address that will receive the accrued yield fee.
To deploy a new prize vault, first ensure the following steps have been completed:
- set relevant environment variables (RPC URLs, deployer address and private key, etherscan API key)
- configure the chain-specific deployment parameters in a JSON file
- deploy a new reward liquidator factory (if one does not exist on the target chain)
- Copy the
deploy:base:rewardLiquidatorFactory
NPM script and modify it for your target chain before running the new script. Then set the reward liquidation factory param in the corresponding config JSON file.
- Copy the
- Transfer a small amount of assets (about $1 worth) to the deployer address so they can be donated to the prize vault to fill the yield buffer on deployment.
To deploy a new prize vault and supporting contracts, first follow the steps above and then run the NPM command in the package.json
file that corresponds to the chain you wish to deploy on. For example, to deploy on base, run npm run deploy:base:prizeVault
.
If a script is not setup for your target chain, first create a new config file for the chain and then copy one of the existing NPM commands and modify it to match your desired configuration.
After deployment, contracts will automatically be verified on etherscan using your set etherscan API key for the relevant chain.
If there are additional token rewards on the yield vault used, they can be initialized after deployment by calling initializeRewardToken
on the RewardLiquidator
paired with the deployed yield vault.