erc_4626.vault_protocol.lagoon.analysis
Documentation for eth_defi.erc_4626.vault_protocol.lagoon.analysis Python module.
Analyse Lagoon protocol deposits and redemptions.
To track our treasury balance
Find Lagoon events here https://github.com/hopperlabsxyz/lagoon-v0/blob/b790b1c1fbb51a101b0c78a4bb20e8700abed054/src/vault/primitives/Events.sol
Functions
|
Extract deposit and redeem events from a settlement transaction. |
Classes
Capture Lagoon vault flow when it is settled. |
- class LagoonSettlementEvent
Bases:
objectCapture Lagoon vault flow when it is settled.
Use to adjust vault treasury balances for internal accounting
Shows the Lagoon vault status after the settlement at a certain block height
We do not capture individual users
The cycle is - Value vault - Settle deposits (USD in) and redeemds (USDC out, shares in) - Because valuation is done before the settle, you need to be careful what the values reflect here - We pull some values from receipt, some values at the end of the block
- __init__(chain_id, tx_hash, block_number, timestamp, vault, deposit_events, redeem_events, deposited, redeemed, shares_minted, shares_burned, total_assets, total_supply, share_price, pending_redemptions_underlying, pending_redemptions_shares, underlying_balance)
- Parameters
chain_id (int) –
tx_hash (hexbytes.main.HexBytes) –
block_number (int) –
timestamp (datetime.datetime) –
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) –
deposit_events (int) –
redeem_events (int) –
deposited (decimal.Decimal) –
redeemed (decimal.Decimal) –
shares_minted (decimal.Decimal) –
shares_burned (decimal.Decimal) –
total_assets (decimal.Decimal) –
total_supply (decimal.Decimal) –
share_price (decimal.Decimal) –
pending_redemptions_underlying (decimal.Decimal) –
pending_redemptions_shares (decimal.Decimal) –
underlying_balance (decimal.Decimal) –
- Return type
None
- get_underlying_balance()
How much of treasury we are holding after this update
- Return type
- get_underlying_diff()
How much the underlying asset changed in the vault treasury
- Return type
Get USDC.
- property underlying: eth_defi.token.TokenDetails
Get USDC.
- analyse_vault_flow_in_settlement(vault, tx_hash)
Extract deposit and redeem events from a settlement transaction.
Analyse vault asset flow based on the settlement tx logs in the receipt
May need to call vault contract if no deposist or redeem events were prevent. This needs an archive node for historical lookback.
- Raises
AssertionError – If the Lagoon settlement transaction reverted.
- Parameters
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) –
tx_hash (hexbytes.main.HexBytes) –
- Return type
eth_defi.erc_4626.vault_protocol.lagoon.analysis.LagoonSettlementEvent