Staking Mechanics
Deep dive into Pupas Protocol's AI-powered staking system
Understanding the technical mechanics behind Pupas Protocol helps you maximize returns and make informed staking decisions. Our system combines traditional LP token mechanics with AI-driven investment strategies.
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
Interval: Every 60 minutes (3,600 seconds)
Oracle Function:
updateLpPrice()called by authorized addressValidation: Price change limits prevent manipulation
Transparency: All updates recorded on-chain
Oracle Price Update
Investment Flow
Fund Allocation Process
Pool Aggregation: Staked USDTu/USDT-ERC20 collected in main pool
AI Analysis: Investment agents analyze market conditions
Strategy Selection: AI choose optimal investment pools
Fund Deployment: Portion of pool allocated to selected strategies
Return Calculation: Profits/losses calculated and recorded
Price Update: New LP token price reflects pool performance and account balance
Investment Strategies
Lending Protocol Integration
Risk Management System
Position Limits
Diversification Rules
Maximum volatility tolerance: 10% per price update
Protocol fee: 0.3% of stake amount
Automated position management via AI agents
Token Economics
LP Token Supply Management
Minting Process
Burning Process
Fee Structure
Protocol Fee (0.3% of stake)
Withdrawal Mechanics
Instant Withdrawal
No Lock Period: Withdraw anytime without penalties
Current Price: Always withdraw at latest LP price
Automated Processing: Smart contract handles transfers
LP Token Burning
Performance Tracking
Price Calculation
Performance Metrics
LP Price History: Tracked via oracle updates
Total Value Locked: Sum of all staked assets
Active Strategies: Monitored by AI agents
Fee Collection: Protocol revenue tracking
Emergency Procedures
Access Control
Initialization Security
Waves Blockchain Benefits
Transaction Efficiency
Low Fees: ~0.005 WAVES per transaction
Fast Finality: ~1 minute confirmation
Predictable Costs: No gas price volatility
RIDE Language: Secure, predictable smart contracts
Data Storage
Monitoring and Alerts
Real-time Monitoring
Price Deviations: Oracle volatility tolerance enforced
Strategy Performance: AI agent monitoring
Liquidity Levels: Automated withdrawal processing
System Health: Smart contract state validation
Error Handling
Important: LP token prices can go down as well as up. AI strategies don't guarantee profits and may result in losses during adverse market conditions.
Next Steps
Understand LP Token mechanics in detail
Learn about Protocol Features to see AI capabilities
Explore Yield Sources for profit generation
Last updated