This repository contains deployment scripts for the orbit protocol, providing functionalities for initializing, deploying, and managing various contract operations. The repository includes both interactive CLI tools and automated deployment scripts.
- Configuration
- Installation
- Usage
- Full Deployment Script
- Liquidation Test Script
- Available CLI Actions
The script uses a configuration file to manage network-specific settings and credentials. Ensure that you create a <selected network>.contracts.json
file with the following content:
{
"contracts": {
"backstop": "address",
"poolFactory": "address",
"treasury": "address",
"pegkeeper": "address",
"bridgeOracle": "address",
"router": "address",
"oracle": "address"
},
"tokens": {},
"pools": {}
}
npm install
npm run build
node lib/start.ts
The fullDeploy.ts
script provides an automated way to deploy all necessary contracts and set up the initial configuration. It performs the following steps:
- Initializes Orbit system contracts
- Deploys XLM and OUSD tokens
- Creates liquidity pool pair
- Initializes Oracle with price feeds
- Sets up pool configurations
- Configures backstop and emissions
- Initializes stablecoin admin
To run the full deployment:
node lib/fullDeploy.ts
The liquidation.ts
script allows testing of the liquidation mechanism by:
- Setting up test accounts
- Minting collateral
- Creating a position
- Triggering a liquidation by changing oracle prices
- Testing the keep-peg mechanism
Note: The script requires the AMM pair address. You can find this on the Stellar testnet explorer by:
- Going to the testnet explorer at https://stellar.expert/explorer/testnet
- Searching one of the tokens created and find the add_liquidity call.
- You should see that it initializes a new contract that is the amm contract needed
To run the liquidation test:
# Edit the AMM pair address in liquidation.ts first
node lib/liquidation.ts
- Initialize Orbit: Initializes the orbit with the given oracle address.
- Parameters:
oracle_address
- Parameters:
- Deploy Token: Deploys a new token contract.
- Parameters:
token_name
- Parameters:
- Deploy Pool: Deploys a new pool with the specified parameters.
- Parameters:
pool_name
,backstop_take_rate
,max_positions
- Parameters:
- Pool Options: Manage pool-specific operations such as setting reserves, emissions, and statuses.
- Treasury Options: Manage treasury-specific operations like adding stablecoins and managing supply.
- Bridge Oracle Options: Manage bridge oracle-specific operations like adding assets and price feeds.
- Set reserve: Set the reserve configuration for a pool.
- Parameters:
token
,reserve_config
- Parameters:
- Set emissions: Set the emissions configuration for a pool.
- Parameters:
poolEmissionMetadata
- Parameters:
- Add to backstop: Add funds to the backstop for a pool.
- Parameters:
backstop_amount
- Parameters:
- Set status: Set the status of a pool.
- Parameters:
status
- Parameters:
- Add to Reward Zone: Add a pool to the reward zone.
- Parameters:
pool_name
,pool_to_remove
- Parameters:
- Set Admin: Set the admin for a pool.
- Parameters:
new_admin
- Parameters:
- Add Stablecoin: Add a new stablecoin to the treasury.
- Parameters:
stablecoin_name
,blend_pool
,asset
- Parameters:
- Increase Supply: Increase the supply of a specified token.
- Parameters:
increase_token_name
,amount
- Parameters:
- Set Pegkeeper: Set the pegkeeper for the treasury.
- Parameters:
pegkeeper
- Parameters:
- Set Treasury Admin: Set the admin for the treasury.
- Parameters:
new_admin
- Parameters:
- Add Bridge Oracle Asset: Add a new asset to the bridge oracle.
- Parameters:
from_asset
,to_asset
- Parameters:
- Get Last Price: Retrieve the last price for an asset from the bridge oracle.
- Parameters:
asset_for_price
- Parameters:
- Set Oracle: Set the oracle address.
- Parameters:
oracle_address
- Parameters: