Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IBondingCurveRegistry

Git Source

Author: 0xIntuition

Interface for the BondingCurveRegistry contract. Routes access to the curves associated with atoms & triples.

Functions

previewDeposit

Preview how many shares would be minted for a deposit of assets

function previewDeposit(uint256 assets, uint256 totalAssets, uint256 totalShares, uint256 id)
    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
iduint256Curve ID to use for the calculation

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, uint256 id)
    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
iduint256Curve ID to use for the calculation

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, uint256 id)
    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
iduint256Curve ID to use for the calculation

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, uint256 id)
    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
iduint256Curve ID to use for the calculation

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, uint256 id)
    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
iduint256Curve ID to use for the calculation

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, uint256 id)
    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
iduint256Curve ID to use for the calculation

Returns

NameTypeDescription
assetsuint256The number of assets equivalent to the given shares

currentPrice

Get the current price of a share

function currentPrice(uint256 totalShares, uint256 id) external view returns (uint256 sharePrice);

Parameters

NameTypeDescription
totalSharesuint256Total quantity of shares already awarded by the curve
iduint256Curve ID to use for the calculation

Returns

NameTypeDescription
sharePriceuint256The current price of a share

getCurveName

Get the name of a curve

function getCurveName(uint256 id) external view returns (string memory name);

Parameters

NameTypeDescription
iduint256Curve ID to query

Returns

NameTypeDescription
namestringThe name of the curve

getCurveMaxShares

Get the maximum number of shares a curve can handle

function getCurveMaxShares(uint256 id) external view returns (uint256 maxShares);

Parameters

NameTypeDescription
iduint256Curve ID to query

Returns

NameTypeDescription
maxSharesuint256The maximum number of shares

getCurveMaxAssets

Get the maximum number of assets a curve can handle

function getCurveMaxAssets(uint256 id) external view returns (uint256 maxAssets);

Parameters

NameTypeDescription
iduint256Curve ID to query

Returns

NameTypeDescription
maxAssetsuint256The maximum number of assets

count

Get the number of curves registered in the registry

function count() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256count The number of curves registered

curveAddresses

Get the curve address for a given ID

function curveAddresses(uint256 id) external view returns (address);

Parameters

NameTypeDescription
iduint256The curve ID to query

Returns

NameTypeDescription
<none>addressThe address of the curve

curveIds

Get the curve ID for a given address

function curveIds(address curve) external view returns (uint256);

Parameters

NameTypeDescription
curveaddressThe curve address to query

Returns

NameTypeDescription
<none>uint256The ID of the curve