FlowVault Technical Documentation

Event Documentation

On-chain print event structures emitted by FlowVault contracts for real-time tracking, indexing, and transactional audits.

Audience: DeFi builders and data indexer teamsMode: Reference

Overview

FlowVault uses Clarity's native print command to emit structured events for state-changing operations. External indexers (such as Hiro API indexer, Subquery, or custom chain monitors) parse these print events to track user deposit history and routing logs.

Deposit Event

Emitted when a user submits a deposit transaction. It includes the complete routing breakdown detailing splits, locked amounts, and held balances as configured in their active strategy.

Event Payload Schema

KeyClarity TypeDescription
event(string-ascii 7)Always set to "deposit".
depositorprincipalAddress of the depositor principal.
amountuintTotal deposit amount in micro-units.
split-amountuintThe portion routed to the split address.
split-to(optional principal)Optional recipient address of the split amount.
lock-amountuintThe portion locked until lock-until block.
lock-untiluintAbsolute block height at which lock expires.
hold-amountuintRemaining portion kept in user's liquid vault balance.

Example Payload

{
  event: "deposit",
  depositor: 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5,
  amount: u1000000,
  split-amount: u200000,
  split-to: (some 'ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG),
  lock-amount: u300000,
  lock-until: u103,
  hold-amount: u800000
}

Withdraw Event

Emitted when a user withdraws unlocked funds from their vault.

Event Payload Schema

KeyClarity TypeDescription
event(string-ascii 8)Always set to "withdraw".
withdrawerprincipalAddress of the withdrawer principal.
amountuintWithdrawn amount in micro-units.
remaining-balanceuintUser's new total vault balance (liquid + locked).

Example Payload

{
  event: "withdraw",
  withdrawer: 'ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG,
  amount: u300000,
  remaining-balance: u700000
}

Strategy Configurations

Note that setting or clearing routing rules (via set-routing-rules and clear-routing-rules) updates the internal contract data maps directly without printing events to minimize network execution gas costs.

The updated strategy rules are implicitly reflected in the next deposit print event.