🧑💻Technical Details
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
This section provides a deeper technical understanding of how Oasis works. While not necessary for using the platform, these details offer insights into the mathematical foundations and mechanisms that ensure the protocol's security and efficiency.
When you provide liquidity, several key values are calculated:
Initial Position Setup
For a deposit amount D_token
:
HTR_matched = D_token / P_htr_i
Where:
D_token
: Initial token deposit amount
P_htr_i
: Initial HTR price
HTR_matched
: Amount of HTR matched by Oasis
Bonus Calculation
HTR_bonus = (D_token × Bonus_rate) / P_htr_i
Where:
Bonus_rate
: Set by lock duration (10%, 15%, or 20%)
HTR_bonus
: Amount of bonus HTR tokens received
The protocol maintains constant product AMM mathematics:
x × y = K
Where:
x: Token amount in pool
y: HTR amount in pool
K: Constant product
R = P_htr_f / P_token_f
Where:
P_htr_f
: Final HTR price
P_token_f
: Final token price
R
: Price ratio
Value Deficit Calculation
Token_deficit = max(0, D_token - x_f)
Where:
x_f
: Final token balance
Token_deficit
: Amount requiring protection
Protection Payment
When protection applies:
HTR_protection = Token_deficit / P_htr_f
For any new price ratio R, new pool balances are calculated as:
y/x = R
x × y = K
Therefore:
x = sqrt(K/R)
y = x × R
Protection ensures that for any price movement within 4x:
withdrawal_value ≥ initial_deposit_value
Where withdrawal_value includes:
Original token amount (or equivalent)
Protection compensation in HTR
Accumulated trading fees
For positions with held bonus:
V_total_hold = LP_value + (B_htr × P_htr_f)
For positions with sold bonus:
V_total_sell = LP_value + (B_htr × P_htr_i)
Where:
LP_value
: Liquidity position value
B_htr
: Bonus HTR amount
P_htr_f
: Final HTR price
P_htr_i
: Initial HTR price
Percentage return calculation:
Return_% = ((V_total / D_token) - 1) × 100
Full Protection Range:
Up to 4x price divergence
Complete value preservation
Automatic calculation
The protocol maintains:
HTR reserve for each pool
Automated matching system
Protection reserve allocation
Dynamic capacity management (new HTR deposits can be made to increase the reserve available)
The simulation tool models returns using:
Price movement inputs:
HTR price change
Token price change (for hBTC)
Strategy comparisons:
Hold bonus path
Immediate sell path
Protection impacts
Fee accumulation
Transaction Processing:
Instant matching
Automatic protection
Real-time calculations
Value Tracking:
Continuous monitoring
Price feed integration
Protection threshold checks