IAavePM

Git Source

This interface defines the essential structures and functions for the AavePM contract.

Functions

initialize

function initialize(
    address owner,
    ContractAddress[] memory contractAddresses,
    TokenAddress[] memory tokenAddresses,
    UniswapV3Pool[] memory uniswapV3Pools,
    uint16 initialHealthFactorTarget,
    uint16 initialSlippageTolerance,
    uint16 initialManagerDailyInvocationLimit
) external;

updateContractAddress

function updateContractAddress(string memory identifier, address newContractAddress) external;

updateTokenAddress

function updateTokenAddress(string memory identifier, address newTokenAddress) external;

updateUniswapV3Pool

function updateUniswapV3Pool(string memory identifier, address newUniswapV3PoolAddress, uint24 newUniswapV3PoolFee)
    external;

updateHealthFactorTarget

function updateHealthFactorTarget(uint16 healthFactorTarget) external;

updateSlippageTolerance

function updateSlippageTolerance(uint16 slippageTolerance) external;

updateManagerDailyInvocationLimit

function updateManagerDailyInvocationLimit(uint16 _managerDailyInvocationLimit) external;

rebalance

function rebalance() external returns (uint256 repaymentAmountUSDC);

reinvest

function reinvest() external payable returns (uint256 reinvestedDebt);

deleverage

function deleverage() external;

aaveSupplyFromContractBalance

function aaveSupplyFromContractBalance() external payable returns (uint256 suppliedCollateral);

aaveRepayUSDCFromContractBalance

function aaveRepayUSDCFromContractBalance() external;

delegateCallHelper

function delegateCallHelper(string memory _targetIdentifier, bytes memory _data) external returns (bytes memory);

rescueEth

function rescueEth(address ownerAddress) external;

withdrawTokensFromContractBalance

function withdrawTokensFromContractBalance(string memory identifier, address ownerAddress) external;

aaveWithdrawWstETH

function aaveWithdrawWstETH(uint256 withdrawAmount, address ownerAddress)
    external
    returns (uint256 collateralDeltaBase);

aaveBorrowAndWithdrawUSDC

function aaveBorrowAndWithdrawUSDC(uint256 borrowAmount, address ownerAddress) external;

aaveClosePosition

function aaveClosePosition(address ownerAddress) external;

getCreator

function getCreator() external view returns (address creator);

getEventBlockNumbers

function getEventBlockNumbers() external view returns (uint64[] memory);

getVersion

function getVersion() external pure returns (string memory version);

getContractAddress

function getContractAddress(string memory) external view returns (address contractAddress);

getTokenAddress

function getTokenAddress(string memory) external view returns (address tokenAddress);

getUniswapV3Pool

function getUniswapV3Pool(string memory)
    external
    view
    returns (address uniswapV3PoolAddress, uint24 uniswapV3PoolFee);

getHealthFactorTarget

function getHealthFactorTarget() external view returns (uint16 healthFactorTarget);

getHealthFactorTargetMinimum

function getHealthFactorTargetMinimum() external pure returns (uint16 healthFactorTargetMinimum);

getSlippageTolerance

function getSlippageTolerance() external view returns (uint16 slippageTolerance);

getSlippageToleranceMaximum

function getSlippageToleranceMaximum() external pure returns (uint16 slippageToleranceMaximum);

getManagerDailyInvocationLimit

function getManagerDailyInvocationLimit() external view returns (uint16 managerDailyInvocationLimit);

getManagerInvocationTimestamps

function getManagerInvocationTimestamps() external view returns (uint64[] memory);

getContractBalance

function getContractBalance(string memory identifier) external view returns (uint256 contractBalance);

getRoleMembers

function getRoleMembers(string memory roleString) external view returns (address[] memory);

getWithdrawnUSDCTotal

function getWithdrawnUSDCTotal() external view returns (uint256 withdrawnUSDCTotal);

getReinvestedDebtTotal

function getReinvestedDebtTotal() external view returns (uint256 reinvestedDebtTotal);

getTotalCollateralDelta

function getTotalCollateralDelta() external returns (uint256 totalCollateralDelta, bool isPositive);

getSuppliedCollateralTotal

function getSuppliedCollateralTotal() external view returns (uint256 depositedCollateralTotal);

getMaxBorrowAndWithdrawUSDCAmount

function getMaxBorrowAndWithdrawUSDCAmount() external view returns (uint256 maxBorrowAndWithdrawUSDCAmount);

getReinvestableAmount

function getReinvestableAmount() external returns (uint256 reinvestableAmount);

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32);

getRoleMember

function getRoleMember(bytes32 role, uint256 index) external view returns (address);

getRoleMemberCount

function getRoleMemberCount(bytes32 role) external view returns (uint256);

grantRole

function grantRole(bytes32 role, address account) external;

hasRole

function hasRole(bytes32 role, address account) external view returns (bool);

renounceRole

function renounceRole(bytes32 role, address callerConfirmation) external;

revokeRole

function revokeRole(bytes32 role, address account) external;

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool);

