Set of liquidity lockbox contracts on Solana for Olas protocol.
This folder contains the liquidity lockbox set of contracts on Solana.
The lockbox program is designed to allow “bonders” to receive in exchange for OLAS and SOL tokens fungible token equivalents to the liquidity created by depositing a such amount of OLAS and SOL tokens with full range in the (OLAS-SOL) Orca whirlpool.
The description of the concept can be found here: Liquidity lockbox concept.
A successful program CPI with Orca Whirlpool program requires that the following environment is satisfied:
anchor --version
anchor-cli 0.26.0
solana --version
solana-cli 1.14.29 (src:36af529e; feat:139196142)
rustc --version
rustc 1.62.0 (a8314ef7d 2022-06-27)
Advise the script setup-env.sh
to correctly install the required environment.
Install the dependencies:
yarn
If you need to remove / check dependencies, run:
cargo clean
cargo tree
You might also want to completely remove the Cargo.lock
file.
Build the code with:
anchor build
Run the validator in a separate window:
./validator.sh
Export environment variables:
export ANCHOR_PROVIDER_URL=http://127.0.0.1:8899
export ANCHOR_WALLET=artifacts/id.json
To run the initial script that would just initialize the lockbox program along with having Orca Whirlpool program and required user accounts setup, run:
solana airdrop 10000 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h --url localhost && npx ts-node tests/lockbox_init.ts
To run integration test, make sure to stop and start the validator.sh
in a separate window. Then run:
solana airdrop 10000 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h --url localhost && npx ts-node tests/liquidity_lockbox.ts
The deployed program ID must be 7ahQGWysExobjeZ91RTsNqTCN3kWyHGZ43ud2vB7VVoZ
and corresponds to the declare_id
in the programs/liquidity_lockbox/src/lib.rs
and Anchor.toml
file.
For debugging a program address, after the launch of local validator, run:
solana logs -v --url localhost 7ahQGWysExobjeZ91RTsNqTCN3kWyHGZ43ud2vB7VVoZ
In order to just calculate and verify the added liquidity, export your credentials and execute the corresponding script:
export ANCHOR_PROVIDER_URL=https://api.mainnet-beta.solana.com
export ANCHOR_WALLET=your_wallet.json
npx ts-node tests/calculate_liquidity.ts
All the project-related documents are located here: docs.
Stub test with only initializing the lockbox program along with having Orca Whirlpool program and required user accounts setup is located here: lockbox_init.ts
Integration test is located here: liquidity_lockbox.ts.
- The audit is provided as development matures. The latest audit report can be found here: audits.
The deployment procedure is described here: deployment.
- Program ID: 1BoXeb8hobfLCHNsyCoG1jpEv41ez4w4eDrJ48N1jY3
- Lockbox: 3UaaD3puPemoZk7qFYJWWCvmN6diS7P63YR4Si9QRpaW
- Position mint: 36WxSP8trn5czobJaa2Ka7jN58B7sCN7xx2HDom6TDEh
- Position: EHQbFx7m5gPBqXXiViNBfHJDRUuFgqqYsLzuWu18ckaR
- Lockbox position account: sVFBxraUUqmiVFeruh1M7bZS9yuNcoH7Nysh3YTSnZJ
- Bridged token mint: CeZ77ti3nPAmcgRkBkUC1JcoAhR8jRti2DHaCcuyUnzR
- Fee collector token account for SOL: Gn7oD4PmQth4ehA4b8PpHzq5v1UXPL61jAZd6CSuPvFU
- Fee collector token account for OLAS: FPaBgHbaJR39WBNn6xZRAmurQCBH9QSNWZ5Kk26cGs9d
anchor idl init -f scripts/liquidity_lockbox.json --provider.cluster https://api.mainnet-beta.solana.com 1BoXeb8hobfLCHNsyCoG1jpEv41ez4w4eDrJ48N1jY3
The liquidity lockbox contracts were inspired and based on the following sources: