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.

Actions

deposit

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.

Arguments

  • amount0Max Max amount of TOKEN0 to deposit

  • amount1Max Max amount of TOKEN1 to deposit

  • amount0Min Ensure amount0 is greater than this, otherwise revert

  • amount1Min Ensure amount1 is greater than this, otherwise revert

Return Values

  • shares Number of shares minted

  • amount0 Amount of TOKEN0 deposited

  • amount1 Amount of TOKEN1 deposited

function deposit(
    uint256 amount0Max,
    uint256 amount1Max,
    uint256 amount0Min,
    uint256 amount1Min
)
    external
    returns (
        uint256 shares,
        uint256 amount0,
        uint256 amount1
    );
withdraw

Withdraws tokens in proportion to the vault's current holdings.

Arguments

  • shares Shares that the caller would like to exchange for underlying tokens

  • amount0Min Revert if resulting amount0 is smaller than this

  • amount1Min Revert if resulting amount1 is smaller than this

Return Values

  • amount0 Amount of TOKEN0 sent to caller

  • amount1 Amount of TOKEN1 sent to caller

function withdraw(
    uint256 shares,
    uint256 amount0Min,
    uint256 amount1Min
) external returns (uint256 amount0, uint256 amount1);
rebalance

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.

Arguments

  • rewardToken The ERC20 token in which the reward should be denominated. If rewardToken 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;

Derived State

getRebalanceUrgency

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).

Return Values

  • urgency How badly the vault wants its rebalance(rewardToken) function to be called

function getRebalanceUrgency() external view returns (uint32 urgency);
getInventory

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).

Return Values

  • inventory0 The amount of TOKEN0 underlying all shares

  • inventory1 The amount of TOKEN1 underlying all shares

function getInventory() external view returns (uint256 inventory0, uint256 inventory1);

State

packedSlot

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.

Return Values

  • primaryLower The primary position's lower tick bound

  • primaryUpper The primary position's upper tick bound

  • limitLower The limit order's lower tick bound

  • limitUpper The limit order's upper tick bound

  • recenterTimestamp The block.timestamp from the last time the primary position was moved

  • maxRebalanceGas The (approximate) maximum amount of gas that has ever been used to rebalance(rewardToken) this vault

  • maintenanceIsSustainable Whether maintenanceBudget0 or maintenanceBudget1 has filled up according to K

  • 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
    );
silo0Basis

The amount of TOKEN0 that was in silo0 last time maintenanceBudget0 was updated

function silo0Basis() external view returns (uint256);
silo1Basis

The amount of TOKEN1 that was in silo1 last time maintenanceBudget1 was updated

function silo1Basis() external view returns (uint256);
maintenanceBudget0

The amount of TOKEN0 available for rebalance(TOKEN0) rewards

function maintenanceBudget0() external view returns (uint256);
maintenanceBudget1

The amount of TOKEN1 available for rebalance(TOKEN1) rewards

function maintenanceBudget1() external view returns (uint256);
gasPrices

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.

Arguments

  • 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.

Return Values

  • gasPrice The amount of token that may motivate expenditure of 1e4 units of gas

function gasPrices(address token) external view returns (uint256 gasPrice);

Immutables

Last updated