Comment on page
AloeBlend.sol
https://github.com/aloelabs/aloe-blend/blob/master/contracts/AloeBlend.sol
The information provided by Aloe Labs, Inc. (“we,” “us” or “our”) on docs.aloe.capital (the “Site”) is for general informational purposes only. All information on the Site is provided in good faith, however we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability or completeness of any information on the Site.Under no circumstance shall we have any liability to you for any loss or damage of any kind incurred as a result of the use of the site or reliance on any information provided on the site. Your use of the site and your reliance on any information on the site is solely at your own risk.
Deposits tokens in proportion to the vault's current holdings. These tokens sit in the vault and are not used as liquidity until the next rebalance.
amount0Max
Max amount of TOKEN0 to depositamount1Max
Max amount of TOKEN1 to depositamount0Min
Ensureamount0
is greater than this, otherwise revertamount1Min
Ensureamount1
is greater than this, otherwise revert
shares
Number of shares mintedamount0
Amount of TOKEN0 depositedamount1
Amount of TOKEN1 deposited
function deposit(
uint256 amount0Max,
uint256 amount1Max,
uint256 amount0Min,
uint256 amount1Min
)
external
returns (
uint256 shares,
uint256 amount0,
uint256 amount1
);
Withdraws tokens in proportion to the vault's current holdings.
shares
Shares that the caller would like to exchange for underlying tokensamount0Min
Revert if resultingamount0
is smaller than thisamount1Min
Revert if resultingamount1
is smaller than this
amount0
Amount of TOKEN0 sent to calleramount1
Amount of TOKEN1 sent to caller
function withdraw(
uint256 shares,
uint256 amount0Min,
uint256 amount1Min
) external returns (uint256 amount0, uint256 amount1);
Rebalances the vault to maintain an inventory ratio between 49%:51% and 51%:49%.
Pro tip:
rewardToken
may be something other than TOKEN0 or TOKEN1, in which case the available maintenance budget is equal to the contract's balance. Note that this will revert unless both silos report that removal of rewardToken
is allowed. For example, a Compound silo should block removal of its cTokens.rewardToken
The ERC20 token in which the reward should be denominated. IfrewardToken
is the 0 address, no reward will be given. Otherwise, the reward is based on (a) time elapsed since primary position last moved, and (b) the contract's estimate of how much each unit of gas costs. Since (b) is fully determined by past contract interactions and is known to all participants, (a) creates a Dutch Auction for calling this function
function rebalance(address rewardToken) external;
Calculates the rebalance urgency, which scales linearly with
block.timestamp - packedSlot.recenterTimestamp
.Will be 0 immediately after the primary Uniswap position is recentered, and 100000 after 24 hours. As this value grows, so does the reward available to actors that call
rebalance(rewardToken)
.urgency
How badly the vault wants itsrebalance(rewardToken)
function to be called
function getRebalanceUrgency() external view returns (uint32 urgency);
Estimates the vault's liabilities to users -- in other words, how much would be paid out if all holders redeemed their shares at once.
Underestimates the true payout unless both silos and Uniswap positions have just been poked. Also assumes that the maximum amount will accrue to the maintenance budget during the next
rebalance(rewardToken)
. If it takes less than that for the budget to reach capacity, then the values reported here may increase after calling rebalance(rewardToken)
.inventory0
The amount of TOKEN0 underlying all sharesinventory1
The amount of TOKEN1 underlying all shares
function getInventory() external view returns (uint256 inventory0, uint256 inventory1);
A variety of key parameters used frequently in the vault's code, stored in a single slot to save gas.
Pro tip: If lower and upper bounds of a Uniswap position are equal, then the vault hasn't deposited liquidity to it.
primaryLower
The primary position's lower tick boundprimaryUpper
The primary position's upper tick boundlimitLower
The limit order's lower tick boundlimitUpper
The limit order's upper tick boundrecenterTimestamp
Theblock.timestamp
from the last time the primary position was movedmaxRebalanceGas
The (approximate) maximum amount of gas that has ever been used torebalance(rewardToken)
this vaultmaintenanceIsSustainable
WhethermaintenanceBudget0
ormaintenanceBudget1
has filled up according toK
locked
Whether the vault is currently locked to reentrancy
function packedSlot()
external
view
returns (
int24 primaryLower,
int24 primaryUpper,
int24 limitLower,
int24 limitUpper,
uint48 recenterTimestamp,
uint32 maxRebalanceGas,
bool maintenanceIsSustainable,
bool locked
);
The contract's opinion on the fair value of 1e4 units of gas, denominated in
token
.The value reported here is an average over 14 samples. Nominally there is 1 sample per day, but actual timing isn't stored. Please do not use this as more than a low fidelity approximation/proxy for truth.
token
The ERC20 token for which the average gas price should be retrieved. Most likely populated for TOKEN0 and TOKEN1, but no guarantees. May also be populated for something like COMP if a Compound silo is being used.
gasPrice
The amount oftoken
that may motivate expenditure of 1e4 units of gas
function gasPrices(address token) external view returns (uint256 gasPrice);
Type | Name | Description |
---|---|---|
uint24 | RECENTERING_INTERVAL | The nominal time (in seconds) that the primary Uniswap position should stay in one place before being recentered. |
int24 | MIN_WIDTH | The minimum width (in ticks) of the primary Uniswap position. |
int24 | MAX_WIDTH | The maximum width (in ticks) of the primary Uniswap position. |
uint8 | K | The maintenance budget buffer multiplier. The vault will attempt to build up a maintenance budget equal to the average cost of rebalance incentivization, multiplied by K. |
uint8 | L | If the maintenance budget drops below [its maximum size ➗ this value], maintenanceIsSustainable will become false. During the next rebalance, this will cause the primary Uniswap position to expand to its maximum width -- de-risking the vault until it has time to rebuild the maintenance budget. |
uint8 | B | The number of standard deviations (from volatilityOracle) to +/- from mean when choosing range for primary Uniswap position. |
uint8 | D | The constraint factor for new gas price observations. The new observation cannot be less than (1 - 1/D) times the previous average. |
uint8 | MAINTENANCE_FEE | The denominator applied to all earnings to determine what portion goes to maintenance budget. For example, if this is 10, then at most 1/10th of all revenue will be added to the maintenance budget. |
uint256 | FLOAT_PERCENTAGE | The percentage of funds (in basis points) that will be left in the contract after the primary Uniswap position is recentered. If your share of the pool is <<< than this, withdrawals will be more gas efficient. Also makes it less gassy to place limit orders. |
IVolatilityOracle | volatilityOracle | The volatility oracle used to decide position width. |
ISilo | silo0 | The silo where excess TOKEN0 is stored to earn yield. |
ISilo | silo1 | The silo where excess TOKEN1 is stored to earn yield. |
Last modified 1yr ago