Skip to main content
Project Version This project uses Foundry’s Solidity Scripts for deployments. The deployment scripts were architected to have different options. See the following sections for more details.

Configuration

Before running the scripts, ensure that the 2 environment variables are set for the target network in the .env file:
RPC_URL={YOUR_RPC_URL}
DEPLOYMENT_OWNER_KEY={YOUR_PRIV_KEY}

Deployment Scripts

Although all the scripts are part of the same super script contract, it contains different scripts for convenience. These scripts will be covered in the next section.

Supported Solidity scripts

allowlistsDeployment

Deploys Y Token and Deployer AllowList contracts.

ALTBCFactoryDeployment

Deploys the ALTBC PoolFactory.

TokenDeployment

Deploys x and y tokens.

ALTBCPoolDeployment

Deploys and cofigures the whole suite of contracts starting from the ALTBC PoolFactory, going through x and y tokens, configuring the factory, and finally deploying a pool with this pair through the factory. Notice that the pool will be already initialized and ready for swaps.

ALTBCFactoryDeploymentConfig

Deploys the ALTBC PoolFactory with already deployed tokens and allowlists. It requires to set the corresponding variables in the .env file.

ALTBCPoolConfigDeployment

Creates pool with already deployed factory and tokens. It requires to set the corresponding variables in the .env file. The following is an env example. Notice that this example is built for the case where both types of TBCs are going to be deployed. If only one type is desired, simply skip the variables that are not necessary for your case:
ALTBC_FACTORY={YOUR_ALTBC_FACTORY_ADDRESS}
XTOKEN_ADDRESS={YOUR_XTOKEN_ADDRESS}
YTOKEN_ADDRESS={YOUR_YTOKEN_ADDRESS}
DEPLOYMENT_OWNER_KEY={YOUR_DEPLOYMENT_OWNER_KEY}
DEPLOYMENT_OWNER={YOUR_DEPLOYMENT_OWNER_ADDRESS}
FEE_COLLECTOR={YOUR_FEE_COLLECTOR_ADDRESS}
FEE_COLLECTOR_KEY={YOUR_FEE_COLLECTOR_KEY}
LP_FEE_AMOUNT={YOUR_LP_FEE_AMOUNT}
PROTOCOL_FEE_AMOUNT={YOUR_PROTOCOL_FEE_AMOUNT}
LOWER_PRICE_AMOUNT={YOUR_LOWER_PRICE_AMOUNT}
UPPER_PRICE_AMOUNT={YOUR_UPPER_PRICE_AMOUNT}
MAX_X_TOKEN_SUPPLY={YOUR_MAX_X_TOKEN_SUPPLY}
K={YOUR_K_EXPRESSED_AS_A_WAD}
V0={YOUR_V0}
SIGMA={YOUR_SIGMA}
LAMBDA={YOUR_LAMBDA}
GAMMA={YOUR_GAMMA}

Running a script

The general format for running deployments is:
forge script {solidity script} --rpc-url {RPC_URL} --broadcast --ffi --gas-price {GAS_NUMBER}
An example of deploying the ALTBC factory to amoy would look like:
forge script ALTBCFactoryDeploymentConfig --rpc-url {RPC_URL} --broadcast --ffi --private-key {DEPLOYER_KEY} --gas-price {GAS_NUMBER}
In addition there are some useful helper scripts in the deploy folder that can get you quickly started so long as you define the correct environment variables. Or you can run the ALTBCPoolDeployment script to deploy the whole suite of contracts and get started immediately.

Contract Interaction Scripts

Please visit Interactions Documentation