CalcsSimulatedTime ​
this is the exact same code as LiquidityCalcs
library, just that it supports a simulated block.timestamp to expose historical calculations.
FluidCalcsSimulatedTimeError ​
solidity
error FluidCalcsSimulatedTimeError(uint256 errorId_)
FluidCalcsSimulatedTimeInvalidTimestamp ​
solidity
error FluidCalcsSimulatedTimeInvalidTimestamp()
EXCHANGE_PRICES_PRECISION ​
solidity
uint256 EXCHANGE_PRICES_PRECISION
constants as from Liquidity variables.sol
SECONDS_PER_YEAR ​
solidity
uint256 SECONDS_PER_YEAR
Ignoring leap years
DEFAULT_EXPONENT_SIZE ​
solidity
uint256 DEFAULT_EXPONENT_SIZE
DEFAULT_EXPONENT_MASK ​
solidity
uint256 DEFAULT_EXPONENT_MASK
FOUR_DECIMALS ​
solidity
uint256 FOUR_DECIMALS
TWELVE_DECIMALS ​
solidity
uint256 TWELVE_DECIMALS
X14 ​
solidity
uint256 X14
X15 ​
solidity
uint256 X15
X16 ​
solidity
uint256 X16
X18 ​
solidity
uint256 X18
X24 ​
solidity
uint256 X24
X33 ​
solidity
uint256 X33
X64 ​
solidity
uint256 X64
calcExchangePrices ​
solidity
function calcExchangePrices(uint256 exchangePricesAndConfig_, uint256 blockTimestamp_) internal pure returns (uint256 supplyExchangePrice_, uint256 borrowExchangePrice_)
calculates interest (exchange prices) for a token given its' exchangePricesAndConfig from storage.
Parameters ​
Name | Type | Description |
---|---|---|
exchangePricesAndConfig_ | uint256 | exchange prices and config packed uint256 read from storage |
blockTimestamp_ | uint256 | simulated block.timestamp |
Return Values ​
Name | Type | Description |
---|---|---|
supplyExchangePrice_ | uint256 | updated supplyExchangePrice |
borrowExchangePrice_ | uint256 | updated borrowExchangePrice |
calcRevenue ​
solidity
function calcRevenue(uint256 totalAmounts_, uint256 exchangePricesAndConfig_, uint256 liquidityTokenBalance_, uint256 blockTimestamp_) internal pure returns (uint256 revenueAmount_)
_gets the revenueAmount_
for a token given its' totalAmounts and exchangePricesAndConfig from storage and the current balance of the Fluid liquidity contract for the token._
Parameters ​
Name | Type | Description |
---|---|---|
totalAmounts_ | uint256 | total amounts packed uint256 read from storage |
exchangePricesAndConfig_ | uint256 | exchange prices and config packed uint256 read from storage |
liquidityTokenBalance_ | uint256 | current balance of Liquidity contract (IERC20(token_).balanceOf(address(this))) |
blockTimestamp_ | uint256 | simulated block.timestamp |
Return Values ​
Name | Type | Description |
---|---|---|
revenueAmount_ | uint256 | collectable revenue amount |
getTotalSupply ​
solidity
function getTotalSupply(uint256 totalAmounts_, uint256 supplyExchangePrice_) internal pure returns (uint256 totalSupply_)
_reads the total supply out of Liquidity packed storage totalAmounts_
forsupplyExchangePrice*
*
getTotalBorrow ​
solidity
function getTotalBorrow(uint256 totalAmounts_, uint256 borrowExchangePrice_) internal pure returns (uint256 totalBorrow_)
_reads the total borrow out of Liquidity packed storage totalAmounts_
forborrowExchangePrice*
*