MOET System Integration
This document explains how MOET connects and enables seamless interactions between ALP, FYV, and the broader FCM ecosystem.
Overview of Integration Architecture
MOET serves as the integration layer that binds together FCM's components, enabling automated capital flows and coordinated risk management:
_44graph TB_44 subgraph FCM[Flow Credit Market Ecosystem]_44 subgraph ALP[ALP - Lending Engine]_44 Pool[Pool Contract]_44 Position[Position Resource]_44 Oracle[Price Oracle]_44 end_44_44 subgraph MOET[MOET - Integration Layer]_44 Mint[Minting System]_44 Burn[Burning System]_44 Balance[Balance Tracking]_44 end_44_44 subgraph FYV[FYV - Yield Layer]_44 Vault[Yield Vault]_44 Strategy[Tracer Strategy]_44 Balancer[Auto Balancer]_44 end_44_44 subgraph Actions[DeFi Actions - Flow Control]_44 Sink[DrawDownSink]_44 Source[TopUpSource]_44 Swap[SwapConnector]_44 end_44_44 Pool -->|Mints| Mint_44 Position -->|Burns| Burn_44 Oracle -->|Prices in MOET| Balance_44_44 Mint -->|Flows via| Sink_44 Sink -->|Deploys to| Strategy_44 Strategy -->|Holds in| Balancer_44_44 Balancer -->|Converts via| Swap_44 Swap -->|Provides via| Source_44 Source -->|Repays to| Position_44 Position -->|Burns| Burn_44 end_44_44 style ALP fill:#6699ff,stroke:#333,stroke-width:2px_44 style MOET fill:#ff6666,stroke:#333,stroke-width:2px_44 style FYV fill:#66cc66,stroke:#333,stroke-width:2px_44 style Actions fill:#ffcc66,stroke:#333,stroke-width:2px
MOET in ALP (Automated Lending Platform)
Primary Borrowed Asset
MOET is the default and primary borrowed asset in ALP, with all lending operations centered around it.
Pool Configuration:
_10// ALP Pool initialization (simplified)_10init() {_10 self.defaultToken = Type<@MOET.Vault>_10 self.supportedTokens = {_10 Type<@MOET.Vault>: TokenState,_10 Type<@FlowToken.Vault>: TokenState,_10 // ... other collateral types_10 }_10}
Why MOET as Default:
- Unified Denomination: Simplifies multi-collateral accounting
- Capital Efficiency: Borrowed MOET immediately deployable to yield
- Composability: Standard FungibleToken interface enables DeFi integration
- Liquidation Simplicity: Single debt token reduces liquidation complexity
Borrowing Flow
Step-by-Step Integration:
_37User Action: Deposit 1000 FLOW Collateral_37_37Step 1: Collateral Locked_37├── User calls: Pool.deposit(collateral: <-flowVault, pushToDrawDownSink: true)_37├── Pool receives: 1000 FLOW tokens_37├── Position created: positionID = 123_37└── Collateral stored in: Pool reserves_37_37Step 2: Borrow Capacity Calculated_37├── Oracle fetches: FLOW/MOET price = 1.0_37├── Collateral value: 1000 × 1.0 = 1000 MOET_37├── Collateral factor: 0.8_37├── Effective collateral: 1000 × 0.8 = 800 MOET_37├── Target health: 1.3_37└── Max borrow: 800 / 1.3 = 615.38 MOET_37_37Step 3: MOET Minted_37├── Pool calls: MOETMinter.mintTokens(615.38)_37├── Minter creates: 615.38 new MOET_37├── Vault returned to: Pool_37├── Total supply: Increased by 615.38_37└── Event emitted: TokensMinted(amount: 615.38, positionID: 123)_37_37Step 4: Debt Recorded_37├── Position.debt.scaledBalance: 615.38_37├── Position.debt.index: Current interest index (I₀)_37├── Position.health: 1.30_37└── Position state: {collateral: 1000 FLOW, debt: 615.38 MOET}_37_37Step 5: MOET Distribution_37├── If pushToDrawDownSink = true:_37│ ├── Pool deposits: <-moetVault into DrawDownSink_37│ ├── Sink forwards to: FYV strategy_37│ └── Automatic yield deployment_37└── If pushToDrawDownSink = false:_37 ├── Pool sends: <-moetVault to user's wallet_37 └── User manually deploys MOET
Unit of Account in Pricing
All collateral assets are priced in MOET terms through the oracle system.
Oracle Interface:
_10access(all) resource interface PriceOracle {_10 // Returns price of token denominated in MOET_10 access(all) fun getPrice(token: Type): UFix64_10}
Price Examples:
_10Oracle Price Feeds (in MOET):_10├── FLOW/MOET: 1.0 (1 FLOW = 1 MOET)_10├── stFLOW/MOET: 1.05 (liquid staking premium)_10├── USDC/MOET: 1.0 (stablecoin parity)_10├── wBTC/MOET: 65,000.0 (Bitcoin price)_10└── wETH/MOET: 3,500.0 (Ethereum price)_10_10Assumption: 1 MOET = 1 USD
Health Factor Calculation Using MOET Prices:
_22Multi-Collateral Position:_22├── Collateral 1: 500 FLOW @ 1.0 MOET each_22│ ├── Value: 500 MOET_22│ ├── CF: 0.8_22│ └── Effective: 400 MOET_22├── Collateral 2: 100 stFLOW @ 1.05 MOET each_22│ ├── Value: 105 MOET_22│ ├── CF: 0.85_22│ └── Effective: 89.25 MOET_22├── Collateral 3: 1000 USDC @ 1.0 MOET each_22│ ├── Value: 1000 MOET_22│ ├── CF: 0.9_22│ └── Effective: 900 MOET_22├── Total Effective Collateral: 1,389.25 MOET_22├── Total Debt: 1,068.65 MOET_22└── Health Factor: 1,389.25 / 1,068.65 = 1.30 ✓_22_22Benefits:_22├── All values in common denomination_22├── No currency conversion needed_22├── Efficient on-chain computation_22└── Real-time health monitoring simplified
Liquidation Process
MOET integration enables efficient liquidation through standardized debt repayment.
Liquidation Flow:
_37Underwater Position Detected:_37├── Position 123: HF = 0.85 < 1.0_37├── Collateral: 1000 FLOW @ $0.70 = $700 (MOET terms)_37├── Effective collateral: $700 × 0.8 = $560 MOET_37├── Debt: 700 MOET_37└── Liquidatable: Yes_37_37Liquidator Action:_37Step 1: Liquidator Prepares_37├── Liquidator has: 300 MOET in wallet_37├── Calls: Pool.liquidate(positionID: 123, repayAmount: 300 MOET)_37└── Goal: Seize collateral at profit_37_37Step 2: Debt Repayment_37├── Pool receives: 300 MOET from liquidator_37├── Position debt reduced: 700 → 400 MOET_37├── Pool burns: 300 MOET (automatic on vault destruction)_37└── Supply reduced: 300 MOET_37_37Step 3: Collateral Seizure_37├── Formula: CollateralSeized = (DebtRepaid × (1 + Bonus)) / PriceCollateral_37├── Calculation: (300 × 1.05) / 0.70 = 450 FLOW_37├── Transfer: 450 FLOW to liquidator_37└── Remaining collateral: 1000 - 450 = 550 FLOW_37_37Step 4: Position Update_37├── New collateral: 550 FLOW @ $0.70 = $385_37├── New effective collateral: $385 × 0.8 = $308_37├── New debt: 400 MOET_37├── New HF: $308 / $400 = 0.77 (still liquidatable)_37└── Further liquidations possible_37_37Liquidator Profit:_37├── Paid: 300 MOET ($300)_37├── Received: 450 FLOW worth $315_37├── Profit: $315 - $300 = $15 (5%)_37└── Incentivizes holding MOET for liquidations
Automated Rebalancing
MOET enables automatic position adjustments through health factor monitoring.
Over-Collateralized Rebalancing (HF > 1.5):
_30Initial State:_30├── Collateral: 1000 FLOW @ $1.00 = $1,000_30├── Effective collateral: $800 MOET_30├── Debt: 615.38 MOET_30├── HF: 1.30_30└── Status: Optimal_30_30Price Increase Event:_30├── FLOW price: $1.00 → $1.50 (+50%)_30├── New collateral value: $1,500_30├── New effective collateral: $1,500 × 0.8 = $1,200 MOET_30├── Debt unchanged: 615.38 MOET_30├── New HF: $1,200 / 615.38 = 1.95 > 1.5 ⚠️_30└── Trigger: Auto-borrow more_30_30Automated Response:_30├── Target HF: 1.3_30├── Target debt: $1,200 / 1.3 = $923.08 MOET_30├── Additional borrow: $923.08 - 615.38 = $307.70 MOET_30├── Pool mints: 307.70 MOET_30├── MOET flows via DrawDownSink to: FYV_30├── Debt updated: 615.38 → 923.08 MOET_30├── HF restored: $1,200 / 923.08 = 1.30 ✓_30└── Extra capital deployed: 307.70 MOET earning yield_30_30Benefits:_30├── Maximizes capital efficiency automatically_30├── No user intervention required_30├── More MOET generating yield_30└── Higher overall returns
Under-Collateralized Rebalancing (HF < 1.1):
_30Initial State:_30├── Collateral: 1000 FLOW @ $1.00 = $1,000_30├── Effective collateral: $800 MOET_30├── Debt: 615.38 MOET_30├── HF: 1.30_30└── Status: Optimal_30_30Price Decrease Event:_30├── FLOW price: $1.00 → $0.85 (-15%)_30├── New collateral value: $850_30├── New effective collateral: $850 × 0.8 = $680 MOET_30├── Debt unchanged: 615.38 MOET_30├── New HF: $680 / 615.38 = 1.11 < 1.1 ⚠️_30└── Trigger: Auto-repay debt_30_30Automated Response:_30├── Target HF: 1.3_30├── Target debt: $680 / 1.3 = $523.08 MOET_30├── Must repay: 615.38 - $523.08 = $92.30 MOET_30├── Pool pulls from TopUpSource: 92.30 MOET (from FYV)_30├── Pool burns: 92.30 MOET_30├── Debt updated: 615.38 → 523.08 MOET_30├── HF restored: $680 / 523.08 = 1.30 ✓_30└── Position protected from liquidation_30_30Benefits:_30├── Prevents liquidation automatically_30├── Utilizes yield earned in FYV_30├── No user intervention required_30└── Maintains position health
MOET in FYV (Flow Yield Vaults)
Yield Deployment Medium
MOET serves as the capital source for FYV yield strategies, enabling leveraged yield farming.
TracerStrategy Integration:
_24Capital Flow: ALP → MOET → FYV → Yield Assets_24_24Step 1: Receive MOET_24├── FYV receives: 615.38 MOET from ALP (via DrawDownSink)_24├── Strategy: TracerStrategy_24└── Goal: Generate yield > borrowing cost_24_24Step 2: Convert to Yield Assets_24├── SwapConnector activated_24├── Swap: 615.38 MOET → 615.38 LP tokens_24├── LP tokens: e.g., FLOW/USDC liquidity pair_24└── Yield sources: Trading fees + liquidity rewards_24_24Step 3: Hold in AutoBalancer_24├── AutoBalancer receives: 615.38 LP tokens_24├── Target value ratio: 100% (1.0)_24├── Acceptable range: 95%-105%_24└── Continuously monitors value growth_24_24Step 4: Yield Accumulation_24├── LP tokens earn: Trading fees_24├── After 30 days: 615.38 LP → 640 LP_24├── Value growth: +4% (monthly yield)_24└── Yield ready for: Rebalancing or withdrawal
Value Ratio Monitoring
FYV tracks the ratio of yield assets to borrowed MOET for rebalancing decisions.
Value Ratio Formula:
_10ValueRatio = Current LP Value (in MOET) / Initial MOET Borrowed_10_10Example:_10├── Initial borrow: 615.38 MOET_10├── Current LP value: 640 MOET (after yield)_10├── Value ratio: 640 / 615.38 = 1.04 (104%)_10└── Status: Within acceptable range (95%-105%)
Rebalancing Thresholds:
_19Value Ratio Conditions:_19_19Case 1: Ratio < 95% (Deficit - Price Drop or Loss)_19├── Current value: 584.61 MOET (95% × 615.38)_19├── Problem: Insufficient value to cover debt_19├── Action: System alerts, may need external capital_19└── Risk: Position may become liquidatable_19_19Case 2: Ratio 95%-105% (Optimal - Balanced)_19├── Current value: 584.61 - 646.15 MOET_19├── Status: Healthy range_19├── Action: No rebalancing needed_19└── Continue: Generating yield_19_19Case 3: Ratio > 105% (Surplus - Excess Yield)_19├── Current value: 646.15+ MOET (>105% × 615.38)_19├── Profit: Excess beyond debt coverage_19├── Action: Harvest profit, reinvest or compound_19└── Opportunity: Increase leverage or take profit
Liquidation Prevention
FYV provides MOET back to ALP through TopUpSource when positions need protection.
TopUpSource Flow:
_32Trigger: ALP Position HF Drops Below 1.1_32_32Step 1: ALP Requests Liquidity_32├── ALP detects: HF = 1.05 < 1.1_32├── Required MOET: 92.30 to restore HF to 1.3_32├── ALP calls: TopUpSource.withdraw(92.30, Type<@MOET.Vault>)_32└── TopUpSource connected to: FYV strategy_32_32Step 2: FYV Prepares MOET_32├── FYV checks: LP balance = 640 tokens_32├── Required conversion: 92.30 MOET_32├── Calculate LP needed: 92.30 LP (assuming 1:1 ratio)_32└── FYV has sufficient: 640 > 92.30 ✓_32_32Step 3: Convert Yield to MOET_32├── FYV calls: SwapConnector.swap(92.30 LP → MOET)_32├── LP tokens sold: 92.30_32├── MOET received: 92.30_32└── Remaining LP: 640 - 92.30 = 547.7_32_32Step 4: Provide to ALP_32├── FYV transfers: 92.30 MOET via TopUpSource_32├── ALP receives: 92.30 MOET_32├── ALP repays position debt: 615.38 → 523.08 MOET_32├── Pool burns: 92.30 MOET_32└── HF restored: 1.30 ✓_32_32Result:_32├── Position saved from liquidation_32├── FYV still has: 547.7 LP generating yield_32├── System maintains: Health and composability_32└── User retains: All collateral
Yield Compounding
FYV can reinvest excess yield back into strategies using MOET as the medium.
Compounding Scenario:
_26Initial Strategy:_26├── Borrowed: 615.38 MOET_26├── LP tokens: 615.38_26├── After 3 months yield: 688 LP (+11.8%)_26├── Value ratio: 688 / 615.38 = 1.118 (111.8%)_26└── Excess: 72.62 LP above 105% threshold_26_26Compounding Decision:_26Option 1: Harvest Profit_26├── Convert excess: 72.62 LP → 72.62 MOET_26├── Repay debt: Reduce from 615.38 to 542.76 MOET_26├── Improve HF: From 1.30 to higher_26└── Lower risk: Less leverage_26_26Option 2: Compound (Increase Leverage)_26├── Keep excess: 72.62 LP in strategy_26├── Borrow more: Request ALP to increase leverage_26├── Additional MOET: Based on new LP value_26├── Higher exposure: More LP, more yield_26└── Higher risk: Increased leverage_26_26Option 3: Take Profit_26├── Convert excess: 72.62 LP → 72.62 MOET_26├── Withdraw to wallet: 72.62 MOET_26├── Realize gains: Lock in profit_26└── Maintain position: Continue with base amount
DeFi Actions: Connecting ALP and FYV
DrawDownSink (ALP → FYV)
DrawDownSink channels borrowed MOET from ALP positions into FYV strategies.
Interface:
_10access(all) resource interface Sink {_10 access(all) fun deposit(vault: @{FungibleToken.Vault})_10}
Implementation in FYV:
_16// TracerStrategy implements Sink_16access(all) resource TracerStrategy: Sink {_16 access(all) fun deposit(vault: @{FungibleToken.Vault}) {_16 // Receive MOET from ALP_16 let moet <- vault as! @MOET.Vault_16_16 // Convert to yield asset_16 let lpTokens <- self.swapConnector.swap(from: <-moet, to: Type<@LPToken.Vault>)_16_16 // Deposit into AutoBalancer_16 self.autoBalancer.deposit(<-lpTokens)_16_16 // Update tracking_16 self.totalBorrowed = self.totalBorrowed + moet.balance_16 }_16}
Usage Flow:
_11ALP Position Configuration:_11├── User sets: position.drawDownSink = TracerStrategy capability_11├── On borrow: ALP calls drawDownSink.deposit(<-moetVault)_11└── MOET flows: ALP → TracerStrategy automatically_11_11Example:_11├── Position borrows: 615.38 MOET_11├── DrawDownSink receives: 615.38 MOET_11├── TracerStrategy swaps: MOET → LP tokens_11├── AutoBalancer holds: 615.38 LP_11└── Yield generation: Begins immediately
TopUpSource (FYV → ALP)
TopUpSource provides MOET from FYV back to ALP for debt repayment and liquidation prevention.
Interface:
_10access(all) resource interface Source {_10 access(all) fun withdraw(amount: UFix64, type: Type): @{FungibleToken.Vault}_10}
Implementation in FYV:
_22// TracerStrategy implements Source_22access(all) resource TracerStrategy: Source {_22 access(all) fun withdraw(amount: UFix64, type: Type): @{FungibleToken.Vault} {_22 // Verify type is MOET_22 assert(type == Type<@MOET.Vault>(), message: "Only MOET withdrawals supported")_22_22 // Calculate LP tokens needed_22 let lpNeeded = amount // Assuming 1:1 ratio for simplicity_22_22 // Withdraw from AutoBalancer_22 let lpTokens <- self.autoBalancer.withdraw(lpNeeded)_22_22 // Convert to MOET_22 let moet <- self.swapConnector.swap(from: <-lpTokens, to: Type<@MOET.Vault>)_22_22 // Update tracking_22 self.totalWithdrawn = self.totalWithdrawn + amount_22_22 // Return MOET to ALP_22 return <- (moet as! @{FungibleToken.Vault})_22 }_22}
Usage Flow:
_12ALP Position Configuration:_12├── User sets: position.topUpSource = TracerStrategy capability_12├── On low HF: ALP calls topUpSource.withdraw(amount, type)_12└── MOET flows: TracerStrategy → ALP automatically_12_12Example:_12├── HF drops to: 1.05_12├── Required MOET: 92.30_12├── TopUpSource provides: 92.30 MOET (converted from LP)_12├── ALP repays: 92.30 MOET debt_12├── HF restored: 1.30_12└── Liquidation prevented
SwapConnector (Token Conversion)
SwapConnector enables MOET ↔ Yield Asset conversions within FYV strategies.
Interface:
_10access(all) resource interface SwapConnector {_10 access(all) fun swap(_10 from: @{FungibleToken.Vault},_10 to: Type_10 ): @{FungibleToken.Vault}_10}
Bidirectional Swaps:
_13MOET → Yield Asset (Deployment):_13├── Input: 615.38 MOET vault_13├── Target: LP token (e.g., FLOW/USDC pair)_13├── Swap via: DEX (e.g., IncrementFi)_13├── Output: 615.38 LP tokens_13└── Use: Deployed to yield vault_13_13Yield Asset → MOET (Withdrawal):_13├── Input: 92.30 LP tokens_13├── Target: MOET_13├── Swap via: DEX_13├── Output: 92.30 MOET_13└── Use: Debt repayment to ALP
Implementation Example:
_18// DEX-based SwapConnector_18access(all) resource DEXSwapConnector: SwapConnector {_18 access(all) fun swap(from: @{FungibleToken.Vault}, to: Type): @{FungibleToken.Vault} {_18 // Route to appropriate DEX pool_18 let pool = self.getPool(fromType: from.getType(), toType: to)_18_18 // Execute swap_18 let output <- pool.swap(input: <-from, minOutput: self.calculateSlippage())_18_18 // Return swapped tokens_18 return <-output_18 }_18_18 access(self) fun getPool(fromType: Type, toType: Type): &Pool {_18 // Find optimal pool for this pair_18 return &self.pools[fromType]![toType]! as &Pool_18 }_18}
Complete Integration Example
End-to-End User Journey
_60Day 1: Position Creation_60├── User deposits: 1000 FLOW_60├── ALP mints: 615.38 MOET_60├── MOET flows via DrawDownSink to: FYV_60├── FYV swaps: MOET → 615.38 LP tokens_60├── LP held in: AutoBalancer_60└── Position state: 1000 FLOW collateral, 615.38 MOET debt, HF = 1.30_60_60Days 2-30: Yield Generation_60├── LP tokens earn: Trading fees + rewards_60├── LP value grows: 615.38 → 640 LP (+4%)_60├── MOET debt accrues interest: 615.38 → 620.51 (+0.83% monthly)_60├── Net position value: 640 - 620.51 = 19.49 MOET profit_60└── Value ratio: 640 / 620.51 = 1.031 (103.1%, healthy)_60_60Day 15: Price Drop Event_60├── FLOW price drops: $1.00 → $0.88 (-12%)_60├── Collateral value: $880_60├── Effective collateral: $880 × 0.8 = $704 MOET_60├── Debt: 617.50 MOET (with partial interest)_60├── HF: 704 / 617.50 = 1.14 > 1.1 ✓_60└── No action: Still above minimum threshold_60_60Day 20: Further Price Drop_60├── FLOW price drops: $0.88 → $0.82 (-7% more, -18% total)_60├── Collateral value: $820_60├── Effective collateral: $820 × 0.8 = $656 MOET_60├── Debt: 618.50 MOET_60├── HF: 656 / 618.50 = 1.06 < 1.1 ⚠️_60└── Trigger: Auto-rebalancing_60_60Auto-Rebalancing:_60├── Target HF: 1.3_60├── Target debt: 656 / 1.3 = 504.62 MOET_60├── Repay amount: 618.50 - 504.62 = 113.88 MOET_60├── FYV provides via TopUpSource: 113.88 MOET_60│ ├── Convert LP: 113.88 LP → 113.88 MOET_60│ └── Remaining LP: 640 - 113.88 = 526.12 LP_60├── ALP burns: 113.88 MOET_60├── New debt: 504.62 MOET_60├── New HF: 656 / 504.62 = 1.30 ✓_60└── Position protected!_60_60Days 21-30: Recovery_60├── FLOW price recovers: $0.82 → $0.95 (+16%)_60├── Collateral value: $950_60├── Effective collateral: $950 × 0.8 = $760 MOET_60├── Debt: 507.50 MOET (with interest)_60├── HF: 760 / 507.50 = 1.50 (at threshold)_60└── No auto-borrow: Exactly at 1.5_60_60Day 30: Position Closure_60├── LP value: 526.12 LP worth $547.35_60├── Convert all LP: 526.12 LP → 547.35 MOET_60├── Total debt: 507.50 MOET_60├── Repay: 507.50 MOET to ALP_60├── ALP burns: 507.50 MOET_60├── Excess MOET: 547.35 - 507.50 = 39.85 MOET_60├── Withdraw collateral: 1000 FLOW_60└── Final profit: 39.85 MOET ($39.85 on $1,000 = 3.98% monthly ROI)
Integration Benefits
For Users:
- Seamless Capital Flow: MOET moves automatically between components
- Automated Protection: Yield protects positions without manual intervention
- Maximized Returns: Borrowed capital immediately deployed to yield
- Simplified UX: Single deposit action triggers entire flow
For Protocol:
- Capital Efficiency: No idle MOET sitting in wallets
- Reduced Liquidations: Auto-rebalancing prevents most liquidations
- Composability: MOET enables third-party integrations
- Scalability: Standardized interfaces support multiple strategies
For Ecosystem:
- Unified Liquidity: MOET creates common liquidity layer
- DeFi Composability: Standard token enables broader integrations
- Innovation: Developers can build new strategies using MOET
- Network Effects: More users → more liquidity → better yields
Technical Implementation Details
Contract Interactions
Key Contract Calls:
_41// ALP borrows MOET for user_41pub fun borrow(amount: UFix64): @MOET.Vault {_41 // Mint MOET_41 let moet <- MOETMinter.mintTokens(amount: amount)_41_41 // Update position debt_41 self.debt.scaledBalance = self.debt.scaledBalance + amount_41_41 // Push to DrawDownSink if configured_41 if let sink = self.drawDownSink {_41 sink.deposit(vault: <-moet)_41 return <- MOET.createEmptyVault() // Return empty vault_41 }_41_41 // Otherwise return MOET to user_41 return <- moet_41}_41_41// ALP repays MOET debt_41pub fun repay(vault: @MOET.Vault) {_41 // Record repaid amount_41 let repaidAmount = vault.balance_41_41 // Update position debt_41 self.debt.scaledBalance = self.debt.scaledBalance - repaidAmount_41_41 // Burn MOET (automatic on destroy)_41 destroy vault // Triggers burnCallback()_41}_41_41// FYV provides MOET for debt repayment_41pub fun provideForRepayment(): @MOET.Vault {_41 // Calculate needed amount_41 let neededAmount = self.calculateRepaymentAmount()_41_41 // Withdraw from strategy_41 let moet <- self.strategy.withdraw(amount: neededAmount, type: Type<@MOET.Vault>())_41_41 // Return MOET for ALP repayment_41 return <- (moet as! @MOET.Vault)_41}
Event Emissions
Tracking MOET Flows:
_14// Emitted when MOET is minted_14pub event TokensMinted(amount: UFix64, positionID: UInt64, mintedBy: Address)_14_14// Emitted when MOET is burned_14pub event TokensBurned(amount: UFix64, burnedFrom: UInt64)_14_14// Emitted when MOET flows to DrawDownSink_14pub event MOETDeployed(amount: UFix64, from: UInt64, to: Address, strategy: String)_14_14// Emitted when MOET provided via TopUpSource_14pub event MOETWithdrawn(amount: UFix64, from: Address, to: UInt64, reason: String)_14_14// Emitted when MOET swapped_14pub event MOETSwapped(amount: UFix64, direction: String, pool: Address)
Analytics Use Cases:
_17Monitor Total Supply:_17├── Track: TokensMinted events_17├── Track: TokensBurned events_17├── Calculate: Supply = Mints - Burns_17└── Analyze: Supply growth trends_17_17Monitor Capital Flows:_17├── Track: MOETDeployed events (ALP → FYV)_17├── Track: MOETWithdrawn events (FYV → ALP)_17├── Calculate: Net flow = Deployed - Withdrawn_17└── Analyze: Capital efficiency metrics_17_17Monitor Liquidation Activity:_17├── Track: TokensBurned with reason = "liquidation"_17├── Calculate: Liquidation volume_17├── Analyze: System health indicators_17└── Alert: Liquidation cascades
Next Steps
- Stability Mechanisms: Understand how MOET maintains its peg and manages risk
- ALP Documentation: Deep dive into ALP's lending mechanics
- FYV Documentation: Explore FYV yield strategies
- DeFi Actions: Learn about the composability framework