Staking Mechanics
Core Staking Process
Smart Contract Functions
Provide Function (Staking)
@Callable(i)
func provide() = {
let pmt = i.payments[0]
# Validate supported tokens (USDTu or USDT-ERC20)
if (pmt.assetId != usdtId && pmt.assetId != usdtuId) then
throw("please attach USDT: " + usdtIdStr + ", " + usdtuIdStr)
else
# Calculate protocol fee (0.3% of stake)
let feeAmount = fraction(pmt.amount, MintFee, Scale6)
let cleanAmount = pmt.amount - feeAmount
# Calculate LP tokens to mint based on current price
let lpAmount = fraction(cleanAmount, Scale6, tryGetInteger("global_lpPrice"))
[
Reissue(lpId, lpAmount, true),
ScriptTransfer(i.caller, lpAmount, lpId),
ScriptTransfer(FeeAddress, feeAmount, pmt.assetId)
]
}Withdraw Function
LP Token Price Mechanism
Price Update Frequency
Oracle Price Update
Investment Flow
Fund Allocation Process
Investment Strategies
Lending Protocol Integration
Risk Management System
Position Limits
Diversification Rules
Token Economics
LP Token Supply Management
Minting Process
Burning Process
Fee Structure
Protocol Fee (0.3% of stake)
Withdrawal Mechanics
Instant Withdrawal
LP Token Burning
Performance Tracking
Price Calculation
Performance Metrics
Emergency Procedures
Access Control
Initialization Security
Waves Blockchain Benefits
Transaction Efficiency
Data Storage
Monitoring and Alerts
Real-time Monitoring
Error Handling
Next Steps
Last updated