Burve is a next-generation decentralized exchange protocol that implements advanced automated market making functionality using a diamond proxy pattern for upgradability and modularity.
Burve Protocol introduces a novel approach to decentralized trading with the following key features:
- Diamond Proxy Architecture: Utilizes the Diamond standard (EIP-2535) for modular and upgradeable smart contracts
- Advanced AMM Logic: Implements sophisticated automated market making algorithms for efficient trading
- Multi-Token Support: Handles multiple token pairs with optimized liquidity management
- Flexible Swapping: Provides precise control over trades with customizable price limits
- Secure Liquidity Provision: Robust mechanisms for adding and removing liquidity
The protocol is built using a modular architecture with the following main components:
- SwapFacet: Handles token swap operations with customizable parameters
- LiqFacet: Manages liquidity provision and removal
- SimplexFacet: Implements simplex-based calculations
- EdgeFacet: Manages token pair relationships and pricing
- ViewFacet: Provides view functions for protocol state
- Foundry
- Solidity ^0.8.27
- Clone the repository:
git clone [https://github.com/itos-finance/Burve](https://github.com/itos-finance/Burve)
cd Burve- Install dependencies:
forge install- Build the project:
forge buildRun the test suite:
forge testforge verify-contract --chain-id 1 --etherscan-api-key <your_etherscan_api_key> --constructor-args <constructor_args> <contract_address> <contract_source_path>Contributions are welcome! Please feel free to submit a Pull Request.
For detailed documentation about the protocol's architecture and usage, please visit our documentation site.
- Website: https://www.hyperplex.xyz/
- Twitter: @Hyperplex_xyz
- Discord: Burve Community
- Install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup- Install dependencies:
forge install- Create a
.envfile with your deployment private key:
DEPLOYER_PRIVATE_KEY=your_private_key_here- Start Anvil local testnet:
anvil- Use Anvil's default account (no need to set DEPLOYER_PRIVATE_KEY):
# Deploy using Anvil's default account
forge script script/Deploy.s.sol:DeployBurve --rpc-url http://localhost:8545 --broadcastFor deploying to actual networks, set your deployer key:
export DEPLOYER_PRIVATE_KEY=your_private_key_here
forge script script/Deploy.s.sol:DeployBurve --rpc-url your_rpc_url --broadcast --verifyThis will:
- Deploy mock tokens (USDC, USDT, DAI, WETH)
- Deploy mock vaults for each token
- Deploy the Burve Diamond contract with all facets
- Set up edges between all token pairs
- Create LP tokens for all valid token combinations
- Save all deployed addresses to
deployed_addresses.json
After deployment, you can use the following utility scripts to interact with the protocol:
When testing locally with Anvil, you don't need to set the DEPLOYER_PRIVATE_KEY as it will use Anvil's default account:
# Example for adding liquidity locally
export CLOSURE_ID=1
export AMOUNT=1000000
forge script script/utils/AddLiquidity.s.sol:AddLiquidity --rpc-url http://localhost:8545 --broadcast
# Example for swapping locally
export IN_TOKEN=<address from deployed_addresses.json>
export OUT_TOKEN=<address from deployed_addresses.json>
export AMOUNT=1000
forge script script/utils/Swap.s.sol:Swap --rpc-url http://localhost:8545 --broadcast# Set environment variables
export CLOSURE_ID=1 # The closure ID you want to add liquidity to
export AMOUNT=1000000 # Amount of each token to add (in token decimals)
export RECIPIENT=0x... # Optional: Address to receive LP tokens (defaults to sender)
# Run the script
forge script script/utils/AddLiquidity.s.sol:AddLiquidity --rpc-url your_rpc_url --broadcast# Set environment variables
export CLOSURE_ID=1 # The closure ID you want to remove liquidity from
export SHARES=1000 # Number of LP shares to burn
export RECIPIENT=0x... # Optional: Address to receive tokens (defaults to sender)
# Run the script
forge script script/utils/RemoveLiquidity.s.sol:RemoveLiquidity --rpc-url your_rpc_url --broadcast# Set environment variables
export IN_TOKEN=0x... # Address of input token
export OUT_TOKEN=0x... # Address of output token
export AMOUNT=1000 # Positive for exact input, negative for exact output
export SQRT_PRICE_LIMIT=0 # Optional: Price limit for the swap
export RECIPIENT=0x... # Optional: Address to receive output tokens (defaults to sender)
# Run the script
forge script script/utils/Swap.s.sol:Swap --rpc-url your_rpc_url --broadcastThe system uses a Diamond proxy pattern with the following facets:
LiqFacet: Handles liquidity addition and removalSwapFacet: Handles token swapsEdgeFacet: Manages edge parameters between token pairsSimplexFacet: Core simplex functionality and admin operationsViewFacet: Read-only view functions
After deployment:
- The mock tokens will need to be minted to users for testing
- Users will need to approve the Diamond contract to spend their tokens
- LP tokens will be automatically created for all valid token combinations
The deployment script includes verification flags. Make sure your block explorer API key is set in the environment:
export ETHERSCAN_API_KEY=your_api_key_hereRun the test suite:
forge testRun with gas reporting:
forge test --gas-reportFor local testing with a fork of mainnet:
forge script script/Deploy.s.sol:DeployBurve --fork-url your_archive_node_urlThe primary license for Burve Protocol is the Business Source License 1.1 (BUSL-1.1), see LICENSE. However, some files have different licenses:
src/FullMath.solis licensed under MIT (as indicated in its SPDX header)
All files in the test/ directory are UNLICENSED (as indicated in their SPDX headers).