ArrakisFactoryinstantiating a tokenized V3 Position. When liquidity is added into the vault, Arrakis vault tokens are minted and credited to the provider. Inversely, Arrakis tokens can be burned to redeem that proportion of the pool's V3 position liquidity and fees earned. Thus, Arrakis tokens represent proportional ownership (or "shares") of the underlying Uniswap V3 position. Similar to the Uniswap V2 LP experience, anyone can add liquidity to or remove liquidity from a Arrakis Vault, and can earn their portion of the fees generated just by holding the fungible tokens. Some Arrakis vaults may have a special privileged
managerrole (see the
ArrakisFactorysmart contract governs over the creation of Arrakis Vaults. In theory, any account or smart contract can create a Arrakis Vault via the factory by calling
deployVault. This creates a tokenized UniswapV3 Position with a given initial price range on the token pair and fee tier of your choice. Anyone can now participate as an LP in that range, by adding liquidity into this position and minting Arrakis tokens. Whatever account is set as the manager role is the only account that may alter the price range of all the underlying vault liquidity with
tokenAOne of the tokens in the Uniswap V3 pair
tokenBThe other token in the Uniswap V3 pair
uniFeeFee tier of the Uniswap V3 pair (100, 500, 3000, 10000)
managerAccount which is initial "manager" (ability to rebalance range). If you want vault position to be entirely immutable (position range can never change) set manager to Zero Address.
managerFee% cut of fees earned that accrue to manager, in Basis Points (9750 is max since 2.5% of earned fees already accrue to Arrakis Protocol).
lowerTickInitial lower price bound for the position, represented as a Uniswap V3 tick.
upperTickInitial upper price bound for the position, represented as a Uniswap V3 tick.
rebalanceAndAddLiquidityRouter method. However the swap parameters passed as argument to this function must be carefully chosen to deposit maximal liquidity and produce the least leftover (any leftover is returned to
msg.sender). This resolver contract exposes a helper for just that.
amount0Inamount of token0 sender forwards to router
amount1Inamount of token1 sender forwards to router
price18Decimalsprice ratio of
token1/token0disregarding (normalizing by) token decimals and then expressed as a WAD (multiplied by
zeroForOnedirection of swap
swapAmountamount of token to swap
manageraccount who can configure the Gelato Executor meta-parameters and also can control and alter the range of the underlying Uniswap V3 position.
executiveRebalancemethod on the
ArrakisVault. This permissioned method is the only way to change the price range of the underlying Uniswap V3 Position. Manager accounts who control this function are the means by which custom rebalancing strategies can be built on top of Arrakis. These strategies can be implemented by governance (slow, but decentralized) or by some central managerial party (more responsive but requiring much more trust) and in the future the manager role can be granted to a Gelato automated smart contract so that they have a sophisticated LP strategy fully automated by Gelato (both reinvesting fees and in rebalancing ranges).
newLowerTickThe new lower price bound of the position represented as a Uniswap V3 tick.
newUpperTickThe new upper price bound of the position represented as a Uniswap V3 tick.
swapThresholdPriceA sqrtPriceX96 that acts as a slippage parameter for the swap that rebalances the inventory (to deposit maximal liquidity around the new price bounds).
swapAmountBPSAmount of inventory to swap represented as Basis Points of the remaining amount of the token to swap.
zeroForOneThe direction of the rebalancing swap.
manageris to configure the manager parameters including those that restrict the functionality of
Gelato Executors. These parameters include how often Gelato bots can reinvest fees and withdraw manager fees, as well as other safety params like the slippage check. Only the manager can call
newManagerFeeBPSChange the cut of fees earned that accrue to manager in Basis Points (9750 max since 2.5% of fees go to Arrakis)
newManagerTreasuryThe treasury address where manager fees are auto withdrawn.
newRebalanceBPSThe maximum percentage the auto fee reinvestment transaction cost can be compared to the fees earned in that feeToken. The percentage is given in Basis Points (where 10000 mean 100%). Example: if rebalanceBPS is 200 and the transaction fee is 10 USDC then the fees earned in USDC must be 500 UDSC or the transaction will revert.
newSlippageBPSThe maximum percentage that the rebalance slippage can be from the TWAP.
newSlippageIntervallength of time in seconds for to compute the TWAP (time weighted average price). I.e. 300 means a 5 minute average price for the vault.
newOwnerthe new account to act as manager.
createVaultmethod. Most relevant information about about a Arrakis position is indexed and queryable via the subgraph. Query URL is: https://api.thegraph.com/subgraphs/name/gelatodigital/g-uni Here is an example query which fetches all information about all Arrakis Positions:
id: subgraph identifier for the vault (contract address)
blockCreated: block Arrakis position was deployed
address: contract address of Arrakis positions
uniswapPool: contract address of Uniswap V3 pair
token0: address of token0
token1: address of token1
feeTier: Uniswap V3 Pair fee tier (500, 3000, 1000)
liquidity: amount of liquidity currently in Arrakis position
lowerTick: current lower tick of Arrakis Position
upperTick: current upper tick of Arrakis Position
totalSupply: current total supply of Arrakis token
positionId: Uniswap V3 ID of the Arrakis position
supplySnapshots: snapshots of the supply when it changes
feeSnapshots: snapshots of fees earned
latestInfo:has up to date info about the position in a recent block. The
latestInfocan be ingested together to produce an estimated APR for fees generated by the position. APR is calculated from these values in the following way: 1. We use the
supplySnapshotsto calculate the time weighted average value of reserves
Vr. This value includes all fees earned.
feeSnapshotsto add up all the fees earned to generate the total value of fees earned
Vf. 3. We compute APR as
Vf / (Vr - Vf)(when
Vr > Vf). In rare cases when
Vf > Vri.e. feesEarned are larger than the time weighted average reserves, one can simply use
ArrakisVaultsmart contract is the core implementation that powers the Arrakis protocol (all Arrakis token proxy contracts point to this implementation). It is an extension of the ERC20 interface so all normal ERC20 token functions apply, as well as a number of custom methods particular to Arrakis which will be outlined below. Most of the methods on the ArrakisVault are low level and end users should likely be interacting with peripheral contracts rather than directly with these low level methods. Nevertheless these methods are publicly exposed and functional.