IBaseCurve

Git Source

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

NameTypeDescription
<none>stringname The name of the curve

maxShares

Get the maximum number of shares the curve can handle

function maxShares() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The maximum number of shares

maxAssets

Get the maximum number of assets the curve can handle

function maxAssets() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The 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

NameTypeDescription
assetsuint256Quantity of assets to deposit
totalAssetsuint256Total quantity of assets already staked into the curve
totalSharesuint256Total quantity of shares already awarded by the curve

Returns

NameTypeDescription
sharesuint256The 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

NameTypeDescription
sharesuint256Quantity of shares to burn
totalSharesuint256Total quantity of shares already awarded by the curve
totalAssetsuint256Total quantity of assets already staked into the curve

Returns

NameTypeDescription
assetsuint256The 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

NameTypeDescription
assetsuint256Quantity of assets to withdraw
totalAssetsuint256Total quantity of assets already staked into the curve
totalSharesuint256Total quantity of shares already awarded by the curve

Returns

NameTypeDescription
sharesuint256The 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

NameTypeDescription
sharesuint256Quantity of shares to mint
totalSharesuint256Total quantity of shares already awarded by the curve
totalAssetsuint256Total quantity of assets already staked into the curve

Returns

NameTypeDescription
assetsuint256The 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

NameTypeDescription
assetsuint256Quantity of assets to convert to shares
totalAssetsuint256Total quantity of assets already staked into the curve
totalSharesuint256Total quantity of shares already awarded by the curve

Returns

NameTypeDescription
sharesuint256The 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

NameTypeDescription
sharesuint256Quantity of shares to convert to assets
totalSharesuint256Total quantity of shares already awarded by the curve
totalAssetsuint256Total quantity of assets already staked into the curve

Returns

NameTypeDescription
assetsuint256The 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

NameTypeDescription
totalSharesuint256Total quantity of shares already awarded by the curve

Returns

NameTypeDescription
sharePriceuint256The current price of a share, scaled by 1e18