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);