upgradeToAndCall

function upgradeToAndCall(address newImplementation, bytes memory data) external payable;

executeOperation

function executeOperation(address asset, uint256 amount, uint256 premium, address initiator, bytes calldata params)
    external
    returns (bool);

Events

AavePMInitialized

event AavePMInitialized(address indexed creator);

ContractAddressUpdated

event ContractAddressUpdated(
    string identifier, address indexed previousContractAddress, address indexed newContractAddress
);

TokenAddressUpdated

event TokenAddressUpdated(string identifier, address indexed previousTokenAddress, address indexed newTokenAddress);

UniswapV3PoolUpdated

event UniswapV3PoolUpdated(string identifier, address indexed newUniswapV3PoolAddress, uint24 newUniswapV3PoolFee);

HealthFactorTargetUpdated

event HealthFactorTargetUpdated(uint16 previousHealthFactorTarget, uint16 newHealthFactorTarget);

SlippageToleranceUpdated

event SlippageToleranceUpdated(uint16 previousSlippageTolerance, uint16 newSlippageTolerance);

ManagerDailyInvocationLimitUpdated

event ManagerDailyInvocationLimitUpdated(
    uint16 previousManagerDailyInvocationLimit, uint16 newManagerDailyInvocationLimit
);

Rebalanced

event Rebalanced(uint256 repaymentAmountUSDC);

Reinvested

event Reinvested(uint256 reinvestedDebt);

Deleveraged

event Deleveraged(uint256 repaymentAmountUSDC);

AaveSuppliedFromContractBalance

event AaveSuppliedFromContractBalance(uint256 suppliedCollateral);

AaveRepayedUSDCFromContractBalance

event AaveRepayedUSDCFromContractBalance(uint256 usdcBalance);

EthRescued

event EthRescued(address indexed to, uint256 amount);

TokensWithdrawnFromContractBalance

event TokensWithdrawnFromContractBalance(string identifier, uint256 tokenBalance);

AaveWithdrawnWstETH

event AaveWithdrawnWstETH(address indexed ownerAddress, uint256 amount);

AaveBorrowedAndWithdrawnUSDC

event AaveBorrowedAndWithdrawnUSDC(address indexed ownerAddress, uint256 amount);

AaveClosedPosition

event AaveClosedPosition(address indexed ownerAddress);

AavePMUpgraded

event AavePMUpgraded(address indexed previousImplementation, address indexed newImplementation);

FlashLoanExecuted

event FlashLoanExecuted(address indexed asset, uint256 amount, uint256 premium);

Errors

AavePM__NoDebtToRepay

error AavePM__NoDebtToRepay();

AavePM__RescueEthFailed

error AavePM__RescueEthFailed();

AavePM__ZeroBorrowAmount

error AavePM__ZeroBorrowAmount();

AavePM__AddressNotAnOwner

error AavePM__AddressNotAnOwner();

AavePM__DelegateCallFailed

error AavePM__DelegateCallFailed();

AavePM__NoTokensToWithdraw

error AavePM__NoTokensToWithdraw();

AavePM__ReinvestNotRequired

error AavePM__ReinvestNotRequired();

AavePM__RebalanceNotRequired

error AavePM__RebalanceNotRequired();

AavePM__FunctionDoesNotExist

error AavePM__FunctionDoesNotExist();

AavePM__NegativeInterestCalc

error AavePM__NegativeInterestCalc();

AavePM__HealthFactorUnchanged

error AavePM__HealthFactorUnchanged();

AavePM__NoCollateralToWithdraw

error AavePM__NoCollateralToWithdraw();

AavePM__InvalidWithdrawalToken

error AavePM__InvalidWithdrawalToken();

AavePM__HealthFactorBelowMinimum

error AavePM__HealthFactorBelowMinimum();

AavePM__SlippageToleranceUnchanged

error AavePM__SlippageToleranceUnchanged();

AavePM__SlippageToleranceAboveMaximum

error AavePM__SlippageToleranceAboveMaximum();

AavePM__ZeroBorrowAndWithdrawUSDCAvailable

error AavePM__ZeroBorrowAndWithdrawUSDCAvailable();

AavePM__ManagerDailyInvocationLimitReached

error AavePM__ManagerDailyInvocationLimitReached();

AaveFunctions__FlashLoanMsgSenderUnauthorized

error AaveFunctions__FlashLoanMsgSenderUnauthorized();

AaveFunctions__FlashLoanInitiatorUnauthorized

error AaveFunctions__FlashLoanInitiatorUnauthorized();

TokenSwaps__NotEnoughTokensForSwap

error TokenSwaps__NotEnoughTokensForSwap(string tokenInIdentifier);

Structs

ContractAddress

struct ContractAddress {
    string identifier;
    address contractAddress;
}

TokenAddress

struct TokenAddress {
    string identifier;
    address tokenAddress;
}

UniswapV3Pool

struct UniswapV3Pool {
    string identifier;
    address poolAddress;
    uint24 fee;
}