ArrakisStandardManager

Git Source

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

NameTypeDescription
owner_addressaddress of the owner of standard manager.
defaultReceiver_addressaddress of the receiver of tokens (by default).
factory_addressArrakisMetaVaultFactory 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

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

NameTypeDescription
vault_addressaddress of the meta vault that contain the specific token.
isSetReceiverToken0_boolboolean if true means that receiver is for token0 if not it's for token1.
receiver_addressaddress 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

NameTypeDescription
vault_addressaddress of the vault.
newFeePIPS_uint24fees 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

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

NameTypeDescription
vault_addressaddress of the vault where fees will be increase after timeLock.
newFeePIPS_uint24fees 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

NameTypeDescription
vault_addressfrom which fees will be collected.

Returns

NameTypeDescription
amount0uint256amount of token0 sent to receiver_
amount1uint256amount 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

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

NameTypeDescription
vault_addressaddress of the vault the manager want to change module.
module_addressaddress 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

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

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

NameTypeDescription
vault_addressaddress of arrakis meta vault that will follow the strategy.
strategy_stringstring 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

NameTypeDescription
startIndex_uint256starting index from which the caller want to read the array of managed vaults.
endIndex_uint256ending 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

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

NameTypeDescription
vault_addressaddress of the meta vault the caller want to check.

Returns

NameTypeDescription
<none>boolisManaged 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;