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
amount0MaxMax amount of TOKEN0 to depositamount1MaxMax amount of TOKEN1 to depositamount0MinEnsureamount0is greater than this, otherwise revertamount1MinEnsureamount1is greater than this, otherwise revert
Return Values
sharesNumber of shares mintedamount0Amount of TOKEN0 depositedamount1Amount 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
sharesShares that the caller would like to exchange for underlying tokensamount0MinRevert if resultingamount0is smaller than thisamount1MinRevert if resultingamount1is smaller than this
Return Values
amount0Amount of TOKEN0 sent to calleramount1Amount 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
rewardTokenThe ERC20 token in which the reward should be denominated. IfrewardTokenis 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
urgencyHow badly the vault wants itsrebalance(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
inventory0The amount of TOKEN0 underlying all sharesinventory1The amount of TOKEN1 underlying all shares
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
primaryLowerThe primary position's lower tick boundprimaryUpperThe primary position's upper tick boundlimitLowerThe limit order's lower tick boundlimitUpperThe limit order's upper tick boundrecenterTimestampTheblock.timestampfrom the last time the primary position was movedmaxRebalanceGasThe (approximate) maximum amount of gas that has ever been used torebalance(rewardToken)this vaultmaintenanceIsSustainableWhethermaintenanceBudget0ormaintenanceBudget1has filled up according toKlockedWhether the vault is currently locked to reentrancy
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
tokenThe 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
gasPriceThe amount oftokenthat may motivate expenditure of 1e4 units of gas
Immutables
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 updated