IBaseCurve
Author: 0xIntuition
Interface for bonding curves in the Intuition protocol. All curves must implement these functions to be compatible with the protocol.
Functions
name
Get the name of the curve
function name() external view returns (string memory);
Returns
Name | Type | Description |
---|---|---|
<none> | string | name The name of the curve |
maxShares
Get the maximum number of shares the curve can handle
function maxShares() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The maximum number of shares |
maxAssets
Get the maximum number of assets the curve can handle
function maxAssets() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The maximum number of assets |
previewDeposit
Preview how many shares would be minted for a deposit of assets
function previewDeposit(uint256 assets, uint256 totalAssets, uint256 totalShares)
external
view
returns (uint256 shares);
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | Quantity of assets to deposit |
totalAssets | uint256 | Total quantity of assets already staked into the curve |
totalShares | uint256 | Total quantity of shares already awarded by the curve |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The number of shares that would be minted |
previewRedeem
Preview how many assets would be returned for burning a specific amount of shares
function previewRedeem(uint256 shares, uint256 totalShares, uint256 totalAssets)
external
view
returns (uint256 assets);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | Quantity of shares to burn |
totalShares | uint256 | Total quantity of shares already awarded by the curve |
totalAssets | uint256 | Total quantity of assets already staked into the curve |
Returns
Name | Type | Description |
---|---|---|
assets | uint256 | The number of assets that would be returned |
previewWithdraw
Preview how many shares would be redeemed for a withdrawal of assets
function previewWithdraw(uint256 assets, uint256 totalAssets, uint256 totalShares)
external
view
returns (uint256 shares);
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | Quantity of assets to withdraw |
totalAssets | uint256 | Total quantity of assets already staked into the curve |
totalShares | uint256 | Total quantity of shares already awarded by the curve |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The number of shares that would need to be redeemed |
previewMint
Preview how many assets would be required to mint a specific amount of shares
function previewMint(uint256 shares, uint256 totalShares, uint256 totalAssets) external view returns (uint256 assets);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | Quantity of shares to mint |
totalShares | uint256 | Total quantity of shares already awarded by the curve |
totalAssets | uint256 | Total quantity of assets already staked into the curve |
Returns
Name | Type | Description |
---|---|---|
assets | uint256 | The number of assets that would be required to mint the shares |
convertToShares
Convert assets to shares at a specific point on the curve
function convertToShares(uint256 assets, uint256 totalAssets, uint256 totalShares)
external
view
returns (uint256 shares);
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | Quantity of assets to convert to shares |
totalAssets | uint256 | Total quantity of assets already staked into the curve |
totalShares | uint256 | Total quantity of shares already awarded by the curve |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The number of shares equivalent to the given assets |
convertToAssets
Convert shares to assets at a specific point on the curve
function convertToAssets(uint256 shares, uint256 totalShares, uint256 totalAssets)
external
view
returns (uint256 assets);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | Quantity of shares to convert to assets |
totalShares | uint256 | Total quantity of shares already awarded by the curve |
totalAssets | uint256 | Total quantity of assets already staked into the curve |
Returns
Name | Type | Description |
---|---|---|
assets | uint256 | The number of assets equivalent to the given shares |
currentPrice
Get the current price of a share
function currentPrice(uint256 totalShares) external view returns (uint256 sharePrice);
Parameters
Name | Type | Description |
---|---|---|
totalShares | uint256 | Total quantity of shares already awarded by the curve |
Returns
Name | Type | Description |
---|---|---|
sharePrice | uint256 | The current price of a share, scaled by 1e18 |