User Deposit

User Deposit Flow
The diagram illustrates what happens when a user deposits SOM tokens into the InsomniaVault.
Step-by-Step Process
Deposit Call
The user calls
depositNative(receiver)
and transfers SOM tokens into the InsomniaVault.
Accumulate Points
The vault triggers
accumulate(vault, receiver)
in the PointsController to ensure the user’s previous point balance is updated before new shares are minted.
Preview Deposit
The vault calls
previewDeposit(amount)
internally to calculate how many shares the user will receive for their SOM deposit.
Mint Shares
The vault executes
_mint(receiver, shares)
to issue ERC-20 vault shares representing proportional ownership.
Lockup Update
The user’s
unlockAt[receiver]
timestamp is updated to enforce the lockup period based on the selected vault.
User Index Update
The vault calls
updateUserIndex(vault, receiver)
in the PointsController to register the user’s new position relative to the global index, ensuring accurate point tracking going forward.
Emit Event
The vault emits a
Deposit
event, recording the action for transparency and off-chain indexing.
Additional Notes
Funds Location: After deposit, SOM tokens remain inside the vault contract until allocated by the StrategyRouter into yield strategies.
Immediate Benefits: The user starts accruing points instantly after shares are minted and their index is updated.
Transparency: Events allow dashboards and explorers to track deposits, balances, and point accrual in real time.
Last updated