UnderwriterVaultStorage
State Variables
STORAGE_SLOT
bytes32 internal constant STORAGE_SLOT = keccak256("premia.contracts.storage.UnderwriterVaultStorage");
Functions
layout
function layout() internal pure returns (Layout storage l);
updateSettings
function updateSettings(Layout storage l, bytes memory settings) internal;
assetDecimals
function assetDecimals(Layout storage l) internal view returns (uint8);
collateral
function collateral(Layout storage l, UD60x18 size, UD60x18 strike) internal view returns (UD60x18);
truncate
function truncate(Layout storage l, UD60x18 value) internal view returns (UD60x18);
fromTokenDecimals
function fromTokenDecimals(Layout storage l, uint256 value) internal view returns (UD60x18);
toTokenDecimals
function toTokenDecimals(Layout storage l, UD60x18 value) internal view returns (uint256);
getMaturityAfterTimestamp
Gets the nearest maturity after the given timestamp, exclusive of the timestamp being on a maturity
function getMaturityAfterTimestamp(Layout storage l, uint256 timestamp) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
l | Layout | |
timestamp | uint256 | The given timestamp |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The nearest maturity after the given timestamp |
getNumberOfUnexpiredListings
Gets the number of unexpired listings within the basket of options underwritten by this vault at the current time
function getNumberOfUnexpiredListings(Layout storage l, uint256 timestamp) internal view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
l | Layout | |
timestamp | uint256 | The given timestamp |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The number of unexpired listings |
contains
Checks if a listing exists within internal data structures
function contains(Layout storage l, UD60x18 strike, uint256 maturity) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
l | Layout | |
strike | UD60x18 | The strike price of the listing |
maturity | uint256 | The maturity of the listing |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | If listing exists, return true, false otherwise |
addListing
Adds a listing to the internal data structures
function addListing(Layout storage l, UD60x18 strike, uint256 maturity) internal;
Parameters
Name | Type | Description |
---|---|---|
l | Layout | |
strike | UD60x18 | The strike price of the listing |
maturity | uint256 | The maturity of the listing |
removeListing
Removes a listing from internal data structures
function removeListing(Layout storage l, UD60x18 strike, uint256 maturity) internal;
Parameters
Name | Type | Description |
---|---|---|
l | Layout | |
strike | UD60x18 | The strike price of the listing |
maturity | uint256 | The maturity of the listing |
Structs
Layout
struct Layout {
address base;
address quote;
uint8 baseDecimals;
uint8 quoteDecimals;
address oracleAdapter;
bool isCall;
UD60x18 totalAssets;
UD60x18 totalLockedAssets;
UD60x18 minDTE;
UD60x18 maxDTE;
UD60x18 minDelta;
UD60x18 maxDelta;
UD60x18 minCLevel;
UD60x18 maxCLevel;
UD60x18 alphaCLevel;
UD60x18 hourlyDecayDiscount;
uint256 lastTradeTimestamp;
uint256 minMaturity;
uint256 maxMaturity;
DoublyLinkedList.Uint256List maturities;
mapping(uint256 => EnumerableSet.Bytes32Set) maturityToStrikes;
mapping(uint256 => mapping(UD60x18 => UD60x18)) positionSizes;
UD60x18 totalLockedSpread;
UD60x18 spreadUnlockingRate;
uint256 lastSpreadUnlockUpdate;
mapping(uint256 => UD60x18) spreadUnlockingTicks;
UD60x18 managementFeeRate;
UD60x18 performanceFeeRate;
UD60x18 protocolFees;
uint256 lastManagementFeeTimestamp;
uint256 pendingAssetsDeposit;
bool enableSell;
mapping(uint256 maturity => mapping(UD60x18 strike => UD60x18)) avgPremium;
}