Skip to content

CalcsVaultSimulatedTime ​

Git Source

this is the exact same code as in vault protocol codebase, just that it supports a simulated block.timestamp to expose historical calculations.

State Variables ​

X16 ​

solidity
uint256 internal constant X16 = 0xffff;

X64 ​

solidity
uint256 internal constant X64 = 0xffffffffffffffff;

Functions ​

updateExchangePrices ​

Calculates new vault exchange prices.

solidity
function updateExchangePrices(
    uint256 vaultVariables2_,
    uint256 vaultRates_,
    uint256 liquiditySupplyExchangePricesAndConfig_,
    uint256 liquidityBorrowExchangePricesAndConfig_,
    uint256 blockTimestamp_
)
    internal
    pure
    returns (
        uint256 liqSupplyExPrice_,
        uint256 liqBorrowExPrice_,
        uint256 vaultSupplyExPrice_,
        uint256 vaultBorrowExPrice_
    );

Parameters

NameTypeDescription
vaultVariables2_uint256vaultVariables2 read from storage for the vault (VaultResolver.getRateRaw)
vaultRates_uint256rates read from storage for the vault (VaultResolver.getVaultVariables2Raw)
liquiditySupplyExchangePricesAndConfig_uint256exchange prices and config packed uint256 read from storage for supply token
liquidityBorrowExchangePricesAndConfig_uint256exchange prices and config packed uint256 read from storage for borrow token
blockTimestamp_uint256simulated block.timestamp

Returns

NameTypeDescription
liqSupplyExPrice_uint256latest liquidity's supply token supply exchange price
liqBorrowExPrice_uint256latest liquidity's borrow token borrow exchange price
vaultSupplyExPrice_uint256latest vault's supply token exchange price
vaultBorrowExPrice_uint256latest vault's borrow token exchange price

Errors ​

FluidCalcsVaultSimulatedTimeError ​

solidity
error FluidCalcsVaultSimulatedTimeError();