IBondingCurveRegistry
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
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 |
id | uint256 | Curve ID to use for the calculation |
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, uint256 id)
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 |
id | uint256 | Curve ID to use for the calculation |
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, uint256 id)
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 |
id | uint256 | Curve ID to use for the calculation |
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, uint256 id)
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 |
id | uint256 | Curve ID to use for the calculation |
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, uint256 id)
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 |
id | uint256 | Curve ID to use for the calculation |
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, uint256 id)
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 |
id | uint256 | Curve ID to use for the calculation |
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, uint256 id) external view returns (uint256 sharePrice);
Parameters
Name | Type | Description |
---|---|---|
totalShares | uint256 | Total quantity of shares already awarded by the curve |
id | uint256 | Curve ID to use for the calculation |
Returns
Name | Type | Description |
---|---|---|
sharePrice | uint256 | The current price of a share |
getCurveName
Get the name of a curve
function getCurveName(uint256 id) external view returns (string memory name);
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | Curve ID to query |
Returns
Name | Type | Description |
---|---|---|
name | string | The 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
Name | Type | Description |
---|---|---|
id | uint256 | Curve ID to query |
Returns
Name | Type | Description |
---|---|---|
maxShares | uint256 | The 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
Name | Type | Description |
---|---|---|
id | uint256 | Curve ID to query |
Returns
Name | Type | Description |
---|---|---|
maxAssets | uint256 | The maximum number of assets |
count
Get the number of curves registered in the registry
function count() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | count The number of curves registered |
curveAddresses
Get the curve address for a given ID
function curveAddresses(uint256 id) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
id | uint256 | The curve ID to query |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the curve |
curveIds
Get the curve ID for a given address
function curveIds(address curve) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
curve | address | The curve address to query |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The ID of the curve |