A sophisticated vault system for automated liquidity provision (LP) staking on Astroport forks, implementing the CW4626 standard for tokenized vaults on Cosmos blockchains.
This project provides the following vault implementations:
cw4626-escher- Enhanced vault with automated LP management, liquid staking and incentives
- Deposit: Users can deposit underlying tokens and receive vault shares
- Redeem: Exact share minting and redemption
- CW20 Compliance: Vault shares are standard CW20 tokens while the underlying asset can be CW20 or native
- Escher Hub Integration: Liquid stake on the Escher Hub in the same chain or across chains
- Incentive Management: Integration with Astroport's reward system
- Oracle Integration: Real-time price feeds for optimal LP management
- Slippage Protection: Configurable slippage tolerance
- Role-Based Access: Manager and Oracle roles for secure operations
- Ownership Management: Secure transfer and management of vault ownership
- Input Validation: Comprehensive parameter validation and bounds checking
- User deposits underlying token
- User receives vault shares representing their position
- Vault manager
- Stakes in the Escher Hub (from the same or other network via ZKGM)
- Provides liquidity to Astroport pairs
- Handles the Vault's position
- Vault earns LP rewards, trading fees, and incentives
- User can redeem shares for underlying tokens + accumulated rewards
./scripts/dev-docker.shdocker-compose exec cw4626-nix ./scripts/nix-bash.sh ./scripts/build-optimize.sh
# To instead enter into an interactive shell run `nix-bash.sh` without any arguments. Like this:
docker-compose exec cw4626-nix ./scripts/nix-bash.shdocker-compose exec cw4626-nix ./scripts/nix-bash.sh cargo test./scripts/nix-bash.sh./scripts/build-optimize.shcargo test# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install wasm-opt
brew install binaryen # macOS
# or
sudo apt install binaryen # Ubuntu# Build all contracts
cargo wasm -p cw4626-escher
# Generate schemas
cargo schema -p cw4626-escher
# Build optimized version
./scripts/build-optimize.shcargo test# 1. Upload contract code
wasmd tx wasm store target/wasm32-unknown-unknown/release/cw4626_escher_optimized.wasm \
--from <key> --chain-id <chain-id> --gas auto --gas-adjustment 1.3
# 2. Instantiate contract
wasmd tx wasm instantiate <code-id> '{
"managers": [
"<manager-address>",
...
],
"oracles": [
"<oracle-address>",
...
],
"underlying_token": {
"native_token": {
"denom": "ibc/..."
}
},
"share_name": "Escher USDC",
"share_symbol": "eUSDC",
"tower_incentives": "<tower-incentives-address>",
"lp": "<lp-address>",
"slippage_tolerance": "0.01",
"incentives": [
{
"native_token": {
"denom": "ibc/..."
}
},
{
"token": {
"contract_addr": "<cw20-address>"
}
}
],
"entry_fee_recipient": "<fee-recipient>"
}' --from <key> --chain-id <chain-id> --gas auto --fees <amount># All tests
cargo test
# Specific tests
cargo test --lib
cargo test --test integration
cargo test test_name# Install coverage tool
cargo install cargo-llvm-cov
# Generate coverage report
cargo cov
# Open coverage in browser
cargo cov --open# Check for warnings
cargo check
# Format code
cargo fmt
# Lint code with Clippy
cargo clippy --workspace -- -D warnings- Deployment Code Verification: See
./VERIFY.md - CW4626-Escher Spec: See
./contracts/cw4626-escher/README.md - API Reference: Generated schemas in
./schema/directory
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for
details.
- Issues: Create an issue on GitHub
- Documentation: Check the setup guides and generated schemas
- Community: Join our Discord/Telegram for discussions
- EIP4626 Standard: Specification
- CosmWasm: Documentation
- Astroport: Protocol
- Union: Protocol
- TowerFi/BabyDEX: Repository
Built with β€οΈ for the Cosmos ecosystem using Docker and Nix