IArrakisLPModule

Git Source

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

NameTypeDescription
data_bytesbytes 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

NameTypeDescription
receiver_addressaddress that will receive tokens.
proportion_uint256the proportion of the total position that need to be withdrawn.

Returns

NameTypeDescription
amount0uint256amount of token0 withdrawn.
amount1uint256amount of token1 withdrawn.

withdrawManagerBalance

function used by metaVault or manager to get manager fees.

function withdrawManagerBalance()
    external
    returns (uint256 amount0, uint256 amount1);

Returns

NameTypeDescription
amount0uint256amount of token0 sent to manager.
amount1uint256amount of token1 sent to manager.

setManagerFeePIPS

function used to set manager fees.

function setManagerFeePIPS(uint256 newFeePIPS_) external;

Parameters

NameTypeDescription
newFeePIPS_uint256new fee that will be applied.

metaVault

function used to get metaVault as IArrakisMetaVault.

function metaVault() external view returns (IArrakisMetaVault);

Returns

NameTypeDescription
<none>IArrakisMetaVaultmetaVault that implement IArrakisMetaVault.

guardian

function used to get the address that can pause the module.

function guardian() external view returns (address);

Returns

NameTypeDescription
<none>addressguardian 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

NameTypeDescription
<none>uint256managerBalance0 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

NameTypeDescription
<none>uint256managerBalance1 amount of token1 that manager earned.

managerFeePIPS

function used to get manager fees.

function managerFeePIPS() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256managerFeePIPS amount of token1 that manager earned.

token0

function used to get token0 as IERC20Metadata.

function token0() external view returns (IERC20Metadata);

Returns

NameTypeDescription
<none>IERC20Metadatatoken0 as IERC20Metadata.

token1

function used to get token1 as IERC20Metadata.

function token1() external view returns (IERC20Metadata);

Returns

NameTypeDescription
<none>IERC20Metadatatoken1 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

NameTypeDescription
init0uint256the amount of token0 needed to open a position.
init1uint256the 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

NameTypeDescription
amount0uint256the amount of token0 sitting on the position.
amount1uint256the 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

NameTypeDescription
priceX96_uint160price at which we want to simulate our tokens composition

Returns

NameTypeDescription
amount0uint256the amount of token0 sitting on the position for priceX96.
amount1uint256the 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

NameTypeDescription
oracle_IOracleWrapperoracle that will used to check internal state.
maxDeviation_uint24maximum 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

NameTypeDescription
receiveraddressaddress that will receive the tokens withdrawn.
proportionuint256percentage of the current position that user want to withdraw.
amount0uint256amount of token0 send to "receiver" due to withdraw action.
amount1uint256amount 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

NameTypeDescription
manageraddressaddress of the manager that will fees earned due to his fund management.
amount0uint256amount of token0 that manager has earned and will be transfered.
amount1uint256amount of token1 that manager has earned and will be transfered.

LogSetManagerFeePIPS

Event describing manager set his fees.

event LogSetManagerFeePIPS(uint256 oldFee, uint256 newFee);

Parameters

NameTypeDescription
oldFeeuint256fees share that have been taken by manager.
newFeeuint256fees 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();