VaultV5
VaultV5 is the LP token management and betting contract system of Chaos Protocol, allowing users to bet on token price movements.
Basic Information
| Property | Value |
|---|---|
| Contract Type | UUPS Upgradeable |
| Core Functions | LP Management + Betting Contracts |
| Contract Lock Time | 3 days |
| LP Transfer Fee | 10% |
| Cancellation Fee Rate | 1%-5% (Dynamic) |
Core Functions
1. LP Token Management
VaultV5 manages all LP tokens generated through BurnPoolV2.
LP Sources
solidity
// Record via BurnPoolV2
function recordLpDeposit(
address user,
uint256 lpAmount
) external onlyBurnPool;
// Direct deposit
function depositLp(uint256 lpAmount) external;LP Query
solidity
// Query user LP balance
function getUserLpBalance(address user) external view returns (uint256);
// Query LP value in USDT
function getUserUsdtBalance(address user) external view returns (uint256);LP Transfer
Users can transfer LP tokens to other addresses:
solidity
function transferLpToken(
address to,
uint256 lpAmount
) external;Fee Mechanism:
- 10% fee on transfers
- LP tokens corresponding to the fee are burned (sent to dead address)
solidity
uint256 fee = lpAmount * 10 / 100;
uint256 netAmount = lpAmount - fee;
// fee portion is burned2. Betting Contract System
The core innovation of VaultV5 is the betting contract system, allowing users to bet on Chaos token price movements.
Contract Status Flow
Create Contract → Locked (30 min) → Waiting for Taker → Active (3 days) → Settle/Cancel
↓ ↓ ↓ ↓ ↓
USDT Locked Cannot Cancel Can Take Contract Price Movement P&L DistributionCreate Contract (Creator)
solidity
function createContract(
uint256 usdtAmount
) external returns (uint256 contractId);Creation Conditions:
- Use USDT to create
- Cannot cancel within 30-minute lock period
- Creation limit based on burn amount:
- Base: 10% of total burn amount
- With referral: Additional +2%
- Minimum 30 USDT
Take Contract (Taker)
solidity
function takeContract(
uint256 contractId,
uint256 lpAmount
) external;Taking Flow:
- Use equivalent LP tokens to take contract
- Contract splits LP into USDT and tokens
- Token portion is sold back for USDT
- Forms a betting position based on current price
Settle/Cancel
solidity
function cancelContract(uint256 contractId) external;Settlement Rules:
| Situation | Creator | Taker |
|---|---|---|
| Token Depreciates | Gets back principal | LP processed according to loss ratio |
| Token Appreciates | Gets 50% of profit | Gets 50% of profit |
Limitations:
- Maximum profit cannot exceed 2x investment
- Cannot cancel during lock period (30 minutes)
Cancellation Fee
Fee dynamically adjusts based on LP token burn ratio:
solidity
function getCancelFeeRate(
uint256 contractId
) external view returns (uint256);| Burn Ratio | Fee Rate |
|---|---|
| ≥ 90% | 1% |
| ≥ 50% | 1% - 5% (Linear decrease) |
| < 50% | 5% |
3. Price Benchmark
Betting contracts use the price at creation as the benchmark:
solidity
struct Contract {
uint256 benchmarkPrice; // Price at creation
uint256 creatorAmount; // Creator's USDT investment
uint256 takerAmount; // Taker's LP value
uint256 createdAt; // Creation time
uint256 lockedUntil; // Lock deadline
ContractStatus status; // Contract status
}User Operations
Query Contracts
solidity
// Query single contract
function getContract(uint256 contractId) external view returns (Contract memory);
// Query all open contracts
function getOpenContractsV2() external view returns (uint256[] memory);
// Query user's created contracts
function getUserCreatedContracts(address user) external view returns (uint256[] memory);
// Query user's taken contracts
function getUserTakenContracts(address user) external view returns (uint256[] memory);Preview Cancellation
solidity
// Preview cancellation P&L
function previewCancellation(
uint256 contractId
) external view returns (
int256 creatorPnl,
int256 takerPnl,
uint256 fee
);Permit2 Support
solidity
function createContractWithPermit(
uint256 usdtAmount,
Permit2Data calldata permit2Data
) external returns (uint256 contractId);Security Features
- UUPS Upgradeable: Supports contract upgrade
- Time Lock: 30-minute lock period prevents instant cancellation
- Dynamic Fee: Incentivizes long-term LP holding
- Profit Cap: Maximum 2x profit limit
- Owner Withdrawal: Emergency token extraction
Events
solidity
event ContractCreated(uint256 indexed contractId, address indexed creator, uint256 amount);
event ContractTaken(uint256 indexed contractId, address indexed taker, uint256 lpAmount);
event ContractCancelled(uint256 indexed contractId, int256 creatorPnl, int256 takerPnl);
event LpTransferred(address indexed from, address indexed to, uint256 amount, uint256 fee);