IUsdnProtocolVault
Interface for the vault layer of the USDN protocol.
Functions
usdnPrice
Calculates the predicted USDN token price based on the given asset price and timestamp.
The effects of the funding and the PnL of the long positions since the last contract state update are taken into account.
function usdnPrice(uint128 currentPrice, uint128 timestamp) external view returns (uint256 price_);
Parameters
Name | Type | Description |
---|---|---|
currentPrice | uint128 | The current or predicted asset price. |
timestamp | uint128 | The timestamp corresponding to currentPrice . |
Returns
Name | Type | Description |
---|---|---|
price_ | uint256 | The predicted USDN token price. |
usdnPrice
Calculates the USDN token price based on the given asset price at the current timestamp.
The effects of the funding and the PnL of the long positions since the last contract state update are taken into account.
function usdnPrice(uint128 currentPrice) external view returns (uint256 price_);
Parameters
Name | Type | Description |
---|---|---|
currentPrice | uint128 | The asset price at block.timestamp . |
Returns
Name | Type | Description |
---|---|---|
price_ | uint256 | The calculated USDN token price. |
vaultAssetAvailableWithFunding
Gets the amount of assets in the vault for the given asset price and timestamp.
The effects of the funding, the PnL of the long positions and the accumulated fees since the last contract
state update are taken into account, but not liquidations. If the provided timestamp is older than the last
state update, the function reverts with UsdnProtocolTimestampTooOld
.
function vaultAssetAvailableWithFunding(uint128 currentPrice, uint128 timestamp)
external
view
returns (uint256 available_);
Parameters
Name | Type | Description |
---|---|---|
currentPrice | uint128 | The current or predicted asset price. |
timestamp | uint128 | The timestamp corresponding to currentPrice (must not be earlier than _lastUpdateTimestamp ). |
Returns
Name | Type | Description |
---|---|---|
available_ | uint256 | The available vault balance (cannot be less than 0). |