OptionPSStorage
State Variables
STORAGE_SLOT
bytes32 internal constant STORAGE_SLOT = keccak256("premia.contracts.storage.OptionPS");
Functions
layout
function layout() internal pure returns (Layout storage l);
formatTokenId
Calculate ERC1155 token id for given option parameters
function formatTokenId(IOptionPS.TokenType tokenType, uint64 maturity, UD60x18 strike)
internal
pure
returns (uint256 tokenId);
parseTokenId
Derive option maturity and strike price from ERC1155 token id
function parseTokenId(uint256 tokenId)
internal
pure
returns (IOptionPS.TokenType tokenType, uint64 maturity, int128 strike);
getCollateral
function getCollateral(Layout storage l) internal view returns (address);
getExerciseToken
function getExerciseToken(Layout storage l) internal view returns (address);
toTokenDecimals
Adjust decimals of a value with 18 decimals to match the token decimals
function toTokenDecimals(Layout storage l, UD60x18 value, address token) internal view returns (uint256);
fromTokenDecimals
Adjust decimals of a value with token decimals to 18 decimals
function fromTokenDecimals(Layout storage l, uint256 value, address token) internal view returns (UD60x18);
fromUD60x18ToInt128
Converts UD60x18
to int128
function fromUD60x18ToInt128(UD60x18 u) internal pure returns (int128);
Structs
Layout
struct Layout {
bool isCall;
uint8 baseDecimals;
uint8 quoteDecimals;
address base;
address quote;
mapping(UD60x18 strike => mapping(uint64 maturity => UD60x18 amount)) totalUnderwritten;
mapping(UD60x18 strike => mapping(uint64 maturity => UD60x18 amount)) totalExercised;
EnumerableSet.UintSet tokenIds;
}