Aloe Protocol
Search
⌃K

MarginAccount.sol

https://github.com/aloelabs/aloe-ii-core/blob/testnet-beta/src/MarginAccount.sol
The information provided by Aloe Labs, Inc. (“we,” “us” or “our”) on docs.aloe.capital (the “Site”) is for general informational purposes only. All information on the Site is provided in good faith, however we make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability or completeness of any information on the Site.
Under no circumstance shall we have any liability to you for any loss or damage of any kind incurred as a result of the use of the site or reliance on any information provided on the site. Your use of the site and your reliance on any information on the site is solely at your own risk.

Actions

modify
Gives the callee complete control of the Margin Account. Only callable by Margin Account owner. Solvency is checked after callee is done executing.

Arguments

  • callee The contract that will be given control of assets. Example
  • data The bytes (arguments, etc.) that will be passed to callee
  • allowances The amounts of each token that callee should have access to. In order: TOKEN0, TOKEN1, KITTY0, KITTY1. Avoid extraneous approves by setting one or more entries to 0.
function modify(
IManager callee,
bytes calldata data,
uint256[4] calldata allowances
) external;
liquidate
Liquidate the margin account.
function liquidate() external;
borrow
Borrows assets from the money market.

Arguments

  • amount0 Amount of TOKEN0 to borrow
  • amount1 Amount of TOKEN1 to borrow
function borrow(uint256 amount0, uint256 amount1) external;
repay
Repays loans that the margin account previously took out.

Arguments

  • amount0 Amount of TOKEN0 to repay
  • amount1 Amount of TOKEN1 to repay
function repay(uint256 amount0, uint256 amount1) external;
uniswapDeposit
Adds liquidity to a Uniswap Position.

Arguments

  • lower The lower tick of the position
  • upper The upper tick of the position
  • liquidity The amount of liquidity to add

Return Values

  • amount0 The amount of TOKEN0 that was used to create the position
  • amount1 The amount of TOKEN1 that was used to create the position
function uniswapDeposit(
int24 lower,
int24 upper,
uint128 liquidity
) external returns (uint256 amount0, uint256 amount1);
uniswapWithdraw
Removes liquidity to a Uniswap Position.

Arguments

  • lower The lower tick of the position
  • upper The upper tick of the position
  • liquidity The amount of liquidity to remove

Return Values

  • burned0 The amount of TOKEN0 that was underlying liquidity
  • burned1 The amount of TOKEN1 that was underlying liquidity
  • collected0 The fees earned in TOKEN0, plus burned0
  • collected1 The fees earned in TOKEN1, plus burned1
function uniswapWithdraw(
int24 lower,
int24 upper,
uint128 liquidity
)
external
returns (
uint256 burned0,
uint256 burned1,
uint256 collected0,
uint256 collected1
);

Derived State

getUniswapPositions
Returns an array of the Margin Account's Uniswap Positions.

Return Values

  • Uniswap.Position[] memory The array of Uniswap Positions
function getUniswapPositions() external view returns (Uniswap.Position[] memory);