LinearCurve
Curve Visualization
%%{init: {"xychart": {"showTitle": true}} }%%
xychart-beta title "Linear Curve" x-axis "Assets (ETH)" [0.000000000000000000, 1.000000000000000000, 2.000000000000000000, 3.000000000000000000, 4.000000000000000000, 5.000000000000000000, 6.000000000000000000, 7.000000000000000000, 8.000000000000000000, 9.000000000000000000, 10.000000000000000000, 11.000000000000000000, 12.000000000000000000, 13.000000000000000000, 14.000000000000000000, 15.000000000000000000, 16.000000000000000000, 17.000000000000000000, 18.000000000000000000, 19.000000000000000000, 20.000000000000000000, 21.000000000000000000, 22.000000000000000000, 23.000000000000000000, 24.000000000000000000, 25.000000000000000000, 26.000000000000000000, 27.000000000000000000, 28.000000000000000000, 29.000000000000000000, 30.000000000000000000, 31.000000000000000000, 32.000000000000000000, 33.000000000000000000, 34.000000000000000000, 35.000000000000000000, 36.000000000000000000, 37.000000000000000000, 38.000000000000000000, 39.000000000000000000, 40.000000000000000000, 41.000000000000000000, 42.000000000000000000, 43.000000000000000000, 44.000000000000000000, 45.000000000000000000, 46.000000000000000000, 47.000000000000000000, 48.000000000000000000, 49.000000000000000000, 50.000000000000000000, 51.000000000000000000, 52.000000000000000000, 53.000000000000000000, 54.000000000000000000, 55.000000000000000000, 56.000000000000000000, 57.000000000000000000, 58.000000000000000000, 59.000000000000000000, 60.000000000000000000, 61.000000000000000000, 62.000000000000000000, 63.000000000000000000, 64.000000000000000000, 65.000000000000000000, 66.000000000000000000, 67.000000000000000000, 68.000000000000000000, 69.000000000000000000, 70.000000000000000000, 71.000000000000000000, 72.000000000000000000, 73.000000000000000000, 74.000000000000000000, 75.000000000000000000, 76.000000000000000000, 77.000000000000000000, 78.000000000000000000, 79.000000000000000000, 80.000000000000000000, 81.000000000000000000, 82.000000000000000000, 83.000000000000000000, 84.000000000000000000, 85.000000000000000000, 86.000000000000000000, 87.000000000000000000, 88.000000000000000000, 89.000000000000000000, 90.000000000000000000, 91.000000000000000000, 92.000000000000000000, 93.000000000000000000, 94.000000000000000000, 95.000000000000000000, 96.000000000000000000, 97.000000000000000000, 98.000000000000000000, 99.000000000000000000] y-axis "Shares" line [0.000000000000000000, 1.000000000000000000, 2.000000000000000000, 3.000000000000000000, 4.000000000000000000, 5.000000000000000000, 6.000000000000000000, 7.000000000000000000, 8.000000000000000000, 9.000000000000000000, 10.000000000000000000, 11.000000000000000000, 12.000000000000000000, 13.000000000000000000, 14.000000000000000000, 15.000000000000000000, 16.000000000000000000, 17.000000000000000000, 18.000000000000000000, 19.000000000000000000, 20.000000000000000000, 21.000000000000000000, 22.000000000000000000, 23.000000000000000000, 24.000000000000000000, 25.000000000000000000, 26.000000000000000000, 27.000000000000000000, 28.000000000000000000, 29.000000000000000000, 30.000000000000000000, 31.000000000000000000, 32.000000000000000000, 33.000000000000000000, 34.000000000000000000, 35.000000000000000000, 36.000000000000000000, 37.000000000000000000, 38.000000000000000000, 39.000000000000000000, 40.000000000000000000, 41.000000000000000000, 42.000000000000000000, 43.000000000000000000, 44.000000000000000000, 45.000000000000000000, 46.000000000000000000, 47.000000000000000000, 48.000000000000000000, 49.000000000000000000, 50.000000000000000000, 51.000000000000000000, 52.000000000000000000, 53.000000000000000000, 54.000000000000000000, 55.000000000000000000, 56.000000000000000000, 57.000000000000000000, 58.000000000000000000, 59.000000000000000000, 60.000000000000000000, 61.000000000000000000, 62.000000000000000000, 63.000000000000000000, 64.000000000000000000, 65.000000000000000000, 66.000000000000000000, 67.000000000000000000, 68.000000000000000000, 69.000000000000000000, 70.000000000000000000, 71.000000000000000000, 72.000000000000000000, 73.000000000000000000, 74.000000000000000000, 75.000000000000000000, 76.000000000000000000, 77.000000000000000000, 78.000000000000000000, 79.000000000000000000, 80.000000000000000000, 81.000000000000000000, 82.000000000000000000, 83.000000000000000000, 84.000000000000000000, 85.000000000000000000, 86.000000000000000000, 87.000000000000000000, 88.000000000000000000, 89.000000000000000000, 90.000000000000000000, 91.000000000000000000, 92.000000000000000000, 93.000000000000000000, 94.000000000000000000, 95.000000000000000000, 96.000000000000000000, 97.000000000000000000, 98.000000000000000000, 99.000000000000000000]
Inherits: BaseCurve
Author: 0xIntuition
A simple 1:1 price model implemented as a bonding curve. This curve maintains a direct linear relationship between assets and shares, where the conversion follows the formula: $$f(x) = x$$ where:
- $x$ represents either assets or shares to be converted
- $f(x)$ returns the corresponding amount in the target unit
The price mechanism relies on fee accumulation rather than supply-based pricing. As fees are collected, they are distributed proportionally across all shareholders, creating gradual appreciation in share value. This provides a conservative incentivization model where early participants benefit from fee accumulation over time.
This implementation offers a low-volatility approach to value accrual, suitable for scenarios where predictable, steady returns are preferred over dynamic pricing mechanisms.
This curve is not currently used in the EthMultiVault implementation to preserve audited code. It serves as a reference implementation demonstrating how traditional pro-rata share pricing can be adapted to the bonding curve architecture for future versions.
State Variables
MAX_SHARES
Maximum number of shares that can be handled by the curve.
uint256 public constant MAX_SHARES = type(uint256).max;
MAX_ASSETS
Maximum number of assets that can be handled by the curve.
uint256 public constant MAX_ASSETS = type(uint256).max;
Functions
constructor
Constructor for the Linear Curve.
constructor(string memory _name) BaseCurve(_name);
Parameters
Name | Type | Description |
---|---|---|
_name | string | The name of the curve. |
previewDeposit
Computes the 1:1 relationship between assets <--> shares.
function previewDeposit(uint256 assets, uint256, uint256) external pure override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | Quantity of assets to deposit |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares The number of shares that would be minted |
previewMint
Computes the 1:1 relationship between assets <--> shares.
function previewMint(uint256 shares, uint256, uint256) external pure override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | Quantity of shares to mint |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets The number of assets that would be required to mint the shares |
previewWithdraw
Computes the 1:1 relationship between assets <--> shares.
function previewWithdraw(uint256 assets, uint256, uint256) external pure override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | Quantity of assets to withdraw |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | shares The number of shares that would need to be redeemed |
previewRedeem
Computes the 1:1 relationship between assets <--> shares.
function previewRedeem(uint256 shares, uint256, uint256) external pure override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | Quantity of shares to burn |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | assets The number of assets that would be returned |
convertToShares
Computes the 1:1 relationship between assets <--> shares.
function convertToShares(uint256 assets, uint256, uint256) external pure override returns (uint256 shares);
Parameters
Name | Type | Description |
---|---|---|
assets | uint256 | Quantity of assets to convert to shares |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The number of shares equivalent to the given assets |
convertToAssets
Computes the 1:1 relationship between assets <--> shares.
function convertToAssets(uint256 shares, uint256, uint256) external pure override returns (uint256 assets);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | Quantity of shares to convert to assets |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
assets | uint256 | The number of assets equivalent to the given shares |
currentPrice
In a linear curve, the base price will always be 1. Pool ratio adjustments are dealt with in the EthMultiVault itself.
function currentPrice(uint256) public pure override returns (uint256 sharePrice);
Parameters
Name | Type | Description |
---|---|---|
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
sharePrice | uint256 | The current price of a share, scaled by 1e18 |
maxShares
The maximum number of shares that this curve can handle without overflowing.
Checked by the EthMultiVault before transacting
function maxShares() external pure override returns (uint256);
maxAssets
The maximum number of assets that this curve can handle without overflowing.
Checked by the EthMultiVault before transacting
function maxAssets() external pure override returns (uint256);