๐Storage overview
Storage fields and types
Base types
type tokenId is nat
type assetType is
| FA12 of address // TZIP-007 compatible token
| FA2 of (address * nat) // TZIP-012 compatible token
type token_metadata_info is [@layout:comb] record [
token_id : tokenId;
token_info : map(string, bytes);
] // token metadata by TZIP-016 for each TZIP-012 token
Account type
allowances
set(address)
allowances (operators) - set of address allowed to transfer on account's behalf
borrow
nat
amount of borrowed tokens
lastBorrowIndex
nat
account's last borrow index to apply interest to borrowed tokens
type account is [@layout:comb] record [
allowances : set(address);
borrow : nat;
lastBorrowIndex : nat;
]
yToken type (market)
mainToken
assetType
FA12/FA2
underlying asset
interestRateModel
address
KT1....
Interest rate contract
interestUpdateTime
timestamp
updateInterest called with tokenId
of this token.
last time when interest of token updated
priceUpdateTime
timestamp
PriceFeed.getPrice called with tokenId
of this token.
last time when price of token updated
totalBorrowsF
nat
float value multiplied by 1e+18
total amount of borrowed tokens
totalLiquidF
nat
float value multiplied by 1e+18
total liquidity locked at market
totalSupplyF
nat
float value multiplied by 1e+18
total supply of yToken
totalReservesF
nat
float value multiplied by 1e+18
"subsidiary" reserves of protocol
borrowIndex
nat
index collecting interest
maxBorrowRate
nat
float value multiplied by 1e+18
limit of borrow rate response. Used to verify borrow rate in accrueInterest
collateralFactorF
nat
float value multiplied by 1e+18
Rate represents by which the borrow limit increases if the yToken is minted
liquidReserveRateF
nat
float value multiplied by 1e+18
Percent of liquidate collateral amount that goes to reserves
reserveFactorF
nat
float value multiplied by 1e+18
Rate that represents what part of the interest goes to the protocol reserves
lastPrice
nat
last price of underlying token to XTZ
threshold
nat
float value multiplied by 1e+18
threshold of collateral borrow rate
type tokenType is [@layout:comb] record [
mainToken : assetType;
interestRateModel : address;
interestUpdateTime : timestamp;
priceUpdateTime : timestamp;
totalBorrowsF : nat;
totalLiquidF : nat;
totalSupplyF : nat;
totalReservesF : nat;
borrowIndex : nat;
maxBorrowRate : nat;
collateralFactorF : nat;
liquidReserveRateF : nat;
reserveFactorF : nat;
lastPrice : nat;
borrowPause : bool;
isInterestUpdating : bool;
threshold : nat;
]
yStorage - main Yupana storage values
admin
address
tz/KT....
contract administrator
ledger
big_map(
(address * tokenId), nat
)
storage of token balances
lastTokenId
nat
counter, size of tokens
tokenId of last created market
closeFactorF
nat
float value multiplied by 1e+18
max portion of the loan that can be liquidated per single transaction
liqIncentiveF
nat
float value multiplied by 1e+18
Rate that the liquidator will earn if liquidate the asset
markets
big_map(
address, set(tokenId)
)
size of set is limited by maxMarkets
value
mapping of entered as collateral user markets
borrows
big_map(
address, set(tokenId)
)
size of set is limited by maxMarkets
value
mapping of borrowed tokens of user markets
maxMarkets
nat
max markets allowed to enter as collateral or borrow
assets
big_map(
assetType, tokenId
)
mapping underlying asset (FA12/FA2) to corresponding tokenId
of yToken market
type yStorage is [@layout:comb] record [
admin: address;
ledger: big_map((address * tokenId), nat);
accounts: big_map((address * tokenId), account);
tokens : map(tokenId, tokenType);
lastTokenId : nat;
priceFeedProxy : address;
closeFactorF : nat;
liqIncentiveF : nat;
markets : big_map(address, set(tokenId));
borrows : big_map(address, set(tokenId));
maxMarkets : nat;
assets : big_map(assetType, tokenId);
]
fullStorage - contract storage root
tokenLambdas
big_map(nat, bytes)
FA2 lambda-methods storage
useLambdas
big_map(nat, bytes)
Yupana protocol lambda-methods storage
type fullStorage is record [
storage : yStorage;
metadata : big_map(string, bytes);
token_metadata : big_map(tokenId, token_metadata_info);
tokenLambdas : big_map(nat, bytes);
useLambdas : big_map(nat, bytes);
]
Last updated