Contracts

FlowVault smart contract surface, execution order, safety invariants, and canonical contract identifiers.

Core Functions

FunctionDescription
set-routing-rulesSet lock amount, lock-until block, split principal, and split amount.
depositTransfer SIP-010 token into vault and execute routing pipeline.
withdrawWithdraw only unlocked vault balance owned by caller principal.
clear-routing-rulesReset routing to default hold behavior.
get-vault-stateReturn locked/unlocked balances and currently active routing values.

Rule Model

Routing rules are principal-scoped. Each wallet configures its own values and deposits are evaluated against that caller state only.

  • lockAmount: portion that moves to locked balance each deposit.
  • lockUntilBlock: absolute chain height when locked amount unlocks.
  • splitAddress: optional principal receiving the split transfer.
  • splitAmount: fixed per-deposit transfer amount.

Routing Mechanics

Deposit processing order is deterministic and always evaluated in this sequence:

  1. Split amount is sent to split-address (if configured).
  2. Lock amount is moved to locked balance until lockUntilBlock.
  3. Remaining amount stays unlocked in the user vault.

If split + lock exceed deposit value, the transaction aborts rather than partially applying state.

Safety Invariants

  • Users cannot withdraw from locked balance before unlock height.
  • Principal ownership is enforced for all mutable vault operations.
  • Rule clearing always returns to hold-all default behavior.
  • Read methods never mutate state and are safe for polling.

Network Addresses

  • FlowVault testnet: STD7QG84VQQ0C35SZM2EYTHZV4M8FQ0R7YNSQWPD.flowvault
  • USDCx testnet: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.usdcx
  • Mainnet USDCx: SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx

Use testnet values only in development. Never ship a frontend build with testnet token principal in production environment variables.