Intro
Welcome to the Arrakis documentation.
Arrakis is a MEV-aware market maker that powers onchain liquidity for token issuers and LPs. We're building the Arrakis Protocol to make onchain liquidity provision more scalable and efficient.
Read this Intro to Arrakis for a high-level overview of the Arrakis Protocol and the Arrakis Pro product that it powers.
Or jump straight into:
The liquidity must flow.
Arrakis Protocol
Arrakis Protocol consists of two major infrastructural components:
- Offchain Market Making Infrastructure
- Onchain Smart Contract Framework
Our smart contract framework for DEX integrations (Arrakis Modular) works together with our offchain market making infrastructure. The union of these onchain and offchain components comprise the Arrakis Protocol.
For example, Arrakis Pro on Uniswap V4 is formed by the following components:
- Arrakis Quoter and other offchain market making components to determine dynamic fees.
- Arrakis Modular (smart contract framework) Private Vaults.
- A new custom Arrakis Uniswap V4 Hook to give private access to a given pool as well setting dynamic fees which are respnsive to market conditions.
Arrakis Pro
Arrakis Pro is the industry leading, non-custodial onchain liquidity management solution for token issuers (protocols and DAOs). Arrakis Pro powers protocol owned liquidity.
See Arrakis Pro Docs
Problem Statement
Uniswap v3 introduced the concept of concentrated liquidity AMM pools which enabled high capital efficiency, but were complex to manage.
Arrakis Pro supports token issuers by:
- Supporting token launches
- Bootstraping liquidity
- Ongoing inventory management
Benefits
Protocols and DAOs can benefit from the following:
- Greater capital efficiency: narrow price range with rebalancing to keep the price in the range.
- Minimum price impact: increased liquidity depth leading to reduced downside price impact and market volatility.
- Return on capital: facilitate more trading volumes whilst reducing toxic order flow.
- Active inventory management: exposure the right amount of liquidity at the right time.
Solution
Arrakis Pro simplifies the process of managing concentrated liquidity by automating liquidity provisioning and rebalancing, for any concentrated liquidity pool (including Uniswap v3, Uniswap v4 and Aerodrome). Arrakis Pro is powered by Arrakis's Offchain Market Making infrastructure.
Arrakis Pro was formerly known as PALM (built on top of Uniswap v3). With Arrakis Modular — the new and improved version of the Arrakis vaults — any DEX can be supported.
Get in Touch
Arrakis is trusted by MakerDAO, Lido, EtherFi, Across, Stargate, Gnosis, Redstone, Euler, Redacted Cartel, Angle, Mountain, Kwenta, IndexCoop, Sturdy, Everclear and many more leading protocols. As of October 2024, Arrakis vaults have facilitated over $20B in cumulative trading volume.
Contact us to learn more about how Arrakis Pro can support your token launch and ongoing liquidity management.
Arrakis Pro Docs
Here you can learn about the feature set and technical details of Arrakis Pro. What is Arrakis Pro? See the high-level intro
Arrakis Pro is built on Arrakis Modular Private Vaults. Dive into Arrakis Modular Docs to learn about Arrakis Modular smart contracts in-depth.
TLDR
A Private Vault can be thought of as the entrypoint and heads-up display for a single LP to manage their onchain DEX liquidity on a token pair (e.g. ETH/AAVE) in a sophisticated and optimized way. Private Vault ownership is tokenized as an NFT, similar to Uniswap V3 NFTs (pictured below)
Arrakis Pro Vaults are a subset of Private Vaults configured to use Arrakis' proprietary Offchain Management Infrastructure and Liquidity Provision Strategy Templates.
Arrakis Pro Vault Setup
Deployment
For now simply contact us to have an Arrakis engineer deploy and configure an Arrakis Pro vault on your behalf. (If you really want to deploy by yourself see sample deploy script here)
At deployment you choose what initial module your vault uses. See integrations section for more info.
Deposit
After deployment, you can now deposit liquidity into your Arrakis Pro vault.
Deposit Using a Safe and Safe App:
Navigate to your vault owner Safe on Safe App. Then go to Apps -> My custom apps
and then add https://app.arrakis.finance/pro
as a "Custom Safe App". In the custom safe app you'll see your Pro vault(s) and can use the GUI to deposit with one multi-step Safe transaction.
Deposit Manually:
-
From
vault.owner()
acct -> call whitelistDepositors on your Vault contract to whitelist the account that will deposit tokens (even owner has to explicitly whitelist itself before depositing). -
From
whitelisted depositor
acct -> approvevault.module()
contract address as spender of token(s) you will deposit. -
From
whitelisted depositor
acct -> Call deposit on your Vault contract to deposit funds. (If depositing native ETH remember to pass amsg.value
that matches the amount0/1 argument)
Activation
After deposit your vault is not necessarily activated immediately. To activate your vault and deploy LP into the DEX of interest, you'll need a "strategy config" set on the Arrakis Pro Backend. See strategies section.
Pro Vault Maintenance
NOTE: most maintenance actions are not yet available on the Arrakis Pro UI. But they will be soon. For now if urgent maintenance actions are needed follow this guide.
updateVaultInfo
On the ArraksStandardManager every vault owner
has the ability to adjust important management parameters for their vault.
-
View call
manager.vaultInfo(address vault)
to see current vault info. -
from vault
owner
acct -> callmanager.updateVaultInfo(struct memory SetupParams)
see here where the struct has these fields:
struct SetupParams {
address vault;
IOracleWrapper oracle;
uint24 maxDeviation;
uint256 cooldownPeriod;
address executor;
address stratAnnouncer;
uint24 maxSlippagePIPS;
}
edit the fields you want to change and copy over the fields from Step 1 that you want to keep the same.
vault
that is the address of your vault. call will fail if msg.sender is not not owner of this vaultoracle
is a smart contract which acts as onchain oracle to police executor actions. Read more about Arrakis Price OraclesmaxDeviation
this is max deviation underlying module spot market can haave from oracle price (in pips)cooldownPeriod
shortest amount of seconds between any successful management actions on the vaultexecutor
account which can call management functions for this vault. Pro vaults have0x420966bCf2A0351F26048cD07076627Cde4f79ac
as executor (the Arrakis Pro Backend)stratAnnouncer
currently unused for now, (in future, account with ability to set vault offchain strategy config via onchain call)maxSlippagePIPS
maximum slippage from oracle price on management swap actions (in pips)
The ArrakisStandardManager is deployed to address 0x2e6E879648293e939aA68bA4c6c129A1Be733bDA
on all networks. See mainnet contract onchain: here
transfer vault
nevertheless you may want to migrate your Arrakis Pro vault to a new owner account. This is as simple as transferring the NFT to the target recipient which can usually be done on any wallet UI directly.
manual steps:
Find your token id of interest and call transferFrom(address from, address to, uint256 tokenId)
on the PrivateVaultNFT contract.
- The
from
is currentowner
of tokenId and also the acct you are calling from - The
to
is your desired recipient of vault control - The
tokenId
is the tokenId you found. It is also thekeccak256(vaultAddress)
Arrakis PrivateVaultNFT contract is deployed to address 0x44A801e7E2E073bd8bcE4bCCf653239Fa156B762
on all networks. See mainnet contract onchain: here
whitelistModules
Every vault owner
has the ability to call whitelistModules(address[] calldata beacons, bytes[] calldata datas)
see here
with valid module beacon addresses in the beacons
argument and valid module initialization payloads in the datas argument.
Because these may not be simple calls to construct correctly, we recommend reaching out to Arrakis engineers if you want to whitelist new modules.
Integrations
One key feature of Arrakis Modular is the ability to switch between modules, where each module defines the vault's integration with a liquidity consuming dApp. For Arrakis Pro there are currently four potential modules to choose from:
-
Uniswap v4: Supply liquidity to Uniswap V4 with easy batching of liquidity operations on a single pool. Easily migrate token0/token1 liquidity across safe (no hook logic on add or remove liquidity) pools (hooks). Integrates with merkl rewards so that vault LPs can earn them.
-
Aerodrome: Supply liquidity and stake liquidity positions to earn AERO on a single Aerodrome slipstream pool, with easy batching of NFT liquidity position operations (mint, burn, claim rewards).
-
PancakeSwap Infinity: [identical in features to Uniswap V4 module, but code is different]
-
Velodrome: [identical to Aerodrome module, same bytecode]
Because each of these modules use Uniswap V3 style tick math they can all consume the same core strategy templates (with slightly different paylaod encodings) described in the strategies section.
Strategies
Arrakis Pro offers adaptive strategies designed for efficient on-chain liquidity management. These strategies work for all AMMs that are based on Uniswap V3 Math, including Uniswap V4, Aerodrome, Velodrome, and PancakeSwap V4.
-
The Bootstrap Strategy is ideal for token launches with imbalanced starting inventories. It deploys liquidity across a full-range position and several narrow “bootstrapping” ranges that hold mostly "base" tokens (as opposed to "quote" tokens like USDC or ETH). As users trade, the strategy captures volatility asymmetrically—accumulating more quote token on buy pressure—and steadily moves toward a 50/50 token balance. Once ~50/50 balance is reached, the strategy stops
-
The Flagship Strategy manages mature pools by reacting to price shifts, inventory imbalance, and volatility. It operates in three risk modes adjusting liquidity depth and range width accordingly. During calm markets, it concentrates liquidity to maximize fees and reduce price impact. During volatile markets, it widens ranges and reduces exposure. Rebalancing is based on price and inventory trends, ensuring stability and efficiency.
Together, these strategies guide tokens from launch to maturity. One the one hand, they provide consistent price impact for traders. On the other hand, they ensure a stable inventory balance and fee generation for treasuries.
We are continuously designing tailored strategies for specific token pairs, which may need more frequent rebalances, swapping on third party aggregators or using offchain prediction models, among others.
Bootstrap strategy
Introduction
Uniswap V2 simplicity and symmetric trading curve are ideal for price discovery during token launches. The absence of directional bias implies that trading activity orgaically determines the market price of a token. However, this requires adding liquidity in a 50/50 ratio, which is not practical for most treasuries.
Our bootstrap strategy is designed to leverage the features of concentrated liquidity introduced in Uniswap V3 in order to manage very imbalanced liquidity ratios, for example 80% of a governace token GOV vs 20% of a quote token like ETH or USDC. By asymmetrically absorbing volatility, it captures more of the quote token during buy spikes, progressively converging to a 50/50 token ratio.
From now on we consider an ETH/GOV token pair as an example to describe the strategy implementation.
Implementation
The bootstrap strategy defines a liquidity distribution composed by several ranges
-
Full Range: A wide position with both tokens in a 50/50 proportion and acting as the main stabilizer. It provides liquidiity at all possible prices and ensures trading is always possible for this pair.
-
Bootstrapping Ranges: Short, sequential ranges with increasing size, initially holding just one token to guide early price movement. They are the core element of this strategy and built such that the price impact for buying and selling orders are very close to each other. These ranges are able to capture ETH during upside movements in price while providing an almost unbiased experience for traders.
-
Price Discovery Range: A long-range position for capturing additional upside if price increases significantly in high volatilty scenarios.
These ranges are depicted in the image below, where we consider a quote token ETH and a base token GOV in a very imbalanced ratio.
This strategy sets target prices used as a rebalance trigger. The target price on the GOV token side is set to quickly capture some of the ETH sold to the pool (called in the figure below).
This ETH is then secured in a full range position via a rebalance of all the positions, which allows to continuously converge to a 50/50 token ratio, which then allows to migrate to a more capital efficient strategy, that we call Flagship strategy.
Flagship strategy
Introduction
The Flagship Strategy is designed to optimize liquidity across different market conditions on AMMs based on Uniswap V3 math. It reacts to price movements, inventory shifts, and market volatility using a flexible system of rules and modes to manage exposure and fee generation.
Implementation
Risk Modes
This strategy runs in one of three risk modes based on volatility:
- 🟢 Low volatility: Most of the liquidity is deployed to maximize trading activity and fee income.
- 🟡 Moderate volatility: Slightly reduced exposure to protect against risk.
- 🔴 High volatility: Only a portion of liquidity is deployed to minimize impermanent loss and risk.
Liquidity Profile
Depending on the mode, the strategy builds liquidity using two or three range types:
- Base Range: A wide range that holds the core liquidity and allows trading of big orders with minimal price impact.
- Bootstrapping Range: A narrower limit-order-like position designed to maintain a 50/50 token ratio.
- Mid Range: A tight position around the current price that provides very deep liquidity and reduces price impact for average orders. This is only present in the low volatility mode.
In the figure below we show a liquidity distribution on a low volatility mode, where the token ratio is 60% GOV and 40% ETH.
Rebalance triggers
-
Price Triggers: If the price moves enough in either direction, the strategy redistributes liquidity around the new price. In balanced portfolios (e.g. 50/50 holdings), a standard threshold is used. For imbalanced portfolios, the threshold dynamically adjusts to respond more aggressively or conservatively, depending on how skewed the inventory is.
-
Inventory Triggers: If the holdings of the two tokens shift beyond a target ratio (like 75/25), the strategy reacts. It recalculates the liquidity split and redistributes accordingly to guide the pool back toward balance.
-
Volatility Triggers: When the market becomes too volatile, the strategy shifts risk modes, pulling back liquidity and widening ranges to reduce risk.
Migration
If you have an Arrakis PALM vault and want to update to the new Arrakis Pro system, contact us.
For now migrations are limited to Uniswap V3 (legacy palm vault) -> Uniswap V4 (pro vault). Because new pro vaults are modular, one could do the migration to Uni V4 and then move to a different module from there.
Migrations, once configured by Arrakis engineers, can be performed seamlessly on the Arrakis Pro UI (via Safe Custom App, for Safe users)
NOTE: because it is a sensitive operations, the migration must be executed within a few minutes of payload generation. Make sure you have signers ready to sign when you are going through migration flow.
Arrakis Modular
Arrakis Modular represents the next evolution of the Arrakis liquidity management smart contract framework, aiming to overcome the limitations of previous versions (V1 and V2).
Check out the Github Repo as well as the documentation here.
Motivation
Arrakis vault contracts have allowed LPs to actively manage or delegate the management of their DEX liquidity positions. However, Arrakis V1 and V2 were purpose-built around Uniswap V3 liquidity. To support alternative venues (e.g. Uniswap V4, Balancer, etc) Arrakis would have to make a completely new standard for each integration from scratch.
Arrakis Modular introduces a universal Meta Vault standard. This modular framework allows Arrakis to create entirely different two-sided LP Vault integrations, which all reuse the same Meta Vault infrastructure and interfaces.
Architecture
Meta Vault: At the heart of the Arrakis Modular system is the concept of a Meta Vault. The Meta Vault creates a unified standard for providing two-sided liquidity to DEXs regardless of the particular features or interfaces of a given DEX.
Modules: Each Meta Vault has the capability to whitelist various modules. A module is essentially a smart contract that establishes an integration with a liquidity-consuming dApp.
Configuration: Each Meta Vaults is configurable by the Vault owner
. This design ensures that as new DEXs emerge, Arrakis integration becomes a matter of simply creating and whitelisting a new module compatible with the DEX, and then activating it.
Diagram: Arrakis Modular smart contract system represented visually.
Security: Arrakis Modular from a Security POV.
Arrakis Meta Vault
Meta Vaults are a core component of the Arrakis Modular system, designed to provide a flexible and efficient way for users to manage liquidity on or across various decentralized exchanges (DEXs) and trading venues.
Public Versus Private
- Public Meta Vaults: These vaults implement ERC20 and are intended for shared liquidity positions or strategies. They allow for delegated management of liquidity on behalf of multiple participants who mint and burn vault ERC20 token supply by depositing or withdrawing a proportion of vault underlying assets.
- Private Meta Vaults: These are designed for token issuers and individual users to manage or delegate management of their own private liquidity. The ownership and transfer rights of Private Meta Vaults is tokenized as a fully onchain NFT, as shown below. Only vault owners can withdraw underlying liquidity from a private vault.
Deploying Vaults
The Factory is responsible for deploying new instances of both public and private Meta Vaults. Private vaults can be permissionlessly deployed by any address while public vaults are only deployed and controlled by whitelisted addresses. The Factory contract maintains a list of all deployed vaults and manages permissions for public vault deployments.
This architecture allows for efficient liquidity management across multiple platforms while providing options for both shared and private liquidity strategies, all within a modular and extensible framework.
Modules
Modules are smart contracts that act as a bridge between Meta Vaults and specific decentralized exchanges (DEXs) or liquidity protocols. They encapsulate the logic for interacting with particular trading venues, allowing Meta Vaults to provide liquidity across various platforms without changing their core structure.
Modules also each expose their own custom functions for liquidity management that only the manager
of the Meta Vault can call.
Module implementations are whitelisted on public and private registry contracts to ensure security and proper functionality. The vault owner
selects which module(s) to attach to their vaults. Each vault has exactly one "active" module and every vault has a setModule
function which only the manager
can call (to change the "active" module).
The key strength of modules lies in their flexibility and standardization. As new DEXs emerge or trading strategies evolve, new modules can be created and integrated seamlessly, enabling the Arrakis system to adapt to the rapidly changing DeFi landscape.
Explore module implementations built by Arrakis here. Or check out the modules interfaces here
Vault Configuration
Every Meta Vault has configurable components which can be adjusted by the Vault owner
role. The two main configurables are:
-
modules: whitelisting and revoking modules which each define the integration with an underlying liquidity protocol (e.g. HOT AMM module) and also expose certain liquidity management functions that can be invoked by the Arrakis Standard Manager.
-
manager configuration: set on the Arrakis Standard Manager, the vault owner controls the VaultInfo struct including an
executor
who can call liquidity management functions for this vault from offchain, and safety checks on any liquidity management actions that theexecutor
invokes.
Configuration Management
The Meta Vault owner
role has the ability to whitelist modules and configure management parameters on the Arrakis Standard Manager. This means a vault owner can entirely augment where vault liquidity flows, how it behaves, what management functions it exposes, and who can execute management functions.
All Public Vault ownership is immutably behind a multi-day timelock (controlled by the Arrakis DAO) so that LPs are guaranteed to have time to react to any changes in configuration.
Private Vaults Ownership is mapped in the Private Vault NFT contract, and Private Vaults do not enforce a timelock on vault ownership (private vault liquidity providers are intended to be the owner of their private vaults).
Diagram
Security
Arrakis Modular employs a multi-layered security approach that combines proactive monitoring and rapid response capabilities with enforced delays on any critical changes.
-
Guardian: responsible for implementing a rushing pauser role that can quickly pause parts of the system in case of critical errors or vulnerabilities.
-
TimeLock: enforces a delay on changes to critical security parameters. This provides security guarantees for public Meta Vaults against compromised multisigs and malicious actors.
Upgradeability
Most of the Arrakis Modular smart contracts are entirely immutable. However module implementations and the ArrakisStandardManager are behind proxies and may be upgradeable as an initial safety precaution. All upgradeability in Arrakis Modular is behind strict timelocks (controlled by Arrakis DAO) absolutely no instant contract upgrades can be made on the Arrakis Modular system
(NOTE: the modular nature of Arrakis Meta Vaults make them inherently similar to upgradeable proxy patterns. By whitelisting and activating a new module, Arrakis Vault functionality can critically change. This is why Public Vault ownership enforces a timelock.)
Audits
Price Oracles
All Arrakis Vaults have a concept of a price oracle
set by vault owners on the ArrakisStandardManager. These price oracles are used as a third-party check on executor
management calls to a vault.
We use our own standard interface for oracle reads and thus we can seamlessly integrate any type of onchain oracle price feed no matter the interfaces/patterns (RedStone, Chainlink, Uni V3 TWAP, etc) -- just by defining a simple Oracle Wrapper smart contract.
To accelerate the integration of safe public and private Meta Vaults for newer tokens that may not already have performant oracle feeds onchain, we refer clients to our oracle partner RedStone.
Methodology
Arrakis implements a standard oracle interface that must be followed:
interface IOracleWrapper {
/// @notice function used to get price0.
/// @return price0 price of token0/token1.
function getPrice0() external view returns (uint256 price0);
/// @notice function used to get price1.
/// @return price1 price of token1/token0.
function getPrice1() external view returns (uint256 price1);
}
Any smart contract that utilizes this interface can function as an oracle on the Arrakis standard manager. This interface is consumed during ArrakisStandardManager.rebalance here:
uint256 price0 = info.oracle.getPrice0();
uint256 vaultInToken1BeforeRebalance = FullMath.mulDiv(
amount0, price0, 10 ** token0Decimals
) + amount1;
we store vaultInToken1BeforeRebalance
and then compare it to the value after rebalance. Further checks can be implemented at the module level with oracle price feeds thanks to this call here:
module.validateRebalance(info.oracle, info.maxDeviation);
Deployments
Arrakis Modular Smart Contracts are deployed on Mainnet, Base, Arbitrum, Optimism, Polygon, Ink, Unichain and Sepolia. They are deployed using CREATE3
, and share addresses among all the networks.
Contract | Address |
---|---|
Arrakis Standard Manager | 0x2e6E879648293e939aA68bA4c6c129A1Be733bDA |
Arrakis Meta Vault Factory | 0x820FB8127a689327C863de8433278d6181123982 |
Private Vault NFT | 0x44A801e7E2E073bd8bcE4bCCf653239Fa156B762 |
Renderer Controller | 0x1Cc0Adff599F244f036a5C2425f646Aef884149D |
TimeLock | 0xAf6f9640092cB1236E5DB6E517576355b6C40b7f |
Guardian | 0x6F441151B478E0d60588f221f1A35BcC3f7aB981 |
Public Module Registry | 0x791d75F87a701C3F7dFfcEC1B6094dB22c779603 |
Private Module Registry | 0xe278C1944BA3321C1079aBF94961E9fF1127A265 |
Public Vault Router | 0x72aa2C8e6B14F30131081401Fa999fC964A66041 |
Public Vault Router Executor | 0x19488620Cdf3Ff1B0784AC4529Fb5c5AbAceb1B6 |
Public Vault Router Resolver | 0xC6c53369c36D6b4f4A6c195441Fe2d33149FB265 |
Private Vault Router | TBD |
Uniswap V4 Private Module Implementation | 0x04eAd25447F9371c5c1e2C33645f32aAFEb337dc |
Aerodrome Private Module Implementation** | 0x0472c68b8945516c125366c4d95aaf1043171410 |
Pauser* | 0x700a1cdA1495C1B34c4962e9742A8A8832aAc03A |
Withdraw Helper* | 0x3F99b26DE263d4436e114e6De54e4DE55D41BD2d |
Migration Helper* | 0xd61407B9B63956CfB61341AAfeFbD7EDA1F9B962 |
* Not available on Sepolia
** Only available on Base
Technical reference
Welcome to the smart contract technical reference of the Arrakis Modular smart contract framework. See Here for the github repository.
Getting Started
In order to run the test suite of Arrakis modular smart contracts, follow these steps:
- Clone the repository by running:
git clone https://github.com/ArrakisFinance/arrakis-modular.git
- Install the required submodules and compile the contracts by running:
forge build
- Create
.env
file using.envExample
as a reference. You can fill in your own alchemy api key (or a different RPC url altogether) - Execute the test suite by running:
forge test -vv
If tests run and pass then your dev environment is set up correctly!
Arrakis Modular Smart Contracts
Meta-Vaults
Vaults
abstracts/ArrakisMetaVault.sol
This contract is the core of the minimal Arrakis Meta Vault standard. It encodes the interfaces and patterns of an Arrakis Meta Vault. A functional ArrakisMetaVault has a module
contract connected to it which entirely defines how the vault integrates with an underlying Liquidity Provision protocol, using standard interfaces. This contract is abstract because it is extended to expose the differenced in the Public and Private vault type, most notable how they are tokenized and how the deposit function is implemented.
-
ArrakisMetaVaultPublic.sol
This inherits and extends the abstractArrakisMetaVault.sol
to create the ERC20 wrapped “public” Arrakis Meta Vault. If we want to create a shared LP position/strategy which can configure or delegate LP active management on behalf of all participants, then we’ll deploy an instance of this through the Factory contract. Public Vault deployments are permissioned since sensitive security parameters for multiple parties are under the timelocked control of a vault owner, so we want some ability to control who might deploy/configure/own these public vaults. Eventually this authority would be under the control of the “Arrakis DAO.” -
ArrakisMetaVaultPrivate.sol
This inherits and extends the abstractArrakisMetaVault.sol
to create the “private” Arrakis Meta Vault, where only the vault owner controls adding or removing liquidity. If you want to create an LP management contract for your own private liquidity (we call this PALM for private active liquidity management) you’d deploy an instance of this through the Factory contract. Ownership is not timelocked and deployment is permissionless in this case, since the sensitive security parameters are fundamentally under the control of the custodian of the vault funds (i.e. the owner is the user).
Factory
ArrakisMetaVaultFactory.sol
deploys fresh instances of ArrakisMetaVaultPublic
and ArrakisMetaVaultPrivate
public vault deployments are permissioned, but private vault ones are not. Stores complete list of all vaults deployed, by type.
Ownership
PrivateVaultNFT.sol
an NFT contract that allows ownership of private vaults to each be tokenized and thus transferrable. Very standard NFT contract
Modules
abstracts/ModuleRegistry.sol
this abstract contract handles the simple duty of “module” whitelistsing, so only modules deemed safe and correct can be used by vaults.
-
ModulePrivateRegistry.sol
registry of all modules which can be whitelisted and used by private vaults. -
ModulePublicRegsitry.sol
registry of all modules which can be whitelisted and used by public vaults.
Implementations
modules/ValantisSOTModule.sol
This is the first ArrakisMetaVault module we will put into production, integrating a specific Sovereign Pool type of the new Valantis DEX.
Administration
ArrakisStandardManager.sol
The manager contract that adds additional safety checks to make delegated LP management safe and as trustless as possible. Arrakis will use this as the entry point to actively manage both private vaults and public vaults. Also how we confiuge/harvest manager fee collection for Arrakis protocol to take cut of revenues generated.
Security
Guardian.sol
this contract is in charge of a rushing pauser role who can pause parts of the system in the case of critical error/vulnerability. This authority would be ultimately in the hands of some “Guardian Multisig” much like how AAVE works today. For any upgradeable contracts (modules are all beacon proxies and could potentially be upgradeable) there would be a timelock. So pauses are rushing but upgrades are slow.
TimeLock.sol
a slightly modified generic timelock (so that timelock cannot transfer ownership of the vault away from the timelock contract) a fresh instance of this is used for each Public Arrakis vault to make sure that security parameters cannot be rushingly reconfigured by a compromised public vault owner to extract value from the public vault.
Routing
ArrakisPublicVaultRouter.sol
A router contract which integrates permit2 which helps depositors add liquidity to ArrakisMetaVaultPublic
instances, safely and conveniently.
RouterSwapExecutor.sol
a sub-component of the Public Vault Router used for swapping safely (need the middleman contract here for security concerns on these generic low level swaps being abused)
Meta Vaults
Content
Core
Content
ArrakisMetaVault
Inherits: IArrakisMetaVault, ReentrancyGuard, Initializable
State Variables
moduleRegistry
address public immutable moduleRegistry;
token0
address public immutable token0;
token1
address public immutable token1;
manager
address public immutable manager;
module
IArrakisLPModule public module;
_whitelistedModules
EnumerableSet.AddressSet internal _whitelistedModules;
Functions
onlyOwnerCustom
modifier onlyOwnerCustom();
onlyManager
modifier onlyManager();
constructor
constructor(
address moduleRegistry_,
address manager_,
address token0_,
address token1_
);
initialize
function initialize(address module_) external initializer;
setModule
function used to set module
function setModule(
address module_,
bytes[] calldata payloads_
) external onlyManager nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
module_ | address | address of the new module |
payloads_ | bytes[] | datas to initialize/rebalance on the new module |
whitelistModules
function used to whitelist modules that can used by manager.
we transfer here all tokens to the new module.
function whitelistModules(
address[] calldata beacons_,
bytes[] calldata data_
) external onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | array of beacons addresses to use for modules creation. |
data_ | bytes[] | array of payload to use for modules creation. |
blacklistModules
function used to blacklist modules that can used by manager.
function blacklistModules(address[] calldata modules_)
external
onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
modules_ | address[] | array of module addresses to be blacklisted. |
whitelistedModules
function used to get the list of modules whitelisted.
function whitelistedModules()
external
view
returns (address[] memory modules);
Returns
Name | Type | Description |
---|---|---|
modules | address[] | whitelisted modules addresses. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
public
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160 priceX96_)
external
view
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
_withdraw
function _withdraw(
address receiver_,
uint256 proportion_
) internal returns (uint256 amount0, uint256 amount1);
_withdrawManagerBalance
function _withdrawManagerBalance(IArrakisLPModule module_)
internal
returns (uint256 amount0, uint256 amount1);
_call
function _call(address module_, bytes memory data_) internal;
_onlyOwnerCheck
function _onlyOwnerCheck() internal view virtual;
ArrakisMetaVaultFactory
Inherits: IArrakisMetaVaultFactory, Pausable, Ownable
this contract will use create3 to deploy vaults.
State Variables
moduleRegistryPublic
address public immutable moduleRegistryPublic;
moduleRegistryPrivate
address public immutable moduleRegistryPrivate;
creationCodePublicVault
address public immutable creationCodePublicVault;
creationCodePrivateVault
address public immutable creationCodePrivateVault;
nft
PrivateVaultNFT public immutable nft;
manager
address public manager;
_publicVaults
EnumerableSet.AddressSet internal _publicVaults;
_privateVaults
EnumerableSet.AddressSet internal _privateVaults;
_deployers
EnumerableSet.AddressSet internal _deployers;
Functions
constructor
constructor(
address owner_,
address manager_,
address moduleRegistryPublic_,
address moduleRegistryPrivate_,
address creationCodePublicVault_,
address creationCodePrivateVault_
);
pause
function used to pause the factory.
only callable by owner.
function pause() external onlyOwner;
unpause
function used to unpause the factory.
only callable by owner.
function unpause() external onlyOwner;
setManager
function used to set a new manager.
only callable by owner.
function setManager(address newManager_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
newManager_ | address | address that will managed newly created vault. |
deployPublicVault
function used to deploy ERC20 token wrapped Arrakis Meta Vault.
function deployPublicVault(
bytes32 salt_,
address token0_,
address token1_,
address owner_,
address beacon_,
bytes calldata moduleCreationPayload_,
bytes calldata initManagementPayload_
) external whenNotPaused returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
salt_ | bytes32 | bytes32 used to get a deterministic all chains address. |
token0_ | address | address of the first token of the token pair. |
token1_ | address | address of the second token of the token pair. |
owner_ | address | address of the owner of the vault. |
beacon_ | address | address of the beacon that will be used to create the default module. |
moduleCreationPayload_ | bytes | payload for initializing the module. |
initManagementPayload_ | bytes | data for initialize management. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the newly created Token Meta Vault. |
deployPrivateVault
function used to deploy owned Arrakis Meta Vault.
function deployPrivateVault(
bytes32 salt_,
address token0_,
address token1_,
address owner_,
address beacon_,
bytes calldata moduleCreationPayload_,
bytes calldata initManagementPayload_
) external whenNotPaused returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
salt_ | bytes32 | bytes32 needed to compute vault address deterministic way. |
token0_ | address | address of the first token of the token pair. |
token1_ | address | address of the second token of the token pair. |
owner_ | address | address of the owner of the vault. |
beacon_ | address | address of the beacon that will be used to create the default module. |
moduleCreationPayload_ | bytes | payload for initializing the module. |
initManagementPayload_ | bytes | data for initialize management. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the newly created private Meta Vault. |
whitelistDeployer
function used to grant the role to deploy to a list of addresses.
function whitelistDeployer(address[] calldata deployers_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
deployers_ | address[] | list of addresses that owner want to grant permission to deploy. |
blacklistDeployer
function used to grant the role to deploy to a list of addresses.
function blacklistDeployer(address[] calldata deployers_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
deployers_ | address[] | list of addresses that owner want to revoke permission to deploy. |
getTokenName
get Arrakis Modular standard token name for two corresponding tokens.
function getTokenName(
address token0_,
address token1_
) public view returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
token0_ | address | address of the first token. |
token1_ | address | address of the second token. |
Returns
Name | Type | Description |
---|---|---|
<none> | string | name name of the arrakis modular token vault. |
publicVaults
get a list of public vaults created by this factory
function publicVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | start index |
endIndex_ | uint256 | end index |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | vaults list of all created vaults. |
numOfPublicVaults
numOfPublicVaults counts the total number of public vaults in existence
function numOfPublicVaults() public view returns (uint256 result);
Returns
Name | Type | Description |
---|---|---|
result | uint256 | total number of vaults deployed |
isPublicVault
isPublicVault check if the inputed vault is a public vault.
function isPublicVault(address vault_) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPublicVault true if the inputed vault is public or otherwise false. |
privateVaults
get a list of private vaults created by this factory
function privateVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | start index |
endIndex_ | uint256 | end index |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | vaults list of all created vaults. |
numOfPrivateVaults
numOfPrivateVaults counts the total number of private vaults in existence
function numOfPrivateVaults() public view returns (uint256 result);
Returns
Name | Type | Description |
---|---|---|
result | uint256 | total number of vaults deployed |
isPrivateVault
isPrivateVault check if the inputed vault is a private vault.
function isPrivateVault(address vault_)
external
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPublicVault true if the inputed vault is private or otherwise false. |
deployers
function used to get a list of address that can deploy public vault.
function deployers() external view returns (address[] memory);
_initManagement
function _initManagement(
address vault_,
bytes memory data_
) internal;
_getPublicVaultConstructorPayload
to anticipate futur changes in the manager's initManagement function manager should implement getInitManagementSelector function, so factory can get the the right selector of the function.
for initializing management we need to know the vault address, so manager should follow this pattern where vault address is the first parameter of the function.
function _getPublicVaultConstructorPayload(
address timeLock_,
address token0_,
address token1_
) internal view returns (bytes memory);
_append
function _append(
string memory a_,
string memory b_,
string memory c_,
string memory d_
) internal pure returns (string memory);
ArrakisStandardManager
Inherits: IArrakisStandardManager, IManager, Ownable, ReentrancyGuardUpgradeable, PausableUpgradeable
State Variables
defaultFeePIPS
uint256 public immutable defaultFeePIPS;
nativeToken
address public immutable nativeToken;
nativeTokenDecimals
uint8 public immutable nativeTokenDecimals;
defaultReceiver
address public defaultReceiver;
receiversByToken
mapping(address => address) public receiversByToken;
vaultInfo
mapping(address => VaultInfo) public vaultInfo;
pendingFeeIncrease
mapping(address => FeeIncrease) public pendingFeeIncrease;
factory
address public factory;
_guardian
address internal immutable _guardian;
_vaults
EnumerableSet.AddressSet internal _vaults;
Functions
onlyVaultOwner
modifier onlyVaultOwner(address vault_);
onlyWhitelistedVault
modifier onlyWhitelistedVault(address vault_);
onlyGuardian
modifier onlyGuardian();
constructor
constructor(
uint256 defaultFeePIPS_,
address nativeToken_,
uint8 nativeTokenDecimals_,
address guardian_
);
initialize
function used to initialize standard manager proxy.
we are not checking if the default fee pips is not zero, to have the option to set 0 as default fee pips.
function initialize(
address owner_,
address defaultReceiver_,
address factory_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
owner_ | address | address of the owner of standard manager. |
defaultReceiver_ | address | address of the receiver of tokens (by default). |
factory_ | address | ArrakisMetaVaultFactory contract address. |
pause
function used to pause the manager.
only callable by guardian
function pause() external onlyGuardian;
unpause
function used to unpause the manager.
only callable by guardian
function unpause() external onlyGuardian;
setDefaultReceiver
function used to set the default receiver of tokens earned.
function setDefaultReceiver(address newDefaultReceiver_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
newDefaultReceiver_ | address | address of the new default receiver of tokens. |
setReceiverByToken
function used to set receiver of a specific token.
function setReceiverByToken(
address vault_,
bool isSetReceiverToken0_,
address receiver_
) external onlyOwner onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the meta vault that contain the specific token. |
isSetReceiverToken0_ | bool | boolean if true means that receiver is for token0 if not it's for token1. |
receiver_ | address | address of the receiver of this specific token. |
decreaseManagerFeePIPS
function used to decrease the fees taken by manager for a specific vault.
function decreaseManagerFeePIPS(
address vault_,
uint24 newFeePIPS_
) external onlyOwner onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault. |
newFeePIPS_ | uint24 | fees in pips to set on the specific vault. |
finalizeIncreaseManagerFeePIPS
function used to finalize a time lock fees increase on a vault.
function finalizeIncreaseManagerFeePIPS(address vault_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault where the fees increase will be applied. |
submitIncreaseManagerFeePIPS
function used to submit a fees increase in a managed vault.
function submitIncreaseManagerFeePIPS(
address vault_,
uint24 newFeePIPS_
) external onlyOwner onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault where fees will be increase after timeLock. |
newFeePIPS_ | uint24 | fees in pips to set on the specific managed vault. |
withdrawManagerBalance
function used by manager to get his balance of fees earned on a vault.
function withdrawManagerBalance(address vault_)
external
onlyOwner
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | from which fees will be collected. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to receiver_ |
amount1 | uint256 | amount of token1 sent to receiver_ |
rebalance
function used to manage vault's strategy.
function rebalance(
address vault_,
bytes[] calldata payloads_
) external nonReentrant whenNotPaused onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault that need a rebalance. |
payloads_ | bytes[] | call data to do specific action of vault side. |
setModule
function used to set a new module (strategy) for the vault.
only public vault should have this check.
function setModule(
address vault_,
address module_,
bytes[] calldata payloads_
) external whenNotPaused onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault the manager want to change module. |
module_ | address | address of the new module. |
payloads_ | bytes[] | call data to initialize position on the new module. |
initManagement
function used to init management of a meta vault.
function initManagement(SetupParams calldata params_)
external
whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
params_ | SetupParams | struct containing all the data for initialize the vault. |
updateVaultInfo
function used to update meta vault management informations.
function updateVaultInfo(SetupParams calldata params_)
external
whenNotPaused
onlyWhitelistedVault(params_.vault)
onlyVaultOwner(params_.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | SetupParams | struct containing all the data for updating the vault. |
receive
receive() external payable;
announceStrategy
function used to announce the strategy that the vault will follow.
function announceStrategy(
address vault_,
string memory strategy_
) external onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of arrakis meta vault that will follow the strategy. |
strategy_ | string | string containing the strategy name that will be used. |
initializedVaults
function used to get a list of managed vaults.
function initializedVaults(
uint256 startIndex_,
uint256 endIndex_
) external view whenNotPaused returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | starting index from which the caller want to read the array of managed vaults. |
endIndex_ | uint256 | ending index until which the caller want to read the array of managed vaults. |
numInitializedVaults
function used to get the number of vault under management.
function numInitializedVaults()
external
view
returns (uint256 numberOfVaults);
guardian
address of the pauser of manager.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | pauser address that can pause/unpause manager. |
isManaged
function used to know if a vault is under management by this manager.
function isManaged(address vault_) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the meta vault the caller want to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isManaged boolean which is true if the vault is under management, false otherwise. |
getInitManagementSelector
function used to know the selector of initManagement functions.
function getInitManagementSelector()
external
pure
returns (bytes4 selector);
_initManagement
function _initManagement(SetupParams memory params_) internal;
_updateParamsChecks
function _updateParamsChecks(SetupParams memory params_)
internal
view;
Public Vaults
Content
ArrakisMetaVaultPublic
Inherits: IArrakisMetaVaultPublic, ArrakisMetaVault, Ownable, ERC20
State Variables
_name
string internal _name;
_symbol
string internal _symbol;
Functions
constructor
constructor(
address owner_,
string memory name_,
string memory symbol_,
address moduleRegistry_,
address manager_,
address token0_,
address token1_
) ArrakisMetaVault(moduleRegistry_, manager_, token0_, token1_);
mint
function used to mint share of the vault position
function mint(
uint256 shares_,
address receiver_
) external payable returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount representing the part of the position owned by receiver. |
receiver_ | address | address where share token will be sent. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 deposited. |
amount1 | uint256 | amount of token1 deposited. |
burn
function used to burn share of the vault position.
function burn(
uint256 shares_,
address receiver_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount of share that will be burn. |
receiver_ | address | address where underlying tokens will be sent. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
transferOwnership
override transfer of ownership, to make it not possible.
function transferOwnership(address) public payable override;
renounceOwnership
override transfer of ownership, to make it not possible.
function renounceOwnership() public payable override;
completeOwnershipHandover
override transfer of ownership, to make it not possible.
function completeOwnershipHandover(address) public payable override;
name
function used to get the name of the LP token.
function name() public view override returns (string memory);
Returns
Name | Type | Description |
---|---|---|
<none> | string | name string value containing the name. |
symbol
function used to get the symbol of the LP token.
function symbol() public view override returns (string memory);
Returns
Name | Type | Description |
---|---|---|
<none> | string | symbol string value containing the symbol. |
_deposit
function _deposit(uint256 proportion_)
internal
nonReentrant
returns (uint256 amount0, uint256 amount1);
_onlyOwnerCheck
msg.sender should be the tokens provider
function _onlyOwnerCheck() internal view override;
CreationCodePublicVault
Inherits: ICreationCode
Functions
getCreationCode
function getCreationCode() external pure returns (bytes memory);
Private Vaults
ArrakisMetaVaultPrivate
Inherits: ArrakisMetaVault, IArrakisMetaVaultPrivate, IOwnable
State Variables
nft
address public immutable nft;
_depositors
EnumerableSet.AddressSet internal _depositors;
Functions
constructor
constructor(
address moduleRegistry_,
address manager_,
address token0_,
address token1_,
address nft_
) ArrakisMetaVault(moduleRegistry_, manager_, token0_, token1_);
deposit
function used to deposit tokens or expand position inside the inherent strategy.
function deposit(
uint256 amount0_,
uint256 amount1_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
amount0_ | uint256 | amount of token0 need to increase the position by proportion_; |
amount1_ | uint256 | amount of token1 need to increase the position by proportion_; |
withdraw
function used to withdraw tokens or position contraction of the underpin strategy.
function withdraw(
uint256 proportion_,
address receiver_
)
external
onlyOwnerCustom
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
proportion_ | uint256 | the proportion of position contraction. |
receiver_ | address | the address that will receive withdrawn tokens. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 returned. |
amount1 | uint256 | amount of token1 returned. |
whitelistDepositors
function used to whitelist depositors.
function whitelistDepositors(address[] calldata depositors_)
external
onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
depositors_ | address[] | list of address that will be granted to depositor role. |
blacklistDepositors
function used to blacklist depositors.
function blacklistDepositors(address[] calldata depositors_)
external
onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
depositors_ | address[] | list of address who depositor role will be revoked. |
owner
function used to get the owner of this contract.
function owner() external view returns (address);
depositors
function used to get the list of depositors.
function depositors() external view returns (address[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | depositors list of address granted to depositor role. |
_deposit
function _deposit(
uint256 amount0_,
uint256 amount1_
) internal nonReentrant;
_onlyOwnerCheck
msg.sender should be the tokens provider
function _onlyOwnerCheck() internal view override;
CreationCodePrivateVault
Inherits: ICreationCode
Functions
getCreationCode
function getCreationCode() external pure returns (bytes memory);
PrivateVaultNFT
Inherits: Ownable, ERC721, IPrivateVaultNFT
State Variables
renderController
address public immutable renderController;
Functions
constructor
constructor() ERC721("Arrakis Private LP NFT", "ARRAKIS");
mint
function used to mint nft (representing a vault) and send it.
function mint(address to_, uint256 tokenId_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
to_ | address | address where to send the NFT. |
tokenId_ | uint256 | id of the NFT to mint. |
tokenURI
function tokenURI(uint256 tokenId_)
public
view
override
returns (string memory);
getMetaDatas
function getMetaDatas(
address token0_,
address token1_
)
public
view
returns (
uint8 decimals0,
uint8 decimals1,
string memory symbol0,
string memory symbol1
);
RenderController
Inherits: Ownable, IRenderController, Initializable
State Variables
renderer
address public renderer;
Functions
initialize
function initialize(address owner_) external initializer;
setRenderer
function used to set the renderer contract
only the svgController can do it.
function setRenderer(address renderer_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
renderer_ | address | address of the contract that will render the tokenUri for the svg of the nft. |
isNFTSVG
function isNFTSVG(address renderer_) public view returns (bool);
Modules
Content
Registry
Content
ModuleRegistry
Inherits: IModuleRegistry, Ownable, Initializable
State Variables
factory
IArrakisMetaVaultFactory public factory;
admin
should be a timelock contract.
address public immutable admin;
_guardian
address internal immutable _guardian;
_beacons
EnumerableSet.AddressSet internal _beacons;
Functions
constructor
constructor(address owner_, address guardian_, address admin_);
initialize
function used to initialize module registry.
function initialize(address factory_) external initializer;
Parameters
Name | Type | Description |
---|---|---|
factory_ | address | address of ArrakisMetaVaultFactory, who is the only one who can call the init management function. |
beacons
function to get the whitelisted list of IBeacon that have module as implementation.
function beacons() external view returns (address[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | beacons list of upgradeable beacon. |
beaconsContains
function to know if the beacons enumerableSet contain beacon_
function beaconsContains(address beacon_)
external
view
returns (bool isContained);
Parameters
Name | Type | Description |
---|---|---|
beacon_ | address | beacon address to check |
guardian
function used to get the guardian address of arrakis protocol.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
whitelistBeacons
function used to whitelist IBeacon that contain implementation of valid module.
function whitelistBeacons(address[] calldata beacons_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | list of beacon to whitelist. |
blacklistBeacons
function used to blacklist IBeacon that contain implementation of unvalid (from now) module.
function blacklistBeacons(address[] calldata beacons_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | list of beacon to blacklist. |
_createModule
function _createModule(
address vault_,
address beacon_,
bytes calldata payload_
) internal returns (address module);
_checkVaultNotAddressZero
function _checkVaultNotAddressZero(address vault_) internal pure;
ModulePublicRegistry
Inherits: ModuleRegistry, IModulePublicRegistry
Functions
constructor
constructor(
address owner_,
address guardian_,
address admin_
) ModuleRegistry(owner_, guardian_, admin_);
createModule
function used to create module instance that can be whitelisted as module inside a vault.
function createModule(
address vault_,
address beacon_,
bytes calldata payload_
) external returns (address module);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | |
beacon_ | address | which whitelisted beacon's implementation we want to create an instance of. |
payload_ | bytes | payload to create the module. |
ModulePrivateRegistry
Inherits: ModuleRegistry, IModulePrivateRegistry
Functions
constructor
constructor(
address owner_,
address guardian_,
address admin_
) ModuleRegistry(owner_, guardian_, admin_);
createModule
function used to create module instance that can be whitelisted as module inside a vault.
function createModule(
address vault_,
address beacon_,
bytes calldata payload_
) external returns (address module);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | |
beacon_ | address | which whitelisted beacon's implementation we want to create an instance of. |
payload_ | bytes | payload to create the module. |
Implementations
Content
Abstracts
Contracts
- Aerodrome Standard Module Private
- Uniswap V4 Standard Module Private
- PancakeSwap Infinity Standard Module Private
- Valantis HOT Module Public
UniV4StandardModule
Inherits: ReentrancyGuardUpgradeable, PausableUpgradeable, IArrakisLPModule, IArrakisLPModuleID, IUniV4StandardModule, IUnlockCallback
this module can only set uni v4 pool that have generic hook, that don't require specific action to become liquidity provider.
due to native coin standard difference between uni V4 and arrakis, we are assuming that all inputed amounts are using arrakis vault token0/token1 as reference. Internal logic of UniV4StandardModule will handle the conversion or use the poolKey to interact with the poolManager.
State Variables
poolManager
function used to get the uniswap v4 pool manager.
IPoolManager public immutable poolManager;
_guardian
address internal immutable _guardian;
metaVault
module's metaVault as IArrakisMetaVault.
IArrakisMetaVault public metaVault;
token0
module's token0 as IERC20Metadata.
IERC20Metadata public token0;
token1
module's token1 as IERC20Metadata.
IERC20Metadata public token1;
isInversed
boolean to know if the poolKey's currencies pair are inversed.
bool public isInversed;
managerFeePIPS
manager fees share.
uint256 public managerFeePIPS;
oracle
oracle that will be used to proctect rebalances against attacks.
IOracleWrapper public oracle;
maxSlippage
max slippage that can occur during swap rebalance.
uint24 public maxSlippage;
poolKey
pool's key of the module.
PoolKey public poolKey;
ethWithdrawers
list of allowed addresses to withdraw eth.
mapping(address => uint256) public ethWithdrawers;
_init0
uint256 internal _init0;
_init1
uint256 internal _init1;
_ranges
Range[] internal _ranges;
_activeRanges
mapping(bytes32 => bool) internal _activeRanges;
Functions
onlyManager
modifier onlyManager();
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
constructor
constructor(address poolManager_, address guardian_);
pause
function used to pause the module.
only callable by guardian
function pause() external whenNotPaused onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external whenPaused onlyGuardian;
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the uniswap v4 standard module.
function initialize(
uint256 init0_,
uint256 init1_,
bool isInversed_,
PoolKey calldata poolKey_,
IOracleWrapper oracle_,
uint24 maxSlippage_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
init0_ | uint256 | initial amount of token0 to provide to uniswap standard module. |
init1_ | uint256 | initial amount of token1 to provide to uniswap standard module. |
isInversed_ | bool | boolean to check if the poolKey's currencies pair are inversed, compared to the module's tokens pair. |
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
oracle_ | IOracleWrapper | address of the oracle used by the uniswap v4 standard module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault. |
initializePosition
function used to initialize the module when a module switch happen
check if the pool is initialized.
function initializePosition(
bytes calldata
) external virtual onlyMetaVault;
withdrawEth
left over will sit on the module.
function withdrawEth(
uint256 amount_
) external nonReentrant whenNotPaused;
approve
function approve(
address spender_,
uint256 amount0_,
uint256 amount1_
) external nonReentrant whenNotPaused;
setPool
function used to set the pool for the module.
function setPool(
PoolKey calldata poolKey_,
LiquidityRange[] calldata liquidityRanges_,
SwapPayload calldata swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
) external onlyManager nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module on the new pool. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
check if the pool is initialized.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | number of share needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
)
public
onlyManager
nonReentrant
whenNotPaused
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Parameters
Name | Type | Description |
---|---|---|
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance.. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
Returns
Name | Type | Description |
---|---|---|
amount0Minted | uint256 | amount of token0 minted. |
amount1Minted | uint256 | amount of token1 minted. |
amount0Burned | uint256 | amount of token0 burned. |
amount1Burned | uint256 | amount of token1 burned. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
public
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
default swapPayload, no swap happens here. swapPayload will be empty. And will use it to do rebalance and collect fees.
function setManagerFeePIPS(
uint256 newFeePIPS_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
receive
receive() external payable;
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
getRanges
function used to get the list of active ranges.
function getRanges() external view returns (Range[] memory ranges);
Returns
Name | Type | Description |
---|---|---|
ranges | Range[] | active ranges |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(
uint160 priceX96_
) external view returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. rebalance can happen. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0()
external
view
returns (uint256 managerFee0);
Returns
Name | Type | Description |
---|---|---|
managerFee0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1()
external
view
returns (uint256 managerFee1);
Returns
Name | Type | Description |
---|---|---|
managerFee1 | uint256 | amount of token1 that manager earned. |
_unlockCallback
function _unlockCallback(
Action action_,
bytes memory data_
) internal returns (bytes memory);
_internalRebalance
function _internalRebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_
)
internal
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Enums
Action
enum Action {
WITHDRAW,
REBALANCE,
DEPOSIT_FUND
}
PancakeSwapV4StandardModule
Inherits: ReentrancyGuardUpgradeable, PausableUpgradeable, IArrakisLPModule, IArrakisLPModuleID, IPancakeSwapV4StandardModule, ILockCallback
this module can set pancakeswap v4 pool that have a generic hook, that don't require specific action to become liquidity provider.
due to native coin standard difference between pancakeswap and arrakis, we are assuming that all inputed amounts are using arrakis vault token0/token1 as reference. Internal logic of PancakeSwapV4StandardModule will handle the conversion or use the poolKey to interact with the poolManager.
State Variables
poolManager
ICLPoolManager public immutable poolManager;
vault
IVault public immutable vault;
distributor
IDistributor public immutable distributor;
collector
address public immutable collector;
_guardian
address internal immutable _guardian;
metaVault
module's metaVault as IArrakisMetaVault.
IArrakisMetaVault public metaVault;
token0
module's token0 as IERC20Metadata.
IERC20Metadata public token0;
token1
module's token1 as IERC20Metadata.
IERC20Metadata public token1;
isInversed
boolean to know if the poolKey's currencies pair are inversed.
bool public isInversed;
managerFeePIPS
manager fees share.
uint256 public managerFeePIPS;
oracle
oracle that will be used to proctect rebalances against attacks.
IOracleWrapper public oracle;
maxSlippage
max slippage that can occur during swap rebalance.
uint24 public maxSlippage;
poolKey
pool's key of the module.
PoolKey public poolKey;
ethWithdrawers
list of allowed addresses to withdraw eth.
mapping(address => uint256) public ethWithdrawers;
_init0
uint256 internal _init0;
_init1
uint256 internal _init1;
_ranges
Range[] internal _ranges;
_activeRanges
mapping(bytes32 => bool) internal _activeRanges;
Functions
onlyManager
modifier onlyManager();
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
onlyMetaVaultOwner
modifier onlyMetaVaultOwner();
constructor
constructor(
address poolManager_,
address guardian_,
address vault_,
address distributor_,
address collector_
);
pause
function used to pause the module.
only callable by guardian
function pause() external whenNotPaused onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external whenPaused onlyGuardian;
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the uniswap v4 standard module.
function initialize(
uint256 init0_,
uint256 init1_,
bool isInversed_,
PoolKey calldata poolKey_,
IOracleWrapper oracle_,
uint24 maxSlippage_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
init0_ | uint256 | initial amount of token0 to provide to uniswap standard module. |
init1_ | uint256 | initial amount of token1 to provide to uniswap standard module. |
isInversed_ | bool | boolean to check if the poolKey's currencies pair are inversed, compared to the module's tokens pair. |
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
oracle_ | IOracleWrapper | address of the oracle used by the uniswap v4 standard module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault. |
initializePosition
function used to initialize the module when a module switch happen
check if the pool is initialized.
function initializePosition(
bytes calldata
) external virtual onlyMetaVault;
withdrawEth
left over will sit on the module.
function withdrawEth(
uint256 amount_
) external nonReentrant whenNotPaused;
approve
function approve(
address spender_,
address[] calldata tokens_,
uint256[] calldata amounts_
) external nonReentrant whenNotPaused onlyMetaVaultOwner;
setPool
function used to set the pool for the module.
function setPool(
PoolKey calldata poolKey_,
LiquidityRange[] calldata liquidityRanges_,
SwapPayload calldata swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
) external onlyManager nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module on the new pool. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | number of share needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
)
public
onlyManager
nonReentrant
whenNotPaused
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Parameters
Name | Type | Description |
---|---|---|
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance.. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
Returns
Name | Type | Description |
---|---|---|
amount0Minted | uint256 | amount of token0 minted. |
amount1Minted | uint256 | amount of token1 minted. |
amount0Burned | uint256 | amount of token0 burned. |
amount1Burned | uint256 | amount of token1 burned. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
public
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
default swapPayload, no swap happens here. swapPayload will be empty. And will use it to do rebalance and collect fees.
function setManagerFeePIPS(
uint256 newFeePIPS_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
receive
receive() external payable;
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
getRanges
function used to get the list of active ranges.
function getRanges() external view returns (Range[] memory ranges);
Returns
Name | Type | Description |
---|---|---|
ranges | Range[] | active ranges |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(
uint160 priceX96_
) external view returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. rebalance can happen. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0()
external
view
returns (uint256 managerFee0);
Returns
Name | Type | Description |
---|---|---|
managerFee0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1()
external
view
returns (uint256 managerFee1);
Returns
Name | Type | Description |
---|---|---|
managerFee1 | uint256 | amount of token1 that manager earned. |
_lockAcquired
function _lockAcquired(
Action action_,
bytes memory data_
) internal returns (bytes memory);
_internalRebalance
function _internalRebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_
)
internal
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Enums
Action
enum Action {
WITHDRAW,
REBALANCE,
DEPOSIT_FUND
}
ValantisModule
Inherits: IArrakisLPModule, IValantisHOTModule, PausableUpgradeable, ReentrancyGuardUpgradeable
BeaconProxy be careful for changing implementation with upgrade.
State Variables
metaVault
IArrakisMetaVault public metaVault;
pool
ISovereignPool public pool;
alm
IHOT public alm;
token0
IERC20Metadata public token0;
token1
IERC20Metadata public token1;
maxSlippage
should we change it to mutable state variable, and settable by who?
uint24 public maxSlippage;
oracle
IOracleWrapper public oracle;
_guardian
address internal immutable _guardian;
_init0
uint256 internal _init0;
_init1
uint256 internal _init1;
_managerFeePIPS
uint256 internal _managerFeePIPS;
Functions
onlyMetaVault
modifier onlyMetaVault();
onlyManager
modifier onlyManager();
onlyGuardian
modifier onlyGuardian();
constructor
constructor(address guardian_);
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the valantis module. who can call deposit and withdraw functions.
function initialize(
address pool_,
uint256 init0_,
uint256 init1_,
uint24 maxSlippage_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
pool_ | address | address of the valantis sovereign pool. |
init0_ | uint256 | initial amount of token0 to provide to valantis module. |
init1_ | uint256 | initial amount of token1 to provide to valantis module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault |
initializePosition
function used to initialize the module when a module switch happen
function initializePosition(bytes calldata data_)
external
virtual
onlyMetaVault;
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | bytes that contain information to initialize the position. |
pause
function used to pause the module.
only callable by guardian
function pause() external onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external onlyGuardian;
setALMAndManagerFees
set HOT, oracle (wrapper of HOT) and init manager fees function.
function setALMAndManagerFees(
address alm_,
address oracle_
) external;
Parameters
Name | Type | Description |
---|---|---|
alm_ | address | address of the valantis HOT ALM. |
oracle_ | address | address of the oracle used by the valantis HOT module. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | the proportion of the total position that need to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
external
whenNotPaused
nonReentrant
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
function setManagerFeePIPS(uint256 newFeePIPS_)
external
whenNotPaused
onlyManager;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
setPriceBounds
fucntion used to set range on valantis AMM
function setPriceBounds(
uint160 sqrtPriceLowX96_,
uint160 sqrtPriceHighX96_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_
) external onlyManager;
Parameters
Name | Type | Description |
---|---|---|
sqrtPriceLowX96_ | uint160 | lower bound of the range in sqrt price. |
sqrtPriceHighX96_ | uint160 | upper bound of the range in sqrt price. |
expectedSqrtSpotPriceUpperX96_ | uint160 | expected lower limit of current spot price (to prevent sandwich attack and manipulation). |
expectedSqrtSpotPriceLowerX96_ | uint160 | expected upper limit of current spot price (to prevent sandwich attack and manipulation). |
swap
function to swap token0->token1 or token1->token0 and then change inventory.
function swap(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
address router_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_,
bytes calldata payload_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
zeroForOne_ | bool | boolean if true token0->token1, if false token1->token0. |
expectedMinReturn_ | uint256 | minimum amount of tokenOut expected. |
amountIn_ | uint256 | amount of tokenIn used during swap. |
router_ | address | address of smart contract that will execute swap. |
expectedSqrtSpotPriceUpperX96_ | uint160 | upper bound of current price. |
expectedSqrtSpotPriceLowerX96_ | uint160 | lower bound of current price. |
payload_ | bytes | data payload used for swapping. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0() external view returns (uint256 fees0);
Returns
Name | Type | Description |
---|---|---|
fees0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1() external view returns (uint256 fees1);
Returns
Name | Type | Description |
---|---|---|
fees1 | uint256 | amount of token1 that manager earned. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | onchain oracle to check the current amm price against. |
maxDeviation_ | uint24 | maximum deviation tolerated by management. |
managerFeePIPS
function used to get manager fees.
function managerFeePIPS() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | managerFeePIPS amount of token1 that manager earned. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying() external view returns (uint256, uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | amount0 the amount of token0 sitting on the position. |
<none> | uint256 | amount1 the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160 priceX96_)
external
view
returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | amount0 the amount of token0 sitting on the position for priceX96. |
<none> | uint256 | amount1 the amount of token1 sitting on the position for priceX96. |
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
_initializePosition
function _initializePosition() internal;
_checkMinReturn
function _checkMinReturn(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
uint8 decimals0_,
uint8 decimals1_
) internal view;
AerodromeStandardModulePrivate
Inherits: IArrakisLPModule, IArrakisLPModulePrivate, IAerodromeStandardModulePrivate, IArrakisLPModuleID, IERC721Receiver, PausableUpgradeable, ReentrancyGuardUpgradeable
State Variables
id
function used to get module id.
id = keccak256(abi.encode("AerodromeStandardModulePrivate"))
bytes32 public constant id =
0x491defc0794897991a8e5e9fa49dcbed24fe84ee079750b1db3f4df77fb17cb5;
AERO
function used to get aero token address.
address public immutable AERO;
_guardian
address internal immutable _guardian;
nftPositionManager
function used to get the NonFungiblePositionManager of aerodrome.
INonfungiblePositionManager public immutable nftPositionManager;
factory
function used to get the factory of aerodrome.
IUniswapV3Factory public immutable factory;
voter
function used to get the voter of aerodrome.
IVoter public immutable voter;
metaVault
function used to get metaVault as IArrakisMetaVault.
IArrakisMetaVault public metaVault;
token0
function used to get token0 as IERC20Metadata.
IERC20Metadata public token0;
token1
function used to get token1 as IERC20Metadata.
IERC20Metadata public token1;
oracle
function used to get the oracle that will be used to proctect rebalances.
IOracleWrapper public oracle;
managerFeePIPS
function used to get manager fees.
uint256 public managerFeePIPS;
maxSlippage
function used to get the maximum slippage.
uint24 public maxSlippage;
aeroReceiver
function used to get aero token receiver.
address public aeroReceiver;
pool
function used to get aero pool the module is interacting with.
address public pool;
gauge
function used to get aero gauge associated to pool the module is interacting with.
address public gauge;
_tokenIds
EnumerableSet.UintSet internal _tokenIds;
_aeroManagerBalance
uint256 internal _aeroManagerBalance;
Functions
onlyManager
modifier onlyManager();
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
onlyMetaVaultOwner
modifier onlyMetaVaultOwner();
constructor
constructor(
address nftPositionManager_,
address factory_,
address voter_,
address guardian_
);
onERC721Received
Whenever an {IERC721} tokenId
token is transferred to this contract via {IERC721-safeTransferFrom}
by operator
from from
, this function is called.
It must return its Solidity selector to confirm the token transfer.
If any other value is returned or the interface is not implemented by the recipient, the transfer will be
reverted.
The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector
.
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external returns (bytes4);
pause
function used to pause the module.
only callable by guardian
function pause() external whenNotPaused onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external whenPaused onlyGuardian;
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the aerodrome module.
function initialize(
IOracleWrapper oracle_,
uint24 maxSlippage_,
address aeroReceiver_,
int24 tickSpacing_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will be the price reference. |
maxSlippage_ | uint24 | maximum slippage allowed during swap, mint and burn. |
aeroReceiver_ | address | recevier of aero token belonging to manager. |
tickSpacing_ | int24 | tickSpacing of the aero pool to interact with. |
metaVault_ | address | address of the meta vault |
initializePosition
function used to initialize the module when a module switch happen
function initializePosition(
bytes calldata data_
) external;
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | bytes that contain information to initialize the position. |
approve
function used to approve a spender to use the left over of the module.
left over will sit on the module.
function approve(
address spender_,
uint256 amount0_,
uint256 amount1_
) external nonReentrant whenNotPaused onlyMetaVaultOwner;
Parameters
Name | Type | Description |
---|---|---|
spender_ | address | address that will be allowed to use left over. |
amount0_ | uint256 | amount of token0 allowed to be used by spender. |
amount1_ | uint256 | amount of token1 allowed to be used by spender. |
fund
deposit function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable nonReentrant onlyMetaVault whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | the proportion of the total position that need to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
claimRewards
function used by user to claim the aero rewards.
decrease nft position or burn it.
function claimRewards(
address receiver_
) external onlyMetaVaultOwner nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive the aero rewards. |
setReceiver
function used to set the receiver of aero rewards.
function setReceiver(
address newReceiver_
) external whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newReceiver_ | address | new address that will receive the aero token. |
claimManager
function used by executor to claim the manager aero rewards.
function claimManager() public nonReentrant whenNotPaused;
rebalance
function used to rebalance the inventory of the module.
function rebalance(
RebalanceParams calldata params_
) external nonReentrant whenNotPaused onlyManager;
Parameters
Name | Type | Description |
---|---|---|
params_ | RebalanceParams | params including decrease positions, swap, increase positions and mint datas. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
public
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
function setManagerFeePIPS(
uint256 newFeePIPS_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
tokenIds
function used to get the list of tokenIds of non fungible position.
function tokenIds() external view returns (uint256[] memory);
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(
uint160 priceX96_
) external view returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0()
external
view
returns (uint256 managerFee0);
Returns
Name | Type | Description |
---|---|---|
managerFee0 | uint256 | managerBalance0 amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1()
external
view
returns (uint256 managerFee1);
Returns
Name | Type | Description |
---|---|---|
managerFee1 | uint256 | managerBalance1 amount of token1 that manager earned. |
aeroManagerBalance
function used to get aero balance due to manager.
function aeroManagerBalance() external view returns (uint256);
_decreaseLiquidity
function _decreaseLiquidity(
ModifyPosition memory modifyPosition_,
uint160 sqrtPriceX96_
)
internal
returns (
uint256 amount0ToSend,
uint256 amount1ToSend,
uint256 aeroAmountCollected
);
_increaseLiquidity
function _increaseLiquidity(
ModifyPosition memory modifyPosition_,
uint160 sqrtPriceX96_
)
internal
returns (
uint256 amount0Sent,
uint256 amount1Sent,
uint256 aeroAmountCollected
);
_unstake
function _unstake(
uint256 tokenId_
)
internal
returns (
uint256 aeroAmountCollected,
address _gauge,
uint128 liquidity
);
_mint
function _mint(
INonfungiblePositionManager.MintParams calldata params_,
address token0_,
address token1_
) internal returns (uint256 amount0, uint256 amount1);
_checkMinReturn
function _checkMinReturn(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
uint8 decimals0_,
uint8 decimals1_
) internal view;
_principal
function _principal(
uint256 tokenId_,
uint160 sqrtRatioX96_
) internal view returns (uint256 amount0, uint256 amount1);
_getPosition
trick to workaround stack too deep.
function _getPosition(
uint256 tokenId_
)
internal
view
returns (int24 tickLower, int24 tickUpper, uint128 liquidity);
UniV4StandardModulePrivate
Inherits: UniV4StandardModule, IArrakisLPModulePrivate
this module can only set uni v4 pool that have generic hook, that don't require specific action to become liquidity provider.
State Variables
id
id = keccak256(abi.encode("UniV4StandardModulePrivate"))
bytes32 public constant id =
0xae9c8e22b1f7ab201e144775cd6f848c3c1b0a82315571de8c67ce32ca9a7d44;
Functions
constructor
constructor(
address poolManager_,
address guardian_,
address distributor_,
address collector_
)
UniV4StandardModule(poolManager_, guardian_, distributor_, collector_);
fund
fund function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable onlyMetaVault whenNotPaused nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
unlockCallback
Called by the pool manager on msg.sender
when a lock is acquired
function unlockCallback(
bytes calldata data_
) public virtual returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | The data that was passed to the call to lock |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | result data that you want to be returned from the lock call |
_fund
use data to do specific action.
function _fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) internal;
PancakeSwapV4StandardModulePrivate
Inherits: PancakeSwapV4StandardModule, IArrakisLPModulePrivate
State Variables
id
id = keccak256(abi.encode("PancakeSwapV4StandardModulePrivate"))
bytes32 public constant id =
0x7cec99d521e59378e389a879513f6373dd58e86a0c1422fa01195032b7071950;
Functions
constructor
constructor(
address poolManager_,
address guardian_,
address vault_,
address distributor_,
address collector_
)
PancakeSwapV4StandardModule(
poolManager_,
guardian_,
vault_,
distributor_,
collector_
);
fund
fund function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable onlyMetaVault whenNotPaused nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
_fund
function _fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) internal;
lockAcquired
function lockAcquired(
bytes calldata data_
) public virtual returns (bytes memory);
ValantisModulePublic
Inherits: ValantisModule, IArrakisLPModulePublic
State Variables
notFirstDeposit
bool public notFirstDeposit;
Functions
constructor
constructor(
address guardian_
) ValantisModule(guardian_);
deposit
deposit function for public vault.
function deposit(
address depositor_,
uint256 proportion_
)
external
payable
onlyMetaVault
whenNotPaused
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
proportion_ | uint256 | percentage of portfolio position vault want to expand. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 needed to expand the portfolio by "proportion" percent. |
amount1 | uint256 | amount of token1 needed to expand the portfolio by "proportion" percent. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
) public override returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | number of share needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
initializePosition
function initializePosition(
bytes calldata data_
) external override onlyMetaVault;
Routers
Content
ArrakisPublicVaultRouter
Inherits: IArrakisPublicVaultRouter, ReentrancyGuard, Ownable, Pausable
State Variables
nativeToken
address public immutable nativeToken;
permit2
IPermit2 public immutable permit2;
factory
IArrakisMetaVaultFactory public immutable factory;
weth
IWETH9 public immutable weth;
swapper
IRouterSwapExecutor public swapper;
Functions
onlyPublicVault
modifier onlyPublicVault(address vault_);
constructor
constructor(
address nativeToken_,
address permit2_,
address owner_,
address factory_,
address weth_
);
pause
function used to pause the router.
only callable by owner
function pause() external onlyOwner;
unpause
function used to unpause the router.
only callable by owner
function unpause() external onlyOwner;
updateSwapExecutor
function updateSwapExecutor(address swapper_)
external
whenNotPaused
onlyOwner;
addLiquidity
addLiquidity adds liquidity to meta vault of interest (mints L tokens)
function addLiquidity(AddLiquidityData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidity
removeLiquidity removes liquidity from vault and burns LP tokens
function removeLiquidity(RemoveLiquidityData memory params_)
external
nonReentrant
whenNotPaused
onlyPublicVault(params_.vault)
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityData | RemoveLiquidityData struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(AddLiquidityPermit2Data memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.swapAndAddData.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidityPermit2
removeLiquidityPermit2 removes liquidity from vault and burns LP tokens
function removeLiquidityPermit2(
RemoveLiquidityPermit2Data memory params_
)
external
nonReentrant
whenNotPaused
onlyPublicVault(params_.removeData.vault)
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityPermit2Data | RemoveLiquidityPermit2Data struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of interest (mints L tokens)
function wrapAndAddLiquidity(AddLiquidityData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to public vault of interest (mints LP tokens)
hack to get rid of stack too depth
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.swapAndAddData.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
receive
hack to get rid of stack too depth
receive() external payable;
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
_addLiquidity
function _addLiquidity(
address vault_,
uint256 amount0_,
uint256 amount1_,
uint256 shares_,
address receiver_,
address token0_,
address token1_
) internal;
_swapAndAddLiquidity
function _swapAndAddLiquidity(
SwapAndAddData memory params_,
address token0_,
address token1_
)
internal
returns (
uint256 amount0Use,
uint256 amount1Use,
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
_swapAndAddLiquiditySendBackLeftOver
function _swapAndAddLiquiditySendBackLeftOver(
SwapAndAddData memory params_,
address token0_,
address token1_
)
internal
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
_removeLiquidity
function _removeLiquidity(RemoveLiquidityData memory params_)
internal
returns (uint256 amount0, uint256 amount1);
_permit2AddLengthOne
function _permit2AddLengthOne(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2AddLengthOneOrTwo
function _permit2AddLengthOneOrTwo(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2Add
function _permit2Add(
uint256 permittedLength_,
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2SwapAndAddLengthOne
function _permit2SwapAndAddLengthOne(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAddLengthOneOrTwo
function _permit2SwapAndAddLengthOneOrTwo(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAdd
function _permit2SwapAndAdd(
uint256 permittedLength_,
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_getMintAmounts
function _getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
internal
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
ArrakisPrivateVaultRouter
Inherits: IArrakisPrivateVaultRouter, ReentrancyGuard, Ownable, Pausable
State Variables
nativeToken
address of the native token.
address public immutable nativeToken;
permit2
permit2 contract address.
IPermit2 public immutable permit2;
factory
arrakis meta vault factory contract address.
IArrakisMetaVaultFactory public immutable factory;
weth
wrapped eth contract address.
IWETH9 public immutable weth;
swapper
swap executor contract address.
IPrivateRouterSwapExecutor public swapper;
Functions
onlyPrivateVault
modifier onlyPrivateVault(
address vault_
);
onlyDepositor
modifier onlyDepositor(
address vault_
);
constructor
constructor(
address nativeToken_,
address permit2_,
address owner_,
address factory_,
address weth_
);
pause
function used to pause the router.
only callable by owner
function pause() external whenNotPaused onlyOwner;
unpause
function used to unpause the router.
only callable by owner
function unpause() external whenPaused onlyOwner;
updateSwapExecutor
function updateSwapExecutor(
address swapper_
) external whenNotPaused onlyOwner;
addLiquidity
addLiquidity adds liquidity to meta vault of iPnterest (mints L tokens)
function addLiquidity(
AddLiquidityData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.vault)
onlyDepositor(params_.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(
SwapAndAddData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.swapAndAddData.addData.vault)
onlyDepositor(params_.swapAndAddData.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of iPnterest (mints L tokens)
function wrapAndAddLiquidity(
AddLiquidityData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.vault)
onlyDepositor(params_.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(
SwapAndAddData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to private vault of interest (mints LP tokens)
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.swapAndAddData.addData.vault)
onlyDepositor(params_.swapAndAddData.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
receive
receive() external payable;
_addLiquidity
function _addLiquidity(
address vault_,
uint256 amount0_,
uint256 amount1_,
address token0_,
address token1_
) internal;
_swapAndAddLiquidity
function _swapAndAddLiquidity(
SwapAndAddData memory params_,
address token0_,
address token1_
) internal returns (uint256 amount0Diff, uint256 amount1Diff);
_permit2AddLengthOne
function _permit2AddLengthOne(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2AddLengthOneOrTwo
function _permit2AddLengthOneOrTwo(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2Add
function _permit2Add(
uint256 permittedLength_,
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2SwapAndAddLengthOne
function _permit2SwapAndAddLengthOne(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAddLengthOneOrTwo
function _permit2SwapAndAddLengthOneOrTwo(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAdd
function _permit2SwapAndAdd(
uint256 permittedLength_,
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
RouterSwapExecutor
Inherits: IRouterSwapExecutor
State Variables
router
address public immutable router;
nativeToken
address public immutable nativeToken;
Functions
onlyRouter
modifier onlyRouter();
constructor
constructor(address router_, address nativeToken_);
swap
function used to swap tokens.
function swap(SwapAndAddData memory params_)
external
payable
onlyRouter
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | struct containing all the informations for swapping. |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | the difference in token0 amount before and after the swap. |
amount1Diff | uint256 | the difference in token1 amount before and after the swap. |
receive
receive() external payable;
RouterSwapResolver
Inherits: IRouterSwapResolver
State Variables
router
IArrakisPublicVaultRouter public immutable router;
Functions
constructor
constructor(address router_);
calculateSwapAmount
function calculateSwapAmount(
IArrakisMetaVault vault_,
uint256 amount0In_,
uint256 amount1In_,
uint256 price18Decimals_
) external view returns (bool zeroForOne, uint256 swapAmount);
_getUnderlyingOrLiquidity
function _getUnderlyingOrLiquidity(IArrakisMetaVault vault_)
internal
view
returns (uint256 gross0, uint256 gross1);
Roter Structs
Content
- AddLiquidityData
- AddLiquidityPermit2Data
- RemoveLiquidityData
- RemoveLiquidityPermit2Data
- SwapAndAddData
- SwapAndAddPermit2Data
- SwapData
AddLiquidityData
struct AddLiquidityData {
uint256 amount0Max;
uint256 amount1Max;
uint256 amount0Min;
uint256 amount1Min;
uint256 amountSharesMin;
address vault;
address receiver;
}
Variables
Name | Type | Description |
---|---|---|
amount0Max | uint256 | Maximum amount of token0 to be transferred from msg.sender to the vault |
amount1Max | uint256 | Maximum amount of token1 to be transferred from msg.sender to the vault |
amount0Min | uint256 | Minimum amount of token0 to be transferred from msg.sender to the vault |
amount1Min | uint256 | Minimum amount of token1 to be transferred from msg.sender to the vault |
amountSharesMin | uint256 | Minimum amount of vault shares to be received by receiver |
vault | address | Address of the vault to add liquidity to |
receiver | address | Address of the receiver of the vault shares |
AddLiquidityPermit2Data
struct AddLiquidityPermit2Data {
AddLiquidityData addData;
PermitBatchTransferFrom permit;
bytes signature;
}
Variables
Name | Type | Description |
---|---|---|
addData | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
permit | PermitBatchTransferFrom | PermitBatchTransferFrom struct containing Permit2 approvals information |
signature | bytes | Data containing the signature of msg.sender to verify by Permit2 |
RemoveLiquidityData
struct RemoveLiquidityData {
uint256 burnAmount;
uint256 amount0Min;
uint256 amount1Min;
address vault;
address payable receiver;
}
Variables
Name | Type | Description |
---|---|---|
burnAmount | uint256 | Amount of vault shares to be burned by msg.sender |
amount0Min | uint256 | Minimum amount of token0 to be send to receiver |
amount1Min | uint256 | Minimum amount of token1 to be send to receiver |
vault | address | Address of the vault to remove liquidity from |
receiver | payable address | Address of the receiver of token0 and token1 |
RemoveLiquidityPermit2Data
struct RemoveLiquidityPermit2Data {
RemoveLiquidityData removeData;
PermitTransferFrom permit;
bytes signature;
}
Variables
Name | Type | Description |
---|---|---|
removeData | RemoveLiquidityData | RemoveLiquidityData struct containing data for removing liquidity |
permit | PermitTransferFrom | PermitTransferFrom struct of a signature containing Permit2 approval for vault token |
signature | bytes | Data containing the signature of msg.sender to verify by Permit2 |
SwapAndAddData
struct SwapAndAddData {
SwapData swapData;
AddLiquidityData addData;
}
Variables
Name | Type | Description |
---|---|---|
swapData | SwapData | SwapData struct containing data for swapping one of the tokens for the other |
addData | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
SwapAndAddPermit2Data
struct SwapAndAddPermit2Data {
SwapAndAddData swapAndAddData;
PermitBatchTransferFrom permit;
bytes signature;
}
Name | Type | Description |
---|---|---|
swapAndAddData | SwapAndAddData | SwapAndAddData struct containing data for swapping one of the tokens for the other and adding liquidity |
permit | PermitBatchTransferFrom | PermitBatchTransferFrom struct of signatures containing Permit2 approvals |
signature | bytes | Data containing the signature of msg.sender to verify by Permit2 |
SwapData
struct SwapData {
bytes swapPayload;
uint256 amountInSwap;
uint256 amountOutSwap;
address swapRouter;
bool zeroForOne;
}
Variables
Name | Type | Description |
---|---|---|
swapPayload | bytes | Payload to use for a swap in an external venue. Transaction must be atomic |
amountInSwap | uint256 | Amount of token to be swapped |
amountOutSwap | uint256 | Minimum amount of the other token to be received from the swap |
swapRouter | address | Address of the router to be used for the swap |
zeroForOne | bool | Boolean to determine the direction of the swap. If true swaps token0 for token1 and viceversa |
Admin and Security
Content
Guardian
Inherits: Ownable, IGuardian
State Variables
pauser
address public pauser;
Functions
constructor
constructor(address owner_, address pauser_);
setPauser
function to set the pauser of Arrakis protocol.
function setPauser(address newPauser_) external onlyOwner;
Pauser
Inherits: IPauser, Ownable
State Variables
_pausers
EnumerableSet.AddressSet internal _pausers;
Functions
constructor
constructor(address pauser_, address owner_);
pause
function pause(address target_) external override;
whitelistPausers
function whitelistPausers(address[] calldata pausers_)
external
override
onlyOwner;
blacklistPausers
function blacklistPausers(address[] calldata pausers_)
external
override
onlyOwner;
isPauser
function isPauser(address account_) public view returns (bool);
TimeLock
Inherits: TimelockController, ITimeLock
Functions
constructor
constructor(
uint256 minDelay,
address[] memory proposers,
address[] memory executors,
address admin
) TimelockController(minDelay, proposers, executors, admin);
updateDelay
override updateDelay function of TimelockController to not allow update of delay.
function updateDelay(uint256) external pure override;
More
This page contains the whole Arrakis Modular smart contracts documentation, which was autogenerated with Foundry forge doc
. This serves as a complete reference for developers and facilitates a detailed search by terms.
Contents
- abstracts
- constants
- hooks
- interfaces
- modules
- structs
- utils
- ArrakisMetaVaultFactory
- ArrakisMetaVaultPrivate
- ArrakisMetaVaultPublic
- ArrakisPublicVaultRouter
- ArrakisStandardManager
- CreationCodePrivateVault
- CreationCodePublicVault
- Guardian
- ModulePrivateRegistry
- ModulePublicRegistry
- Pauser
- PrivateVaultNFT
- RenderController
- RouterSwapExecutor
- RouterSwapResolver
- TimeLock
Contents
ArrakisMetaVault
Inherits: IArrakisMetaVault, ReentrancyGuard, Initializable
State Variables
moduleRegistry
address public immutable moduleRegistry;
token0
address public immutable token0;
token1
address public immutable token1;
manager
address public immutable manager;
module
IArrakisLPModule public module;
_whitelistedModules
EnumerableSet.AddressSet internal _whitelistedModules;
Functions
onlyOwnerCustom
modifier onlyOwnerCustom();
onlyManager
modifier onlyManager();
constructor
constructor(
address moduleRegistry_,
address manager_,
address token0_,
address token1_
);
initialize
function initialize(address module_) external initializer;
setModule
function used to set module
function setModule(
address module_,
bytes[] calldata payloads_
) external onlyManager nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
module_ | address | address of the new module |
payloads_ | bytes[] | datas to initialize/rebalance on the new module |
whitelistModules
function used to whitelist modules that can used by manager.
we transfer here all tokens to the new module.
function whitelistModules(
address[] calldata beacons_,
bytes[] calldata data_
) external onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | array of beacons addresses to use for modules creation. |
data_ | bytes[] | array of payload to use for modules creation. |
blacklistModules
function used to blacklist modules that can used by manager.
function blacklistModules(address[] calldata modules_)
external
onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
modules_ | address[] | array of module addresses to be blacklisted. |
whitelistedModules
function used to get the list of modules whitelisted.
function whitelistedModules()
external
view
returns (address[] memory modules);
Returns
Name | Type | Description |
---|---|---|
modules | address[] | whitelisted modules addresses. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
public
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160 priceX96_)
external
view
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
_withdraw
function _withdraw(
address receiver_,
uint256 proportion_
) internal returns (uint256 amount0, uint256 amount1);
_withdrawManagerBalance
function _withdrawManagerBalance(IArrakisLPModule module_)
internal
returns (uint256 amount0, uint256 amount1);
_call
function _call(address module_, bytes memory data_) internal;
_onlyOwnerCheck
function _onlyOwnerCheck() internal view virtual;
ModuleRegistry
Inherits: IModuleRegistry, Ownable, Initializable
State Variables
factory
IArrakisMetaVaultFactory public factory;
admin
should be a timelock contract.
address public immutable admin;
_guardian
address internal immutable _guardian;
_beacons
EnumerableSet.AddressSet internal _beacons;
Functions
constructor
constructor(address owner_, address guardian_, address admin_);
initialize
function used to initialize module registry.
function initialize(address factory_) external initializer;
Parameters
Name | Type | Description |
---|---|---|
factory_ | address | address of ArrakisMetaVaultFactory, who is the only one who can call the init management function. |
beacons
function to get the whitelisted list of IBeacon that have module as implementation.
function beacons() external view returns (address[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | beacons list of upgradeable beacon. |
beaconsContains
function to know if the beacons enumerableSet contain beacon_
function beaconsContains(address beacon_)
external
view
returns (bool isContained);
Parameters
Name | Type | Description |
---|---|---|
beacon_ | address | beacon address to check |
guardian
function used to get the guardian address of arrakis protocol.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
whitelistBeacons
function used to whitelist IBeacon that contain implementation of valid module.
function whitelistBeacons(address[] calldata beacons_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | list of beacon to whitelist. |
blacklistBeacons
function used to blacklist IBeacon that contain implementation of unvalid (from now) module.
function blacklistBeacons(address[] calldata beacons_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | list of beacon to blacklist. |
_createModule
function _createModule(
address vault_,
address beacon_,
bytes calldata payload_
) internal returns (address module);
_checkVaultNotAddressZero
function _checkVaultNotAddressZero(address vault_) internal pure;
PancakeSwapV4StandardModule
Inherits: ReentrancyGuardUpgradeable, PausableUpgradeable, IArrakisLPModule, IArrakisLPModuleID, IPancakeSwapV4StandardModule, ILockCallback
this module can set pancakeswap v4 pool that have a generic hook, that don't require specific action to become liquidity provider.
due to native coin standard difference between pancakeswap and arrakis, we are assuming that all inputed amounts are using arrakis vault token0/token1 as reference. Internal logic of PancakeSwapV4StandardModule will handle the conversion or use the poolKey to interact with the poolManager.
State Variables
poolManager
ICLPoolManager public immutable poolManager;
vault
IVault public immutable vault;
distributor
IDistributor public immutable distributor;
collector
address public immutable collector;
_guardian
address internal immutable _guardian;
metaVault
module's metaVault as IArrakisMetaVault.
IArrakisMetaVault public metaVault;
token0
module's token0 as IERC20Metadata.
IERC20Metadata public token0;
token1
module's token1 as IERC20Metadata.
IERC20Metadata public token1;
isInversed
boolean to know if the poolKey's currencies pair are inversed.
bool public isInversed;
managerFeePIPS
manager fees share.
uint256 public managerFeePIPS;
oracle
oracle that will be used to proctect rebalances against attacks.
IOracleWrapper public oracle;
maxSlippage
max slippage that can occur during swap rebalance.
uint24 public maxSlippage;
poolKey
pool's key of the module.
PoolKey public poolKey;
ethWithdrawers
list of allowed addresses to withdraw eth.
mapping(address => uint256) public ethWithdrawers;
_init0
uint256 internal _init0;
_init1
uint256 internal _init1;
_ranges
Range[] internal _ranges;
_activeRanges
mapping(bytes32 => bool) internal _activeRanges;
Functions
onlyManager
modifier onlyManager();
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
onlyMetaVaultOwner
modifier onlyMetaVaultOwner();
constructor
constructor(
address poolManager_,
address guardian_,
address vault_,
address distributor_,
address collector_
);
pause
function used to pause the module.
only callable by guardian
function pause() external whenNotPaused onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external whenPaused onlyGuardian;
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the uniswap v4 standard module.
function initialize(
uint256 init0_,
uint256 init1_,
bool isInversed_,
PoolKey calldata poolKey_,
IOracleWrapper oracle_,
uint24 maxSlippage_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
init0_ | uint256 | initial amount of token0 to provide to uniswap standard module. |
init1_ | uint256 | initial amount of token1 to provide to uniswap standard module. |
isInversed_ | bool | boolean to check if the poolKey's currencies pair are inversed, compared to the module's tokens pair. |
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
oracle_ | IOracleWrapper | address of the oracle used by the uniswap v4 standard module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault. |
initializePosition
function used to initialize the module when a module switch happen
check if the pool is initialized.
function initializePosition(
bytes calldata
) external virtual onlyMetaVault;
withdrawEth
left over will sit on the module.
function withdrawEth(
uint256 amount_
) external nonReentrant whenNotPaused;
approve
function approve(
address spender_,
address[] calldata tokens_,
uint256[] calldata amounts_
) external nonReentrant whenNotPaused onlyMetaVaultOwner;
setPool
function used to set the pool for the module.
function setPool(
PoolKey calldata poolKey_,
LiquidityRange[] calldata liquidityRanges_,
SwapPayload calldata swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
) external onlyManager nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module on the new pool. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | number of share needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
)
public
onlyManager
nonReentrant
whenNotPaused
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Parameters
Name | Type | Description |
---|---|---|
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance.. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
Returns
Name | Type | Description |
---|---|---|
amount0Minted | uint256 | amount of token0 minted. |
amount1Minted | uint256 | amount of token1 minted. |
amount0Burned | uint256 | amount of token0 burned. |
amount1Burned | uint256 | amount of token1 burned. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
public
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
default swapPayload, no swap happens here. swapPayload will be empty. And will use it to do rebalance and collect fees.
function setManagerFeePIPS(
uint256 newFeePIPS_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
receive
receive() external payable;
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
getRanges
function used to get the list of active ranges.
function getRanges() external view returns (Range[] memory ranges);
Returns
Name | Type | Description |
---|---|---|
ranges | Range[] | active ranges |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(
uint160 priceX96_
) external view returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. rebalance can happen. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0()
external
view
returns (uint256 managerFee0);
Returns
Name | Type | Description |
---|---|---|
managerFee0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1()
external
view
returns (uint256 managerFee1);
Returns
Name | Type | Description |
---|---|---|
managerFee1 | uint256 | amount of token1 that manager earned. |
_lockAcquired
function _lockAcquired(
Action action_,
bytes memory data_
) internal returns (bytes memory);
_internalRebalance
function _internalRebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_
)
internal
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Enums
Action
enum Action {
WITHDRAW,
REBALANCE,
DEPOSIT_FUND
}
UniV4StandardModule
Inherits: ReentrancyGuardUpgradeable, PausableUpgradeable, IArrakisLPModule, IArrakisLPModuleID, IUniV4StandardModule, IUnlockCallback
this module can only set uni v4 pool that have generic hook, that don't require specific action to become liquidity provider.
due to native coin standard difference between uni V4 and arrakis, we are assuming that all inputed amounts are using arrakis vault token0/token1 as reference. Internal logic of UniV4StandardModule will handle the conversion or use the poolKey to interact with the poolManager.
State Variables
poolManager
function used to get the uniswap v4 pool manager.
IPoolManager public immutable poolManager;
_guardian
address internal immutable _guardian;
metaVault
module's metaVault as IArrakisMetaVault.
IArrakisMetaVault public metaVault;
token0
module's token0 as IERC20Metadata.
IERC20Metadata public token0;
token1
module's token1 as IERC20Metadata.
IERC20Metadata public token1;
isInversed
boolean to know if the poolKey's currencies pair are inversed.
bool public isInversed;
managerFeePIPS
manager fees share.
uint256 public managerFeePIPS;
oracle
oracle that will be used to proctect rebalances against attacks.
IOracleWrapper public oracle;
maxSlippage
max slippage that can occur during swap rebalance.
uint24 public maxSlippage;
poolKey
pool's key of the module.
PoolKey public poolKey;
ethWithdrawers
list of allowed addresses to withdraw eth.
mapping(address => uint256) public ethWithdrawers;
_init0
uint256 internal _init0;
_init1
uint256 internal _init1;
_ranges
Range[] internal _ranges;
_activeRanges
mapping(bytes32 => bool) internal _activeRanges;
Functions
onlyManager
modifier onlyManager();
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
constructor
constructor(address poolManager_, address guardian_);
pause
function used to pause the module.
only callable by guardian
function pause() external whenNotPaused onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external whenPaused onlyGuardian;
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the uniswap v4 standard module.
function initialize(
uint256 init0_,
uint256 init1_,
bool isInversed_,
PoolKey calldata poolKey_,
IOracleWrapper oracle_,
uint24 maxSlippage_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
init0_ | uint256 | initial amount of token0 to provide to uniswap standard module. |
init1_ | uint256 | initial amount of token1 to provide to uniswap standard module. |
isInversed_ | bool | boolean to check if the poolKey's currencies pair are inversed, compared to the module's tokens pair. |
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
oracle_ | IOracleWrapper | address of the oracle used by the uniswap v4 standard module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault. |
initializePosition
function used to initialize the module when a module switch happen
check if the pool is initialized.
function initializePosition(
bytes calldata
) external virtual onlyMetaVault;
withdrawEth
left over will sit on the module.
function withdrawEth(
uint256 amount_
) external nonReentrant whenNotPaused;
approve
function approve(
address spender_,
uint256 amount0_,
uint256 amount1_
) external nonReentrant whenNotPaused;
setPool
function used to set the pool for the module.
function setPool(
PoolKey calldata poolKey_,
LiquidityRange[] calldata liquidityRanges_,
SwapPayload calldata swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
) external onlyManager nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module on the new pool. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
check if the pool is initialized.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | number of share needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
)
public
onlyManager
nonReentrant
whenNotPaused
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Parameters
Name | Type | Description |
---|---|---|
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance.. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
Returns
Name | Type | Description |
---|---|---|
amount0Minted | uint256 | amount of token0 minted. |
amount1Minted | uint256 | amount of token1 minted. |
amount0Burned | uint256 | amount of token0 burned. |
amount1Burned | uint256 | amount of token1 burned. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
public
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
default swapPayload, no swap happens here. swapPayload will be empty. And will use it to do rebalance and collect fees.
function setManagerFeePIPS(
uint256 newFeePIPS_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
receive
receive() external payable;
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
getRanges
function used to get the list of active ranges.
function getRanges() external view returns (Range[] memory ranges);
Returns
Name | Type | Description |
---|---|---|
ranges | Range[] | active ranges |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(
uint160 priceX96_
) external view returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. rebalance can happen. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0()
external
view
returns (uint256 managerFee0);
Returns
Name | Type | Description |
---|---|---|
managerFee0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1()
external
view
returns (uint256 managerFee1);
Returns
Name | Type | Description |
---|---|---|
managerFee1 | uint256 | amount of token1 that manager earned. |
_unlockCallback
function _unlockCallback(
Action action_,
bytes memory data_
) internal returns (bytes memory);
_internalRebalance
function _internalRebalance(
LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_
)
internal
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Enums
Action
enum Action {
WITHDRAW,
REBALANCE,
DEPOSIT_FUND
}
ValantisModule
Inherits: IArrakisLPModule, IValantisHOTModule, PausableUpgradeable, ReentrancyGuardUpgradeable
BeaconProxy be careful for changing implementation with upgrade.
State Variables
metaVault
IArrakisMetaVault public metaVault;
pool
ISovereignPool public pool;
alm
IHOT public alm;
token0
IERC20Metadata public token0;
token1
IERC20Metadata public token1;
maxSlippage
should we change it to mutable state variable, and settable by who?
uint24 public maxSlippage;
oracle
IOracleWrapper public oracle;
_guardian
address internal immutable _guardian;
_init0
uint256 internal _init0;
_init1
uint256 internal _init1;
_managerFeePIPS
uint256 internal _managerFeePIPS;
Functions
onlyMetaVault
modifier onlyMetaVault();
onlyManager
modifier onlyManager();
onlyGuardian
modifier onlyGuardian();
constructor
constructor(address guardian_);
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the valantis module. who can call deposit and withdraw functions.
function initialize(
address pool_,
uint256 init0_,
uint256 init1_,
uint24 maxSlippage_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
pool_ | address | address of the valantis sovereign pool. |
init0_ | uint256 | initial amount of token0 to provide to valantis module. |
init1_ | uint256 | initial amount of token1 to provide to valantis module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault |
initializePosition
function used to initialize the module when a module switch happen
function initializePosition(bytes calldata data_)
external
virtual
onlyMetaVault;
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | bytes that contain information to initialize the position. |
pause
function used to pause the module.
only callable by guardian
function pause() external onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external onlyGuardian;
setALMAndManagerFees
set HOT, oracle (wrapper of HOT) and init manager fees function.
function setALMAndManagerFees(
address alm_,
address oracle_
) external;
Parameters
Name | Type | Description |
---|---|---|
alm_ | address | address of the valantis HOT ALM. |
oracle_ | address | address of the oracle used by the valantis HOT module. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | the proportion of the total position that need to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
external
whenNotPaused
nonReentrant
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
function setManagerFeePIPS(uint256 newFeePIPS_)
external
whenNotPaused
onlyManager;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
setPriceBounds
fucntion used to set range on valantis AMM
function setPriceBounds(
uint160 sqrtPriceLowX96_,
uint160 sqrtPriceHighX96_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_
) external onlyManager;
Parameters
Name | Type | Description |
---|---|---|
sqrtPriceLowX96_ | uint160 | lower bound of the range in sqrt price. |
sqrtPriceHighX96_ | uint160 | upper bound of the range in sqrt price. |
expectedSqrtSpotPriceUpperX96_ | uint160 | expected lower limit of current spot price (to prevent sandwich attack and manipulation). |
expectedSqrtSpotPriceLowerX96_ | uint160 | expected upper limit of current spot price (to prevent sandwich attack and manipulation). |
swap
function to swap token0->token1 or token1->token0 and then change inventory.
function swap(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
address router_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_,
bytes calldata payload_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
zeroForOne_ | bool | boolean if true token0->token1, if false token1->token0. |
expectedMinReturn_ | uint256 | minimum amount of tokenOut expected. |
amountIn_ | uint256 | amount of tokenIn used during swap. |
router_ | address | address of smart contract that will execute swap. |
expectedSqrtSpotPriceUpperX96_ | uint160 | upper bound of current price. |
expectedSqrtSpotPriceLowerX96_ | uint160 | lower bound of current price. |
payload_ | bytes | data payload used for swapping. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0() external view returns (uint256 fees0);
Returns
Name | Type | Description |
---|---|---|
fees0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1() external view returns (uint256 fees1);
Returns
Name | Type | Description |
---|---|---|
fees1 | uint256 | amount of token1 that manager earned. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | onchain oracle to check the current amm price against. |
maxDeviation_ | uint24 | maximum deviation tolerated by management. |
managerFeePIPS
function used to get manager fees.
function managerFeePIPS() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | managerFeePIPS amount of token1 that manager earned. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying() external view returns (uint256, uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | amount0 the amount of token0 sitting on the position. |
<none> | uint256 | amount1 the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160 priceX96_)
external
view
returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | amount0 the amount of token0 sitting on the position for priceX96. |
<none> | uint256 | amount1 the amount of token1 sitting on the position for priceX96. |
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
_initializePosition
function _initializePosition() internal;
_checkMinReturn
function _checkMinReturn(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
uint8 decimals0_,
uint8 decimals1_
) internal view;
Contents
Constants
MINIMUM_LIQUIDITY
uint256 constant MINIMUM_LIQUIDITY = 10 ** 3;
BASE
uint256 constant BASE = 1e18;
PIPS
uint24 constant PIPS = 1_000_000;
TEN_PERCENT
uint24 constant TEN_PERCENT = 100_000;
WEEK
uint256 constant WEEK = 604_800;
NATIVE_COIN
address constant NATIVE_COIN =
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
NATIVE_COIN_DECIMALS
uint8 constant NATIVE_COIN_DECIMALS = 18;
Contents
ArrakisPrivateHook
Inherits: IHooks, IArrakisPrivateHook
State Variables
module
address public immutable module;
vault
address public immutable vault;
manager
address public immutable manager;
_zeroForOneFee
uint24 internal _zeroForOneFee;
_oneForZeroFee
uint24 internal _oneForZeroFee;
Functions
constructor
constructor(
address module_
);
setFees
function setFees(
uint24 zeroForOneFee_,
uint24 oneForZeroFee_
) external;
beforeInitialize
The hook called before the state of a pool is initialized.
function not implemented, ArrakisPrivateHook will not support this hook.
function beforeInitialize(
address,
PoolKey calldata,
uint160
) external virtual returns (bytes4);
afterInitialize
The hook called after the state of a pool is initialized.
function not implemented, ArrakisPrivateHook will not support this hook.
function afterInitialize(
address,
PoolKey calldata,
uint160,
int24
) external virtual returns (bytes4);
beforeAddLiquidity
The hook called before liquidity is added
function beforeAddLiquidity(
address sender,
PoolKey calldata,
IPoolManager.ModifyLiquidityParams calldata,
bytes calldata
) external virtual returns (bytes4);
Parameters
Name | Type | Description |
---|---|---|
sender | address | The initial msg.sender for the add liquidity call. |
<none> | PoolKey | |
<none> | IPoolManager.ModifyLiquidityParams | |
<none> | bytes |
afterAddLiquidity
The hook called after liquidity is added.
function not implemented, ArrakisPrivateHook will not support this hook.
function afterAddLiquidity(
address,
PoolKey calldata,
IPoolManager.ModifyLiquidityParams calldata,
BalanceDelta,
BalanceDelta,
bytes calldata
) external virtual returns (bytes4, BalanceDelta);
beforeRemoveLiquidity
The hook called before liquidity is removed.
function beforeRemoveLiquidity(
address,
PoolKey calldata,
IPoolManager.ModifyLiquidityParams calldata,
bytes calldata
) external virtual returns (bytes4);
afterRemoveLiquidity
The hook called after liquidity is removed.
function not implemented, ArrakisPrivateHook will not support this hook.
function afterRemoveLiquidity(
address,
PoolKey calldata,
IPoolManager.ModifyLiquidityParams calldata,
BalanceDelta,
BalanceDelta,
bytes calldata
) external virtual returns (bytes4, BalanceDelta);
beforeSwap
The hook called before a swap.
function beforeSwap(
address,
PoolKey calldata,
IPoolManager.SwapParams calldata swapParams_,
bytes calldata
)
external
virtual
returns (
bytes4 funcSelector,
BeforeSwapDelta,
uint24 lpFeeOverride
);
afterSwap
The hook called after a swap.
function not implemented, ArrakisPrivateHook will not support this hook.
function afterSwap(
address,
PoolKey calldata,
IPoolManager.SwapParams calldata,
BalanceDelta,
bytes calldata
) external virtual returns (bytes4, int128);
beforeDonate
The hook called before donate.
function not implemented, ArrakisPrivateHook will not support this hook.
function beforeDonate(
address,
PoolKey calldata,
uint256,
uint256,
bytes calldata
) external virtual returns (bytes4);
afterDonate
The hook called after donate.
function not implemented, ArrakisPrivateHook will not support this hook.
function afterDonate(
address,
PoolKey calldata,
uint256,
uint256,
bytes calldata
) external virtual returns (bytes4);
zeroForOneFee
function zeroForOneFee() external view returns (uint24);
oneForZeroFee
function oneForZeroFee() external view returns (uint24);
getHookPermissions
function getHookPermissions()
public
pure
virtual
returns (Hooks.Permissions memory);
_validateHookAddress
function _validateHookAddress(
IHooks _this
) internal pure virtual;
ArrakisPrivateHookFactory
Inherits: IArrakisPrivateHookFactory
Functions
createPrivateHook
function createPrivateHook(
address module_,
bytes32 salt_
) external override returns (address hook);
addressOf
function addressOf(
bytes32 salt_
) external view returns (address);
Contents
- AggregatorV3Interface
- IAerodromeStandardModulePrivate
- IArrakisLPModule
- IArrakisLPModuleID
- IArrakisLPModulePrivate
- IArrakisLPModulePublic
- IArrakisMetaVault
- IArrakisMetaVaultFactory
- IArrakisMetaVaultPrivate
- IArrakisMetaVaultPublic
- IArrakisPrivateHook
- IArrakisPrivateHookFactory
- IArrakisPrivateVaultRouter
- IArrakisPublicVaultRouter
- IArrakisStandardManager
- IArrakisV2
- IBunkerModule
- ICLGauge
- ICreationCode
- IGuardian
- IHOTExecutor
- IManager
- IMigrationHelper
- IModulePrivateRegistry
- IModulePublicRegistry
- IModuleRegistry
- INonfungiblePositionManager
- IOracleWrapper
- IOwnable
- IPALMTerms
- IPausable
- IPauser
- IPermit2
- IPrivateRouterSwapExecutor
- IPrivateVaultNFT
- IRenderController
- IResolver
- IRouterSwapExecutor
- IRouterSwapResolver
- Operation
- ISafe
- ISovereignPool
- ITimeLock
- IUniV4ModuleBase
- IUniV4Oracle
- IUniV4StandardModule
- IUniV4StandardModuleResolver
- IUniswapV3Factory
- IUniswapV3Pool
- IUniswapV3SwapCallback
- IValantisHOTModule
- IVoter
- IWETH9
- IWithdrawHelper
AggregatorV3Interface
Functions
decimals
function decimals() external view returns (uint8);
description
function description() external view returns (string memory);
version
function version() external view returns (uint256);
getRoundData
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
latestRoundData
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
IAerodromeStandardModulePrivate
Author: Arrakis Finance
Aerodrome Module interface, modules able to interact with aerodrome dex.
Functions
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the aerodrome module.
function initialize(
IOracleWrapper oracle_,
uint24 maxSlippage_,
address aeroReceiver_,
int24 tickSpacing_,
address metaVault_
) external;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will be the price reference. |
maxSlippage_ | uint24 | maximum slippage allowed during swap, mint and burn. |
aeroReceiver_ | address | recevier of aero token belonging to manager. |
tickSpacing_ | int24 | tickSpacing of the aero pool to interact with. |
metaVault_ | address | address of the meta vault |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
RebalanceParams calldata params_
) external;
Parameters
Name | Type | Description |
---|---|---|
params_ | RebalanceParams | params including decrease positions, swap, increase positions and mint datas. |
claimRewards
function used by user to claim the aero rewards.
function claimRewards(
address receiver_
) external;
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive the aero rewards. |
claimManager
function used by executor to claim the manager aero rewards.
function claimManager() external;
approve
function used to approve a spender to use the left over of the module.
function approve(
address spender_,
uint256 amount0_,
uint256 amount1_
) external;
Parameters
Name | Type | Description |
---|---|---|
spender_ | address | address that will be allowed to use left over. |
amount0_ | uint256 | amount of token0 allowed to be used by spender. |
amount1_ | uint256 | amount of token1 allowed to be used by spender. |
setReceiver
function used to set the receiver of aero rewards.
function setReceiver(
address newReceiver_
) external;
Parameters
Name | Type | Description |
---|---|---|
newReceiver_ | address | new address that will receive the aero token. |
nftPositionManager
function used to get the NonFungiblePositionManager of aerodrome.
function nftPositionManager()
external
view
returns (INonfungiblePositionManager);
factory
function used to get the factory of aerodrome.
function factory() external view returns (IUniswapV3Factory);
voter
function used to get the voter of aerodrome.
function voter() external view returns (IVoter);
tokenIds
function used to get the list of tokenIds of non fungible position.
function tokenIds() external view returns (uint256[] memory);
maxSlippage
function used to get the maximum slippage.
function maxSlippage() external view returns (uint24);
aeroReceiver
function used to get aero token receiver.
function aeroReceiver() external view returns (address);
pool
function used to get aero pool the module is interacting with.
function pool() external view returns (address);
gauge
function used to get aero gauge associated to pool the module is interacting with.
function gauge() external view returns (address);
aeroManagerBalance
function used to get aero balance due to manager.
function aeroManagerBalance() external view returns (uint256);
oracle
function used to get the oracle that will be used to proctect rebalances.
function oracle() external view returns (IOracleWrapper);
AERO
function used to get aero token address.
function AERO() external view returns (address);
Events
LogApproval
Event describing an approval of left overs to an address.
event LogApproval(
address indexed spender, uint256 amount0, uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
spender | address | the address that will get the allowance. |
amount0 | uint256 | the amount of token0 allowed to spender. |
amount1 | uint256 | the amount of token1 allowed to spender. |
LogRebalance
Event describing an rebalance results on underlying.
event LogRebalance(
uint256 burn0, uint256 burn1, uint256 mint0, uint256 mint1
);
Parameters
Name | Type | Description |
---|---|---|
burn0 | uint256 | the amount of token0 burned during rebalance. |
burn1 | uint256 | the amount of token1 burned during rebalance. |
mint0 | uint256 | the amount of token0 minted during rebalance. |
mint1 | uint256 | the amount of token1 minted during rebalance. |
LogClaim
Event describing an claim by user of aero token.
event LogClaim(address indexed receiver, uint256 aeroAmount);
Parameters
Name | Type | Description |
---|---|---|
receiver | address | the receiver of aero token. |
aeroAmount | uint256 | the amount of aero token claimed. |
LogManagerClaim
Event describing an claim by manager of aero token.
event LogManagerClaim(address indexed receiver, uint256 aeroAmount);
Parameters
Name | Type | Description |
---|---|---|
receiver | address | the receiver of aero token. |
aeroAmount | uint256 | the amount of aero token claimed. |
LogSetReceiver
Event describing the update of receiver of manager aero reward.
event LogSetReceiver(address oldReceiver, address newReceiver);
Parameters
Name | Type | Description |
---|---|---|
oldReceiver | address | previous receiver of aero token. |
newReceiver | address | new receiver of aero token. |
Errors
MaxSlippageGtTenPercent
triggered when the max slippage variable is set to greater than 10%.
error MaxSlippageGtTenPercent();
OnlyMetaVaultOwner
triggered when the caller is different than the meta vault owner.
error OnlyMetaVaultOwner();
NativeCoinNotSupported
triggered when token pair contain native coin.
error NativeCoinNotSupported();
BurnToken0
triggered when burn of token0 is smaller than expected.
error BurnToken0();
BurnToken1
triggered when burn of token1 is smaller than expected.
error BurnToken1();
MintToken0
triggered when mint of token0 is smaller than expected.
error MintToken0();
MintToken1
triggered when mint of token1 is smaller than expected.
error MintToken1();
TokenIdNotFound
triggered when tokenId of position is unknown from the module.
error TokenIdNotFound();
Token0Mismatch
triggered when token0 of mintParams is different than module token0.
error Token0Mismatch();
Token1Mismatch
triggered when token1 of mintParams is different than module token1.
error Token1Mismatch();
TickSpacingMismatch
triggered when tick spacing of mintParams is different than the pool module.
error TickSpacingMismatch();
ExpectedMinReturnTooLow
triggered when min return of rebalance swap is too low.
error ExpectedMinReturnTooLow();
WrongRouter
triggered when swap router of the rebalance payload is unauthorized address.
error WrongRouter();
SlippageTooHigh
triggered when amount received from rebalance swap is too low.
error SlippageTooHigh();
OverMaxDeviation
triggered when deviation of pool price from oracle price is greater than max allowed value.
error OverMaxDeviation();
SameReceiver
triggered when new aero receiver is equal to old aero receiver.
error SameReceiver();
PoolNotFound
triggered when pool has not been created on factory.
error PoolNotFound();
AmountsZero
triggered when funded amounts are equals to zero.
error AmountsZero();
OnlyManagerOwner
triggered when caller is not the owner of the manager.
error OnlyManagerOwner();
AEROTokenNotSupported
triggered when aero token is one of the token of the module token pair.
error AEROTokenNotSupported();
GaugeKilled
triggered when gauge returned by voter is not alive.
error GaugeKilled();
IArrakisLPModule
Author: Arrakis Finance
Module interfaces, modules are implementing differents strategies that an arrakis module can use.
Functions
pause
function used to pause the module.
only callable by guardian
function pause() external;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external;
initializePosition
function used to initialize the module when a module switch happen
function initializePosition(bytes calldata data_) external;
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | bytes that contain information to initialize the position. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | the proportion of the total position that need to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
external
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
function setManagerFeePIPS(uint256 newFeePIPS_) external;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
metaVault
function used to get metaVault as IArrakisMetaVault.
function metaVault() external view returns (IArrakisMetaVault);
Returns
Name | Type | Description |
---|---|---|
<none> | IArrakisMetaVault | metaVault that implement IArrakisMetaVault. |
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | managerBalance0 amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | managerBalance1 amount of token1 that manager earned. |
managerFeePIPS
function used to get manager fees.
function managerFeePIPS() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | managerFeePIPS amount of token1 that manager earned. |
token0
function used to get token0 as IERC20Metadata.
function token0() external view returns (IERC20Metadata);
Returns
Name | Type | Description |
---|---|---|
<none> | IERC20Metadata | token0 as IERC20Metadata. |
token1
function used to get token1 as IERC20Metadata.
function token1() external view returns (IERC20Metadata);
Returns
Name | Type | Description |
---|---|---|
<none> | IERC20Metadata | token1 as IERC20Metadata. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160 priceX96_)
external
view
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. |
Events
LogWithdraw
Event describing a withdrawal of participation by an user inside this module.
withdraw action can be indexed by receiver.
event LogWithdraw(
address indexed receiver,
uint256 proportion,
uint256 amount0,
uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
receiver | address | address that will receive the tokens withdrawn. |
proportion | uint256 | percentage of the current position that user want to withdraw. |
amount0 | uint256 | amount of token0 send to "receiver" due to withdraw action. |
amount1 | uint256 | amount of token1 send to "receiver" due to withdraw action. |
LogWithdrawManagerBalance
Event describing a manager fee withdrawal.
event LogWithdrawManagerBalance(
address manager, uint256 amount0, uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
manager | address | address of the manager that will fees earned due to his fund management. |
amount0 | uint256 | amount of token0 that manager has earned and will be transfered. |
amount1 | uint256 | amount of token1 that manager has earned and will be transfered. |
LogSetManagerFeePIPS
Event describing manager set his fees.
event LogSetManagerFeePIPS(uint256 oldFee, uint256 newFee);
Parameters
Name | Type | Description |
---|---|---|
oldFee | uint256 | fees share that have been taken by manager. |
newFee | uint256 | fees share that have been taken by manager. |
Errors
AddressZero
triggered when an address that should not be zero is equal to address zero.
error AddressZero();
OnlyMetaVault
triggered when the caller is different than the metaVault that own this module.
error OnlyMetaVault(address caller, address metaVault);
OnlyManager
triggered when the caller is different than the manager defined by the metaVault.
error OnlyManager(address caller, address manager);
ProportionZero
triggered if proportion of minting or burning is zero.
error ProportionZero();
ProportionGtBASE
triggered if during withdraw more than 100% of the position.
error ProportionGtBASE();
NewFeesGtPIPS
triggered when manager want to set his more earned by the position than 100% of fees earned.
error NewFeesGtPIPS(uint256 newFees);
SameManagerFee
triggered when manager is setting the same fees that already active.
error SameManagerFee();
InitsAreZeros
triggered when inits values are zeros.
error InitsAreZeros();
OnlyGuardian
triggered when pause/unpaused function is called by someone else than guardian.
error OnlyGuardian();
IArrakisLPModuleID
Functions
id
function id() external view returns (bytes32);
IArrakisLPModulePrivate
expose a deposit function for that can deposit any share of token0 and token1.
this deposit feature will be used by private actor.
Functions
fund
deposit function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
Events
LogFund
event emitted when owner of private fund the private vault.
event LogFund(address depositor, uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
depositor | address | address that are sending the tokens, the owner. |
amount0 | uint256 | amount of token0 sent by depositor. |
amount1 | uint256 | amount of token1 sent by depositor. |
Errors
DepositZero
error DepositZero();
IArrakisLPModulePublic
expose a deposit function for that can deposit a specific share of token0 and token1.
this deposit feature will be used by public actor.
Functions
deposit
deposit function for public vault.
function deposit(
address depositor_,
uint256 proportion_
) external payable returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
proportion_ | uint256 | percentage of portfolio position vault want to expand. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 needed to expand the portfolio by "proportion" percent. |
amount1 | uint256 | amount of token1 needed to expand the portfolio by "proportion" percent. |
Events
LogDeposit
Event describing a deposit done by an user inside this module.
deposit action can be indexed by depositor.
event LogDeposit(
address depositor,
uint256 proportion,
uint256 amount0,
uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
depositor | address | address of the tokens provider. |
proportion | uint256 | percentage of the current position that depositor want to increase. |
amount0 | uint256 | amount of token0 needed to increase the portfolio of "proportion" percent. |
amount1 | uint256 | amount of token1 needed to increase the portfolio of "proportion" percent. |
IArrakisMetaVault
IArrakisMetaVault is a vault that is able to invest dynamically deposited tokens into protocols through his module.
Functions
initialize
function used to initialize default module.
function initialize(address module_) external;
Parameters
Name | Type | Description |
---|---|---|
module_ | address | address of the default module. |
setModule
function used to set module
function setModule(
address module_,
bytes[] calldata payloads_
) external;
Parameters
Name | Type | Description |
---|---|---|
module_ | address | address of the new module |
payloads_ | bytes[] | datas to initialize/rebalance on the new module |
whitelistModules
function used to whitelist modules that can used by manager.
function whitelistModules(
address[] calldata beacons_,
bytes[] calldata data_
) external;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | array of beacons addresses to use for modules creation. |
data_ | bytes[] | array of payload to use for modules creation. |
blacklistModules
function used to blacklist modules that can used by manager.
function blacklistModules(address[] calldata modules_) external;
Parameters
Name | Type | Description |
---|---|---|
modules_ | address[] | array of module addresses to be blacklisted. |
whitelistedModules
function used to get the list of modules whitelisted.
function whitelistedModules()
external
view
returns (address[] memory modules);
Returns
Name | Type | Description |
---|---|---|
modules | address[] | whitelisted modules addresses. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160 priceX96)
external
view
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96 | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
token0
function used to get the address of token0.
function token0() external view returns (address);
token1
function used to get the address of token1.
function token1() external view returns (address);
manager
function used to get manager address.
function manager() external view returns (address);
module
function used to get module used to open/close/manager a position.
function module() external view returns (IArrakisLPModule);
moduleRegistry
function used to get module registry.
function moduleRegistry() external view returns (address registry);
Returns
Name | Type | Description |
---|---|---|
registry | address | address of module registry. |
Events
LogWithdrawManagerBalance
Event describing a manager fee withdrawal.
event LogWithdrawManagerBalance(uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 that manager has earned and will be transfered. |
amount1 | uint256 | amount of token1 that manager has earned and will be transfered. |
LogSetManager
Event describing owner setting the manager.
event LogSetManager(address manager);
Parameters
Name | Type | Description |
---|---|---|
manager | address | address of manager that will manage the portfolio. |
LogSetModule
Event describing manager setting the module.
event LogSetModule(address module, bytes[] payloads);
Parameters
Name | Type | Description |
---|---|---|
module | address | address of the new active module. |
payloads | bytes[] | data payloads for initializing positions on the new module. |
LogSetFirstModule
Event describing default module that the vault will be initialized with.
event LogSetFirstModule(address module);
Parameters
Name | Type | Description |
---|---|---|
module | address | address of the default module. |
LogWhiteListedModules
Event describing list of modules that has been whitelisted by owner.
event LogWhiteListedModules(address[] modules);
Parameters
Name | Type | Description |
---|---|---|
modules | address[] | list of addresses corresponding to new modules now available to be activated by manager. |
LogWhitelistedModule
Event describing whitelisted of the first module during vault creation.
event LogWhitelistedModule(address module);
Parameters
Name | Type | Description |
---|---|---|
module | address | default activation. |
LogBlackListedModules
Event describing blacklisting action of modules by owner.
event LogBlackListedModules(address[] modules);
Parameters
Name | Type | Description |
---|---|---|
modules | address[] | list of addresses corresponding to old modules that has been blacklisted. |
Errors
AddressZero
triggered when an address that should not be zero is equal to address zero.
error AddressZero(string property);
OnlyManager
triggered when the caller is different than the manager.
error OnlyManager(address caller, address manager);
CallFailed
triggered when a low level call failed during execution.
error CallFailed();
SameModule
triggered when manager try to set the active module as active.
error SameModule();
SameManager
triggered when owner of the vault try to set the manager with the current manager.
error SameManager();
ModuleNotEmpty
triggered when all tokens withdrawal has been done during a switch of module.
error ModuleNotEmpty(uint256 amount0, uint256 amount1);
AlreadyWhitelisted
triggered when owner try to whitelist a module that has been already whitelisted.
error AlreadyWhitelisted(address module);
NotWhitelistedModule
triggered when owner try to blacklist a module that has not been whitelisted.
error NotWhitelistedModule(address module);
ActiveModule
triggered when owner try to blacklist the active module.
error ActiveModule();
Token0GtToken1
triggered during vault creation if token0 address is greater than token1 address.
error Token0GtToken1();
Token0EqToken1
triggered during vault creation if token0 address is equal to token1 address.
error Token0EqToken1();
NotWhitelistedBeacon
triggered when whitelisting action is occuring and module's beacon is not whitelisted on module registry.
error NotWhitelistedBeacon();
NotSameGuardian
triggered when guardian of the whitelisting module is different than the guardian of the registry.
error NotSameGuardian();
NotImplemented
triggered when a function logic is not implemented.
error NotImplemented();
ArrayNotSameLength
triggered when two arrays suppposed to have the same length, have different length.
error ArrayNotSameLength();
OnlyOwner
triggered when function is called by someone else than the owner.
error OnlyOwner();
WithdrawNotAllowed
triggered when setModule action try to remove funds.
error WithdrawNotAllowed();
PositionNotInitialized
triggered when setModule function end without initiliazePosition call.
error PositionNotInitialized();
NotPositionInitializationCall
triggered when the first external call of setModule function isn't InitializePosition function.
error NotPositionInitializationCall();
IArrakisMetaVaultFactory
Functions
pause
function used to pause the factory.
only callable by owner.
function pause() external;
unpause
function used to unpause the factory.
only callable by owner.
function unpause() external;
setManager
function used to set a new manager.
only callable by owner.
function setManager(address newManager_) external;
Parameters
Name | Type | Description |
---|---|---|
newManager_ | address | address that will managed newly created vault. |
deployPublicVault
function used to deploy ERC20 token wrapped Arrakis Meta Vault.
function deployPublicVault(
bytes32 salt_,
address token0_,
address token1_,
address owner_,
address beacon_,
bytes calldata moduleCreationPayload_,
bytes calldata initManagementPayload_
) external returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
salt_ | bytes32 | bytes32 used to get a deterministic all chains address. |
token0_ | address | address of the first token of the token pair. |
token1_ | address | address of the second token of the token pair. |
owner_ | address | address of the owner of the vault. |
beacon_ | address | address of the beacon that will be used to create the default module. |
moduleCreationPayload_ | bytes | payload for initializing the module. |
initManagementPayload_ | bytes | data for initialize management. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the newly created Token Meta Vault. |
deployPrivateVault
function used to deploy owned Arrakis Meta Vault.
function deployPrivateVault(
bytes32 salt_,
address token0_,
address token1_,
address owner_,
address beacon_,
bytes calldata moduleCreationPayload_,
bytes calldata initManagementPayload_
) external returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
salt_ | bytes32 | bytes32 needed to compute vault address deterministic way. |
token0_ | address | address of the first token of the token pair. |
token1_ | address | address of the second token of the token pair. |
owner_ | address | address of the owner of the vault. |
beacon_ | address | address of the beacon that will be used to create the default module. |
moduleCreationPayload_ | bytes | payload for initializing the module. |
initManagementPayload_ | bytes | data for initialize management. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the newly created private Meta Vault. |
whitelistDeployer
function used to grant the role to deploy to a list of addresses.
function whitelistDeployer(address[] calldata deployers_) external;
Parameters
Name | Type | Description |
---|---|---|
deployers_ | address[] | list of addresses that owner want to grant permission to deploy. |
blacklistDeployer
function used to grant the role to deploy to a list of addresses.
function blacklistDeployer(address[] calldata deployers_) external;
Parameters
Name | Type | Description |
---|---|---|
deployers_ | address[] | list of addresses that owner want to revoke permission to deploy. |
getTokenName
get Arrakis Modular standard token name for two corresponding tokens.
function getTokenName(
address token0_,
address token1_
) external view returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
token0_ | address | address of the first token. |
token1_ | address | address of the second token. |
Returns
Name | Type | Description |
---|---|---|
<none> | string | name name of the arrakis modular token vault. |
publicVaults
get a list of public vaults created by this factory
function publicVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | start index |
endIndex_ | uint256 | end index |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | vaults list of all created vaults. |
numOfPublicVaults
numOfPublicVaults counts the total number of token vaults in existence
function numOfPublicVaults() external view returns (uint256 result);
Returns
Name | Type | Description |
---|---|---|
result | uint256 | total number of vaults deployed |
isPublicVault
isPublicVault check if the inputed vault is a public vault.
function isPublicVault(address vault_) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPublicVault true if the inputed vault is public or otherwise false. |
privateVaults
get a list of private vaults created by this factory
function privateVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | start index |
endIndex_ | uint256 | end index |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | vaults list of all created vaults. |
numOfPrivateVaults
numOfPrivateVaults counts the total number of private vaults in existence
function numOfPrivateVaults()
external
view
returns (uint256 result);
Returns
Name | Type | Description |
---|---|---|
result | uint256 | total number of vaults deployed |
isPrivateVault
isPrivateVault check if the inputed vault is a private vault.
function isPrivateVault(address vault_)
external
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPublicVault true if the inputed vault is private or otherwise false. |
manager
function used to get the manager of newly deployed vault.
function manager() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | manager address that will manager vault that will be created. |
deployers
function used to get a list of address that can deploy public vault.
function deployers() external view returns (address[] memory);
moduleRegistryPublic
function used to get public module registry.
function moduleRegistryPublic() external view returns (address);
moduleRegistryPrivate
function used to get private module registry.
function moduleRegistryPrivate() external view returns (address);
Events
LogPublicVaultCreation
event emitted when public vault is created by a deployer.
event LogPublicVaultCreation(
address indexed creator,
bytes32 salt,
address token0,
address token1,
address owner,
address module,
address publicVault,
address timeLock
);
Parameters
Name | Type | Description |
---|---|---|
creator | address | address that is creating the public vault, a deployer. |
salt | bytes32 | salt used for create3. |
token0 | address | first token of the token pair. |
token1 | address | second token of the token pair. |
owner | address | address of the owner. |
module | address | default module that will be used by the meta vault. |
publicVault | address | address of the deployed meta vault. |
timeLock | address | timeLock that will owned the meta vault. |
LogPrivateVaultCreation
event emitted when private vault is created.
event LogPrivateVaultCreation(
address indexed creator,
bytes32 salt,
address token0,
address token1,
address owner,
address module,
address privateVault
);
Parameters
Name | Type | Description |
---|---|---|
creator | address | address that is deploying the vault. |
salt | bytes32 | salt used for create3. |
token0 | address | address of the first token of the pair. |
token1 | address | address of the second token of the pair. |
owner | address | address that will owned the private vault. |
module | address | address of the default module. |
privateVault | address | address of the deployed meta vault. |
LogWhitelistDeployers
event emitted when whitelisting an array of public vault deployers.
event LogWhitelistDeployers(address[] deployers);
Parameters
Name | Type | Description |
---|---|---|
deployers | address[] | list of deployers added to the whitelist. |
LogBlacklistDeployers
event emitted when blacklisting an array of public vault deployers.
event LogBlacklistDeployers(address[] deployers);
Parameters
Name | Type | Description |
---|---|---|
deployers | address[] | list of deployers removed from the whitelist. |
LogSetManager
event emitted when owner set a new manager.
event LogSetManager(address oldManager, address newManager);
Parameters
Name | Type | Description |
---|---|---|
oldManager | address | address of the previous manager. |
newManager | address | address of the new manager. |
Errors
AddressZero
error AddressZero();
StartIndexLtEndIndex
triggered when querying vaults on factory and start index is lower than end index.
error StartIndexLtEndIndex(uint256 startIndex, uint256 endIndex);
EndIndexGtNbOfVaults
triggered when querying vaults on factory and end index of the query is bigger the biggest index of the vaults array.
error EndIndexGtNbOfVaults(uint256 endIndex, uint256 numberOfVaults);
AlreadyWhitelistedDeployer
triggered when owner want to whitelist a deployer that has been already whitelisted.
error AlreadyWhitelistedDeployer(address deployer);
NotAlreadyADeployer
triggered when owner want to blackist a deployer that is not a current deployer.
error NotAlreadyADeployer(address deployer);
NotADeployer
triggered when public vault deploy function is called by an address that is not a deployer.
error NotADeployer();
CallFailed
triggered when init management low level failed.
error CallFailed();
VaultNotManaged
triggered when init management happened and still the vault is not under management by manager.
error VaultNotManaged();
SameManager
triggered when owner is setting a new manager, and the new manager address match with the old manager address.
error SameManager();
IArrakisMetaVaultPrivate
Functions
deposit
function used to deposit tokens or expand position inside the inherent strategy.
function deposit(
uint256 amount0_,
uint256 amount1_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
amount0_ | uint256 | amount of token0 need to increase the position by proportion_; |
amount1_ | uint256 | amount of token1 need to increase the position by proportion_; |
withdraw
function used to withdraw tokens or position contraction of the underpin strategy.
function withdraw(
uint256 proportion_,
address receiver_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
proportion_ | uint256 | the proportion of position contraction. |
receiver_ | address | the address that will receive withdrawn tokens. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 returned. |
amount1 | uint256 | amount of token1 returned. |
whitelistDepositors
function used to whitelist depositors.
function whitelistDepositors(address[] calldata depositors_)
external;
Parameters
Name | Type | Description |
---|---|---|
depositors_ | address[] | list of address that will be granted to depositor role. |
blacklistDepositors
function used to blacklist depositors.
function blacklistDepositors(address[] calldata depositors_)
external;
Parameters
Name | Type | Description |
---|---|---|
depositors_ | address[] | list of address who depositor role will be revoked. |
depositors
function used to get the list of depositors.
function depositors() external view returns (address[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | depositors list of address granted to depositor role. |
Events
LogDeposit
Event describing a deposit done by an user inside this vault.
event LogDeposit(uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 needed to increase the portfolio of "proportion" percent. |
amount1 | uint256 | amount of token1 needed to increase the portfolio of "proportion" percent. |
LogWithdraw
Event describing a withdrawal of participation by an user inside this vault.
event LogWithdraw(
uint256 proportion, uint256 amount0, uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
proportion | uint256 | percentage of the current position that user want to withdraw. |
amount0 | uint256 | amount of token0 withdrawn due to withdraw action. |
amount1 | uint256 | amount of token1 withdrawn due to withdraw action. |
LogWhitelistDepositors
Event describing the whitelist of fund depositor.
event LogWhitelistDepositors(address[] depositors);
Parameters
Name | Type | Description |
---|---|---|
depositors | address[] | list of address that are granted to depositor role. |
LogBlacklistDepositors
Event describing the blacklist of fund depositor.
event LogBlacklistDepositors(address[] depositors);
Parameters
Name | Type | Description |
---|---|---|
depositors | address[] | list of address who depositor role is revoked. |
Errors
MintZero
error MintZero();
BurnZero
error BurnZero();
BurnOverflow
error BurnOverflow();
DepositorAlreadyWhitelisted
error DepositorAlreadyWhitelisted();
NotAlreadyWhitelistedDepositor
error NotAlreadyWhitelistedDepositor();
OnlyDepositor
error OnlyDepositor();
IArrakisMetaVaultPublic
Functions
mint
function used to mint share of the vault position
function mint(
uint256 shares_,
address receiver_
) external payable returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount representing the part of the position owned by receiver. |
receiver_ | address | address where share token will be sent. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 deposited. |
amount1 | uint256 | amount of token1 deposited. |
burn
function used to burn share of the vault position.
function burn(
uint256 shares_,
address receiver_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount of share that will be burn. |
receiver_ | address | address where underlying tokens will be sent. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
Events
LogMint
event emitted when a user mint some shares on a public vault.
event LogMint(
uint256 shares, address receiver, uint256 amount0, uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | amount of shares minted. |
receiver | address | address that will receive the LP token (shares). |
amount0 | uint256 | amount of token0 needed to mint shares. |
amount1 | uint256 | amount of token1 needed to mint shares. |
LogBurn
event emitted when a user burn some of his shares.
event LogBurn(
uint256 shares, address receiver, uint256 amount0, uint256 amount1
);
Parameters
Name | Type | Description |
---|---|---|
shares | uint256 | amount of share burned by the user. |
receiver | address | address that will receive amounts of tokens related to burning the shares. |
amount0 | uint256 | amount of token0 that is collected from burning shares. |
amount1 | uint256 | amount of token1 that is collected from burning shares. |
Errors
MintZero
error MintZero();
BurnZero
error BurnZero();
IArrakisPrivateHook
Functions
setFee
function setFee(PoolKey calldata poolKey_, uint24 fee_) external;
module
function module() external view returns (address);
vault
function vault() external view returns (address);
manager
function manager() external view returns (address);
fee
function fee() external view returns (uint24);
poolManager
function poolManager() external view returns (address);
Events
SetFee
event SetFee(uint24 fee);
Errors
AddressZero
error AddressZero();
OnlyModule
error OnlyModule();
NotImplemented
error NotImplemented();
OnlyVaultExecutor
error OnlyVaultExecutor();
IArrakisPrivateHookFactory
Functions
createPrivateHook
function createPrivateHook(
address module_,
bytes32 salt_
) external returns (address hook);
addressOf
function addressOf(
bytes32 salt_
) external view returns (address);
Errors
AddressZero
error AddressZero();
IArrakisPrivateVaultRouter
Functions
pause
function used to pause the router.
only callable by owner
function pause() external;
unpause
function used to unpause the router.
only callable by owner
function unpause() external;
addLiquidity
addLiquidity adds liquidity to meta vault of interest (mints L tokens)
function addLiquidity(
AddLiquidityData memory params_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(
SwapAndAddData memory params_
)
external
payable
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(
AddLiquidityPermit2Data memory params_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of iPnterest (mints L tokens)
function wrapAndAddLiquidity(
AddLiquidityData memory params_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(
SwapAndAddData memory params_
)
external
payable
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to public vault of interest (mints LP tokens)
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
Events
Swapped
event emitted when a swap happen before depositing.
event Swapped(
bool zeroForOne,
uint256 amount0Diff,
uint256 amount1Diff,
uint256 amountOutSwap
);
Parameters
Name | Type | Description |
---|---|---|
zeroForOne | bool | boolean indicating if we are swap token0 to token1 or the inverse. |
amount0Diff | uint256 | amount of token0 get or consumed by the swap. |
amount1Diff | uint256 | amount of token1 get or consumed by the swap. |
amountOutSwap | uint256 | minimum amount of tokens out wanted after swap. |
Errors
AddressZero
error AddressZero();
NotEnoughNativeTokenSent
error NotEnoughNativeTokenSent();
OnlyPrivateVault
error OnlyPrivateVault();
OnlyDepositor
error OnlyDepositor();
RouterIsNotDepositor
error RouterIsNotDepositor();
EmptyAmounts
error EmptyAmounts();
LengthMismatch
error LengthMismatch();
Deposit0
error Deposit0();
Deposit1
error Deposit1();
MsgValueZero
error MsgValueZero();
NativeTokenNotSupported
error NativeTokenNotSupported();
MsgValueDTAmount
error MsgValueDTAmount();
NoWethToken
error NoWethToken();
Permit2WethNotAuthorized
error Permit2WethNotAuthorized();
IArrakisPublicVaultRouter
Functions
pause
function used to pause the router.
only callable by owner
function pause() external;
unpause
function used to unpause the router.
only callable by owner
function unpause() external;
addLiquidity
addLiquidity adds liquidity to meta vault of interest (mints L tokens)
function addLiquidity(AddLiquidityData memory params_)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidity
removeLiquidity removes liquidity from vault and burns LP tokens
function removeLiquidity(RemoveLiquidityData memory params_)
external
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityData | RemoveLiquidityData struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(AddLiquidityPermit2Data memory params_)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidityPermit2
removeLiquidityPermit2 removes liquidity from vault and burns LP tokens
function removeLiquidityPermit2(
RemoveLiquidityPermit2Data memory params_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityPermit2Data | RemoveLiquidityPermit2Data struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of interest (mints L tokens)
function wrapAndAddLiquidity(AddLiquidityData memory params_)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to public vault of interest (mints LP tokens)
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
Events
Swapped
event emitted when a swap happen before depositing.
event Swapped(
bool zeroForOne,
uint256 amount0Diff,
uint256 amount1Diff,
uint256 amountOutSwap
);
Parameters
Name | Type | Description |
---|---|---|
zeroForOne | bool | boolean indicating if we are swap token0 to token1 or the inverse. |
amount0Diff | uint256 | amount of token0 get or consumed by the swap. |
amount1Diff | uint256 | amount of token1 get or consumed by the swap. |
amountOutSwap | uint256 | minimum amount of tokens out wanted after swap. |
Errors
AddressZero
error AddressZero();
NotEnoughNativeTokenSent
error NotEnoughNativeTokenSent();
NoNativeTokenAndValueNotZero
error NoNativeTokenAndValueNotZero();
OnlyPublicVault
error OnlyPublicVault();
EmptyMaxAmounts
error EmptyMaxAmounts();
NothingToMint
error NothingToMint();
NothingToBurn
error NothingToBurn();
BelowMinAmounts
error BelowMinAmounts();
SwapCallFailed
error SwapCallFailed();
ReceivedBelowMinimum
error ReceivedBelowMinimum();
LengthMismatch
error LengthMismatch();
NoNativeToken
error NoNativeToken();
MsgValueZero
error MsgValueZero();
NativeTokenNotSupported
error NativeTokenNotSupported();
MsgValueDTMaxAmount
error MsgValueDTMaxAmount();
NoWethToken
error NoWethToken();
Permit2WethNotAuthorized
error Permit2WethNotAuthorized();
IArrakisStandardManager
Functions
initialize
function used to initialize standard manager proxy.
function initialize(
address owner_,
address defaultReceiver_,
address factory_
) external;
Parameters
Name | Type | Description |
---|---|---|
owner_ | address | address of the owner of standard manager. |
defaultReceiver_ | address | address of the receiver of tokens (by default). |
factory_ | address | ArrakisMetaVaultFactory contract address. |
pause
function used to pause the manager.
only callable by guardian
function pause() external;
unpause
function used to unpause the manager.
only callable by guardian
function unpause() external;
setDefaultReceiver
function used to set the default receiver of tokens earned.
function setDefaultReceiver(address newDefaultReceiver_) external;
Parameters
Name | Type | Description |
---|---|---|
newDefaultReceiver_ | address | address of the new default receiver of tokens. |
setReceiverByToken
function used to set receiver of a specific token.
function setReceiverByToken(
address vault_,
bool isSetReceiverToken0_,
address receiver_
) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the meta vault that contain the specific token. |
isSetReceiverToken0_ | bool | boolean if true means that receiver is for token0 if not it's for token1. |
receiver_ | address | address of the receiver of this specific token. |
decreaseManagerFeePIPS
function used to decrease the fees taken by manager for a specific managed vault.
function decreaseManagerFeePIPS(
address vault_,
uint24 newFeePIPS_
) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault. |
newFeePIPS_ | uint24 | fees in pips to set on the specific vault. |
finalizeIncreaseManagerFeePIPS
function used to finalize a time lock fees increase on a vault.
function finalizeIncreaseManagerFeePIPS(address vault_) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault where the fees increase will be applied. |
submitIncreaseManagerFeePIPS
function used to submit a fees increase in a managed vault.
function submitIncreaseManagerFeePIPS(
address vault_,
uint24 newFeePIPS_
) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault where fees will be increase after timeLock. |
newFeePIPS_ | uint24 | fees in pips to set on the specific managed vault. |
withdrawManagerBalance
function used by manager to get his balance of fees earned on a vault.
function withdrawManagerBalance(address vault_)
external
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | from which fees will be collected. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to receiver_ |
amount1 | uint256 | amount of token1 sent to receiver_ |
rebalance
function used to manage vault's strategy.
function rebalance(
address vault_,
bytes[] calldata payloads_
) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault that need a rebalance. |
payloads_ | bytes[] | call data to do specific action of vault side. |
setModule
function used to set a new module (strategy) for the vault.
function setModule(
address vault_,
address module_,
bytes[] calldata payloads_
) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault the manager want to change module. |
module_ | address | address of the new module. |
payloads_ | bytes[] | call data to initialize position on the new module. |
initManagement
function used to init management of a meta vault.
function initManagement(SetupParams calldata params_) external;
Parameters
Name | Type | Description |
---|---|---|
params_ | SetupParams | struct containing all the data for initialize the vault. |
updateVaultInfo
function used to update meta vault management informations.
function updateVaultInfo(SetupParams calldata params_) external;
Parameters
Name | Type | Description |
---|---|---|
params_ | SetupParams | struct containing all the data for updating the vault. |
announceStrategy
function used to announce the strategy that the vault will follow.
function announceStrategy(
address vault_,
string memory strategy_
) external;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of arrakis meta vault that will follow the strategy. |
strategy_ | string | string containing the strategy name that will be used. |
initializedVaults
function used to get a list of managed vaults.
function initializedVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | starting index from which the caller want to read the array of managed vaults. |
endIndex_ | uint256 | ending index until which the caller want to read the array of managed vaults. |
numInitializedVaults
function used to get the number of vault under management.
function numInitializedVaults()
external
view
returns (uint256 numberOfVaults);
guardian
address of the pauser of manager.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | pauser address that can pause/unpause manager. |
factory
address of the vault factory.
function factory() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | factory address that can deploy meta vault. |
defaultFeePIPS
function used to get the default fee applied on manager vault.
function defaultFeePIPS() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | defaultFeePIPS amount of default fees. |
nativeToken
function used to get the native token/coin of the chain.
function nativeToken() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | nativeToken address of the native token/coin of the chain. |
nativeTokenDecimals
function used to get the native token/coin decimals precision.
function nativeTokenDecimals() external view returns (uint8);
Returns
Name | Type | Description |
---|---|---|
<none> | uint8 | nativeTokenDecimals decimals precision of the native coin. |
defaultReceiver
function used to get the default receiver of tokens earned in managed vault.
function defaultReceiver() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | defaultReceiver address of the default receiver. |
receiversByToken
function used to get the receiver of a specific token.
function receiversByToken(address token_)
external
view
returns (address receiver);
Parameters
Name | Type | Description |
---|---|---|
token_ | address | address of the ERC20 token that we want the receiver of |
Returns
Name | Type | Description |
---|---|---|
receiver | address | address of the receiver of 'token_' |
vaultInfo
function used to get vault management config.
function vaultInfo(address vault_)
external
view
returns (
uint256 lastRebalance,
uint256 cooldownPeriod,
IOracleWrapper oracle,
uint24 maxDeviation,
address executor,
address stratAnnouncer,
uint24 maxSlippagePIPS,
uint24 managerFeePIPS
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the metaVault. |
Returns
Name | Type | Description |
---|---|---|
lastRebalance | uint256 | timestamp when the last rebalance happen. |
cooldownPeriod | uint256 | minimum duration between two rebalance. |
oracle | IOracleWrapper | oracle used to check against price manipulation. |
maxDeviation | uint24 | maximum deviation from oracle price allowed. |
executor | address | address that can trigger a rebalance. |
stratAnnouncer | address | address that will announce a strategy to follow. |
maxSlippagePIPS | uint24 | maximum slippage authorized. |
managerFeePIPS | uint24 | fees that manager take. |
Events
LogWhitelistNftRebalancers
event LogWhitelistNftRebalancers(address[] nftRebalancers);
LogBlacklistNftRebalancers
event LogBlacklistNftRebalancers(address[] nftRebalancers);
LogWhitelistStrategies
event LogWhitelistStrategies(string[] strategies);
LogSetManagementParams
event LogSetManagementParams(
address indexed vault,
address oracle,
uint24 maxSlippagePIPS,
uint24 maxDeviation,
uint256 cooldownPeriod,
address executor,
address stratAnnouncer
);
LogSetVaultData
event LogSetVaultData(address indexed vault, bytes datas);
LogSetVaultStrat
event LogSetVaultStrat(address indexed vault, string strat);
LogFundBalance
event LogFundBalance(address indexed vault, uint256 balance);
LogWithdrawVaultBalance
event LogWithdrawVaultBalance(
address indexed vault,
uint256 amount,
address receiver,
uint256 newBalance
);
LogSetDefaultReceiver
event LogSetDefaultReceiver(address oldReceiver, address newReceiver);
LogSetReceiverByToken
event LogSetReceiverByToken(address indexed token, address receiver);
LogWithdrawManagerBalance
event LogWithdrawManagerBalance(
address indexed receiver0,
address indexed receiver1,
uint256 amount0,
uint256 amount1
);
LogChangeManagerFee
event LogChangeManagerFee(address vault, uint256 newFeePIPS);
LogIncreaseManagerFeeSubmission
event LogIncreaseManagerFeeSubmission(
address vault, uint256 newFeePIPS
);
LogRebalance
event LogRebalance(address indexed vault, bytes[] payloads);
LogSetModule
event LogSetModule(
address indexed vault, address module, bytes[] payloads
);
LogSetFactory
event LogSetFactory(address vaultFactory);
LogStrategyAnnouncement
event LogStrategyAnnouncement(address vault, string strategy);
Errors
EmptyNftRebalancersArray
error EmptyNftRebalancersArray();
NotWhitelistedNftRebalancer
error NotWhitelistedNftRebalancer(address nftRebalancer);
AlreadyWhitelistedNftRebalancer
error AlreadyWhitelistedNftRebalancer(address nftRebalancer);
OnlyNftRebalancers
error OnlyNftRebalancers(address caller);
EmptyString
error EmptyString();
StratAlreadyWhitelisted
error StratAlreadyWhitelisted();
StratNotWhitelisted
error StratNotWhitelisted();
OnlyPrivateVault
error OnlyPrivateVault();
OnlyERC20Vault
error OnlyERC20Vault();
OnlyVaultOwner
error OnlyVaultOwner(address caller, address vaultOwner);
AlreadyInManagement
error AlreadyInManagement();
NotTheManager
error NotTheManager(address caller, address manager);
SlippageTooHigh
error SlippageTooHigh();
MaxDeviationTooHigh
error MaxDeviationTooHigh();
CooldownPeriodSetToZero
error CooldownPeriodSetToZero();
ValueDtBalanceInputed
error ValueDtBalanceInputed(uint256 value, uint256 balance);
OnlyOwner
error OnlyOwner();
OnlyManagedVault
error OnlyManagedVault();
DataIsUpdated
error DataIsUpdated();
SameStrat
error SameStrat();
NotWhitelistedStrat
error NotWhitelistedStrat();
NotNativeCoinSent
error NotNativeCoinSent();
NoEnoughBalance
error NoEnoughBalance();
OverMaxSlippage
error OverMaxSlippage();
NativeTokenDecimalsZero
error NativeTokenDecimalsZero();
NotFeeDecrease
error NotFeeDecrease();
AlreadyPendingIncrease
error AlreadyPendingIncrease();
NotFeeIncrease
error NotFeeIncrease();
TimeNotPassed
error TimeNotPassed();
NoPendingIncrease
error NoPendingIncrease();
NotExecutor
error NotExecutor();
NotStratAnnouncer
error NotStratAnnouncer();
AddressZero
error AddressZero();
NotWhitelistedVault
error NotWhitelistedVault(address vault);
AlreadyWhitelistedVault
error AlreadyWhitelistedVault(address vault);
EmptyVaultsArray
error EmptyVaultsArray();
CallFailed
error CallFailed(bytes payload);
StartIndexLtEndIndex
error StartIndexLtEndIndex(uint256 startIndex, uint256 endIndex);
EndIndexGtNbOfVaults
error EndIndexGtNbOfVaults(uint256 endIndex, uint256 numberOfVaults);
OnlyGuardian
error OnlyGuardian(address caller, address guardian);
OnlyFactory
error OnlyFactory(address caller, address factory);
VaultNotDeployed
error VaultNotDeployed();
SetManagerFeeCallNotAllowed
error SetManagerFeeCallNotAllowed();
OnlyStratAnnouncer
error OnlyStratAnnouncer();
PublicVaultTotalSupplyChanged
error PublicVaultTotalSupplyChanged();
IArrakisV2
Functions
token0
function token0() external view returns (IERC20);
token1
function token1() external view returns (IERC20);
IBunkerModule
Functions
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the bunker module.
function initialize(address metaVault_) external;
Parameters
Name | Type | Description |
---|---|---|
metaVault_ | address | address of the meta vault |
Errors
NotImplemented
error NotImplemented();
AmountsZeros
error AmountsZeros();
ICLGauge
Functions
nft
function nft() external view returns (INonfungiblePositionManager);
voter
function voter() external view returns (IVoter);
feesVotingReward
function feesVotingReward() external view returns (address);
periodFinish
function periodFinish() external view returns (uint256);
rewardRate
function rewardRate() external view returns (uint256);
rewards
function rewards(
uint256 tokenId
) external view returns (uint256);
lastUpdateTime
function lastUpdateTime(
uint256 tokenId
) external view returns (uint256);
rewardRateByEpoch
function rewardRateByEpoch(
uint256
) external view returns (uint256);
fees0
function fees0() external view returns (uint256);
fees1
function fees1() external view returns (uint256);
WETH9
function WETH9() external view returns (address);
token0
function token0() external view returns (address);
token1
function token1() external view returns (address);
tickSpacing
function tickSpacing() external view returns (int24);
left
function left() external view returns (uint256 _left);
rewardToken
function rewardToken() external view returns (address);
isPool
function isPool() external view returns (bool);
supportsPayable
function supportsPayable() external view returns (bool);
rewardGrowthInside
function rewardGrowthInside(
uint256 tokenId
) external view returns (uint256);
initialize
function initialize(
address _pool,
address _feesVotingReward,
address _rewardToken,
address _voter,
address _nft,
address _token0,
address _token1,
int24 _tickSpacing,
bool _isPool
) external;
earned
function earned(
address account,
uint256 tokenId
) external view returns (uint256);
getReward
function getReward(
address account
) external;
getReward
function getReward(
uint256 tokenId
) external;
notifyRewardAmount
function notifyRewardAmount(
uint256 amount
) external;
notifyRewardWithoutClaim
function notifyRewardWithoutClaim(
uint256 amount
) external;
deposit
function deposit(
uint256 tokenId
) external;
withdraw
function withdraw(
uint256 tokenId
) external;
stakedValues
function stakedValues(
address depositor
) external view returns (uint256[] memory);
stakedByIndex
function stakedByIndex(
address depositor,
uint256 index
) external view returns (uint256);
stakedContains
function stakedContains(
address depositor,
uint256 tokenId
) external view returns (bool);
stakedLength
function stakedLength(
address depositor
) external view returns (uint256);
Events
NotifyReward
event NotifyReward(address indexed from, uint256 amount);
Deposit
event Deposit(
address indexed user,
uint256 indexed tokenId,
uint128 indexed liquidityToStake
);
Withdraw
event Withdraw(
address indexed user,
uint256 indexed tokenId,
uint128 indexed liquidityToStake
);
ClaimFees
event ClaimFees(
address indexed from, uint256 claimed0, uint256 claimed1
);
ClaimRewards
event ClaimRewards(address indexed from, uint256 amount);
ICreationCode
Functions
getCreationCode
function getCreationCode() external pure returns (bytes memory);
IDistributor
Functions
claim
Claims rewards for a given set of users
Unless another address has been approved for claiming, only an address can claim for itself
function claim(
address[] calldata users,
address[] calldata tokens,
uint256[] calldata amounts,
bytes32[][] calldata proofs
) external;
Parameters
Name | Type | Description |
---|---|---|
users | address[] | Addresses for which claiming is taking place |
tokens | address[] | ERC20 token claimed |
amounts | uint256[] | Amount of tokens that will be sent to the corresponding users |
proofs | bytes32[][] | Array of hashes bridging from a leaf `(hash of user |
toggleOperator
Toggles whitelisting for a given user and a given operator
When an operator is whitelisted for a user, the operator can claim rewards on behalf of the user
function toggleOperator(address user, address operator) external;
IGuardian
Functions
pauser
function to get the address of the pauser of arrakis protocol.
function pauser() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | pauser address that can pause the arrakis protocol. |
setPauser
function to set the pauser of Arrakis protocol.
function setPauser(address newPauser_) external;
Events
LogSetPauser
event emitted when the pauser is set by the owner of the Guardian.
event LogSetPauser(address oldPauser, address newPauser);
Parameters
Name | Type | Description |
---|---|---|
oldPauser | address | address of the previous pauser. |
newPauser | address | address of the current pauser. |
Errors
AddressZero
error AddressZero();
SamePauser
error SamePauser();
IHOTExecutor
Functions
setW3f
function setW3f(address newW3f_) external;
rebalance
function rebalance(
address vault_,
bytes[] calldata payloads_,
uint256 expectedReservesAmount_,
bool zeroToOne_
) external;
manager
function manager() external view returns (address);
w3f
function w3f() external view returns (address);
Events
LogSetW3f
event LogSetW3f(address newW3f);
Errors
AddressZero
error AddressZero();
SameW3f
error SameW3f();
UnexpectedReservesAmount0
error UnexpectedReservesAmount0();
UnexpectedReservesAmount1
error UnexpectedReservesAmount1();
OnlyW3F
error OnlyW3F();
IManager
Functions
getInitManagementSelector
function used to know the selector of initManagement functions.
function getInitManagementSelector()
external
pure
returns (bytes4 selector);
isManaged
function used to know if a vault is under management by this manager.
function isManaged(address vault_)
external
view
returns (bool isManaged);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the meta vault the caller want to check. |
Returns
Name | Type | Description |
---|---|---|
isManaged | bool | boolean which is true if the vault is under management, false otherwise. |
IMigrationHelper
Functions
migrateVault
Migrate a vault from ArrakisV2 to ArrakisMetaVaultPrivate.
can be called by the owner of this migration helper or by the safe.
function migrateVault(
Migration calldata params_
) external returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | Migration | Migration struct, containing informations about how to migrate from ArrakisV2 vault to a modular vault. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the new ArrakisMetaVaultPrivate vault. |
palmTerms
Get the address of the arrakisV2 PALMTerms contract.
function palmTerms() external view returns (address);
factory
Get the address of the arrakis modular meta vault factory.
function factory() external view returns (address);
manager
Get the address of the arrakis standard manager.
function manager() external view returns (address);
poolManager
Get the address of the uni v4 pool manager.
function poolManager() external view returns (address);
weth
Get the address of the WETH.
function weth() external view returns (address);
Errors
AddressZero
Error emitted when the address is zero.
error AddressZero();
CloseTermsErr
Error emitted when closing arrakisV2 vault fails.
error CloseTermsErr();
WhitelistDepositorErr
Error emitted when whitelisting safe as depositor fails.
error WhitelistDepositorErr();
Approval0Err
Error emitted when approving module to use token0 fails.
error Approval0Err();
Approval1Err
Error emitted when approving module to use token1 fails.
error Approval1Err();
DepositErr
Error emitted when depositing through the safe fails.
error DepositErr();
RebalanceErr
Error emitted when rebalancing the new ArrakisMetaVaultPrivate fails.
error RebalanceErr();
ChangeExecutorErr
Error emitted when updating the executor fails.
error ChangeExecutorErr();
WithdrawETH
Error emitted when withdrawing ETH from WETH sm fails.
error WithdrawETH();
InvalidSqrtPrice
Error emitted when pool creation fails due to initial sqrtPrice not provided by payload.
error InvalidSqrtPrice();
VaultCreationErr
Error emitted when vault creation fails.
error VaultCreationErr();
UnableModuleErr
Error emitted when disable module fails.
error UnableModuleErr();
PayloadOutdated
Error emitted when the new uni V4 pool creation with an outdated price.
error PayloadOutdated();
Structs
InternalStruct
struct InternalStruct {
bytes payload;
bool success;
address token0;
address token1;
uint256 amount0;
uint256 amount1;
uint256 value;
bool isInversed;
}
CloseTerm
Struct containing informations about the close term.
struct CloseTerm {
IArrakisV2 vault;
address newOwner;
address newManager;
}
PoolCreation
Struct containing informations about the v4 Pool that should be used on the new vault. If createPool is true, the pool will be created.
struct PoolCreation {
PoolKey poolKey;
uint160 sqrtPriceX96;
}
VaultCreation
Struct containing informations about the new ArrakisMetaVaultPrivate vault to be created.
struct VaultCreation {
bytes32 salt;
address upgradeableBeacon;
uint256 init0;
uint256 init1;
IOracleWrapper oracle;
bool isUniV4OracleNeedInitilization;
uint24 maxDeviation;
uint256 cooldownPeriod;
address stratAnnouncer;
uint24 maxSlippage;
}
Migration
Struct containing informations about the migration.
struct Migration {
address safe;
CloseTerm closeTerm;
PoolCreation poolCreation;
VaultCreation vaultCreation;
bytes[] rebalancePayloads;
address executor;
uint256 timestampLimit;
}
IModulePrivateRegistry
Events
LogCreatePrivateModule
Log creation of a private module.
event LogCreatePrivateModule(
address beacon,
bytes payload,
address vault,
address creator,
address module
);
Parameters
Name | Type | Description |
---|---|---|
beacon | address | which beacon from who we get the implementation. |
payload | bytes | payload sent to the module constructor. |
vault | address | address of the Arrakis Meta Vault that will own this module |
creator | address | address that create the module. |
module | address | address of the newly created module. |
Errors
NotPrivateVault
error NotPrivateVault();
IModulePublicRegistry
Events
LogCreatePublicModule
Log creation of a public module.
event LogCreatePublicModule(
address beacon,
bytes payload,
address vault,
address creator,
address module
);
Parameters
Name | Type | Description |
---|---|---|
beacon | address | which beacon from who we get the implementation. |
payload | bytes | payload sent to the module constructor. |
vault | address | address of the Arrakis Meta Vault that will own this module |
creator | address | address that create the module. |
module | address | address of the newly created module. |
Errors
NotPublicVault
error NotPublicVault();
IModuleRegistry
Author: Arrakis Team.
interface of module registry that contains all whitelisted modules.
Functions
beacons
function to get the whitelisted list of IBeacon that have module as implementation.
function beacons() external view returns (address[] memory beacons);
Returns
Name | Type | Description |
---|---|---|
beacons | address[] | list of upgradeable beacon. |
beaconsContains
function to know if the beacons enumerableSet contain beacon_
function beaconsContains(address beacon_)
external
view
returns (bool isContained);
Parameters
Name | Type | Description |
---|---|---|
beacon_ | address | beacon address to check |
guardian
function used to get the guardian address of arrakis protocol.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
admin
function used to get the admin address that can upgrade beacon implementation.
admin address should be a timelock contract.
function admin() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | admin address that can upgrade beacon implementation. |
initialize
function used to initialize module registry.
function initialize(address factory_) external;
Parameters
Name | Type | Description |
---|---|---|
factory_ | address | address of ArrakisMetaVaultFactory, who is the only one who can call the init management function. |
whitelistBeacons
function used to whitelist IBeacon that contain implementation of valid module.
function whitelistBeacons(address[] calldata beacons_) external;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | list of beacon to whitelist. |
blacklistBeacons
function used to blacklist IBeacon that contain implementation of unvalid (from now) module.
function blacklistBeacons(address[] calldata beacons_) external;
Parameters
Name | Type | Description |
---|---|---|
beacons_ | address[] | list of beacon to blacklist. |
createModule
function used to create module instance that can be whitelisted as module inside a vault.
function createModule(
address vault_,
address beacon_,
bytes calldata payload_
) external returns (address module);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | |
beacon_ | address | which whitelisted beacon's implementation we want to create an instance of. |
payload_ | bytes | payload to create the module. |
Events
LogWhitelistBeacons
Log whitelist action of beacons.
event LogWhitelistBeacons(address[] beacons);
Parameters
Name | Type | Description |
---|---|---|
beacons | address[] | list of beacons whitelisted. |
LogBlacklistBeacons
Log blacklist action of beacons.
event LogBlacklistBeacons(address[] beacons);
Parameters
Name | Type | Description |
---|---|---|
beacons | address[] | list of beacons blacklisted. |
Errors
AddressZero
error AddressZero();
AlreadyWhitelistedBeacon
error AlreadyWhitelistedBeacon(address beacon);
NotAlreadyWhitelistedBeacon
error NotAlreadyWhitelistedBeacon(address beacon);
NotWhitelistedBeacon
error NotWhitelistedBeacon();
NotBeacon
error NotBeacon();
ModuleNotLinkedToMetaVault
error ModuleNotLinkedToMetaVault();
NotSameGuardian
error NotSameGuardian();
NotSameAdmin
error NotSameAdmin();
INonfungiblePositionManager
Functions
mint
function mint(
MintParams calldata params
)
external
payable
returns (
uint256 tokenId,
uint128 liquidity,
uint256 amount0,
uint256 amount1
);
increaseLiquidity
function increaseLiquidity(
IncreaseLiquidityParams calldata params
)
external
payable
returns (uint128 liquidity, uint256 amount0, uint256 amount1);
decreaseLiquidity
function decreaseLiquidity(
DecreaseLiquidityParams calldata params
) external payable returns (uint256 amount0, uint256 amount1);
collect
function collect(
CollectParams calldata params
) external payable returns (uint256 amount0, uint256 amount1);
burn
function burn(
uint256 tokenId
) external payable;
positions
function positions(
uint256 tokenId
)
external
view
returns (
uint96 nonce,
address operator,
address token0,
address token1,
int24 tickSpacing,
int24 tickLower,
int24 tickUpper,
uint128 liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
approve
function approve(address to, uint256 tokenId) external;
Structs
MintParams
struct MintParams {
address token0;
address token1;
int24 tickSpacing;
int24 tickLower;
int24 tickUpper;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
address recipient;
uint256 deadline;
uint160 sqrtPriceX96;
}
IncreaseLiquidityParams
struct IncreaseLiquidityParams {
uint256 tokenId;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
uint256 deadline;
}
DecreaseLiquidityParams
struct DecreaseLiquidityParams {
uint256 tokenId;
uint128 liquidity;
uint256 amount0Min;
uint256 amount1Min;
uint256 deadline;
}
CollectParams
struct CollectParams {
uint256 tokenId;
address recipient;
uint128 amount0Max;
uint128 amount1Max;
}
IOracleWrapper
Functions
getPrice0
function used to get price0.
function getPrice0() external view returns (uint256 price0);
Returns
Name | Type | Description |
---|---|---|
price0 | uint256 | price of token0/token1. |
getPrice1
function used to get price1.
function getPrice1() external view returns (uint256 price1);
Returns
Name | Type | Description |
---|---|---|
price1 | uint256 | price of token1/token0. |
Errors
AddressZero
error AddressZero();
DecimalsToken0Zero
error DecimalsToken0Zero();
DecimalsToken1Zero
error DecimalsToken1Zero();
IOwnable
Functions
owner
function used to get the owner of this contract.
function owner() external view returns (address);
IPALMTerms
Functions
closeTerm
function closeTerm(
IArrakisV2 vault_,
address to_,
address newOwner_,
address newManager_
) external;
IPancakeSwapV4StandardModule
Functions
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the uniswap v4 standard module.
this function will deposit fund as left over on poolManager.
function initialize(
uint256 init0_,
uint256 init1_,
bool isInversed_,
PoolKey calldata poolKey_,
IOracleWrapper oracle_,
uint24 maxSlippage_,
address metaVault_
) external;
Parameters
Name | Type | Description |
---|---|---|
init0_ | uint256 | initial amount of token0 to provide to uniswap standard module. |
init1_ | uint256 | initial amount of token1 to provide to valantis module. |
isInversed_ | bool | boolean to check if the poolKey's currencies pair are inversed, compared to the module's tokens pair. |
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
oracle_ | IOracleWrapper | address of the oracle used by the uniswap v4 standard module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault |
approve
function approve(
address spender_,
address[] calldata tokens_,
uint256[] calldata amounts
) external;
setPool
function used to set the pool for the module.
function setPool(
PoolKey calldata poolKey_,
LiquidityRange[] calldata liquidityRanges_,
SwapPayload calldata swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
) external;
Parameters
Name | Type | Description |
---|---|---|
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module on the new pool. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
LiquidityRange[] calldata liquidityRanges_,
SwapPayload memory swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
)
external
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Parameters
Name | Type | Description |
---|---|---|
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
Returns
Name | Type | Description |
---|---|---|
amount0Minted | uint256 | amount of token0 minted. |
amount1Minted | uint256 | amount of token1 minted. |
amount0Burned | uint256 | amount of token0 burned. |
amount1Burned | uint256 | amount of token1 burned. |
withdrawEth
function used to withdraw eth from the module.
these fund will be used to swap eth to the other token of the currencyPair to rebalance the inventory inside a single tx.
function withdrawEth(
uint256 amount_
) external;
poolManager
function used to get the uniswap v4 pool manager.
function poolManager() external view returns (ICLPoolManager);
Returns
Name | Type | Description |
---|---|---|
<none> | ICLPoolManager | poolManager return the pool manager. |
isInversed
function used to know if the poolKey's currencies pair are inversed.
function isInversed() external view returns (bool);
vault
function vault() external view returns (IVault);
poolKey
function used to get the pool's key of the module.
function poolKey()
external
view
returns (
Currency currency0,
Currency currency1,
IHooks hooks,
IPoolManager poolManager,
uint24 fee,
bytes32 parameters
);
oracle
function used to get the oracle that will be used to proctect rebalances.
function oracle() external view returns (IOracleWrapper);
maxSlippage
function used to get the max slippage that can occur during swap rebalance.
function maxSlippage() external view returns (uint24);
getRanges
function used to get the list of active ranges.
function getRanges() external view returns (Range[] memory ranges);
Returns
Name | Type | Description |
---|---|---|
ranges | Range[] | active ranges |
Events
LogApproval
event LogApproval(
address indexed spender, address[] tokens, uint256[] amounts
);
LogRebalance
event LogRebalance(
LiquidityRange[] liquidityRanges,
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
LogSetPool
event LogSetPool(PoolKey oldPoolKey, PoolKey poolKey);
LogSetRewardReceiver
event LogSetRewardReceiver(address rewardReceiver);
Errors
Currency0DtToken0
error Currency0DtToken0(address currency0, address token0);
Currency1DtToken1
error Currency1DtToken1(address currency1, address token1);
Currency1DtToken0
error Currency1DtToken0(address currency1, address token0);
Currency0DtToken1
error Currency0DtToken1(address currency0, address token1);
RangeShouldBeActive
error RangeShouldBeActive(int24 tickLower, int24 tickUpper);
SqrtPriceZero
error SqrtPriceZero();
OverBurning
error OverBurning();
MaxSlippageGtTenPercent
error MaxSlippageGtTenPercent();
NativeCoinCannotBeToken1
error NativeCoinCannotBeToken1();
NoRemoveOrAddLiquidityHooks
error NoRemoveOrAddLiquidityHooks();
OnlyMetaVaultOwner
error OnlyMetaVaultOwner();
InsufficientFunds
error InsufficientFunds();
OverMaxDeviation
error OverMaxDeviation();
AmountZero
error AmountZero();
BurnToken0
error BurnToken0();
BurnToken1
error BurnToken1();
MintToken0
error MintToken0();
MintToken1
error MintToken1();
SamePool
error SamePool();
ExpectedMinReturnTooLow
error ExpectedMinReturnTooLow();
InvalidCurrencyDelta
error InvalidCurrencyDelta();
WrongRouter
error WrongRouter();
SlippageTooHigh
error SlippageTooHigh();
InvalidMsgValue
error InvalidMsgValue();
OnlyVault
error OnlyVault();
TicksMisordered
error TicksMisordered(int24 tickLower, int24 tickUpper);
TickLowerOutOfBounds
error TickLowerOutOfBounds(int24 tickLower);
TickUpperOutOfBounds
error TickUpperOutOfBounds(int24 tickUpper);
OnlyManagerOrVaultOwner
error OnlyManagerOrVaultOwner();
LengthsNotEqual
error LengthsNotEqual();
SameRewardReceiver
error SameRewardReceiver();
Structs
Range
struct Range {
int24 tickLower;
int24 tickUpper;
}
LiquidityRange
struct LiquidityRange {
Range range;
int128 liquidity;
}
IPancakeSwapV4StandardModuleResolver
Functions
poolManager
function poolManager() external returns (address);
computeMintAmounts
function computeMintAmounts(
uint256 current0_,
uint256 current1_,
uint256 totalSupply_,
uint256 amount0Max_,
uint256 amount1Max_
) external pure returns (uint256 mintAmount);
Errors
MaxAmountsTooLow
error MaxAmountsTooLow();
AddressZero
error AddressZero();
MintZero
error MintZero();
NotSupported
error NotSupported();
IPausable
Functions
pause
function pause() external;
unpause
function unpause() external;
IPauser
Functions
pause
function pause(address target_) external;
whitelistPausers
function whitelistPausers(address[] calldata pausers_) external;
blacklistPausers
function blacklistPausers(address[] calldata pausers_) external;
isPauser
function isPauser(address account) external view returns (bool);
Events
LogPauserWhitelisted
event LogPauserWhitelisted(address[] indexed pauser);
LogPauserBlacklisted
event LogPauserBlacklisted(address[] indexed pauser);
LogPause
event LogPause(address indexed target);
Errors
AddressZero
error AddressZero();
AlreadyPauser
error AlreadyPauser();
NotPauser
error NotPauser();
OnlyPauser
error OnlyPauser();
IPermit2
Functions
permitTransferFrom
function permitTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes calldata signature
) external;
permitTransferFrom
function permitTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes calldata signature
) external;
IPrivateRouterSwapExecutor
IPrivateVaultNFT
Functions
mint
function used to mint nft (representing a vault) and send it.
function mint(address to_, uint256 tokenId_) external;
Parameters
Name | Type | Description |
---|---|---|
to_ | address | address where to send the NFT. |
tokenId_ | uint256 | id of the NFT to mint. |
getMetaDatas
for doing meta data calls of tokens.
function getMetaDatas(
address token0_,
address token1_
)
external
view
returns (
uint8 decimals0,
uint8 decimals1,
string memory symbol0,
string memory symbol1
);
IRenderController
Functions
setRenderer
function used to set the renderer contract adress
only the owner can do it.
function setRenderer(address renderer_) external;
Parameters
Name | Type | Description |
---|---|---|
renderer_ | address | address of the contract that will render the tokenUri for the svg of the nft. |
isNFTSVG
for knowning if renderer is a NFTSVG contract.
function isNFTSVG(address renderer_) external view returns (bool);
renderer
NFTSVG contract that will generate the tokenURI.
function renderer() external view returns (address);
Events
LogSetRenderer
event LogSetRenderer(address newRenderer);
Errors
InvalidRenderer
error InvalidRenderer();
AddressZero
error AddressZero();
IResolver
Functions
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
IRouterSwapExecutor
Functions
swap
function used to swap tokens.
function swap(SwapAndAddData memory _swapData)
external
payable
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
_swapData | SwapAndAddData | struct containing all the informations for swapping. |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | the difference in token0 amount before and after the swap. |
amount1Diff | uint256 | the difference in token1 amount before and after the swap. |
Errors
OnlyRouter
error OnlyRouter(address caller, address router);
AddressZero
error AddressZero();
SwapCallFailed
error SwapCallFailed();
ReceivedBelowMinimum
error ReceivedBelowMinimum();
IRouterSwapResolver
Functions
calculateSwapAmount
function calculateSwapAmount(
IArrakisMetaVault vault,
uint256 amount0In,
uint256 amount1In,
uint256 price18Decimals
) external view returns (bool zeroForOne, uint256 swapAmount);
Errors
AddressZero
error AddressZero();
Operation
enum Operation {
Call,
DelegateCall
}
ISafe
Functions
execTransactionFromModule
Allows a Module to execute a Safe transaction without any further confirmations.
function execTransactionFromModule(
address to,
uint256 value,
bytes calldata data,
Operation operation
) external returns (bool success);
Parameters
Name | Type | Description |
---|---|---|
to | address | Destination address of module transaction. |
value | uint256 | Ether value of module transaction. |
data | bytes | Data payload of module transaction. |
operation | Operation | Operation type of module transaction. |
execTransactionFromModuleReturnData
function execTransactionFromModuleReturnData(
address to,
uint256 value,
bytes calldata data,
Operation operation
) external returns (bool success, bytes memory returnData);
disableModule
function disableModule(address prevModule, address module) external;
getModulesPaginated
function getModulesPaginated(
address start,
uint256 pageSize
) external view returns (address[] memory array, address next);
ISovereignPool
Functions
setPoolManagerFeeBips
function setPoolManagerFeeBips(uint256 poolManagerFeeBips_)
external;
setPoolManager
function setPoolManager(address manager_) external;
claimPoolManagerFees
function claimPoolManagerFees(
uint256 feeProtocol0Bips_,
uint256 feeProtocol1Bips_
)
external
returns (
uint256 feePoolManager0Received,
uint256 feePoolManager1Received
);
getPoolManagerFees
function getPoolManagerFees()
external
view
returns (uint256 poolManagerFee0, uint256 poolManagerFee1);
poolManagerFeeBips
function poolManagerFeeBips() external view returns (uint256);
getReserves
function getReserves() external view returns (uint256, uint256);
ITimeLock
Errors
NotImplemented
error NotImplemented();
IUniV4ModuleBase
Functions
poolKey
function poolKey() external view returns (PoolKey memory);
IUniV4Oracle
Functions
initialize
function initialize(
address module_
) external;
module
function module() external view returns (address);
poolManager
function poolManager() external view returns (address);
decimals0
function decimals0() external view returns (uint8);
decimals1
function decimals1() external view returns (uint8);
isInversed
function isInversed() external view returns (bool);
Errors
SqrtPriceZero
error SqrtPriceZero();
IUniV4StandardModule
Functions
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the uniswap v4 standard module.
this function will deposit fund as left over on poolManager.
function initialize(
uint256 init0_,
uint256 init1_,
bool isInversed_,
PoolKey calldata poolKey_,
IOracleWrapper oracle_,
uint24 maxSlippage_,
address metaVault_
) external;
Parameters
Name | Type | Description |
---|---|---|
init0_ | uint256 | initial amount of token0 to provide to uniswap standard module. |
init1_ | uint256 | initial amount of token1 to provide to valantis module. |
isInversed_ | bool | boolean to check if the poolKey's currencies pair are inversed, compared to the module's tokens pair. |
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
oracle_ | IOracleWrapper | address of the oracle used by the uniswap v4 standard module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault |
approve
function used to approve a spender to use the left over of the module.
function approve(
address spender_,
uint256 amount0_,
uint256 amount1_
) external;
Parameters
Name | Type | Description |
---|---|---|
spender_ | address | address that will be allowed to use left over. |
amount0_ | uint256 | amount of token0 allowed to be used by spender. |
amount1_ | uint256 | amount of token1 allowed to be used by spender. |
setPool
function used to set the pool for the module.
function setPool(
PoolKey calldata poolKey_,
LiquidityRange[] calldata liquidityRanges_,
SwapPayload calldata swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
) external;
Parameters
Name | Type | Description |
---|---|---|
poolKey_ | PoolKey | pool key of the uniswap v4 pool that will be used by the module. |
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module on the new pool. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
rebalance
function used to rebalance the inventory of the module.
function rebalance(
LiquidityRange[] calldata liquidityRanges_,
SwapPayload memory swapPayload_,
uint256 minBurn0_,
uint256 minBurn1_,
uint256 minDeposit0_,
uint256 minDeposit1_
)
external
returns (
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Parameters
Name | Type | Description |
---|---|---|
liquidityRanges_ | LiquidityRange[] | list of liquidity ranges to be used by the module. |
swapPayload_ | SwapPayload | swap payload to be used during rebalance. |
minBurn0_ | uint256 | minimum amount of token0 to burn. |
minBurn1_ | uint256 | minimum amount of token1 to burn. |
minDeposit0_ | uint256 | minimum amount of token0 to deposit. |
minDeposit1_ | uint256 | minimum amount of token1 to deposit. |
Returns
Name | Type | Description |
---|---|---|
amount0Minted | uint256 | amount of token0 minted. |
amount1Minted | uint256 | amount of token1 minted. |
amount0Burned | uint256 | amount of token0 burned. |
amount1Burned | uint256 | amount of token1 burned. |
withdrawEth
function used to withdraw eth from the module.
these fund will be used to swap eth to the other token of the currencyPair to rebalance the inventory inside a single tx.
function withdrawEth(
uint256 amount_
) external;
ethWithdrawers
function used to get eth withdrawers allowances.
function ethWithdrawers(
address
) external view returns (uint256);
getRanges
function used to get the list of active ranges.
function getRanges() external view returns (Range[] memory ranges);
Returns
Name | Type | Description |
---|---|---|
ranges | Range[] | active ranges |
poolKey
function used to get the pool's key of the module.
function poolKey()
external
view
returns (
Currency currency0,
Currency currency1,
uint24 fee,
int24 tickSpacing,
IHooks hooks
);
Returns
Name | Type | Description |
---|---|---|
currency0 | Currency | currency0 of the pool. |
currency1 | Currency | currency1 of the pool. |
fee | uint24 | fee of the pool. |
tickSpacing | int24 | tick spacing of the pool. |
hooks | IHooks | hooks of the pool. |
poolManager
function used to get the uniswap v4 pool manager.
function poolManager() external view returns (IPoolManager);
Returns
Name | Type | Description |
---|---|---|
<none> | IPoolManager | poolManager return the pool manager. |
isInversed
function used to know if the poolKey's currencies pair are inversed.
function isInversed() external view returns (bool);
maxSlippage
function used to get the max slippage that can occur during swap rebalance.
function maxSlippage() external view returns (uint24);
oracle
function used to get the oracle that will be used to proctect rebalances.
function oracle() external view returns (IOracleWrapper);
Events
LogApproval
event LogApproval(
address indexed spender, uint256 amount0, uint256 amount1
);
LogSetPool
event LogSetPool(PoolKey oldPoolKey, PoolKey poolKey);
LogRebalance
event LogRebalance(
LiquidityRange[] liquidityRanges,
uint256 amount0Minted,
uint256 amount1Minted,
uint256 amount0Burned,
uint256 amount1Burned
);
Errors
Currency0DtToken0
error Currency0DtToken0(address currency0, address token0);
Currency1DtToken1
error Currency1DtToken1(address currency1, address token1);
Currency1DtToken0
error Currency1DtToken0(address currency1, address token0);
Currency0DtToken1
error Currency0DtToken1(address currency0, address token1);
SqrtPriceZero
error SqrtPriceZero();
OnlyPoolManager
error OnlyPoolManager();
InvalidCurrencyDelta
error InvalidCurrencyDelta();
RangeShouldBeActive
error RangeShouldBeActive(int24 tickLower, int24 tickUpper);
OverBurning
error OverBurning();
TicksMisordered
error TicksMisordered(int24 tickLower, int24 tickUpper);
TickLowerOutOfBounds
error TickLowerOutOfBounds(int24 tickLower);
TickUpperOutOfBounds
error TickUpperOutOfBounds(int24 tickUpper);
SamePool
error SamePool();
NoRemoveOrAddLiquidityHooks
error NoRemoveOrAddLiquidityHooks();
OverMaxDeviation
error OverMaxDeviation();
NativeCoinCannotBeToken1
error NativeCoinCannotBeToken1();
MaxSlippageGtTenPercent
error MaxSlippageGtTenPercent();
ExpectedMinReturnTooLow
error ExpectedMinReturnTooLow();
WrongRouter
error WrongRouter();
SlippageTooHigh
error SlippageTooHigh();
OnlyMetaVaultOwner
error OnlyMetaVaultOwner();
InvalidMsgValue
error InvalidMsgValue();
InsufficientFunds
error InsufficientFunds();
AmountZero
error AmountZero();
BurnToken0
error BurnToken0();
BurnToken1
error BurnToken1();
MintToken0
error MintToken0();
MintToken1
error MintToken1();
Structs
Range
struct Range {
int24 tickLower;
int24 tickUpper;
}
LiquidityRange
struct LiquidityRange {
Range range;
int128 liquidity;
}
IUniV4StandardModuleResolver
Functions
poolManager
function poolManager() external returns (address);
computeMintAmounts
function computeMintAmounts(
uint256 current0_,
uint256 current1_,
uint256 totalSupply_,
uint256 amount0Max_,
uint256 amount1Max_
) external pure returns (uint256 mintAmount);
Errors
MaxAmountsTooLow
error MaxAmountsTooLow();
AddressZero
error AddressZero();
MintZero
error MintZero();
NotSupported
error NotSupported();
IUniswapV3Factory
Functions
getPool
function getPool(
address tokenA,
address tokenB,
int24 tickSpacing
) external view returns (address pool);
IUniswapV3Pool
Functions
swap
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
mint
function mint(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount,
bytes calldata data
) external returns (uint256 amount0, uint256 amount1);
burn
function burn(
int24 tickLower,
int24 tickUpper,
uint128 amount
) external returns (uint256 amount0, uint256 amount1);
collect
function collect(
address recipient,
int24 tickLower,
int24 tickUpper,
uint128 amount0Requested,
uint128 amount1Requested
) external returns (uint128 amount0, uint128 amount1);
slot0
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
bool unlocked
);
positions
function positions(
bytes32 key
)
external
view
returns (
uint128 _liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
ticks
function ticks(
int24 tick
)
external
view
returns (
uint128 liquidityGross,
int128 liquidityNet,
int128 stakedLiquidityNet,
uint256 feeGrowthOutside0X128,
uint256 feeGrowthOutside1X128,
uint256 rewardGrowthOutsideX128,
int56 tickCumulativeOutside,
uint160 secondsPerLiquidityOutsideX128,
uint32 secondsOutside,
bool initialized
);
feeGrowthGlobal0X128
function feeGrowthGlobal0X128() external view returns (uint256);
feeGrowthGlobal1X128
function feeGrowthGlobal1X128() external view returns (uint256);
tickSpacing
function tickSpacing() external view returns (int24);
IUniswapV3SwapCallback
Functions
uniswapV3SwapCallback
function uniswapV3SwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external;
IValantisHOTModule
Functions
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the valantis module. who can call deposit and withdraw functions.
function initialize(
address pool_,
uint256 init0_,
uint256 init1_,
uint24 maxSlippage_,
address metaVault_
) external;
Parameters
Name | Type | Description |
---|---|---|
pool_ | address | address of the valantis sovereign pool. |
init0_ | uint256 | initial amount of token0 to provide to valantis module. |
init1_ | uint256 | initial amount of token1 to provide to valantis module. |
maxSlippage_ | uint24 | allowed to manager for rebalancing the inventory using swap. |
metaVault_ | address | address of the meta vault |
setALMAndManagerFees
set HOT and initialize manager fees function.
function setALMAndManagerFees(
address alm_,
address oracle_
) external;
Parameters
Name | Type | Description |
---|---|---|
alm_ | address | address of the valantis HOT ALM. |
oracle_ | address | address of the oracle used by the valantis HOT module. |
setPriceBounds
fucntion used to set range on valantis AMM
function setPriceBounds(
uint160 _sqrtPriceLowX96,
uint160 _sqrtPriceHighX96,
uint160 _expectedSqrtSpotPriceLowerX96,
uint160 _expectedSqrtSpotPriceUpperX96
) external;
Parameters
Name | Type | Description |
---|---|---|
_sqrtPriceLowX96 | uint160 | lower bound of the range in sqrt price. |
_sqrtPriceHighX96 | uint160 | upper bound of the range in sqrt price. |
_expectedSqrtSpotPriceLowerX96 | uint160 | expected upper limit of current spot price (to prevent sandwich attack and manipulation). |
_expectedSqrtSpotPriceUpperX96 | uint160 | expected lower limit of current spot price (to prevent sandwich attack and manipulation). |
swap
function to swap token0->token1 or token1->token0 and then change inventory.
function swap(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
address router_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_,
bytes calldata payload_
) external;
Parameters
Name | Type | Description |
---|---|---|
zeroForOne_ | bool | boolean if true token0->token1, if false token1->token0. |
expectedMinReturn_ | uint256 | minimum amount of tokenOut expected. |
amountIn_ | uint256 | amount of tokenIn used during swap. |
router_ | address | address of smart contract that will execute swap. |
expectedSqrtSpotPriceUpperX96_ | uint160 | upper bound of current price. |
expectedSqrtSpotPriceLowerX96_ | uint160 | lower bound of current price. |
payload_ | bytes | data payload used for swapping. |
pool
function used to get the valantis hot pool.
function pool() external view returns (ISovereignPool);
alm
function used to get the valantis hot alm/ liquidity module.
function alm() external view returns (IHOT);
maxSlippage
function used to get the max slippage that can occur during swap rebalance.
function maxSlippage() external view returns (uint24);
oracle
function used to get the oracle that will be used to proctect rebalances.
function oracle() external view returns (IOracleWrapper);
Events
LogSetALM
event LogSetALM(address alm);
LogInitializePosition
event LogInitializePosition(uint256 amount0, uint256 amount1);
LogSwap
event LogSwap(
uint256 oldBalance0,
uint256 oldBalance1,
uint256 newBalance0,
uint256 newBalance1
);
Errors
NoNativeToken
error NoNativeToken();
OnlyPool
error OnlyPool(address caller, address pool);
AmountsZeros
error AmountsZeros();
NotImplemented
error NotImplemented();
ExpectedMinReturnTooLow
error ExpectedMinReturnTooLow();
MaxSlippageGtTenPercent
error MaxSlippageGtTenPercent();
NotDepositedAllToken0
error NotDepositedAllToken0();
NotDepositedAllToken1
error NotDepositedAllToken1();
OnlyMetaVaultOwner
error OnlyMetaVaultOwner();
ALMAlreadySet
error ALMAlreadySet();
SlippageTooHigh
error SlippageTooHigh();
NotEnoughToken0
error NotEnoughToken0();
NotEnoughToken1
error NotEnoughToken1();
SwapCallFailed
error SwapCallFailed();
OverMaxDeviation
error OverMaxDeviation();
WrongRouter
error WrongRouter();
IVoter
Functions
killGauge
function killGauge(
address _gauge
) external;
gauges
function gauges(
address pool
) external view returns (address);
isAlive
function isAlive(
address gauge
) external view returns (bool);
emergencyCouncil
function emergencyCouncil() external view returns (address);
IWETH9
IWithdrawHelper
Functions
withdraw
Withdraws the funds from the vault at any ratio.
function withdraw(
address safe_,
address vault_,
uint256 amount0_,
uint256 amount1_,
address payable receiver_
) external;
Parameters
Name | Type | Description |
---|---|---|
safe_ | address | The address of the safe that owns the vault. |
vault_ | address | The address of the vault to withdraw the funds from. |
amount0_ | uint256 | The amount of token0 to withdraw. |
amount1_ | uint256 | The amount of token1 to withdraw. |
receiver_ | address payable | The address that will receive the funds. |
Errors
InsufficientUnderlying
Error emitted when the withdraw try to withdraw more than the funds sitting on the vault.
error InsufficientUnderlying();
Unauthorized
Error emitted when the caller is not the safe.
error Unauthorized();
WithdrawErr
Error emitted when the withdraw fails.
error WithdrawErr();
WhitelistDepositorErr
Error emitted when whitelisting safe as depositor fails.
error WhitelistDepositorErr();
Transfer0Err
Error emitted when transfering token0 to receiver fails.
error Transfer0Err();
Transfer1Err
Error emitted when transfering token1 to receiver fails.
error Transfer1Err();
Approval0Err
Error emitted when approving module to use token0 fails.
error Approval0Err();
Approval1Err
Error emitted when approving module to use token1 fails.
error Approval1Err();
DepositErr
Error emitted when depositing through the safe fails.
error DepositErr();
Contents
PancakeSwapV4
Functions
rebalance
function rebalance(
IPancakeSwapV4StandardModule self,
PoolKey memory poolKey_,
IPancakeSwapV4StandardModule.LiquidityRange[] memory
liquidityRanges_,
SwapPayload memory swapPayload_,
IPancakeSwapV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) public returns (bytes memory result);
_collectAndSendFeesToManager
here we are reasonning in term of token0 and token1 of vault (not poolKey).
function _collectAndSendFeesToManager(
IVault pancakeVault_,
PoolKey memory poolKey_,
address manager_,
uint256 managerFeePIPS_,
uint256 fee0_,
uint256 fee1_
) internal returns (uint256 managerFee0, uint256 managerFee1);
_modifyLiquidity
function _modifyLiquidity(
ICLPoolManager poolManager_,
PoolKey memory poolKey_,
IPancakeSwapV4StandardModule.LiquidityRange[] memory
liquidityRanges_,
SwapPayload memory swapPayload_,
IPancakeSwapV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) internal returns (RebalanceResult memory rebalanceResult);
_rebalanceSettle
principalDelta has negative values.
function _rebalanceSettle(
IPancakeSwapV4StandardModule self,
PoolKey memory poolKey_,
int256 amount0_,
int256 amount1_
) internal;
_collectFee
function _collectFee(
ICLPoolManager poolManager_,
PoolKey memory poolKey_,
mapping(bytes32 => bool) storage activeRanges_,
int24 tickLower_,
int24 tickUpper_
) internal returns (BalanceDelta feesAccrued);
_addLiquidity
function _addLiquidity(
ICLPoolManager poolManager_,
PoolKey memory poolKey_,
IPancakeSwapV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_,
uint128 liquidityToAdd_,
int24 tickLower_,
int24 tickUpper_
)
internal
returns (BalanceDelta callerDelta, BalanceDelta feesAccrued);
_removeLiquidity
function _removeLiquidity(
ICLPoolManager poolManager_,
PoolKey memory poolKey_,
IPancakeSwapV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_,
uint128 liquidityToRemove_,
int24 tickLower_,
int24 tickUpper_
)
internal
returns (BalanceDelta callerDelta, BalanceDelta feesAccrued);
withdraw
function withdraw(
IPancakeSwapV4StandardModule self,
Withdraw memory withdraw_,
IPancakeSwapV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) public returns (bytes memory result);
_burnRanges
if receiver is a smart contract, the sm should implement receive fallback function.
if proportion is 100% we take all fees, to prevent rounding errors.
function _burnRanges(
PoolKey memory poolKey_,
Withdraw memory withdraw_,
ICLPoolManager poolManager_,
IPancakeSwapV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) internal returns (BalanceDelta delta, BalanceDelta fees);
_withdrawCollectExtraFees
multiply -1 because we will remove liquidity.
function _withdrawCollectExtraFees(
IVault pancakeVault_,
PoolKey memory poolKey_,
uint256 amount0_,
uint256 amount1_
) internal;
deposit
function deposit(
IPancakeSwapV4StandardModule self,
Deposit memory deposit_,
IPancakeSwapV4StandardModule.Range[] storage ranges_
) public returns (bytes memory, bool);
totalUnderlyingForMint
no need to rounding up because uni v4 should do it during minting.
no need to use Address lib for PoolManager.
currency1 cannot be native coin because address(0).
function totalUnderlyingForMint(
UnderlyingPayload memory underlyingPayload_,
uint256 proportion_
) public view returns (uint256 amount0, uint256 amount1);
totalUnderlyingAtPriceWithFees
function totalUnderlyingAtPriceWithFees(
UnderlyingPayload memory underlyingPayload_,
uint160 sqrtPriceX96_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
underlyingMint
function underlyingMint(
RangeData memory underlying_,
uint256 proportion_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
underlying
function underlying(
RangeData memory underlying_,
uint160 sqrtPriceX96_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
getUnderlyingBalancesMint
function getUnderlyingBalancesMint(
PositionUnderlying memory positionUnderlying_,
uint256 proportion_
)
public
view
returns (
uint256 amount0Current,
uint256 amount1Current,
uint256 fee0,
uint256 fee1
);
getUnderlyingBalances
function getUnderlyingBalances(
PositionUnderlying memory positionUnderlying_
)
public
view
returns (
uint256 amount0Current,
uint256 amount1Current,
uint256 fee0,
uint256 fee1
);
getAmountsForDelta
function getAmountsForDelta(
uint160 sqrtRatioX96,
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
int128 liquidity
) public pure returns (uint256 amount0, uint256 amount1);
_getTokens
function _getTokens(
IPancakeSwapV4StandardModule self,
PoolKey memory poolKey_
) internal view returns (address _token0, address _token1);
_totalUnderlyingWithFees
function _totalUnderlyingWithFees(
UnderlyingPayload memory underlyingPayload_,
uint160 sqrtPriceX96_
)
private
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
_getLeftOvers
function _getLeftOvers(
IPancakeSwapV4StandardModule self_,
PoolKey memory poolKey_
) internal view returns (uint256 leftOver0, uint256 leftOver1);
_getPoolRanges
function _getPoolRanges(
IPancakeSwapV4StandardModule.Range[] storage ranges_,
PoolKey memory poolKey_
) internal view returns (PoolRange[] memory poolRanges);
_checkTokens
function _checkTokens(
PoolKey memory poolKey_,
address token0_,
address token1_,
bool isInversed_
) internal pure;
_checkPermissions
Currency.unwrap(poolKey_.currency1) == address(0) is not possible
because currency0 should be lower currency1.
function _checkPermissions(
PoolKey memory poolKey_
) internal;
_getFeesEarned
function _getFeesEarned(
GetFeesPayload memory feeInfo_
) private view returns (uint256 fee0, uint256 fee1);
_computeFeesEarned
function _computeFeesEarned(
ComputeFeesPayload memory computeFees_
) private pure returns (uint256 fee);
_checkMinReturn
function _checkMinReturn(
IPancakeSwapV4StandardModule self,
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
uint8 decimals0_,
uint8 decimals1_
) internal view;
_checkCurrencyBalances
function _checkCurrencyBalances(
IVault pancakeVault_,
PoolKey memory poolKey_
) internal view returns (uint256, uint256);
_checkCurrencyDelta
function _checkCurrencyDelta(
int256 currency0BalanceRaw_,
int256 currency1BalanceRaw_
) internal view returns (uint256, uint256);
_getRangeIndex
function _getRangeIndex(
IPancakeSwapV4StandardModule.Range[] storage ranges_,
int24 tickLower_,
int24 tickUpper_
) internal view returns (uint256, uint256);
UnderlyingV4
Functions
totalUnderlyingForMint
function totalUnderlyingForMint(
UnderlyingPayload memory underlyingPayload_,
uint256 proportion_
) public view returns (uint256 amount0, uint256 amount1);
totalUnderlyingWithFees
function totalUnderlyingWithFees(
UnderlyingPayload memory underlyingPayload_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
totalUnderlyingAtPriceWithFees
function totalUnderlyingAtPriceWithFees(
UnderlyingPayload memory underlyingPayload_,
uint160 sqrtPriceX96_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
underlying
function underlying(
RangeData memory underlying_,
uint160 sqrtPriceX96_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
underlyingMint
function underlyingMint(
RangeData memory underlying_,
uint256 proportion_
)
public
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
getUnderlyingBalancesMint
function getUnderlyingBalancesMint(
PositionUnderlying memory positionUnderlying_,
uint256 proportion_
)
public
view
returns (
uint256 amount0Current,
uint256 amount1Current,
uint256 fee0,
uint256 fee1
);
getUnderlyingBalances
function getUnderlyingBalances(
PositionUnderlying memory positionUnderlying_
)
public
view
returns (
uint256 amount0Current,
uint256 amount1Current,
uint256 fee0,
uint256 fee1
);
getAmountsForDelta
Computes the token0 and token1 value for a given amount of liquidity, the current pool prices and the prices at the tick boundaries
function getAmountsForDelta(
uint160 sqrtRatioX96,
uint160 sqrtRatioAX96,
uint160 sqrtRatioBX96,
int128 liquidity
) public pure returns (uint256 amount0, uint256 amount1);
_getFeesOwned
function _getFeesOwned(
Position.State memory self,
uint256 feeGrowthInside0X128,
uint256 feeGrowthInside1X128
) internal view returns (uint256 feesOwed0, uint256 feesOwed1);
_totalUnderlyingWithFees
function _totalUnderlyingWithFees(
UnderlyingPayload memory underlyingPayload_,
uint160 sqrtPriceX96_
)
private
view
returns (
uint256 amount0,
uint256 amount1,
uint256 fee0,
uint256 fee1
);
UniswapV4
Functions
rebalance
function rebalance(
IUniV4StandardModule self,
PoolKey memory poolKey_,
IUniV4StandardModule.LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_,
IUniV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) public returns (bytes memory result);
_collectAndSendFeesToManager
here we are reasonning in term of token0 and token1 of vault (not poolKey).
function _collectAndSendFeesToManager(
IPoolManager poolManager_,
PoolKey memory poolKey_,
address manager_,
uint256 managerFeePIPS_,
uint256 fee0_,
uint256 fee1_
) internal returns (uint256 managerFee0, uint256 managerFee1);
_modifyLiquidity
function _modifyLiquidity(
IPoolManager poolManager_,
PoolKey memory poolKey_,
IUniV4StandardModule.LiquidityRange[] memory liquidityRanges_,
SwapPayload memory swapPayload_,
IUniV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) internal returns (RebalanceResult memory rebalanceResult);
_rebalanceSettle
principalDelta has negative values.
function _rebalanceSettle(
IUniV4StandardModule self,
PoolKey memory poolKey_,
int256 amount0_,
int256 amount1_
) internal;
_collectFee
function _collectFee(
IPoolManager poolManager_,
PoolKey memory poolKey_,
mapping(bytes32 => bool) storage activeRanges_,
int24 tickLower_,
int24 tickUpper_
) internal returns (BalanceDelta feesAccrued);
_addLiquidity
function _addLiquidity(
IPoolManager poolManager_,
PoolKey memory poolKey_,
IUniV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_,
uint128 liquidityToAdd_,
int24 tickLower_,
int24 tickUpper_
)
internal
returns (BalanceDelta callerDelta, BalanceDelta feesAccrued);
_removeLiquidity
function _removeLiquidity(
IPoolManager poolManager_,
PoolKey memory poolKey_,
IUniV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_,
uint128 liquidityToRemove_,
int24 tickLower_,
int24 tickUpper_
)
internal
returns (BalanceDelta callerDelta, BalanceDelta feesAccrued);
withdraw
function withdraw(
IUniV4StandardModule self,
Withdraw memory withdraw_,
IUniV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) public returns (bytes memory result);
_burnRanges
if receiver is a smart contract, the sm should implement receive fallback function.
if proportion is 100% we take all fees, to prevent rounding errors.
function _burnRanges(
PoolKey memory poolKey_,
Withdraw memory withdraw_,
IPoolManager poolManager_,
IUniV4StandardModule.Range[] storage ranges_,
mapping(bytes32 => bool) storage activeRanges_
) internal returns (BalanceDelta delta, BalanceDelta fees);
_withdrawCollectExtraFees
multiply -1 because we will remove liquidity.
function _withdrawCollectExtraFees(
IPoolManager poolManager_,
PoolKey memory poolKey_,
uint256 amount0_,
uint256 amount1_
) internal;
deposit
function deposit(
IUniV4StandardModule self,
Deposit memory deposit_,
IUniV4StandardModule.Range[] storage ranges_
) public returns (bytes memory, bool);
_checkMinReturn
no need to rounding up because uni v4 should do it during minting.
no need to use Address lib for PoolManager.
currency1 cannot be native coin because address(0).
function _checkMinReturn(
IUniV4StandardModule self,
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
uint8 decimals0_,
uint8 decimals1_
) internal view;
_getRangeIndex
function _getRangeIndex(
IUniV4StandardModule.Range[] storage ranges_,
int24 tickLower_,
int24 tickUpper_
) internal view returns (uint256, uint256);
_checkTokens
function _checkTokens(
PoolKey memory poolKey_,
address token0_,
address token1_,
bool isInversed_
) internal pure;
_checkPermissions
Currency.unwrap(poolKey_.currency1) == address(0) is not possible
because currency0 should be lower currency1.
function _checkPermissions(
PoolKey memory poolKey_
) internal;
_getLeftOvers
function _getLeftOvers(
IUniV4StandardModule self,
PoolKey memory poolKey_
) internal view returns (uint256 leftOver0, uint256 leftOver1);
_getTokens
function _getTokens(
IUniV4StandardModule self,
PoolKey memory poolKey_
) internal view returns (address _token0, address _token1);
_getPoolRanges
function _getPoolRanges(
IUniV4StandardModule.Range[] storage ranges_,
PoolKey memory poolKey_
) internal view returns (PoolRange[] memory poolRanges);
_checkCurrencyBalances
function _checkCurrencyBalances(
IPoolManager poolManager_,
PoolKey memory poolKey_
) internal view returns (uint256, uint256);
_checkCurrencyDelta
function _checkCurrencyDelta(
int256 currency0BalanceRaw_,
int256 currency1BalanceRaw_
) internal view returns (uint256, uint256);
Contents
- resolvers
- AerodromeStandardModulePrivate
- BunkerModule
- HOTExecutor
- HOTOracleWrapper
- UniV4StandardModulePrivate
- UniV4StandardModulePublic
- ValantisModulePrivate
- ValantisModulePublic
- VelodromeStandardModulePrivate
Contents
PancakeSwapV4StandardModuleResolver
Inherits: IResolver, IPancakeSwapV4StandardModuleResolver
State Variables
poolManager
address public immutable poolManager;
Functions
constructor
constructor(
address poolManager_
);
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0_' and 'maxAmount1_'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
computeMintAmounts
function computeMintAmounts(
uint256 current0_,
uint256 current1_,
uint256 totalSupply_,
uint256 amount0Max_,
uint256 amount1Max_
) public pure returns (uint256 mintAmount);
UniV4StandardModuleResolver
Inherits: IResolver, IUniV4StandardModuleResolver
State Variables
poolManager
address public immutable poolManager;
Functions
constructor
constructor(
address poolManager_
);
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0_' and 'maxAmount1_'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
computeMintAmounts
function computeMintAmounts(
uint256 current0_,
uint256 current1_,
uint256 totalSupply_,
uint256 amount0Max_,
uint256 amount1Max_
) public pure returns (uint256 mintAmount);
ValantisResolver
Inherits: IResolver
Functions
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
AerodromeStandardModulePrivate
Inherits: IArrakisLPModule, IArrakisLPModulePrivate, IAerodromeStandardModulePrivate, IArrakisLPModuleID, IERC721Receiver, PausableUpgradeable, ReentrancyGuardUpgradeable
State Variables
id
function used to get module id.
id = keccak256(abi.encode("AerodromeStandardModulePrivate"))
bytes32 public constant id =
0x491defc0794897991a8e5e9fa49dcbed24fe84ee079750b1db3f4df77fb17cb5;
AERO
function used to get aero token address.
address public immutable AERO;
_guardian
address internal immutable _guardian;
nftPositionManager
function used to get the NonFungiblePositionManager of aerodrome.
INonfungiblePositionManager public immutable nftPositionManager;
factory
function used to get the factory of aerodrome.
IUniswapV3Factory public immutable factory;
voter
function used to get the voter of aerodrome.
IVoter public immutable voter;
metaVault
function used to get metaVault as IArrakisMetaVault.
IArrakisMetaVault public metaVault;
token0
function used to get token0 as IERC20Metadata.
IERC20Metadata public token0;
token1
function used to get token1 as IERC20Metadata.
IERC20Metadata public token1;
oracle
function used to get the oracle that will be used to proctect rebalances.
IOracleWrapper public oracle;
managerFeePIPS
function used to get manager fees.
uint256 public managerFeePIPS;
maxSlippage
function used to get the maximum slippage.
uint24 public maxSlippage;
aeroReceiver
function used to get aero token receiver.
address public aeroReceiver;
pool
function used to get aero pool the module is interacting with.
address public pool;
gauge
function used to get aero gauge associated to pool the module is interacting with.
address public gauge;
_tokenIds
EnumerableSet.UintSet internal _tokenIds;
_aeroManagerBalance
uint256 internal _aeroManagerBalance;
Functions
onlyManager
modifier onlyManager();
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
onlyMetaVaultOwner
modifier onlyMetaVaultOwner();
constructor
constructor(
address nftPositionManager_,
address factory_,
address voter_,
address guardian_
);
onERC721Received
Whenever an {IERC721} tokenId
token is transferred to this contract via {IERC721-safeTransferFrom}
by operator
from from
, this function is called.
It must return its Solidity selector to confirm the token transfer.
If any other value is returned or the interface is not implemented by the recipient, the transfer will be
reverted.
The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector
.
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external returns (bytes4);
pause
function used to pause the module.
only callable by guardian
function pause() external whenNotPaused onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external whenPaused onlyGuardian;
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the aerodrome module.
function initialize(
IOracleWrapper oracle_,
uint24 maxSlippage_,
address aeroReceiver_,
int24 tickSpacing_,
address metaVault_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will be the price reference. |
maxSlippage_ | uint24 | maximum slippage allowed during swap, mint and burn. |
aeroReceiver_ | address | recevier of aero token belonging to manager. |
tickSpacing_ | int24 | tickSpacing of the aero pool to interact with. |
metaVault_ | address | address of the meta vault |
initializePosition
function used to initialize the module when a module switch happen
function initializePosition(
bytes calldata data_
) external;
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | bytes that contain information to initialize the position. |
approve
function used to approve a spender to use the left over of the module.
left over will sit on the module.
function approve(
address spender_,
uint256 amount0_,
uint256 amount1_
) external nonReentrant whenNotPaused onlyMetaVaultOwner;
Parameters
Name | Type | Description |
---|---|---|
spender_ | address | address that will be allowed to use left over. |
amount0_ | uint256 | amount of token0 allowed to be used by spender. |
amount1_ | uint256 | amount of token1 allowed to be used by spender. |
fund
deposit function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable nonReentrant onlyMetaVault whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | the proportion of the total position that need to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
claimRewards
function used by user to claim the aero rewards.
decrease nft position or burn it.
function claimRewards(
address receiver_
) external onlyMetaVaultOwner nonReentrant whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive the aero rewards. |
setReceiver
function used to set the receiver of aero rewards.
function setReceiver(
address newReceiver_
) external whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newReceiver_ | address | new address that will receive the aero token. |
claimManager
function used by executor to claim the manager aero rewards.
function claimManager() public nonReentrant whenNotPaused;
rebalance
function used to rebalance the inventory of the module.
function rebalance(
RebalanceParams calldata params_
) external nonReentrant whenNotPaused onlyManager;
Parameters
Name | Type | Description |
---|---|---|
params_ | RebalanceParams | params including decrease positions, swap, increase positions and mint datas. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
public
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
function setManagerFeePIPS(
uint256 newFeePIPS_
) external onlyManager whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
newFeePIPS_ | uint256 | new fee that will be applied. |
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
tokenIds
function used to get the list of tokenIds of non fungible position.
function tokenIds() external view returns (uint256[] memory);
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(
uint160 priceX96_
) external view returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
priceX96_ | uint160 | price at which we want to simulate our tokens composition |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(
IOracleWrapper oracle_,
uint24 maxDeviation_
) external view;
Parameters
Name | Type | Description |
---|---|---|
oracle_ | IOracleWrapper | oracle that will used to check internal state. |
maxDeviation_ | uint24 | maximum deviation allowed. |
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0()
external
view
returns (uint256 managerFee0);
Returns
Name | Type | Description |
---|---|---|
managerFee0 | uint256 | managerBalance0 amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1()
external
view
returns (uint256 managerFee1);
Returns
Name | Type | Description |
---|---|---|
managerFee1 | uint256 | managerBalance1 amount of token1 that manager earned. |
aeroManagerBalance
function used to get aero balance due to manager.
function aeroManagerBalance() external view returns (uint256);
_decreaseLiquidity
function _decreaseLiquidity(
ModifyPosition memory modifyPosition_,
uint160 sqrtPriceX96_
)
internal
returns (
uint256 amount0ToSend,
uint256 amount1ToSend,
uint256 aeroAmountCollected
);
_increaseLiquidity
function _increaseLiquidity(
ModifyPosition memory modifyPosition_,
uint160 sqrtPriceX96_
)
internal
returns (
uint256 amount0Sent,
uint256 amount1Sent,
uint256 aeroAmountCollected
);
_unstake
function _unstake(
uint256 tokenId_
)
internal
returns (
uint256 aeroAmountCollected,
address _gauge,
uint128 liquidity
);
_mint
function _mint(
INonfungiblePositionManager.MintParams calldata params_,
address token0_,
address token1_
) internal returns (uint256 amount0, uint256 amount1);
_checkMinReturn
function _checkMinReturn(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
uint8 decimals0_,
uint8 decimals1_
) internal view;
_principal
function _principal(
uint256 tokenId_,
uint160 sqrtRatioX96_
) internal view returns (uint256 amount0, uint256 amount1);
_getPosition
trick to workaround stack too deep.
function _getPosition(
uint256 tokenId_
)
internal
view
returns (int24 tickLower, int24 tickUpper, uint128 liquidity);
BunkerModule
Inherits: IArrakisLPModule, IArrakisLPModuleID, IBunkerModule, PausableUpgradeable, ReentrancyGuardUpgradeable
State Variables
id
bytes32 public constant id =
0xce98d8396fff0b5125f78c5c5878c5c82596417dec23d9d52e0ed2377d14b9b8;
metaVault
IArrakisMetaVault public metaVault;
token0
IERC20Metadata public token0;
token1
IERC20Metadata public token1;
_guardian
address internal immutable _guardian;
Functions
onlyMetaVault
modifier onlyMetaVault();
onlyGuardian
modifier onlyGuardian();
constructor
constructor(address guardian_);
initialize
initialize function to delegate call onced the beacon proxy is deployed, for initializing the bunker module.
function initialize(address metaVault_) external initializer;
Parameters
Name | Type | Description |
---|---|---|
metaVault_ | address | address of the meta vault. |
pause
function used to pause the module.
only callable by guardian
function pause() external onlyGuardian;
unpause
function used to unpause the module.
only callable by guardian
function unpause() external onlyGuardian;
initializePosition
function initializePosition(bytes calldata) external;
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
)
public
virtual
onlyMetaVault
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | the proportion of the total position that need to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
withdrawManagerBalance
function used by metaVault or manager to get manager fees.
function withdrawManagerBalance()
external
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to manager. |
amount1 | uint256 | amount of token1 sent to manager. |
setManagerFeePIPS
function used to set manager fees.
function setManagerFeePIPS(uint256) external;
managerBalance0
function used to get manager token0 balance.
amount of fees in token0 that manager have not taken yet.
function managerBalance0() external view returns (uint256 fees0);
Returns
Name | Type | Description |
---|---|---|
fees0 | uint256 | amount of token0 that manager earned. |
managerBalance1
function used to get manager token1 balance.
amount of fees in token1 that manager have not taken yet.
function managerBalance1() external view returns (uint256 fees1);
Returns
Name | Type | Description |
---|---|---|
fees1 | uint256 | amount of token1 that manager earned. |
validateRebalance
function used to validate if module state is not manipulated before rebalance.
function validateRebalance(IOracleWrapper, uint24) external view;
totalUnderlyingAtPrice
function used to get the amounts of token0 and token1 sitting on the position for a specific price.
function totalUnderlyingAtPrice(uint160)
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position for priceX96. |
amount1 | uint256 | the amount of token1 sitting on the position for priceX96. |
totalUnderlying
function used to get the amount of token0 and token1 sitting on the position.
function totalUnderlying()
external
view
returns (uint256 amount0, uint256 amount1);
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | the amount of token0 sitting on the position. |
amount1 | uint256 | the amount of token1 sitting on the position. |
getInits
function used to get the initial amounts needed to open a position.
function getInits()
external
view
returns (uint256 init0, uint256 init1);
Returns
Name | Type | Description |
---|---|---|
init0 | uint256 | the amount of token0 needed to open a position. |
init1 | uint256 | the amount of token1 needed to open a position. |
managerFeePIPS
function used to get manager fees.
function managerFeePIPS() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | managerFeePIPS amount of token1 that manager earned. |
guardian
function used to get the address that can pause the module.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | guardian address of the pauser. |
HOTExecutor
Inherits: IHOTExecutor, Ownable
State Variables
manager
address public immutable manager;
w3f
address public w3f;
Functions
constructor
constructor(address manager_, address w3f_, address owner_);
setW3f
function setW3f(address newW3f_) external onlyOwner;
rebalance
function rebalance(
address vault_,
bytes[] calldata payloads_,
uint256 expectedReservesAmount_,
bool zeroToOne_
) external;
HOTOracleWrapper
Inherits: IOracleWrapper
State Variables
oracle
IHOTOracle public immutable oracle;
decimals0
uint8 public immutable decimals0;
decimals1
uint8 public immutable decimals1;
Functions
constructor
constructor(address oracle_, uint8 decimals0_, uint8 decimals1_);
getPrice0
function getPrice0() public view returns (uint256 price0);
getPrice1
function getPrice1() public view returns (uint256 price1);
PancakeSwapV4StandardModulePrivate
Inherits: PancakeSwapV4StandardModule, IArrakisLPModulePrivate
State Variables
id
id = keccak256(abi.encode("PancakeSwapV4StandardModulePrivate"))
bytes32 public constant id =
0x7cec99d521e59378e389a879513f6373dd58e86a0c1422fa01195032b7071950;
Functions
constructor
constructor(
address poolManager_,
address guardian_,
address vault_,
address distributor_,
address collector_
)
PancakeSwapV4StandardModule(
poolManager_,
guardian_,
vault_,
distributor_,
collector_
);
fund
fund function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable onlyMetaVault whenNotPaused nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
_fund
function _fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) internal;
lockAcquired
function lockAcquired(
bytes calldata data_
) public virtual returns (bytes memory);
PancakeSwapV4StandardModulePublic
Inherits: PancakeSwapV4StandardModule, IArrakisLPModulePublic
this module can only set pancake v4 pool that have generic hook, that don't require specific action to become liquidity provider.
State Variables
id
id = keccak256(abi.encode("PancakeSwapV4StandardModulePublic"))
bytes32 public constant id =
0xf8a84b2e3e22d069766d4756d362bc5c6eb85d74765bf4feeb8c017f9e8c7937;
notFirstDeposit
bool public notFirstDeposit;
Functions
constructor
constructor(
address poolManager_,
address guardian_,
address vault_,
address distributor_,
address collector_
)
PancakeSwapV4StandardModule(
poolManager_,
guardian_,
vault_,
distributor_,
collector_
);
deposit
function used by metaVault to deposit tokens into the strategy.
function deposit(
address depositor_,
uint256 proportion_
)
external
payable
onlyMetaVault
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
proportion_ | uint256 | proportion of position needed to be add. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 deposited. |
amount1 | uint256 | amount of token1 deposited. |
initializePosition
function initializePosition(
bytes calldata
) external override onlyMetaVault;
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
) public override returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | proportion of position needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
lockAcquired
Called by the pool manager on msg.sender
when a lock is acquired
function lockAcquired(
bytes calldata data_
) public virtual returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | The data that was passed to the call to lock |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | result data that you want to be returned from the lock call |
UniV4StandardModulePrivate
Inherits: UniV4StandardModule, IArrakisLPModulePrivate
this module can only set uni v4 pool that have generic hook, that don't require specific action to become liquidity provider.
State Variables
id
id = keccak256(abi.encode("UniV4StandardModulePrivate"))
bytes32 public constant id =
0xae9c8e22b1f7ab201e144775cd6f848c3c1b0a82315571de8c67ce32ca9a7d44;
Functions
constructor
constructor(
address poolManager_,
address guardian_
) UniV4StandardModule(poolManager_, guardian_);
fund
fund function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable onlyMetaVault whenNotPaused nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
unlockCallback
Called by the pool manager on msg.sender
when a lock is acquired
function unlockCallback(
bytes calldata data_
) public virtual returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | The data that was passed to the call to lock |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | result data that you want to be returned from the lock call |
_fund
use data to do specific action.
function _fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) internal returns (bytes memory);
UniV4StandardModulePublic
Inherits: UniV4StandardModule, IArrakisLPModulePublic
this module can only set uni v4 pool that have generic hook, that don't require specific action to become liquidity provider.
State Variables
id
id = keccak256(abi.encode("UniV4StandardModulePublic"))
bytes32 public constant id =
0x22f7eb8a1e047f6c492e05813f6e9c6cb1563d057a61278b8e0ae7977af1ac3f;
notFirstDeposit
bool public notFirstDeposit;
Functions
constructor
constructor(
address poolManager_,
address guardian_
) UniV4StandardModule(poolManager_, guardian_);
deposit
function used by metaVault to deposit tokens into the strategy.
function deposit(
address depositor_,
uint256 proportion_
)
external
payable
onlyMetaVault
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
proportion_ | uint256 | proportion of position needed to be add. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 deposited. |
amount1 | uint256 | amount of token1 deposited. |
initializePosition
function initializePosition(
bytes calldata
) external override onlyMetaVault;
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
) public override returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | proportion of position needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
unlockCallback
Called by the pool manager on msg.sender
when a lock is acquired
function unlockCallback(
bytes calldata data_
) public virtual returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | The data that was passed to the call to lock |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | result data that you want to be returned from the lock call |
ValantisModulePrivate
Inherits: ValantisModule, IArrakisLPModulePrivate
Functions
constructor
constructor(address guardian_) ValantisModule(guardian_);
fund
deposit function for private vault.
function fund(
address depositor_,
uint256 amount0_,
uint256 amount1_
) external payable onlyMetaVault whenNotPaused nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
amount0_ | uint256 | amount of token0 that depositor want to send to module. |
amount1_ | uint256 | amount of token1 that depositor want to send to module. |
ValantisModulePublic
Inherits: ValantisModule, IArrakisLPModulePublic
State Variables
notFirstDeposit
bool public notFirstDeposit;
Functions
constructor
constructor(address guardian_) ValantisModule(guardian_);
deposit
deposit function for public vault.
function deposit(
address depositor_,
uint256 proportion_
)
external
payable
onlyMetaVault
whenNotPaused
nonReentrant
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
depositor_ | address | address that will provide the tokens. |
proportion_ | uint256 | percentage of portfolio position vault want to expand. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 needed to expand the portfolio by "proportion" percent. |
amount1 | uint256 | amount of token1 needed to expand the portfolio by "proportion" percent. |
withdraw
function used by metaVault to withdraw tokens from the strategy.
function withdraw(
address receiver_,
uint256 proportion_
) public override returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
receiver_ | address | address that will receive tokens. |
proportion_ | uint256 | number of share needed to be withdrawn. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
initializePosition
function initializePosition(bytes calldata data_)
external
override
onlyMetaVault;
VelodromeStandardModulePrivate
Inherits: AerodromeStandardModulePrivate
Functions
constructor
constructor(
address nftPositionManager_,
address factory_,
address voter_,
address guardian_
)
AerodromeStandardModulePrivate(
nftPositionManager_,
factory_,
voter_,
guardian_
);
Contents
UniV4Oracle
Inherits: IOracleWrapper, IUniV4Oracle, Initializable
State Variables
poolManager
address public immutable poolManager;
isInversed
bool public immutable isInversed;
module
address public module;
decimals0
uint8 public decimals0;
decimals1
uint8 public decimals1;
Functions
constructor
constructor(address poolManager_, bool isInversed_);
initialize
function initialize(
address module_
) external override initializer;
getPrice0
function getPrice0() external view returns (uint256 price0);
getPrice1
function getPrice1() external view returns (uint256 price1);
_getPrice0
function _getPrice0() internal view returns (uint256 price0);
_getPrice1
function _getPrice1() internal view returns (uint256 price1);
Contents
- VaultInfo
- SetupParams
- FeeIncrease
- TokenPermissions
- PermitTransferFrom
- SignatureTransferDetails
- PermitBatchTransferFrom
- AddLiquidityData
- SwapData
- SwapAndAddData
- AddLiquidityPermit2Data
- SwapAndAddPermit2Data
- AddLiquidityData
- RemoveLiquidityData
- SwapData
- SwapAndAddData
- AddLiquidityPermit2Data
- RemoveLiquidityPermit2Data
- SwapAndAddPermit2Data
- Range
- PositionUnderlying
- UnderlyingPayload
- GetFeesPayload
- ComputeFeesPayload
- ModifyPosition
- SwapPayload
- RebalanceParams
- UnderlyingPayload
- RangeData
- Range
- RangeMintBurn
- ComputeFeesPayload
- GetFeesPayload
- PositionUnderlying
- Withdraw
- Deposit
- RebalanceResult
- SwapPayload
- SwapBalances
- SwapBalances
VaultInfo
struct VaultInfo {
uint256 lastRebalance;
uint256 cooldownPeriod;
IOracleWrapper oracle;
uint24 maxDeviation;
address executor;
address stratAnnouncer;
uint24 maxSlippagePIPS;
uint24 managerFeePIPS;
}
SetupParams
struct SetupParams {
address vault;
IOracleWrapper oracle;
uint24 maxDeviation;
uint256 cooldownPeriod;
address executor;
address stratAnnouncer;
uint24 maxSlippagePIPS;
}
FeeIncrease
struct FeeIncrease {
uint256 submitTimestamp;
uint24 newFeePIPS;
}
SwapPayload
struct SwapPayload {
bytes payload;
address router;
uint256 amountIn;
uint256 expectedMinReturn;
bool zeroForOne;
}
RangeData
struct RangeData {
address self;
Range range;
ICLPoolManager poolManager;
}
Range
struct Range {
int24 lowerTick;
int24 upperTick;
PoolKey poolKey;
}
UnderlyingPayload
struct UnderlyingPayload {
Range[] ranges;
ICLPoolManager poolManager;
address self;
uint256 leftOver0;
uint256 leftOver1;
}
PositionUnderlying
struct PositionUnderlying {
uint160 sqrtPriceX96;
ICLPoolManager poolManager;
PoolKey poolKey;
address self;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
ComputeFeesPayload
struct ComputeFeesPayload {
uint256 feeGrowthInsideLast;
uint256 feeGrowthOutsideLower;
uint256 feeGrowthOutsideUpper;
uint256 feeGrowthGlobal;
PoolId poolId;
ICLPoolManager poolManager;
uint128 liquidity;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
GetFeesPayload
struct GetFeesPayload {
uint256 feeGrowthInside0Last;
uint256 feeGrowthInside1Last;
PoolId poolId;
ICLPoolManager poolManager;
uint128 liquidity;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
RebalanceResult
struct RebalanceResult {
uint256 amount0Minted;
uint256 amount1Minted;
uint256 amount0Burned;
uint256 amount1Burned;
uint256 fee0;
uint256 fee1;
uint256 managerFee0;
uint256 managerFee1;
}
Withdraw
struct Withdraw {
address receiver;
uint256 proportion;
uint256 amount0;
uint256 amount1;
uint256 fee0;
uint256 fee1;
}
Deposit
struct Deposit {
address depositor;
uint256 proportion;
uint256 value;
bool notFirstDeposit;
uint256 fee0;
uint256 fee1;
uint256 leftOverToMint0;
uint256 leftOverToMint1;
}
SwapBalances
struct SwapBalances {
uint256 initBalance;
uint256 balance;
}
TokenPermissions
struct TokenPermissions {
address token;
uint256 amount;
}
PermitTransferFrom
struct PermitTransferFrom {
TokenPermissions permitted;
uint256 nonce;
uint256 deadline;
}
SignatureTransferDetails
struct SignatureTransferDetails {
address to;
uint256 requestedAmount;
}
PermitBatchTransferFrom
struct PermitBatchTransferFrom {
TokenPermissions[] permitted;
uint256 nonce;
uint256 deadline;
}
AddLiquidityData
struct AddLiquidityData {
uint256 amount0;
uint256 amount1;
address vault;
}
SwapData
struct SwapData {
bytes swapPayload;
uint256 amountInSwap;
uint256 amountOutSwap;
address swapRouter;
bool zeroForOne;
}
SwapAndAddData
struct SwapAndAddData {
SwapData swapData;
AddLiquidityData addData;
}
AddLiquidityPermit2Data
struct AddLiquidityPermit2Data {
AddLiquidityData addData;
PermitBatchTransferFrom permit;
bytes signature;
}
SwapAndAddPermit2Data
struct SwapAndAddPermit2Data {
SwapAndAddData swapAndAddData;
PermitBatchTransferFrom permit;
bytes signature;
}
AddLiquidityData
struct AddLiquidityData {
uint256 amount0Max;
uint256 amount1Max;
uint256 amount0Min;
uint256 amount1Min;
uint256 amountSharesMin;
address vault;
address receiver;
}
RemoveLiquidityData
struct RemoveLiquidityData {
uint256 burnAmount;
uint256 amount0Min;
uint256 amount1Min;
address vault;
address payable receiver;
}
SwapData
struct SwapData {
bytes swapPayload;
uint256 amountInSwap;
uint256 amountOutSwap;
address swapRouter;
bool zeroForOne;
}
SwapAndAddData
struct SwapAndAddData {
SwapData swapData;
AddLiquidityData addData;
}
AddLiquidityPermit2Data
struct AddLiquidityPermit2Data {
AddLiquidityData addData;
PermitBatchTransferFrom permit;
bytes signature;
}
RemoveLiquidityPermit2Data
struct RemoveLiquidityPermit2Data {
RemoveLiquidityData removeData;
PermitTransferFrom permit;
bytes signature;
}
SwapAndAddPermit2Data
struct SwapAndAddPermit2Data {
SwapAndAddData swapAndAddData;
PermitBatchTransferFrom permit;
bytes signature;
}
Range
struct Range {
int24 lowerTick;
int24 upperTick;
uint24 feeTier;
}
PositionUnderlying
struct PositionUnderlying {
address nftPositionManager;
address factory;
uint256 tokenId;
}
UnderlyingPayload
struct UnderlyingPayload {
uint256[] tokenIds;
address nftPositionManager;
address factory;
uint256 leftOver0;
uint256 leftOver1;
address module;
}
GetFeesPayload
struct GetFeesPayload {
uint256 feeGrowthInside0Last;
uint256 feeGrowthInside1Last;
IUniswapV3Pool pool;
uint128 liquidity;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
ComputeFeesPayload
struct ComputeFeesPayload {
uint256 feeGrowthInsideLast;
uint256 feeGrowthOutsideLower;
uint256 feeGrowthOutsideUpper;
uint256 feeGrowthGlobal;
uint128 liquidity;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
ModifyPosition
struct ModifyPosition {
uint256 tokenId;
uint256 proportion;
}
SwapPayload
struct SwapPayload {
bytes payload;
address router;
uint256 amountIn;
uint256 expectedMinReturn;
bool zeroForOne;
}
RebalanceParams
struct RebalanceParams {
ModifyPosition[] decreasePositions;
ModifyPosition[] increasePositions;
SwapPayload swapPayload;
INonfungiblePositionManager.MintParams[] mintParams;
uint256 minBurn0;
uint256 minBurn1;
uint256 minDeposit0;
uint256 minDeposit1;
}
UnderlyingPayload
struct UnderlyingPayload {
Range[] ranges;
IPoolManager poolManager;
address self;
uint256 leftOver0;
uint256 leftOver1;
}
RangeData
struct RangeData {
address self;
Range range;
IPoolManager poolManager;
}
Range
struct Range {
int24 lowerTick;
int24 upperTick;
PoolKey poolKey;
}
RangeMintBurn
struct RangeMintBurn {
Range range;
uint128 liquidity;
}
ComputeFeesPayload
struct ComputeFeesPayload {
uint256 feeGrowthInsideLast;
uint256 feeGrowthOutsideLower;
uint256 feeGrowthOutsideUpper;
uint256 feeGrowthGlobal;
IPoolManager poolManager;
PoolKey poolKey;
uint128 liquidity;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
GetFeesPayload
struct GetFeesPayload {
uint256 feeGrowthInside0Last;
uint256 feeGrowthInside1Last;
IPoolManager poolManager;
PoolKey poolKey;
uint128 liquidity;
int24 tick;
int24 lowerTick;
int24 upperTick;
}
PositionUnderlying
struct PositionUnderlying {
uint160 sqrtPriceX96;
IPoolManager poolManager;
PoolKey poolKey;
address self;
int24 lowerTick;
int24 upperTick;
}
Withdraw
struct Withdraw {
address receiver;
uint256 proportion;
uint256 amount0;
uint256 amount1;
uint256 fee0;
uint256 fee1;
}
Deposit
struct Deposit {
address depositor;
uint256 proportion;
uint256 value;
bool notFirstDeposit;
uint256 fee0;
uint256 fee1;
uint256 leftOverToMint0;
uint256 leftOverToMint1;
}
RebalanceResult
struct RebalanceResult {
uint256 amount0Minted;
uint256 amount1Minted;
uint256 amount0Burned;
uint256 amount1Burned;
uint256 fee0;
uint256 fee1;
uint256 managerFee0;
uint256 managerFee1;
}
SwapPayload
struct SwapPayload {
bytes payload;
address router;
uint256 amountIn;
uint256 expectedMinReturn;
bool zeroForOne;
}
SwapBalances
struct SwapBalances {
uint256 initBalance;
uint256 balance;
}
SwapBalances
struct SwapBalances {
uint256 actual0;
uint256 actual1;
uint256 initBalance0;
uint256 initBalance1;
uint256 balance0;
uint256 balance1;
}
Contents
MigrationHelper
Inherits: IMigrationHelper, Ownable
State Variables
palmTerms
Get the address of the arrakisV2 PALMTerms contract.
address public immutable palmTerms;
factory
Get the address of the arrakis modular meta vault factory.
address public immutable factory;
manager
Get the address of the arrakis standard manager.
address public immutable manager;
poolManager
Get the address of the uni v4 pool manager.
address public immutable poolManager;
weth
Get the address of the WETH.
address public immutable weth;
Functions
constructor
constructor(
address palmTerms_,
address factory_,
address manager_,
address poolManager_,
address weth_,
address owner_
);
migrateVault
Migrate a vault from ArrakisV2 to ArrakisMetaVaultPrivate.
can be called by the owner of this migration helper or by the safe.
function migrateVault(
Migration calldata params_
) external returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | Migration | Migration struct, containing informations about how to migrate from ArrakisV2 vault to a modular vault. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the new ArrakisMetaVaultPrivate vault. |
receive
receive() external payable;
SVGParams
Parameters for generating the URI
struct SVGParams {
address vault;
uint256 amount0;
uint256 amount1;
uint8 decimals0;
uint8 decimals1;
string symbol0;
string symbol1;
}
INFTSVG
Interface for the NFTSVG contract
Functions
isNFTSVG
Checks if the contract is compliant with the NFTSVG interface
function isNFTSVG() external pure returns (bool);
generateVaultURI
Generates a URI for a given vault
function generateVaultURI(
SVGParams memory params_
) external pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
params_ | SVGParams | Parameters for generating the URI |
generateFallbackURI
Generates a fallback URI for a given vault
function generateFallbackURI(
SVGParams memory params_
) external pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
params_ | SVGParams | Parameters for generating the URI |
NFTSVG
Inherits: INFTSVG
Functions
isNFTSVG
Checks if the contract is compliant with the NFTSVG interface
function isNFTSVG() external pure returns (bool);
generateVaultURI
Generates a URI for a given vault
function generateVaultURI(
SVGParams memory params_
) public pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
params_ | SVGParams | Parameters for generating the URI |
generateFallbackURI
Generates a fallback URI for a given vault
function generateFallbackURI(
SVGParams memory params_
) public pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
params_ | SVGParams | Parameters for generating the URI |
_generateName
Generates the name of the URI for a given vault
function _generateName(
SVGParams memory params_
) internal pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
params_ | SVGParams | Parameters for generating the URI |
_generateDescription
Generates the description of the URI for a given vault
function _generateDescription(
SVGParams memory params_
) internal pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
params_ | SVGParams | Parameters for generating the URI |
_generateSVGImage
Generates the SVG image of the URI for a given vault
function _generateSVGImage(
address vault_
) internal pure returns (string memory svg);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | The vault address represented by the NFT |
_generateSVGDefs
function _generateSVGDefs() internal pure returns (string memory);
_generateSVGMasks
function _generateSVGMasks() internal pure returns (string memory);
_generateSVGFrame
function _generateSVGFrame() internal pure returns (string memory);
_generateSVGDunes
function _generateSVGDunes() internal pure returns (string memory);
_generateSVGFront
function _generateSVGFront() internal pure returns (string memory);
_generateSVGBack
function _generateSVGBack(
address vault_
) internal pure returns (string memory);
NFTSVGUtils
State Variables
HEX_DIGITS
bytes16 private constant HEX_DIGITS = "0123456789abcdef";
Functions
generateSVGLogo
Generates the logo for the NFT.
function generateSVGLogo() public pure returns (string memory);
addressToString
Converts an address to 2 string slices.
function addressToString(
address addr_
) public pure returns (string memory, string memory);
Parameters
Name | Type | Description |
---|---|---|
addr_ | address | address to convert to string. |
uintToFloatString
Converts uints to float strings with 4 decimal places.
function uintToFloatString(
uint256 value_,
uint8 decimals_
) public pure returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
value_ | uint256 | uint to convert to string. |
decimals_ | uint8 | number of decimal places of the input value. |
_uintToString
Code borrowed form: https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol
Converts uints to strings.
function _uintToString(
uint256 value_
) internal pure returns (string memory str);
Parameters
Name | Type | Description |
---|---|---|
value_ | uint256 | uint to convert to string. |
WithdrawHelper
Inherits: IWithdrawHelper
Functions
withdraw
Withdraws the funds from the vault at any ratio.
function withdraw(
address safe_,
address vault_,
uint256 amount0_,
uint256 amount1_,
address payable receiver_
) external override;
Parameters
Name | Type | Description |
---|---|---|
safe_ | address | The address of the safe that owns the vault. |
vault_ | address | The address of the vault to withdraw the funds from. |
amount0_ | uint256 | The amount of token0 to withdraw. |
amount1_ | uint256 | The amount of token1 to withdraw. |
receiver_ | address payable | The address that will receive the funds. |
ArrakisMetaVaultFactory
Inherits: IArrakisMetaVaultFactory, Pausable, Ownable
this contract will use create3 to deploy vaults.
State Variables
moduleRegistryPublic
address public immutable moduleRegistryPublic;
moduleRegistryPrivate
address public immutable moduleRegistryPrivate;
creationCodePublicVault
address public immutable creationCodePublicVault;
creationCodePrivateVault
address public immutable creationCodePrivateVault;
nft
PrivateVaultNFT public immutable nft;
manager
address public manager;
_publicVaults
EnumerableSet.AddressSet internal _publicVaults;
_privateVaults
EnumerableSet.AddressSet internal _privateVaults;
_deployers
EnumerableSet.AddressSet internal _deployers;
Functions
constructor
constructor(
address owner_,
address manager_,
address moduleRegistryPublic_,
address moduleRegistryPrivate_,
address creationCodePublicVault_,
address creationCodePrivateVault_
);
pause
function used to pause the factory.
only callable by owner.
function pause() external onlyOwner;
unpause
function used to unpause the factory.
only callable by owner.
function unpause() external onlyOwner;
setManager
function used to set a new manager.
only callable by owner.
function setManager(address newManager_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
newManager_ | address | address that will managed newly created vault. |
deployPublicVault
function used to deploy ERC20 token wrapped Arrakis Meta Vault.
function deployPublicVault(
bytes32 salt_,
address token0_,
address token1_,
address owner_,
address beacon_,
bytes calldata moduleCreationPayload_,
bytes calldata initManagementPayload_
) external whenNotPaused returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
salt_ | bytes32 | bytes32 used to get a deterministic all chains address. |
token0_ | address | address of the first token of the token pair. |
token1_ | address | address of the second token of the token pair. |
owner_ | address | address of the owner of the vault. |
beacon_ | address | address of the beacon that will be used to create the default module. |
moduleCreationPayload_ | bytes | payload for initializing the module. |
initManagementPayload_ | bytes | data for initialize management. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the newly created Token Meta Vault. |
deployPrivateVault
function used to deploy owned Arrakis Meta Vault.
function deployPrivateVault(
bytes32 salt_,
address token0_,
address token1_,
address owner_,
address beacon_,
bytes calldata moduleCreationPayload_,
bytes calldata initManagementPayload_
) external whenNotPaused returns (address vault);
Parameters
Name | Type | Description |
---|---|---|
salt_ | bytes32 | bytes32 needed to compute vault address deterministic way. |
token0_ | address | address of the first token of the token pair. |
token1_ | address | address of the second token of the token pair. |
owner_ | address | address of the owner of the vault. |
beacon_ | address | address of the beacon that will be used to create the default module. |
moduleCreationPayload_ | bytes | payload for initializing the module. |
initManagementPayload_ | bytes | data for initialize management. |
Returns
Name | Type | Description |
---|---|---|
vault | address | address of the newly created private Meta Vault. |
whitelistDeployer
function used to grant the role to deploy to a list of addresses.
function whitelistDeployer(address[] calldata deployers_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
deployers_ | address[] | list of addresses that owner want to grant permission to deploy. |
blacklistDeployer
function used to grant the role to deploy to a list of addresses.
function blacklistDeployer(address[] calldata deployers_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
deployers_ | address[] | list of addresses that owner want to revoke permission to deploy. |
getTokenName
get Arrakis Modular standard token name for two corresponding tokens.
function getTokenName(
address token0_,
address token1_
) public view returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
token0_ | address | address of the first token. |
token1_ | address | address of the second token. |
Returns
Name | Type | Description |
---|---|---|
<none> | string | name name of the arrakis modular token vault. |
publicVaults
get a list of public vaults created by this factory
function publicVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | start index |
endIndex_ | uint256 | end index |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | vaults list of all created vaults. |
numOfPublicVaults
numOfPublicVaults counts the total number of public vaults in existence
function numOfPublicVaults() public view returns (uint256 result);
Returns
Name | Type | Description |
---|---|---|
result | uint256 | total number of vaults deployed |
isPublicVault
isPublicVault check if the inputed vault is a public vault.
function isPublicVault(address vault_) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPublicVault true if the inputed vault is public or otherwise false. |
privateVaults
get a list of private vaults created by this factory
function privateVaults(
uint256 startIndex_,
uint256 endIndex_
) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | start index |
endIndex_ | uint256 | end index |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | vaults list of all created vaults. |
numOfPrivateVaults
numOfPrivateVaults counts the total number of private vaults in existence
function numOfPrivateVaults() public view returns (uint256 result);
Returns
Name | Type | Description |
---|---|---|
result | uint256 | total number of vaults deployed |
isPrivateVault
isPrivateVault check if the inputed vault is a private vault.
function isPrivateVault(address vault_)
external
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the address to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isPublicVault true if the inputed vault is private or otherwise false. |
deployers
function used to get a list of address that can deploy public vault.
function deployers() external view returns (address[] memory);
_initManagement
function _initManagement(
address vault_,
bytes memory data_
) internal;
_getPublicVaultConstructorPayload
to anticipate futur changes in the manager's initManagement function manager should implement getInitManagementSelector function, so factory can get the the right selector of the function.
for initializing management we need to know the vault address, so manager should follow this pattern where vault address is the first parameter of the function.
function _getPublicVaultConstructorPayload(
address timeLock_,
address token0_,
address token1_
) internal view returns (bytes memory);
_append
function _append(
string memory a_,
string memory b_,
string memory c_,
string memory d_
) internal pure returns (string memory);
ArrakisMetaVaultPrivate
Inherits: ArrakisMetaVault, IArrakisMetaVaultPrivate, IOwnable
State Variables
nft
address public immutable nft;
_depositors
EnumerableSet.AddressSet internal _depositors;
Functions
constructor
constructor(
address moduleRegistry_,
address manager_,
address token0_,
address token1_,
address nft_
) ArrakisMetaVault(moduleRegistry_, manager_, token0_, token1_);
deposit
function used to deposit tokens or expand position inside the inherent strategy.
function deposit(
uint256 amount0_,
uint256 amount1_
) external payable;
Parameters
Name | Type | Description |
---|---|---|
amount0_ | uint256 | amount of token0 need to increase the position by proportion_; |
amount1_ | uint256 | amount of token1 need to increase the position by proportion_; |
withdraw
function used to withdraw tokens or position contraction of the underpin strategy.
function withdraw(
uint256 proportion_,
address receiver_
)
external
onlyOwnerCustom
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
proportion_ | uint256 | the proportion of position contraction. |
receiver_ | address | the address that will receive withdrawn tokens. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 returned. |
amount1 | uint256 | amount of token1 returned. |
whitelistDepositors
function used to whitelist depositors.
function whitelistDepositors(
address[] calldata depositors_
) external onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
depositors_ | address[] | list of address that will be granted to depositor role. |
blacklistDepositors
function used to blacklist depositors.
function blacklistDepositors(
address[] calldata depositors_
) external onlyOwnerCustom;
Parameters
Name | Type | Description |
---|---|---|
depositors_ | address[] | list of address who depositor role will be revoked. |
owner
function used to get the owner of this contract.
function owner() external view returns (address);
depositors
function used to get the list of depositors.
function depositors() external view returns (address[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | depositors list of address granted to depositor role. |
_deposit
function _deposit(
uint256 amount0_,
uint256 amount1_
) internal nonReentrant;
_onlyOwnerCheck
msg.sender should be the tokens provider
function _onlyOwnerCheck() internal view override;
ArrakisMetaVaultPublic
Inherits: IArrakisMetaVaultPublic, ArrakisMetaVault, Ownable, ERC20
State Variables
_name
string internal _name;
_symbol
string internal _symbol;
Functions
constructor
constructor(
address owner_,
string memory name_,
string memory symbol_,
address moduleRegistry_,
address manager_,
address token0_,
address token1_
) ArrakisMetaVault(moduleRegistry_, manager_, token0_, token1_);
mint
function used to mint share of the vault position
function mint(
uint256 shares_,
address receiver_
) external payable returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount representing the part of the position owned by receiver. |
receiver_ | address | address where share token will be sent. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 deposited. |
amount1 | uint256 | amount of token1 deposited. |
burn
function used to burn share of the vault position.
function burn(
uint256 shares_,
address receiver_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount of share that will be burn. |
receiver_ | address | address where underlying tokens will be sent. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 withdrawn. |
amount1 | uint256 | amount of token1 withdrawn. |
transferOwnership
override transfer of ownership, to make it not possible.
function transferOwnership(address) public payable override;
renounceOwnership
override transfer of ownership, to make it not possible.
function renounceOwnership() public payable override;
completeOwnershipHandover
override transfer of ownership, to make it not possible.
function completeOwnershipHandover(address) public payable override;
name
function used to get the name of the LP token.
function name() public view override returns (string memory);
Returns
Name | Type | Description |
---|---|---|
<none> | string | name string value containing the name. |
symbol
function used to get the symbol of the LP token.
function symbol() public view override returns (string memory);
Returns
Name | Type | Description |
---|---|---|
<none> | string | symbol string value containing the symbol. |
_deposit
function _deposit(uint256 proportion_)
internal
nonReentrant
returns (uint256 amount0, uint256 amount1);
_onlyOwnerCheck
msg.sender should be the tokens provider
function _onlyOwnerCheck() internal view override;
ArrakisPrivateVaultRouter
Inherits: IArrakisPrivateVaultRouter, ReentrancyGuard, Ownable, Pausable
State Variables
nativeToken
address of the native token.
address public immutable nativeToken;
permit2
permit2 contract address.
IPermit2 public immutable permit2;
factory
arrakis meta vault factory contract address.
IArrakisMetaVaultFactory public immutable factory;
weth
wrapped eth contract address.
IWETH9 public immutable weth;
swapper
swap executor contract address.
IPrivateRouterSwapExecutor public swapper;
Functions
onlyPrivateVault
modifier onlyPrivateVault(
address vault_
);
onlyDepositor
modifier onlyDepositor(
address vault_
);
constructor
constructor(
address nativeToken_,
address permit2_,
address owner_,
address factory_,
address weth_
);
pause
function used to pause the router.
only callable by owner
function pause() external whenNotPaused onlyOwner;
unpause
function used to unpause the router.
only callable by owner
function unpause() external whenPaused onlyOwner;
updateSwapExecutor
function updateSwapExecutor(
address swapper_
) external whenNotPaused onlyOwner;
addLiquidity
addLiquidity adds liquidity to meta vault of iPnterest (mints L tokens)
function addLiquidity(
AddLiquidityData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.vault)
onlyDepositor(params_.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(
SwapAndAddData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.swapAndAddData.addData.vault)
onlyDepositor(params_.swapAndAddData.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of iPnterest (mints L tokens)
function wrapAndAddLiquidity(
AddLiquidityData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.vault)
onlyDepositor(params_.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(
SwapAndAddData memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to private vault of interest (mints LP tokens)
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.addData.vault)
onlyDepositor(params_.addData.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPrivateVault(params_.swapAndAddData.addData.vault)
onlyDepositor(params_.swapAndAddData.addData.vault)
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
receive
receive() external payable;
_addLiquidity
function _addLiquidity(
address vault_,
uint256 amount0_,
uint256 amount1_,
address token0_,
address token1_
) internal;
_swapAndAddLiquidity
function _swapAndAddLiquidity(
SwapAndAddData memory params_,
address token0_,
address token1_
) internal returns (uint256 amount0Diff, uint256 amount1Diff);
_permit2AddLengthOne
function _permit2AddLengthOne(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2AddLengthOneOrTwo
function _permit2AddLengthOneOrTwo(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2Add
function _permit2Add(
uint256 permittedLength_,
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2SwapAndAddLengthOne
function _permit2SwapAndAddLengthOne(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAddLengthOneOrTwo
function _permit2SwapAndAddLengthOneOrTwo(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAdd
function _permit2SwapAndAdd(
uint256 permittedLength_,
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
ArrakisPublicVaultRouter
Inherits: IArrakisPublicVaultRouter, ReentrancyGuard, Ownable, Pausable
State Variables
nativeToken
address public immutable nativeToken;
permit2
IPermit2 public immutable permit2;
factory
IArrakisMetaVaultFactory public immutable factory;
weth
IWETH9 public immutable weth;
swapper
IRouterSwapExecutor public swapper;
Functions
onlyPublicVault
modifier onlyPublicVault(address vault_);
constructor
constructor(
address nativeToken_,
address permit2_,
address owner_,
address factory_,
address weth_
);
pause
function used to pause the router.
only callable by owner
function pause() external onlyOwner;
unpause
function used to unpause the router.
only callable by owner
function unpause() external onlyOwner;
updateSwapExecutor
function updateSwapExecutor(address swapper_)
external
whenNotPaused
onlyOwner;
addLiquidity
addLiquidity adds liquidity to meta vault of interest (mints L tokens)
function addLiquidity(AddLiquidityData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidity
removeLiquidity removes liquidity from vault and burns LP tokens
function removeLiquidity(RemoveLiquidityData memory params_)
external
nonReentrant
whenNotPaused
onlyPublicVault(params_.vault)
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityData | RemoveLiquidityData struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(AddLiquidityPermit2Data memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.swapAndAddData.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidityPermit2
removeLiquidityPermit2 removes liquidity from vault and burns LP tokens
function removeLiquidityPermit2(
RemoveLiquidityPermit2Data memory params_
)
external
nonReentrant
whenNotPaused
onlyPublicVault(params_.removeData.vault)
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityPermit2Data | RemoveLiquidityPermit2Data struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of interest (mints L tokens)
function wrapAndAddLiquidity(AddLiquidityData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to public vault of interest (mints LP tokens)
hack to get rid of stack too depth
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.addData.vault)
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
nonReentrant
whenNotPaused
onlyPublicVault(params_.swapAndAddData.addData.vault)
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
receive
hack to get rid of stack too depth
receive() external payable;
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
_addLiquidity
function _addLiquidity(
address vault_,
uint256 amount0_,
uint256 amount1_,
uint256 shares_,
address receiver_,
address token0_,
address token1_
) internal;
_swapAndAddLiquidity
function _swapAndAddLiquidity(
SwapAndAddData memory params_,
address token0_,
address token1_
)
internal
returns (
uint256 amount0Use,
uint256 amount1Use,
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
_swapAndAddLiquiditySendBackLeftOver
function _swapAndAddLiquiditySendBackLeftOver(
SwapAndAddData memory params_,
address token0_,
address token1_
)
internal
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
_removeLiquidity
function _removeLiquidity(RemoveLiquidityData memory params_)
internal
returns (uint256 amount0, uint256 amount1);
_permit2AddLengthOne
function _permit2AddLengthOne(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2AddLengthOneOrTwo
function _permit2AddLengthOneOrTwo(
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2Add
function _permit2Add(
uint256 permittedLength_,
AddLiquidityPermit2Data memory params_,
address token0_,
address token1_,
uint256 amount0_,
uint256 amount1_
) internal;
_permit2SwapAndAddLengthOne
function _permit2SwapAndAddLengthOne(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAddLengthOneOrTwo
function _permit2SwapAndAddLengthOneOrTwo(
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_permit2SwapAndAdd
function _permit2SwapAndAdd(
uint256 permittedLength_,
SwapAndAddPermit2Data memory params_,
address token0_,
address token1_
) internal;
_getMintAmounts
function _getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
internal
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
ArrakisPublicVaultRouterV2
ArrakisStandardManager
Inherits: IArrakisStandardManager, IManager, Ownable, ReentrancyGuardUpgradeable, PausableUpgradeable
State Variables
defaultFeePIPS
uint256 public immutable defaultFeePIPS;
nativeToken
address public immutable nativeToken;
nativeTokenDecimals
uint8 public immutable nativeTokenDecimals;
defaultReceiver
address public defaultReceiver;
receiversByToken
mapping(address => address) public receiversByToken;
vaultInfo
mapping(address => VaultInfo) public vaultInfo;
pendingFeeIncrease
mapping(address => FeeIncrease) public pendingFeeIncrease;
factory
address public factory;
_guardian
address internal immutable _guardian;
_vaults
EnumerableSet.AddressSet internal _vaults;
Functions
onlyVaultOwner
modifier onlyVaultOwner(address vault_);
onlyWhitelistedVault
modifier onlyWhitelistedVault(address vault_);
onlyGuardian
modifier onlyGuardian();
constructor
constructor(
uint256 defaultFeePIPS_,
address nativeToken_,
uint8 nativeTokenDecimals_,
address guardian_
);
initialize
function used to initialize standard manager proxy.
we are not checking if the default fee pips is not zero, to have the option to set 0 as default fee pips.
function initialize(
address owner_,
address defaultReceiver_,
address factory_
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
owner_ | address | address of the owner of standard manager. |
defaultReceiver_ | address | address of the receiver of tokens (by default). |
factory_ | address | ArrakisMetaVaultFactory contract address. |
pause
function used to pause the manager.
only callable by guardian
function pause() external onlyGuardian;
unpause
function used to unpause the manager.
only callable by guardian
function unpause() external onlyGuardian;
setDefaultReceiver
function used to set the default receiver of tokens earned.
function setDefaultReceiver(address newDefaultReceiver_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
newDefaultReceiver_ | address | address of the new default receiver of tokens. |
setReceiverByToken
function used to set receiver of a specific token.
function setReceiverByToken(
address vault_,
bool isSetReceiverToken0_,
address receiver_
) external onlyOwner onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the meta vault that contain the specific token. |
isSetReceiverToken0_ | bool | boolean if true means that receiver is for token0 if not it's for token1. |
receiver_ | address | address of the receiver of this specific token. |
decreaseManagerFeePIPS
function used to decrease the fees taken by manager for a specific vault.
function decreaseManagerFeePIPS(
address vault_,
uint24 newFeePIPS_
) external onlyOwner onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault. |
newFeePIPS_ | uint24 | fees in pips to set on the specific vault. |
finalizeIncreaseManagerFeePIPS
function used to finalize a time lock fees increase on a vault.
function finalizeIncreaseManagerFeePIPS(address vault_)
external
onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault where the fees increase will be applied. |
submitIncreaseManagerFeePIPS
function used to submit a fees increase in a managed vault.
function submitIncreaseManagerFeePIPS(
address vault_,
uint24 newFeePIPS_
) external onlyOwner onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault where fees will be increase after timeLock. |
newFeePIPS_ | uint24 | fees in pips to set on the specific managed vault. |
withdrawManagerBalance
function used by manager to get his balance of fees earned on a vault.
function withdrawManagerBalance(address vault_)
external
onlyOwner
nonReentrant
whenNotPaused
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | from which fees will be collected. |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 sent to receiver_ |
amount1 | uint256 | amount of token1 sent to receiver_ |
rebalance
function used to manage vault's strategy.
function rebalance(
address vault_,
bytes[] calldata payloads_
) external nonReentrant whenNotPaused onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault that need a rebalance. |
payloads_ | bytes[] | call data to do specific action of vault side. |
setModule
function used to set a new module (strategy) for the vault.
only public vault should have this check.
function setModule(
address vault_,
address module_,
bytes[] calldata payloads_
) external whenNotPaused onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the vault the manager want to change module. |
module_ | address | address of the new module. |
payloads_ | bytes[] | call data to initialize position on the new module. |
initManagement
function used to init management of a meta vault.
function initManagement(SetupParams calldata params_)
external
whenNotPaused;
Parameters
Name | Type | Description |
---|---|---|
params_ | SetupParams | struct containing all the data for initialize the vault. |
updateVaultInfo
function used to update meta vault management informations.
function updateVaultInfo(SetupParams calldata params_)
external
whenNotPaused
onlyWhitelistedVault(params_.vault)
onlyVaultOwner(params_.vault);
Parameters
Name | Type | Description |
---|---|---|
params_ | SetupParams | struct containing all the data for updating the vault. |
receive
receive() external payable;
announceStrategy
function used to announce the strategy that the vault will follow.
function announceStrategy(
address vault_,
string memory strategy_
) external onlyWhitelistedVault(vault_);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of arrakis meta vault that will follow the strategy. |
strategy_ | string | string containing the strategy name that will be used. |
initializedVaults
function used to get a list of managed vaults.
function initializedVaults(
uint256 startIndex_,
uint256 endIndex_
) external view whenNotPaused returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
startIndex_ | uint256 | starting index from which the caller want to read the array of managed vaults. |
endIndex_ | uint256 | ending index until which the caller want to read the array of managed vaults. |
numInitializedVaults
function used to get the number of vault under management.
function numInitializedVaults()
external
view
returns (uint256 numberOfVaults);
guardian
address of the pauser of manager.
function guardian() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | pauser address that can pause/unpause manager. |
isManaged
function used to know if a vault is under management by this manager.
function isManaged(address vault_) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | address of the meta vault the caller want to check. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isManaged boolean which is true if the vault is under management, false otherwise. |
getInitManagementSelector
function used to know the selector of initManagement functions.
function getInitManagementSelector()
external
pure
returns (bytes4 selector);
_initManagement
function _initManagement(SetupParams memory params_) internal;
_updateParamsChecks
function _updateParamsChecks(SetupParams memory params_)
internal
view;
CreationCodePrivateVault
Inherits: ICreationCode
Functions
getCreationCode
function getCreationCode() external pure returns (bytes memory);
CreationCodePublicVault
Inherits: ICreationCode
Functions
getCreationCode
function getCreationCode() external pure returns (bytes memory);
Guardian
Inherits: Ownable, IGuardian
State Variables
pauser
address public pauser;
Functions
constructor
constructor(address owner_, address pauser_);
setPauser
function to set the pauser of Arrakis protocol.
function setPauser(address newPauser_) external onlyOwner;
ModulePrivateRegistry
Inherits: ModuleRegistry, IModulePrivateRegistry
Functions
constructor
constructor(
address owner_,
address guardian_,
address admin_
) ModuleRegistry(owner_, guardian_, admin_);
createModule
function used to create module instance that can be whitelisted as module inside a vault.
function createModule(
address vault_,
address beacon_,
bytes calldata payload_
) external returns (address module);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | |
beacon_ | address | which whitelisted beacon's implementation we want to create an instance of. |
payload_ | bytes | payload to create the module. |
ModulePublicRegistry
Inherits: ModuleRegistry, IModulePublicRegistry
Functions
constructor
constructor(
address owner_,
address guardian_,
address admin_
) ModuleRegistry(owner_, guardian_, admin_);
createModule
function used to create module instance that can be whitelisted as module inside a vault.
function createModule(
address vault_,
address beacon_,
bytes calldata payload_
) external returns (address module);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | |
beacon_ | address | which whitelisted beacon's implementation we want to create an instance of. |
payload_ | bytes | payload to create the module. |
Pauser
Inherits: IPauser, Ownable
State Variables
_pausers
EnumerableSet.AddressSet internal _pausers;
Functions
constructor
constructor(address pauser_, address owner_);
pause
function pause(address target_) external override;
whitelistPausers
function whitelistPausers(address[] calldata pausers_)
external
override
onlyOwner;
blacklistPausers
function blacklistPausers(address[] calldata pausers_)
external
override
onlyOwner;
isPauser
function isPauser(address account_) public view returns (bool);
PrivateRouterSwapExecutor
Inherits: IPrivateRouterSwapExecutor
State Variables
router
address public immutable router;
nativeToken
address public immutable nativeToken;
Functions
onlyRouter
modifier onlyRouter();
constructor
constructor(address router_, address nativeToken_);
swap
function used to swap tokens.
function swap(
SwapAndAddData memory params_
)
external
payable
onlyRouter
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | struct containing all the informations for swapping. |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | the difference in token0 amount before and after the swap. |
amount1Diff | uint256 | the difference in token1 amount before and after the swap. |
receive
receive() external payable;
PrivateVaultNFT
Inherits: Ownable, ERC721, IPrivateVaultNFT
State Variables
renderController
address public immutable renderController;
Functions
constructor
constructor() ERC721("Arrakis Private LP NFT", "ARRAKIS");
mint
function used to mint nft (representing a vault) and send it.
function mint(address to_, uint256 tokenId_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
to_ | address | address where to send the NFT. |
tokenId_ | uint256 | id of the NFT to mint. |
tokenURI
function tokenURI(uint256 tokenId_)
public
view
override
returns (string memory);
getMetaDatas
function getMetaDatas(
address token0_,
address token1_
)
public
view
returns (
uint8 decimals0,
uint8 decimals1,
string memory symbol0,
string memory symbol1
);
RenderController
Inherits: Ownable, IRenderController, Initializable
State Variables
renderer
address public renderer;
Functions
initialize
function initialize(address owner_) external initializer;
setRenderer
function used to set the renderer contract
only the svgController can do it.
function setRenderer(address renderer_) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
renderer_ | address | address of the contract that will render the tokenUri for the svg of the nft. |
isNFTSVG
function isNFTSVG(address renderer_) public view returns (bool);
RouterSwapExecutor
Inherits: IRouterSwapExecutor
State Variables
router
address public immutable router;
nativeToken
address public immutable nativeToken;
Functions
onlyRouter
modifier onlyRouter();
constructor
constructor(address router_, address nativeToken_);
swap
function used to swap tokens.
function swap(SwapAndAddData memory params_)
external
payable
onlyRouter
returns (uint256 amount0Diff, uint256 amount1Diff);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | struct containing all the informations for swapping. |
Returns
Name | Type | Description |
---|---|---|
amount0Diff | uint256 | the difference in token0 amount before and after the swap. |
amount1Diff | uint256 | the difference in token1 amount before and after the swap. |
receive
receive() external payable;
RouterSwapResolver
Inherits: IRouterSwapResolver
State Variables
router
IArrakisPublicVaultRouter public immutable router;
Functions
constructor
constructor(address router_);
calculateSwapAmount
function calculateSwapAmount(
IArrakisMetaVault vault_,
uint256 amount0In_,
uint256 amount1In_,
uint256 price18Decimals_
) external view returns (bool zeroForOne, uint256 swapAmount);
_getUnderlyingOrLiquidity
function _getUnderlyingOrLiquidity(IArrakisMetaVault vault_)
internal
view
returns (uint256 gross0, uint256 gross1);
TimeLock
Inherits: TimelockController, ITimeLock
Functions
constructor
constructor(
uint256 minDelay,
address[] memory proposers,
address[] memory executors,
address admin
) TimelockController(minDelay, proposers, executors, admin);
updateDelay
override updateDelay function of TimelockController to not allow update of delay.
function updateDelay(uint256) external pure override;
Module Implementations
Here's the list of Arrakis Modules:
- Uniswap V4 Module
- PancakeSwap Infinity Module
- Aerodrome Module
- Velodrome Module
- Valantis HOT AMM Module
Uniswap V4 Module
Arrakis Private Vault module integration with Uniswap V4.
Vault Type(s): Private Vault
Features:
- manage multiple V4 liquidity positions in a aggregated/batched way with nice interfaces
- configure and control automated LP strategies tailor designed for V4
- easily migrate liquidity from one Uniswap V4 hook to another (or algorithmically switch between them)
- integrates merkl rewards if there are auxiliary rewards for LPing that pair
- optionally enable direct RFQ with the vault (policed by your oracle of choice)
- optionally use ArrakisProHook liquiidity pool to automate dynamic swap fees with Arrakis
See full contract specification here and here
Deployments
Networks: Ethereum Mainnet, Base, Arbitrum, Unichain, Optimism Mainnet
Aerodrome Module
The Aerodrome Module integration of Aerodrome Slipstream (concentrated liquidity) DEX.
Vault Type(s): Private Vault
Features:
- manage multiple concentrated liquidity positions in a aggregated/batched way with nice interfaces
- Automatically stake all LP positions to earn AERO rewards
- configure and control automated LP strategies tailor designed for Aerodrome (and AERO capture)
- optionally enable direct RFQ with the vault (policed by your oracle of choice)
See full contract specification here
Deployments
Networks: Base (only)
Velodrome Module
Velodrome module is an exact clone of the Aerodrome Module
Deployments
Networks: Optimism Mainnet (only)
PancakeSwap Infinity Module
While some underlying library code is different the feature set of the PancakeSwap Infinity module is exactly the same as the Uniswap V4 Module
Deployments
Networks: Ethereum Mainnet, BSC (soon)
HOT AMM (Valantis) module
Public Vault and Private Vault module integrations with the Valantis HOT AMM.
HOT AMM is a hybrid AMM / RFQ based experimental liquidity pool contract.
The HOT AMM module was used for our first ever Arrakis Modular Public Vault experiment on ETH/USDC mainnet pair. Though recently deprecated, you can read more about it here
NOTE: To create and activate this module requires coordination with both valantis and arrakis teams to deploy the AMM pool specifically for the Arrakis Vault of interest (whether public or private).
Deployments
Networks: Ethereum Mainnet, Arbitrum
Contents
Audits
Arrakis smart contracts have been audited by world class security firms. You can find the audit reports below:
- Arrakis Modular Audit Report
- Arrakis Uniswap V4 Module Audit Report
- Arrakis Aerodrome Module Audit Report
Research
Here you can find Arrakis's research papers:
Legacy Documentation
Arrakis Modular is the third version of Arrakis's smart contracts. Here you can find the documentation for the previous versions covering both:
- Non-technical overviews
- Developer documentation
Arrakis v2
Arrakis v1
HOT AMM Overview
LPs are getting rekt by toxic order flow. HOT improves returns and maximizes capital efficiency for LPs, by internalizing MEV using an intent-based design.
To learn more, refer to this HOT AMM: Concepts page.
Just want to deposit? Here's our New User Interface
HOT was designed by Arrakis and Valantis Labs. It is built on the Valantis Modular DEX Framework. HOT is the first integration on Arrakis Modular and is powered by Arrakis's offchain market making infrastructure.
Flagship Public Vault using HOT AMM
Our flagship WETH/USDC Arrakis Modular Public Vault on Ethereum Mainnet deploys it's funds into a HOT AMM liquidity pool (details).
This public vault offering is similar to LPing on a traditional AMM, but has a few advanced features under the hood:
- actively managed concentrated liquidity rebalancing (via the Arrakis Public Vault
manager
role) - intents-based Quoter activity (via the underlying HOT AMM
QuoteSigner
role)
Thanks to these roles (and proper strategies for their activity), LPs can passively make WETH/USDC markets in a way that is competitive with the most sophisticated Private Market Makers onchain.
Concepts
Hybrid Order Type
HOT is a first of its kind hybrid AMM design, that combines the permissionless properties of AMMs with the capital efficiency and non-toxic order flow of Private market making on intents-based protocols like CoWSwap and UniswapX.
HOT stands for Hybrid Order Type. HOT pools have two swap execution mechanisms that run in parallel: RfQ Quotes and Permissionless AMM.
RfQ Quotes
-
Solvers compete for non-toxic uninformed order flow from intents-based protocols (CoW Swap, UniswapX, 1inch Fusion etc).
-
Permissioned solvers request quotes from an API, which calls the Arrakis offchain quoter and in turn issues quotes as a signed intent. Solvers can use these signed quotes at deterministic prices to fill their order against the HOT liquidity pool (until expiration).
-
When executed, these signed quotes update the pool price playing a special role in keeping the price from becoming stale to mitigate against arbitrage.
Learn more about the Quoter here.
Permissionless AMM
-
A single concentrated liquidity position is used, akin to Uniswap v3. In addition a dynamic fee is implemented. Anyone can permissionlessly swap against the pool onchain by invoking the
swap
method. -
A dynamic fee that increases over time is used to further protect the pool against stale price arbitrage, in the event that a RfQ Quotes hasn’t been issued onchain recently. This fee is reset at the time a RfQ signed quoted is executed onchain.
Arrakis Module
The only way to provide liquidity to a HOT pool is via an Arrakis Vault. The Vault exposes Manager Functions that the manager
role can call to actively manage the Arrakis liquidity position in the pool.
Quickstart HOT AMM
Solvers
Are you a solver looking to integrate HOT AMM liquidity pools as a liquidity source? Please refer to the Valantis Solver Guide.
Permissionless AMM Users
HOT AMM functions as a permissionless onchain liquidity pool very similar to Uniswap V3 pools.
-
Provide Liquidity: see this guide for interacting with HOT AMM as a liquidity provider.
-
Swap: for retail users and aggregators that desire to swap with low fees and up-to-date prices. These swaps happen against a single concentrated liquidity position, according to a UniswapV3 like constant-product AMM logic. For more details, we refer to the Valantis Sovereign Pool documentation.
Manager Functions
Note that ALL manager functions defined in Modules are subject to checks in the ArrakisStandardManager. Learn more about vault management and configurability here.
Set Price Bounds
This module exposes a function where the manager can change the concentration of the Arrakis vault liquidity position.
function setPriceBounds(
uint160 sqrtPriceLowX96_,
uint160 sqrtPriceHighX96_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_
) external onlyManager {
Swap
This module exposes a function where the manager can swap to rebalance Arrakis vault liquidity against another onchain liquidity source (atomically).
function swap(
bool zeroForOne_,
uint256 expectedMinReturn_,
uint256 amountIn_,
address router_,
uint160 expectedSqrtSpotPriceUpperX96_,
uint160 expectedSqrtSpotPriceLowerX96_,
bytes calldata payload_
) external onlyManager whenNotPaused {
All modules also implement a setManagerFeePIPS
and withdrawManagerBalance
functions for handling Arrakis Protocol fee collection.
NOTE: while not executed through the manager
role, the Quoter functionality is another offchain process that HOT pools rely on.
Quoter
A crucial offchain component of the HOT AMM is the QuoteSigner
role which is set directly on the HOT.sol
valantis ALM smart contract containing the core pricing logic of the HOT AMM.
Whoever holds the private key to the QuoteSigner
role has the authority to at any time issue a signed quote that allows the recipient to execute a swap directly against the funds in the liquidity pool at the price specified in the signed quote (subject to certain onchain safety checks on the price and volume of the quote).
For Arrakis Public Vaults, the Quoter is a semi-trusted automated offchain process, which escrows Public Vault QuoteSigner
keys and signs quotes to integrated parties (like CoWSwap solvers) at prices determined by the state of centralized exchanges, state of the LP Vault's onchain reserves, and the current Requests-For-Quotes seeking to trade.
Quoter Market Making Strategy
A quoter can use any offchain quoting strategy, as long as it's within the bounds enforced at the smart contract level:
- bounds on size of any quote
- bounds on number of quotes in a block
- bounds on quote prices compared to an onchain oracle
A manager on the HOT.sol
smart contract can set both the QuoteSigner
role and these bounds on the QuoteSigner
activity (this role should be burned, timelocked, or otherwise trusted). Within these guardrails, a quoter can implement any strategy it likes to issue quotes (and signed quote holders can execute these valid quotes).
The ETH/USDC Public Vault Quoter uses an Avellaneda and Stoikov based approach, where the bid ask spread skews around the mid market price with the goal to converge to a target inventory ratio (in this case, 50% ETH and 50% USDC).
Quoter Oracle Values
When the QuoteSigner
issues signed quotes they can attach metadata that acts as oracle values to the state of the onchain AMM if and when the quote gets executed onchain. The key values are:
- a new value for the midprice of the AMM, based on the Quoter's current instantaneous midprice observed offchain (
sqrtSpotPriceX96New
) - a new starting value for swap fee rates (
feeMinToken{0,1}
) - a new growth rate for swap fees (
feeGrowthE6Token{0,1}
) - a new max swap fee for the fee growth to stop at (
feeMaxToken{0,1}
)
When a quote actually executes onchain (and is the first one to do so in a block) it will automagically reset the state of the AMM from that point in the block onward to:
- spot price at
sqrtSpotPriceX96New
- swap fee for token{0,1} of
feeMinToken{0,1} + feeGrowthE6Token{0,1} * (blockTimestamp- signatureTimestamp) / 100
(the minimum fee, plus the growth rate for the amount of time that has elapsed since this quote was signed)
If no new signed quotes land at the top of the next block then the swap fee rates will continue to grow second by second at the linear rate and thus will be larger at the top of the next block. This swap fee growth continues until the fee hits the maximum rate or until a new signed quote lands and resets the process.
Quoter Decentralization
One major direction of research and development at Arrakis is to make the Public Vault Quoter more transparently verifiable and trustless. More info on that coming soon!
Loss-Versus-Rebalancing (LVR)
LVR Problem
MEV losses are frequently associated with swappers because most retail DeFi users interact with DEXs to execute swaps. But passive LPs collectively account for the biggest losses in today’s MEV landscape because they offer stale prices and lose out on fees to searchers, builders, and proposers (and they need these fees to maintain profitability). In the 2022 paper Automated Market Making and Loss-Versus-Rebalancing, Columbia University professor and a16z researcher Tim Roughgarden and his team found that arbitrage costs ETH-USDC LPs about 11% of their principal per year.
Loss-Versus-Rebalancing (LVR) is a term used to describe MEV lost through arbitrage as a result of AMMs offering LPs liquidity at stale prices. As AMM prices update slower than CEXs, LPs become exposed to losses when arbitrageurs correct the discrepancy. LVR accounts for a major part of MEV extraction on Ethereum.
The AMM space has evolved since MEV extraction started to encroach on DeFi. Uniswap V3 pioneered liquidity concentration to help LPs earn more fees but this feature requires active monitoring. As MEV is brokered offchain through MEV-Boost, and most LPs passively provide liquidity onchain, LPs keep getting burned by LVR.
HOT AMM solution
HOT is an AMM design that attacks the LVR problem head on. It is done with a first of its kind Hybrid Order Type liquidity pool design. The summary for why it works well to recapture value for LPs is that an offchain API is trusted by the pool to issue signed orders to offchain swap requests at fair and competitive prices.
This offchain RfQ is one of the two parallel order types that the HOT liquidity pool supports. RfQ sidesteps the LVR problem completely by handling pricing offchain (within some bounds of an onchain oracle check, for LP safety from a malicious quoter).
For the classical AMM swap mode of the HOT liquidity pool, which is entirely onchain and thus subject to LVR, a combination of Dynamic Fees and injection of up-to-date info in RfQ swap execution both allow HOT to have more performant pricing than other onchain AMMs.
Deployments
Mainnet
WETH/USDC
Whitepaper
Abstract: Hybrid Order Type (HOT) is a novel automated market maker (AMM) created by Arrakis Finance and Valantis Labs. The HOT AMM is designed to mitigate MEV in the form of LVR by symbiotically existing alongside intent-centric protocols. HOT pools have a hybrid execution setup whereby trades can either occur through a familiar permissionless AMM swap or through a novel RfQ system where solvers can receive a deterministic quote to trade against the pool in exchange for updating the two key AMM state variables: the spot price and the dynamic fee. The fresher pricing combined with protective dynamic fees provides robust guarantees of LVR reduction for LPs on Arrakis. In this paper, we present the core design elements of this novel AMM as well as its advantages over conventional AMMs.
Public Vault List
Just want to deposit? Here's our New User Interface
Ethereum Mainnet
WETH/USDC Vault
This is the first and flagship Arrakis Modular Public Vault.
- Network:
Ethereum Mainnet
- Vault Address:
0xf790870ccF6aE66DdC69f68e6d05d446f1a6ad83
- Type:
ERC20
- Symbol:
ARRAKIS
- Active Module:
HOT AMM
- Whitelisted Modules:
HOT AMM
,Bunker
(safety module) - Vault Owner (Timelock):
0xCFaD8B6981Da1c734352Bd31618040C23FE99117
- Vault Timelock Admin:
0x5108EF86cF493905BcD35A3736e4B46DeCD7de58
(Arrakis Multisig)
Management Configuration:
- Vault Executor:
0x030DE9fd3ca63AB012f4E22dB595b66C812c8525
(HOTExecutor) - Price Oracle:
0xF23d83Da92844C53aD57e6031c231dC93eC4eE80
(WrappedChainlink
feeds) - Cooldown Period:
60 seconds
- Max Oracle Deviation:
2%
- Max Swap Slippage:
2%
- Manager Fee (on Swap Fees Earned):
1%
HOT AMM pool WETH/USDC Config:
- QuoteSigner:
0x498c8a1a179b5D1D4Ff64bC90Cf3224a3478765C
(controlled by Arrakis) - HOT Manager:
0xAf6f9640092cB1236E5DB6E517576355b6C40b7f
(timelocked) - Price Oracle:
Chainlink
- Max HOT Swaps Per Block:
3
- Max HOT Swap Oracle Deviation:
3.5%
Read more about the HOT AMM Quoter and the Vault Manager Functions which both perform actions that help power this Public Vault.
History
Background
Arrakis Finance started in early 2021, shortly after the Uniswap v3 whitepaper was released. The introduction of concentrated Liquidity AMMs promised to finally disrupt the need for traditional Centralized Exchanges (CEX) in terms of efficiency, enabling AMMs to behave similar to their Central Limit Order Book (CLOB) counterparts.
These substantial efficiency improvements over older constant product AMMs unfortunately came at the cost of Liquidity Providers (LPs) facing substantial complexity and overhead associated with trying to fully leverage the potential of providing liquidity in a concentrated fashion on Uniswap V3.
The project, first being part of Gelato Network, later spun out into an independant project after receiving substantial organic traction and going on to have $1.8B TVL.
Arrakis has gone on to facilitate $20B in volume traded.
Since mid 2023, Arrakis has been focussed on the next generation of AMMs and MEV recapture to tackle the biggest threat Ethereum faces: extractive centralised actors.
Centralised Actors Taking Over DeFi
We are in the midst of a shift in DeFi. As Ethereum has grown, sophisticated actors have infiltrated DeFi and leveraged complex strategies to extract value from the ecosystem.
Naturally this has increased the scope of the problem statement Arrakis is tackling. It has grown to encompass recapturing MEV from centralised actors who are extractive to the ecosystem. Arrakis aims to give token issuers and LPs a fairer share of the pie.
Arrakis is focused on being a decentralized onchain market making solution, with a key feature of built-in MEV-Awareness / vertical integration into the MEV supply chain. Arrakis aims to give all token markets a seamless next-generation onchain spot market liquidity provision experience.
Inspiration
The name Arrakis comes in reference to Frank Herbert’s Dune Universe. Arrakis is a harsh desert planet full of dangers and mineable riches (the fabled “spice melange”), which echoes the similarly harsh, dangerous and yet financially potent world of crypto.