This project supports both devnet and mainnet deployments using Cargo features and environment variables.
You can set these environment variables to configure the deployment:
ANCHOR_CLUSTER: Network cluster (devnet/mainnet)ANCHOR_WALLET: Path to wallet keypair fileANCHOR_REGISTRY_URL: RPC endpoint URL
For Devnet (default):
anchor keys sync
anchor run build-devnet
anchor deployFor Mainnet:
# Set environment variables
export ANCHOR_CLUSTER=mainnet
export ANCHOR_WALLET=deployer-keypair.json
export ANCHOR_REGISTRY_URL=https://api.mainnet-beta.solana.com
# Build and deploy
anchor keys sync
anchor run build-mainnet
anchor deploy-
Create Development Token Pair (with the new deployed program id as the mint authority):
yarn deploy-tokens
Update
.envwith the new token mint addresses:TOKEN0_MINT=<new_token0_mint_address> TOKEN1_MINT=<new_token1_mint_address> -
Initialize Futarchy Authority and Pair Config:
yarn init-futarchy
-
Mint Test Tokens:
yarn faucet-mint
-
Initialize the Pair:
yarn initialize
-
Publish IDL
# For devnet
anchor idl init --filepath target/idl/omnipair.json [program.id]
# For mainnet
ANCHOR_CLUSTER=mainnet anchor idl init --filepath target/idl/omnipair.json [program.id]After completing these steps, you can:
- Add and remove liquidity
- Add and remove collateral
- Borrow and repay loans
For production deployment with verification:
# Set environment variables
export ANCHOR_CLUSTER=mainnet
export ANCHOR_WALLET=mainnet-keypair.json
export ANCHOR_REGISTRY_URL=https://api.mainnet-beta.solana.com
# Build, deploy, and verify
anchor keys sync
anchor build --verifiable -- --features "production"
anchor deploy --verifiable
anchor idl init --filepath target/idl/omnipair.json <program-id>
anchor verify -p omnipair <program-id>To upgrade an existing deployed program:
# Set environment variables for mainnet
export ANCHOR_CLUSTER=mainnet
export ANCHOR_WALLET=mainnet-keypair.json
export ANCHOR_REGISTRY_URL=https://mainnet.helius-rpc.com/?api-key={YOUR_API_KEY}
# Build the new program
anchor build -- --features "production"
# Upgrade the program
anchor upgrade --provider.cluster https://mainnet.helius-rpc.com/?api-key={YOUR_API_KEY} \
--program-id 3tJrAXnjofAw8oskbMaSo9oMAYuzdBgVbW3TvQLdMEBd \
./target/deploy/omnipair.so
// for devnet
anchor upgrade --provider.cluster https://devnet.helius-rpc.com/?api-key=66a4060b-2453-49cd-bf7a-fa03546c97ec --program-id 6boPPughAjq1PeoEicamfirB9SYjF8bBCSCeUvKJeZMj ./target/deploy/omnipair.soNote: Replace {YOUR_API_KEY} with your Helius API key and 3tJrAXnjofAw8oskbMaSo9oMAYuzdBgVbW3TvQLdMEBd with program ID.