ETH Price: $2,767.36 (+2.27%)

Contract

0x543134eC56eE444403461519C1Ec8590C7475897
 
Transaction Hash
Method
Block
From
To
Transfer Ownersh...154786312022-09-05 15:33:28895 days ago1662392008IN
0x543134eC...0C7475897
0 ETH0.0006352222.1976347
Set User Incenti...154784762022-09-05 14:52:21895 days ago1662389541IN
0x543134eC...0C7475897
0 ETH0.0009252620

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FlashStrategyAAVEv2

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 14 : FlashStrategyAAVEv2.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../interfaces/AAVE/ILendingPool.sol";
import "../interfaces/AAVE/IAaveIncentivesController.sol";
import "../interfaces/IFlashStrategy.sol";
import "../interfaces/IUserIncentive.sol";
import "../interfaces/IFlashFToken.sol";

contract FlashStrategyAAVEv2 is IFlashStrategy, Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    address immutable flashProtocolAddress;
    address immutable lendingPoolAddress; // The AAVE V2 lending pool address
    address immutable principalTokenAddress; // The Principal token address (eg DAI)
    address immutable interestBearingTokenAddress; // The AAVE V2 interest bearing token address
    uint8 immutable principalDecimals;

    address fTokenAddress; // The Flash fERC20 token address
    uint16 referralCode = 0; // The AAVE V2 referral code
    uint256 principalBalance; // The amount of principal in this strategy
    address constant aaveIncentivesAddress = 0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5;

    address public userIncentiveAddress;
    bool public userIncentiveAddressLocked;

    constructor(
        address _lendingPoolAddress,
        address _principalTokenAddress,
        address _interestBearingTokenAddress,
        address _flashProtocolAddress
    ) public {
        lendingPoolAddress = _lendingPoolAddress;
        principalTokenAddress = _principalTokenAddress;
        interestBearingTokenAddress = _interestBearingTokenAddress;
        flashProtocolAddress = _flashProtocolAddress;

        // Read the number of decimals from the principal token
        principalDecimals = IFlashFToken(principalTokenAddress).decimals();

        increaseAllowance();
    }

    // Implemented as a separate function just in case the strategy ever runs out of allowance
    function increaseAllowance() public {
        IERC20(principalTokenAddress).safeApprove(lendingPoolAddress, 0);
        IERC20(principalTokenAddress).safeApprove(lendingPoolAddress, type(uint256).max);
    }

    function depositPrincipal(uint256 _tokenAmount) external override onlyAuthorised returns (uint256) {
        // Register how much we are depositing
        principalBalance = principalBalance + _tokenAmount;

        // Deposit into AAVE
        ILendingPool(lendingPoolAddress).deposit(principalTokenAddress, _tokenAmount, address(this), referralCode);

        return _tokenAmount;
    }

    function withdrawYield(uint256 _tokenAmount) private {
        // Withdraw from AAVE
        uint256 returnedTokens = ILendingPool(lendingPoolAddress).withdraw(
            principalTokenAddress,
            _tokenAmount,
            address(this)
        );
        require(returnedTokens >= _tokenAmount);

        uint256 aTokenBalance = IERC20(interestBearingTokenAddress).balanceOf(address(this));
        require(aTokenBalance >= getPrincipalBalance(), "PRINCIPAL BALANCE INVALID");
    }

    function withdrawPrincipal(uint256 _tokenAmount) external override onlyAuthorised {
        // Withdraw from AAVE
        uint256 returnedTokens = ILendingPool(lendingPoolAddress).withdraw(
            principalTokenAddress,
            _tokenAmount,
            address(this)
        );
        require(returnedTokens >= _tokenAmount);

        IERC20(principalTokenAddress).safeTransfer(msg.sender, _tokenAmount);

        principalBalance = principalBalance - _tokenAmount;
    }

    function withdrawERC20(address[] calldata _tokenAddresses, uint256[] calldata _tokenAmounts) external onlyOwner {
        require(_tokenAddresses.length == _tokenAmounts.length, "ARRAY SIZE MISMATCH");

        for (uint256 i = 0; i < _tokenAddresses.length; i++) {
            // Ensure the token being withdrawn is not the interest bearing token
            require(_tokenAddresses[i] != interestBearingTokenAddress, "TOKEN ADDRESS PROHIBITED");

            // Transfer the token to the caller
            IERC20(_tokenAddresses[i]).safeTransfer(msg.sender, _tokenAmounts[i]);
        }
    }

    function getPrincipalBalance() public view override returns (uint256) {
        return principalBalance;
    }

    function getYieldBalance() public view override returns (uint256) {
        uint256 interestBearingTokenBalance = IERC20(interestBearingTokenAddress).balanceOf(address(this));

        return (interestBearingTokenBalance - getPrincipalBalance());
    }

    function getPrincipalAddress() external view override returns (address) {
        return principalTokenAddress;
    }

    function getFTokenAddress() external view returns (address) {
        return fTokenAddress;
    }

    function setFTokenAddress(address _fTokenAddress) external override onlyAuthorised {
        require(fTokenAddress == address(0), "FTOKEN ADDRESS ALREADY SET");
        fTokenAddress = _fTokenAddress;
    }

    function quoteMintFToken(uint256 _tokenAmount, uint256 _duration) external view override returns (uint256) {
        // Enforce minimum _duration
        require(_duration >= 60, "DURATION TOO LOW");

        // 1 ERC20 for 365 DAYS = 1 fERC20
        // 1 second = 0.000000031709792000
        // eg (100000000000000000 * (1 second * 31709792000)) / 10**18
        // eg (1000000 * (1 second * 31709792000)) / 10**6
        uint256 amountToMint = (_tokenAmount * (_duration * 31709792000)) / (10**principalDecimals);

        require(amountToMint > 0, "INSUFFICIENT OUTPUT");

        return amountToMint;
    }

    function quoteBurnFToken(uint256 _tokenAmount) public view override returns (uint256) {
        uint256 totalSupply = IERC20(fTokenAddress).totalSupply();
        require(totalSupply > 0, "INSUFFICIENT fERC20 TOKEN SUPPLY");

        if (_tokenAmount > totalSupply) {
            _tokenAmount = totalSupply;
        }

        // Calculate the percentage of _tokenAmount vs totalSupply provided
        // and multiply by total yield
        return (getYieldBalance() * _tokenAmount) / totalSupply;
    }

    function burnFToken(
        uint256 _tokenAmount,
        uint256 _minimumReturned,
        address _yieldTo
    ) external override nonReentrant returns (uint256) {
        // Calculate how much yield to give back
        uint256 tokensOwed = quoteBurnFToken(_tokenAmount);
        require(tokensOwed >= _minimumReturned && tokensOwed > 0, "INSUFFICIENT OUTPUT");

        // Transfer fERC20 (from caller) tokens to contract so we can burn them
        IFlashFToken(fTokenAddress).burnFrom(msg.sender, _tokenAmount);

        withdrawYield(tokensOwed);
        IERC20(principalTokenAddress).safeTransfer(_yieldTo, tokensOwed);

        // Distribute rewards if there is a reward balance within contract
        if (userIncentiveAddress != address(0)) {
            IUserIncentive(userIncentiveAddress).claimReward(_tokenAmount, _yieldTo);
        }

        emit BurnedFToken(msg.sender, _tokenAmount, tokensOwed);

        return tokensOwed;
    }

    modifier onlyAuthorised() {
        require(msg.sender == flashProtocolAddress || msg.sender == address(this), "NOT FLASH PROTOCOL");
        _;
    }

    function getMaxStakeDuration() public pure override returns (uint256) {
        return 63072000; // Static 730 days (2 years)
    }

    function claimAAVEv2Rewards(address[] calldata _assets, uint256 _amount) external onlyOwner {
        IAaveIncentivesController(aaveIncentivesAddress).claimRewards(_assets, _amount, address(this));
    }

    function setUserIncentiveAddress(address _userIncentiveAddress) external onlyOwner {
        require(userIncentiveAddressLocked == false);
        userIncentiveAddress = _userIncentiveAddress;
    }

    function lockSetUserIncentiveAddress() external onlyOwner {
        require(userIncentiveAddressLocked == false);
        userIncentiveAddressLocked = true;
    }
}

File 2 of 14 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 4 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 14 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 14 : ILendingPool.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;
pragma experimental ABIEncoderV2;

import { ILendingPoolAddressesProvider } from "./ILendingPoolAddressesProvider.sol";
import { DataTypes } from "./DataTypes.sol";

interface ILendingPool {
    /**
     * @dev Emitted on deposit()
     * @param reserve The address of the underlying asset of the reserve
     * @param user The address initiating the deposit
     * @param onBehalfOf The beneficiary of the deposit, receiving the aTokens
     * @param amount The amount deposited
     * @param referral The referral code used
     **/
    event Deposit(
        address indexed reserve,
        address user,
        address indexed onBehalfOf,
        uint256 amount,
        uint16 indexed referral
    );

    /**
     * @dev Emitted on withdraw()
     * @param reserve The address of the underlyng asset being withdrawn
     * @param user The address initiating the withdrawal, owner of aTokens
     * @param to Address that will receive the underlying
     * @param amount The amount to be withdrawn
     **/
    event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount);

    /**
     * @dev Emitted on borrow() and flashLoan() when debt needs to be opened
     * @param reserve The address of the underlying asset being borrowed
     * @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
     * initiator of the transaction on flashLoan()
     * @param onBehalfOf The address that will be getting the debt
     * @param amount The amount borrowed out
     * @param borrowRateMode The rate mode: 1 for Stable, 2 for Variable
     * @param borrowRate The numeric rate at which the user has borrowed
     * @param referral The referral code used
     **/
    event Borrow(
        address indexed reserve,
        address user,
        address indexed onBehalfOf,
        uint256 amount,
        uint256 borrowRateMode,
        uint256 borrowRate,
        uint16 indexed referral
    );

    /**
     * @dev Emitted on repay()
     * @param reserve The address of the underlying asset of the reserve
     * @param user The beneficiary of the repayment, getting his debt reduced
     * @param repayer The address of the user initiating the repay(), providing the funds
     * @param amount The amount repaid
     **/
    event Repay(address indexed reserve, address indexed user, address indexed repayer, uint256 amount);

    /**
     * @dev Emitted on swapBorrowRateMode()
     * @param reserve The address of the underlying asset of the reserve
     * @param user The address of the user swapping his rate mode
     * @param rateMode The rate mode that the user wants to swap to
     **/
    event Swap(address indexed reserve, address indexed user, uint256 rateMode);

    /**
     * @dev Emitted on setUserUseReserveAsCollateral()
     * @param reserve The address of the underlying asset of the reserve
     * @param user The address of the user enabling the usage as collateral
     **/
    event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);

    /**
     * @dev Emitted on setUserUseReserveAsCollateral()
     * @param reserve The address of the underlying asset of the reserve
     * @param user The address of the user enabling the usage as collateral
     **/
    event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);

    /**
     * @dev Emitted on rebalanceStableBorrowRate()
     * @param reserve The address of the underlying asset of the reserve
     * @param user The address of the user for which the rebalance has been executed
     **/
    event RebalanceStableBorrowRate(address indexed reserve, address indexed user);

    /**
     * @dev Emitted on flashLoan()
     * @param target The address of the flash loan receiver contract
     * @param initiator The address initiating the flash loan
     * @param asset The address of the asset being flash borrowed
     * @param amount The amount flash borrowed
     * @param premium The fee flash borrowed
     * @param referralCode The referral code used
     **/
    event FlashLoan(
        address indexed target,
        address indexed initiator,
        address indexed asset,
        uint256 amount,
        uint256 premium,
        uint16 referralCode
    );

    /**
     * @dev Emitted when the pause is triggered.
     */
    event Paused();

    /**
     * @dev Emitted when the pause is lifted.
     */
    event Unpaused();

    /**
     * @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via
     * LendingPoolCollateral manager using a DELEGATECALL
     * This allows to have the events in the generated ABI for LendingPool.
     * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
     * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
     * @param user The address of the borrower getting liquidated
     * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
     * @param liquidatedCollateralAmount The amount of collateral received by the liiquidator
     * @param liquidator The address of the liquidator
     * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants
     * to receive the underlying collateral asset directly
     **/
    event LiquidationCall(
        address indexed collateralAsset,
        address indexed debtAsset,
        address indexed user,
        uint256 debtToCover,
        uint256 liquidatedCollateralAmount,
        address liquidator,
        bool receiveAToken
    );

    /**
     * @dev Emitted when the state of a reserve is updated. NOTE: This event is actually declared
     * in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal,
     * the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it
     * gets added to the LendingPool ABI
     * @param reserve The address of the underlying asset of the reserve
     * @param liquidityRate The new liquidity rate
     * @param stableBorrowRate The new stable borrow rate
     * @param variableBorrowRate The new variable borrow rate
     * @param liquidityIndex The new liquidity index
     * @param variableBorrowIndex The new variable borrow index
     **/
    event ReserveDataUpdated(
        address indexed reserve,
        uint256 liquidityRate,
        uint256 stableBorrowRate,
        uint256 variableBorrowRate,
        uint256 liquidityIndex,
        uint256 variableBorrowIndex
    );

    /**
     * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
     * - E.g. User deposits 100 USDC and gets in return 100 aUSDC
     * @param asset The address of the underlying asset to deposit
     * @param amount The amount to be deposited
     * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
     *   wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
     *   is a different wallet
     * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
     *   0 if the action is executed directly by the user, without any middle-man
     **/
    function deposit(
        address asset,
        uint256 amount,
        address onBehalfOf,
        uint16 referralCode
    ) external;

    /**
     * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
     * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
     * @param asset The address of the underlying asset to withdraw
     * @param amount The underlying amount to be withdrawn
     *   - Send the value type(uint256).max in order to withdraw the whole aToken balance
     * @param to Address that will receive the underlying, same as msg.sender if the user
     *   wants to receive it on his own wallet, or a different address if the beneficiary is a
     *   different wallet
     * @return The final amount withdrawn
     **/
    function withdraw(
        address asset,
        uint256 amount,
        address to
    ) external returns (uint256);

    /**
     * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
     * already deposited enough collateral, or he was given enough allowance by a credit delegator on the
     * corresponding debt token (StableDebtToken or VariableDebtToken)
     * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
     *   and 100 stable/variable debt tokens, depending on the `interestRateMode`
     * @param asset The address of the underlying asset to borrow
     * @param amount The amount to be borrowed
     * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
     * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
     *   0 if the action is executed directly by the user, without any middle-man
     * @param onBehalfOf Address of the user who will receive the debt. Should be the address of the borrower itself
     * calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
     * if he has been given credit delegation allowance
     **/
    function borrow(
        address asset,
        uint256 amount,
        uint256 interestRateMode,
        uint16 referralCode,
        address onBehalfOf
    ) external;

    /**
     * @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
     * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
     * @param asset The address of the borrowed underlying asset previously borrowed
     * @param amount The amount to repay
     * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
     * @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
     * @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
     * user calling the function if he wants to reduce/remove his own debt, or the address of any other
     * other borrower whose debt should be removed
     * @return The final amount repaid
     **/
    function repay(
        address asset,
        uint256 amount,
        uint256 rateMode,
        address onBehalfOf
    ) external returns (uint256);

    /**
     * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa
     * @param asset The address of the underlying asset borrowed
     * @param rateMode The rate mode that the user wants to swap to
     **/
    function swapBorrowRateMode(address asset, uint256 rateMode) external;

    /**
     * @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
     * - Users can be rebalanced if the following conditions are satisfied:
     *     1. Usage ratio is above 95%
     *     2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been
     *        borrowed at a stable rate and depositors are not earning enough
     * @param asset The address of the underlying asset borrowed
     * @param user The address of the user to be rebalanced
     **/
    function rebalanceStableBorrowRate(address asset, address user) external;

    /**
     * @dev Allows depositors to enable/disable a specific deposited asset as collateral
     * @param asset The address of the underlying asset deposited
     * @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise
     **/
    function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;

    /**
     * @dev Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
     * - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
     *   a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
     * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
     * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
     * @param user The address of the borrower getting liquidated
     * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
     * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants
     * to receive the underlying collateral asset directly
     **/
    function liquidationCall(
        address collateralAsset,
        address debtAsset,
        address user,
        uint256 debtToCover,
        bool receiveAToken
    ) external;

    /**
     * @dev Allows smartcontracts to access the liquidity of the pool within one transaction,
     * as long as the amount taken plus a fee is returned.
     * IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration.
     * For further details please visit https://developers.aave.com
     * @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface
     * @param assets The addresses of the assets being flash-borrowed
     * @param amounts The amounts amounts being flash-borrowed
     * @param modes Types of the debt to open if the flash loan is not returned:
     *   0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
     *   1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
     *   2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
     * @param onBehalfOf The address  that will receive the debt in the case of using on `modes` 1 or 2
     * @param params Variadic packed params to pass to the receiver as extra information
     * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
     *   0 if the action is executed directly by the user, without any middle-man
     **/
    function flashLoan(
        address receiverAddress,
        address[] calldata assets,
        uint256[] calldata amounts,
        uint256[] calldata modes,
        address onBehalfOf,
        bytes calldata params,
        uint16 referralCode
    ) external;

    /**
     * @dev Returns the user account data across all the reserves
     * @param user The address of the user
     * @return totalCollateralETH the total collateral in ETH of the user
     * @return totalDebtETH the total debt in ETH of the user
     * @return availableBorrowsETH the borrowing power left of the user
     * @return currentLiquidationThreshold the liquidation threshold of the user
     * @return ltv the loan to value of the user
     * @return healthFactor the current health factor of the user
     **/
    function getUserAccountData(address user)
        external
        view
        returns (
            uint256 totalCollateralETH,
            uint256 totalDebtETH,
            uint256 availableBorrowsETH,
            uint256 currentLiquidationThreshold,
            uint256 ltv,
            uint256 healthFactor
        );

    function initReserve(
        address reserve,
        address aTokenAddress,
        address stableDebtAddress,
        address variableDebtAddress,
        address interestRateStrategyAddress
    ) external;

    function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external;

    function setConfiguration(address reserve, uint256 configuration) external;

    /**
     * @dev Returns the configuration of the reserve
     * @param asset The address of the underlying asset of the reserve
     * @return The configuration of the reserve
     **/
    function getConfiguration(address asset) external view returns (DataTypes.ReserveConfigurationMap memory);

    /**
     * @dev Returns the configuration of the user across all the reserves
     * @param user The user address
     * @return The configuration of the user
     **/
    function getUserConfiguration(address user) external view returns (DataTypes.UserConfigurationMap memory);

    /**
     * @dev Returns the normalized income normalized income of the reserve
     * @param asset The address of the underlying asset of the reserve
     * @return The reserve's normalized income
     */
    function getReserveNormalizedIncome(address asset) external view returns (uint256);

    /**
     * @dev Returns the normalized variable debt per unit of asset
     * @param asset The address of the underlying asset of the reserve
     * @return The reserve normalized variable debt
     */
    function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);

    /**
     * @dev Returns the state and configuration of the reserve
     * @param asset The address of the underlying asset of the reserve
     * @return The state of the reserve
     **/
    function getReserveData(address asset) external view returns (DataTypes.ReserveData memory);

    function finalizeTransfer(
        address asset,
        address from,
        address to,
        uint256 amount,
        uint256 balanceFromAfter,
        uint256 balanceToBefore
    ) external;

    function getReservesList() external view returns (address[] memory);

    function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);

    function setPause(bool val) external;

    function paused() external view returns (bool);
}

File 7 of 14 : IAaveIncentivesController.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;
pragma experimental ABIEncoderV2;

interface IAaveIncentivesController {
    event RewardsAccrued(address indexed user, uint256 amount);

    event RewardsClaimed(address indexed user, address indexed to, uint256 amount);

    event RewardsClaimed(address indexed user, address indexed to, address indexed claimer, uint256 amount);

    event ClaimerSet(address indexed user, address indexed claimer);

    /*
     * @dev Returns the configuration of the distribution for a certain asset
     * @param asset The address of the reference asset of the distribution
     * @return The asset index, the emission per second and the last updated timestamp
     **/
    function getAssetData(address asset)
        external
        view
        returns (
            uint256,
            uint256,
            uint256
        );

    /*
     * LEGACY **************************
     * @dev Returns the configuration of the distribution for a certain asset
     * @param asset The address of the reference asset of the distribution
     * @return The asset index, the emission per second and the last updated timestamp
     **/
    function assets(address asset)
        external
        view
        returns (
            uint128,
            uint128,
            uint256
        );

    /**
     * @dev Whitelists an address to claim the rewards on behalf of another address
     * @param user The address of the user
     * @param claimer The address of the claimer
     */
    function setClaimer(address user, address claimer) external;

    /**
     * @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
     * @param user The address of the user
     * @return The claimer address
     */
    function getClaimer(address user) external view returns (address);

    /**
     * @dev Configure assets for a certain rewards emission
     * @param assets The assets to incentivize
     * @param emissionsPerSecond The emission for each asset
     */
    function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond) external;

    /**
     * @dev Called by the corresponding asset on any update that affects the rewards distribution
     * @param asset The address of the user
     * @param userBalance The balance of the user of the asset in the lending pool
     * @param totalSupply The total supply of the asset in the lending pool
     **/
    function handleAction(
        address asset,
        uint256 userBalance,
        uint256 totalSupply
    ) external;

    /**
     * @dev Returns the total of rewards of an user, already accrued + not yet accrued
     * @param user The address of the user
     * @return The rewards
     **/
    function getRewardsBalance(address[] calldata assets, address user) external view returns (uint256);

    /**
     * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
     * @param amount Amount of rewards to claim
     * @param to Address that will be receiving the rewards
     * @return Rewards claimed
     **/
    function claimRewards(
        address[] calldata assets,
        uint256 amount,
        address to
    ) external returns (uint256);

    /**
     * @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must
     * be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
     * @param amount Amount of rewards to claim
     * @param user Address to check and claim rewards
     * @param to Address that will be receiving the rewards
     * @return Rewards claimed
     **/
    function claimRewardsOnBehalf(
        address[] calldata assets,
        uint256 amount,
        address user,
        address to
    ) external returns (uint256);

    /**
     * @dev returns the unclaimed rewards of the user
     * @param user the address of the user
     * @return the unclaimed user rewards
     */
    function getUserUnclaimedRewards(address user) external view returns (uint256);

    /**
     * @dev returns the unclaimed rewards of the user
     * @param user the address of the user
     * @param asset The asset to incentivize
     * @return the user index for the asset
     */
    function getUserAssetData(address user, address asset) external view returns (uint256);

    /**
     * @dev for backward compatibility with previous implementation of the Incentives controller
     */
    function REWARD_TOKEN() external view returns (address);

    /**
     * @dev for backward compatibility with previous implementation of the Incentives controller
     */
    function PRECISION() external view returns (uint8);

    /**
     * @dev Gets the distribution end timestamp of the emissions
     */
    function DISTRIBUTION_END() external view returns (uint256);
}

File 8 of 14 : IFlashStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IFlashStrategy {
    event BurnedFToken(address indexed _address, uint256 _tokenAmount, uint256 _yieldReturned);

    // This is how principal will be deposited into the contract
    // The Flash protocol allows the strategy to specify how much
    // should be registered. This allows the strategy to manipulate (eg take fee)
    // on the principal if the strategy requires
    function depositPrincipal(uint256 _tokenAmount) external returns (uint256);

    // This is how principal will be returned from the contract
    function withdrawPrincipal(uint256 _tokenAmount) external;

    // Responsible for instant upfront yield. Takes fERC20 tokens specific to this
    // strategy. The strategy is responsible for returning some amount of principal tokens
    function burnFToken(
        uint256 _tokenAmount,
        uint256 _minimumReturned,
        address _yieldTo
    ) external returns (uint256);

    // This should return the current total of all principal within the contract
    function getPrincipalBalance() external view returns (uint256);

    // This should return the current total of all yield generated to date (including bootstrapped tokens)
    function getYieldBalance() external view returns (uint256);

    // This should return the principal token address (eg DAI)
    function getPrincipalAddress() external view returns (address);

    // View function which quotes how many principal tokens would be returned if x
    // fERC20 tokens are burned
    function quoteMintFToken(uint256 _tokenAmount, uint256 duration) external view returns (uint256);

    // View function which quotes how many principal tokens would be returned if x
    // fERC20 tokens are burned
    // IMPORTANT NOTE: This should utilise bootstrap tokens if they exist
    // bootstrapped tokens are any principal tokens that exist within the smart contract
    function quoteBurnFToken(uint256 _tokenAmount) external view returns (uint256);

    // The function to set the fERC20 address within the strategy
    function setFTokenAddress(address _fTokenAddress) external;

    // This should return what the maximum stake duration is
    function getMaxStakeDuration() external view returns (uint256);
}

File 9 of 14 : IUserIncentive.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IUserIncentive {
    event RewardClaimed(address _rewardToken, address indexed _address);

    // This will be called by the Strategy to claim rewards for the user
    // This should be permissioned such that only the Strategy address can call
    function claimReward(uint256 _fERC20Burned, address _yieldTo) external;

    // This is a view function to determine how many reward tokens will be paid out
    // providing ??? fERC20 tokens are burned
    function quoteReward(uint256 _fERC20Burned) external view returns (uint256);

    // Administrator: setting the reward ratio
    function setRewardRatio(uint256 _ratio) external;

    // Administrator: adding the reward tokens
    function addRewardTokens(uint256 _tokenAmount) external;

    // Administrator: depositing the reward tokens
    function depositReward(
        address _rewardTokenAddress,
        uint256 _tokenAmount,
        uint256 _ratio
    ) external;
}

File 10 of 14 : IFlashFToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IFlashFToken {
    function mint(address account, uint256 amount) external;

    function burnFrom(address from, uint256 amount) external;

    function decimals() external returns (uint8);
}

File 11 of 14 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 12 of 14 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 13 of 14 : ILendingPoolAddressesProvider.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;

/**
 * @title LendingPoolAddressesProvider contract
 * @dev Main registry of addresses part of or connected to the protocol, including permissioned roles
 * - Acting also as factory of proxies and admin of those, so with right to change its implementations
 * - Owned by the Aave Governance
 * @author Aave
 **/
interface ILendingPoolAddressesProvider {
    event MarketIdSet(string newMarketId);
    event LendingPoolUpdated(address indexed newAddress);
    event ConfigurationAdminUpdated(address indexed newAddress);
    event EmergencyAdminUpdated(address indexed newAddress);
    event LendingPoolConfiguratorUpdated(address indexed newAddress);
    event LendingPoolCollateralManagerUpdated(address indexed newAddress);
    event PriceOracleUpdated(address indexed newAddress);
    event LendingRateOracleUpdated(address indexed newAddress);
    event ProxyCreated(bytes32 id, address indexed newAddress);
    event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);

    function getMarketId() external view returns (string memory);

    function setMarketId(string calldata marketId) external;

    function setAddress(bytes32 id, address newAddress) external;

    function setAddressAsProxy(bytes32 id, address impl) external;

    function getAddress(bytes32 id) external view returns (address);

    function getLendingPool() external view returns (address);

    function setLendingPoolImpl(address pool) external;

    function getLendingPoolConfigurator() external view returns (address);

    function setLendingPoolConfiguratorImpl(address configurator) external;

    function getLendingPoolCollateralManager() external view returns (address);

    function setLendingPoolCollateralManager(address manager) external;

    function getPoolAdmin() external view returns (address);

    function setPoolAdmin(address admin) external;

    function getEmergencyAdmin() external view returns (address);

    function setEmergencyAdmin(address admin) external;

    function getPriceOracle() external view returns (address);

    function setPriceOracle(address priceOracle) external;

    function getLendingRateOracle() external view returns (address);

    function setLendingRateOracle(address lendingRateOracle) external;
}

File 14 of 14 : DataTypes.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.4;

library DataTypes {
    // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
    struct ReserveData {
        //stores the reserve configuration
        ReserveConfigurationMap configuration;
        //the liquidity index. Expressed in ray
        uint128 liquidityIndex;
        //variable borrow index. Expressed in ray
        uint128 variableBorrowIndex;
        //the current supply rate. Expressed in ray
        uint128 currentLiquidityRate;
        //the current variable borrow rate. Expressed in ray
        uint128 currentVariableBorrowRate;
        //the current stable borrow rate. Expressed in ray
        uint128 currentStableBorrowRate;
        uint40 lastUpdateTimestamp;
        //tokens addresses
        address aTokenAddress;
        address stableDebtTokenAddress;
        address variableDebtTokenAddress;
        //address of the interest rate strategy
        address interestRateStrategyAddress;
        //the id of the reserve. Represents the position in the list of the active reserves
        uint8 id;
    }

    struct ReserveConfigurationMap {
        //bit 0-15: LTV
        //bit 16-31: Liq. threshold
        //bit 32-47: Liq. bonus
        //bit 48-55: Decimals
        //bit 56: Reserve is active
        //bit 57: reserve is frozen
        //bit 58: borrowing is enabled
        //bit 59: stable rate borrowing enabled
        //bit 60-63: reserved
        //bit 64-79: reserve factor
        uint256 data;
    }

    struct UserConfigurationMap {
        uint256 data;
    }

    enum InterestRateMode {
        NONE,
        STABLE,
        VARIABLE
    }
}

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_lendingPoolAddress","type":"address"},{"internalType":"address","name":"_principalTokenAddress","type":"address"},{"internalType":"address","name":"_interestBearingTokenAddress","type":"address"},{"internalType":"address","name":"_flashProtocolAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_yieldReturned","type":"uint256"}],"name":"BurnedFToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint256","name":"_minimumReturned","type":"uint256"},{"internalType":"address","name":"_yieldTo","type":"address"}],"name":"burnFToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claimAAVEv2Rewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"depositPrincipal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getFTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxStakeDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPrincipalAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrincipalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getYieldBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increaseAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockSetUserIncentiveAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"quoteBurnFToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"}],"name":"quoteMintFToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fTokenAddress","type":"address"}],"name":"setFTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userIncentiveAddress","type":"address"}],"name":"setUserIncentiveAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"userIncentiveAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userIncentiveAddressLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokenAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_tokenAmounts","type":"uint256[]"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenAmount","type":"uint256"}],"name":"withdrawPrincipal","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101206040526002805461ffff60a01b191690553480156200002057600080fd5b50604051620024423803806200244283398101604081905262000043916200059d565b6200004e3362000103565b600180556001600160a01b0380851660a05283811660c081905283821660e0529082166080526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181600087803b158015620000ad57600080fd5b505af1158015620000c2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000e89190620005fa565b60ff1661010052620000f962000153565b50505050620006e3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200017d60a051600060c0516001600160a01b0316620001aa60201b620011d0179092919060201c565b620001a860a05160001960c0516001600160a01b0316620001aa60201b620011d0179092919060201c565b565b801580620002385750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015620001fb57600080fd5b505afa15801562000210573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200023691906200061f565b155b620002b05760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084015b60405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620003089185916200030d16565b505050565b600062000369826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620003eb60201b62001360179092919060201c565b8051909150156200030857808060200190518101906200038a919062000639565b620003085760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620002a7565b6060620003fc848460008562000406565b90505b9392505050565b606082471015620004695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620002a7565b6001600160a01b0385163b620004c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620002a7565b600080866001600160a01b03168587604051620004e0919062000690565b60006040518083038185875af1925050503d80600081146200051f576040519150601f19603f3d011682016040523d82523d6000602084013e62000524565b606091505b5090925090506200053782828662000542565b979650505050505050565b6060831562000553575081620003ff565b825115620005645782518084602001fd5b8160405162461bcd60e51b8152600401620002a79190620006ae565b80516001600160a01b03811681146200059857600080fd5b919050565b60008060008060808587031215620005b457600080fd5b620005bf8562000580565b9350620005cf6020860162000580565b9250620005df6040860162000580565b9150620005ef6060860162000580565b905092959194509250565b6000602082840312156200060d57600080fd5b815160ff81168114620003ff57600080fd5b6000602082840312156200063257600080fd5b5051919050565b6000602082840312156200064c57600080fd5b81518015158114620003ff57600080fd5b60005b838110156200067a57818101518382015260200162000660565b838111156200068a576000848401525b50505050565b60008251620006a48184602087016200065d565b9190910192915050565b6020815260008251806020840152620006cf8160408501602087016200065d565b601f01601f19169190910160400192915050565b60805160a05160c05160e05161010051611cb1620007916000396000610ba20152600081816103cb015281816105a1015261149b0152600081816101e201528181610862015281816109d401528181610aa601528181610efe01528181610f530152818161103801526113be015260008181610a0c01528181610f2001528181610f750152818161108701526113f601526000818161095101528181610dfd0152610fa90152611cb16000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c8063658e28a4116100d85780638da5cb5b1161008c578063ed91f1d011610066578063ed91f1d0146102e2578063ef8d4964146102ea578063f2fde38b146102fd57600080fd5b80638da5cb5b146102ab578063cec833a9146102bc578063e68c84cb146102cf57600080fd5b806376972999116100bd578063769729991461027b5780637b027af0146102855780638997c1f41461029857600080fd5b8063658e28a414610260578063715018a61461027357600080fd5b80634756ce0d1161012f5780634cae6edc116101145780634cae6edc14610216578063580d2b5d1461023a578063594cc6861461024d57600080fd5b80634756ce0d14610206578063489cc20c1461020e57600080fd5b8063272d28ca11610160578063272d28ca146101a85780633b28e418146101cd57806345ed7f33146101e057600080fd5b8063188190221461017c578063202f2a2714610191575b600080fd5b61018f61018a366004611886565b610310565b005b6003545b6040519081526020015b60405180910390f35b6002546001600160a01b03165b6040516001600160a01b03909116815260200161019f565b6004546101b5906001600160a01b031681565b7f00000000000000000000000000000000000000000000000000000000000000006101b5565b61018f6104de565b61019561057f565b60045461022a90600160a01b900460ff1681565b604051901515815260200161019f565b61018f6102483660046118f2565b610636565b61019561025b366004611955565b610725565b61018f61026e36600461198a565b610946565b61018f610ae2565b6303c26700610195565b6101956102933660046119a3565b610b48565b61018f6102a63660046119c5565b610c46565b6000546001600160a01b03166101b5565b6101956102ca36600461198a565b610ce6565b61018f6102dd3660046119c5565b610df2565b61018f610ef1565b6101956102f836600461198a565b610f9c565b61018f61030b3660046119c5565b6110ee565b6000546001600160a01b0316331461036f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b8281146103be5760405162461bcd60e51b815260206004820152601360248201527f41525241592053495a45204d49534d41544348000000000000000000000000006044820152606401610366565b60005b838110156104d7577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316858583818110610405576104056119e0565b905060200201602081019061041a91906119c5565b6001600160a01b031614156104715760405162461bcd60e51b815260206004820152601860248201527f544f4b454e20414444524553532050524f4849424954454400000000000000006044820152606401610366565b6104c533848484818110610487576104876119e0565b905060200201358787858181106104a0576104a06119e0565b90506020020160208101906104b591906119c5565b6001600160a01b03169190611377565b806104cf81611a0c565b9150506103c1565b5050505050565b6000546001600160a01b031633146105385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b600454600160a01b900460ff161561054f57600080fd5b600480547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b1580156105e357600080fd5b505afa1580156105f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061b9190611a27565b905061062660035490565b6106309082611a40565b91505090565b6000546001600160a01b031633146106905760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b604051633111e7b360e01b815273d784927ff2f95ba542bfc824c8a8a98f3495f6b590633111e7b3906106cd908690869086903090600401611a57565b602060405180830381600087803b1580156106e757600080fd5b505af11580156106fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071f9190611a27565b50505050565b60006002600154141561077a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610366565b6002600155600061078a85610ce6565b905083811015801561079c5750600081115b6107e85760405162461bcd60e51b815260206004820152601360248201527f494e53554646494349454e54204f5554505554000000000000000000000000006044820152606401610366565b60025460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561083457600080fd5b505af1158015610848573d6000803e3d6000fd5b50505050610855816113a7565b6108896001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168483611377565b6004546001600160a01b0316156108ff576004805460405163738759c960e11b81529182018790526001600160a01b038581166024840152169063e70eb39290604401600060405180830381600087803b1580156108e657600080fd5b505af11580156108fa573d6000803e3d6000fd5b505050505b604080518681526020810183905233917f931033e43a2977753dbe3de2347d53265c3a695c82b3fa009dd57e06d6a20503910160405180910390a260018055949350505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061097c57503330145b6109bd5760405162461bcd60e51b81526020600482015260126024820152711393d50811931054d208141493d513d0d3d360721b6044820152606401610366565b604051631a4ca37b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390523060448301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906369328dec90606401602060405180830381600087803b158015610a5257600080fd5b505af1158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611a27565b905081811015610a9957600080fd5b610acd6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384611377565b81600354610adb9190611a40565b6003555050565b6000546001600160a01b03163314610b3c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b610b466000611577565b565b6000603c821015610b9b5760405162461bcd60e51b815260206004820152601060248201527f4455524154494f4e20544f4f204c4f57000000000000000000000000000000006044820152606401610366565b6000610bc87f0000000000000000000000000000000000000000000000000000000000000000600a611b9f565b610bd7846407620d0700611bae565b610be19086611bae565b610beb9190611bcd565b905060008111610c3d5760405162461bcd60e51b815260206004820152601360248201527f494e53554646494349454e54204f5554505554000000000000000000000000006044820152606401610366565b90505b92915050565b6000546001600160a01b03163314610ca05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b600454600160a01b900460ff1615610cb757600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600080600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6f9190611a27565b905060008111610dc15760405162461bcd60e51b815260206004820181905260248201527f494e53554646494349454e542066455243323020544f4b454e20535550504c596044820152606401610366565b80831115610dcd578092505b8083610dd761057f565b610de19190611bae565b610deb9190611bcd565b9392505050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480610e2857503330145b610e695760405162461bcd60e51b81526020600482015260126024820152711393d50811931054d208141493d513d0d3d360721b6044820152606401610366565b6002546001600160a01b031615610ec25760405162461bcd60e51b815260206004820152601a60248201527f46544f4b454e204144445245535320414c5245414459205345540000000000006044820152606401610366565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610f466001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f000000000000000000000000000000000000000000000000000000000000000060006111d0565b610b466001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000167f00000000000000000000000000000000000000000000000000000000000000006000196111d0565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480610fd457503330145b6110155760405162461bcd60e51b81526020600482015260126024820152711393d50811931054d208141493d513d0d3d360721b6044820152606401610366565b816003546110239190611bef565b60035560025460405163e8eda9df60e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03908116600483015260248201859052306044830152600160a01b90920461ffff1660648201527f00000000000000000000000000000000000000000000000000000000000000009091169063e8eda9df90608401600060405180830381600087803b1580156110cd57600080fd5b505af11580156110e1573d6000803e3d6000fd5b505050508190505b919050565b6000546001600160a01b031633146111485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b6001600160a01b0381166111c45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610366565b6111cd81611577565b50565b8015806112595750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561121f57600080fd5b505afa158015611233573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112579190611a27565b155b6112cb5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610366565b6040516001600160a01b03831660248201526044810182905261135b90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526115d4565b505050565b606061136f84846000856116b9565b949350505050565b6040516001600160a01b03831660248201526044810182905261135b90849063a9059cbb60e01b906064016112f7565b604051631a4ca37b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390523060448301526000917f0000000000000000000000000000000000000000000000000000000000000000909116906369328dec90606401602060405180830381600087803b15801561143c57600080fd5b505af1158015611450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114749190611a27565b90508181101561148357600080fd5b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b1580156114e557600080fd5b505afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d9190611a27565b905061152860035490565b81101561135b5760405162461bcd60e51b815260206004820152601960248201527f5052494e434950414c2042414c414e434520494e56414c4944000000000000006044820152606401610366565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611629826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113609092919063ffffffff16565b80519091501561135b57808060200190518101906116479190611c07565b61135b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610366565b6060824710156117315760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610366565b6001600160a01b0385163b6117885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610366565b600080866001600160a01b031685876040516117a49190611c55565b60006040518083038185875af1925050503d80600081146117e1576040519150601f19603f3d011682016040523d82523d6000602084013e6117e6565b606091505b50915091506117f6828286611801565b979650505050505050565b60608315611810575081610deb565b8251156118205782518084602001fd5b8160405162461bcd60e51b81526004016103669190611c71565b60008083601f84011261184c57600080fd5b50813567ffffffffffffffff81111561186457600080fd5b6020830191508360208260051b850101111561187f57600080fd5b9250929050565b6000806000806040858703121561189c57600080fd5b843567ffffffffffffffff808211156118b457600080fd5b6118c08883890161183a565b909650945060208701359150808211156118d957600080fd5b506118e68782880161183a565b95989497509550505050565b60008060006040848603121561190757600080fd5b833567ffffffffffffffff81111561191e57600080fd5b61192a8682870161183a565b909790965060209590950135949350505050565b80356001600160a01b03811681146110e957600080fd5b60008060006060848603121561196a57600080fd5b83359250602084013591506119816040850161193e565b90509250925092565b60006020828403121561199c57600080fd5b5035919050565b600080604083850312156119b657600080fd5b50508035926020909101359150565b6000602082840312156119d757600080fd5b610deb8261193e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611a2057611a206119f6565b5060010190565b600060208284031215611a3957600080fd5b5051919050565b600082821015611a5257611a526119f6565b500390565b6060808252810184905260008560808301825b87811015611a98576001600160a01b03611a838461193e565b16825260209283019290910190600101611a6a565b50602084019590955250506001600160a01b039190911660409091015292915050565b600181815b80851115611af6578160001904821115611adc57611adc6119f6565b80851615611ae957918102915b93841c9390800290611ac0565b509250929050565b600082611b0d57506001610c40565b81611b1a57506000610c40565b8160018114611b305760028114611b3a57611b56565b6001915050610c40565b60ff841115611b4b57611b4b6119f6565b50506001821b610c40565b5060208310610133831016604e8410600b8410161715611b79575081810a610c40565b611b838383611abb565b8060001904821115611b9757611b976119f6565b029392505050565b6000610deb60ff841683611afe565b6000816000190483118215151615611bc857611bc86119f6565b500290565b600082611bea57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611c0257611c026119f6565b500190565b600060208284031215611c1957600080fd5b81518015158114610c3d57600080fd5b60005b83811015611c44578181015183820152602001611c2c565b8381111561071f5750506000910152565b60008251611c67818460208701611c29565b9190910192915050565b6020815260008251806020840152611c90816040850160208701611c29565b601f01601f1916919091016040019291505056fea164736f6c6343000809000a0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f00000000000000000000000035f6b052c598d933d69a4eec4d04c73a191fe6c200000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101775760003560e01c8063658e28a4116100d85780638da5cb5b1161008c578063ed91f1d011610066578063ed91f1d0146102e2578063ef8d4964146102ea578063f2fde38b146102fd57600080fd5b80638da5cb5b146102ab578063cec833a9146102bc578063e68c84cb146102cf57600080fd5b806376972999116100bd578063769729991461027b5780637b027af0146102855780638997c1f41461029857600080fd5b8063658e28a414610260578063715018a61461027357600080fd5b80634756ce0d1161012f5780634cae6edc116101145780634cae6edc14610216578063580d2b5d1461023a578063594cc6861461024d57600080fd5b80634756ce0d14610206578063489cc20c1461020e57600080fd5b8063272d28ca11610160578063272d28ca146101a85780633b28e418146101cd57806345ed7f33146101e057600080fd5b8063188190221461017c578063202f2a2714610191575b600080fd5b61018f61018a366004611886565b610310565b005b6003545b6040519081526020015b60405180910390f35b6002546001600160a01b03165b6040516001600160a01b03909116815260200161019f565b6004546101b5906001600160a01b031681565b7f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f6101b5565b61018f6104de565b61019561057f565b60045461022a90600160a01b900460ff1681565b604051901515815260200161019f565b61018f6102483660046118f2565b610636565b61019561025b366004611955565b610725565b61018f61026e36600461198a565b610946565b61018f610ae2565b6303c26700610195565b6101956102933660046119a3565b610b48565b61018f6102a63660046119c5565b610c46565b6000546001600160a01b03166101b5565b6101956102ca36600461198a565b610ce6565b61018f6102dd3660046119c5565b610df2565b61018f610ef1565b6101956102f836600461198a565b610f9c565b61018f61030b3660046119c5565b6110ee565b6000546001600160a01b0316331461036f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b8281146103be5760405162461bcd60e51b815260206004820152601360248201527f41525241592053495a45204d49534d41544348000000000000000000000000006044820152606401610366565b60005b838110156104d7577f00000000000000000000000035f6b052c598d933d69a4eec4d04c73a191fe6c26001600160a01b0316858583818110610405576104056119e0565b905060200201602081019061041a91906119c5565b6001600160a01b031614156104715760405162461bcd60e51b815260206004820152601860248201527f544f4b454e20414444524553532050524f4849424954454400000000000000006044820152606401610366565b6104c533848484818110610487576104876119e0565b905060200201358787858181106104a0576104a06119e0565b90506020020160208101906104b591906119c5565b6001600160a01b03169190611377565b806104cf81611a0c565b9150506103c1565b5050505050565b6000546001600160a01b031633146105385760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b600454600160a01b900460ff161561054f57600080fd5b600480547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055565b6040516370a0823160e01b815230600482015260009081906001600160a01b037f00000000000000000000000035f6b052c598d933d69a4eec4d04c73a191fe6c216906370a082319060240160206040518083038186803b1580156105e357600080fd5b505afa1580156105f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061b9190611a27565b905061062660035490565b6106309082611a40565b91505090565b6000546001600160a01b031633146106905760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b604051633111e7b360e01b815273d784927ff2f95ba542bfc824c8a8a98f3495f6b590633111e7b3906106cd908690869086903090600401611a57565b602060405180830381600087803b1580156106e757600080fd5b505af11580156106fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071f9190611a27565b50505050565b60006002600154141561077a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610366565b6002600155600061078a85610ce6565b905083811015801561079c5750600081115b6107e85760405162461bcd60e51b815260206004820152601360248201527f494e53554646494349454e54204f5554505554000000000000000000000000006044820152606401610366565b60025460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561083457600080fd5b505af1158015610848573d6000803e3d6000fd5b50505050610855816113a7565b6108896001600160a01b037f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f168483611377565b6004546001600160a01b0316156108ff576004805460405163738759c960e11b81529182018790526001600160a01b038581166024840152169063e70eb39290604401600060405180830381600087803b1580156108e657600080fd5b505af11580156108fa573d6000803e3d6000fd5b505050505b604080518681526020810183905233917f931033e43a2977753dbe3de2347d53265c3a695c82b3fa009dd57e06d6a20503910160405180910390a260018055949350505050565b336001600160a01b037f00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b916148061097c57503330145b6109bd5760405162461bcd60e51b81526020600482015260126024820152711393d50811931054d208141493d513d0d3d360721b6044820152606401610366565b604051631a4ca37b60e21b81526001600160a01b037f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f81166004830152602482018390523060448301526000917f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9909116906369328dec90606401602060405180830381600087803b158015610a5257600080fd5b505af1158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a9190611a27565b905081811015610a9957600080fd5b610acd6001600160a01b037f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f163384611377565b81600354610adb9190611a40565b6003555050565b6000546001600160a01b03163314610b3c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b610b466000611577565b565b6000603c821015610b9b5760405162461bcd60e51b815260206004820152601060248201527f4455524154494f4e20544f4f204c4f57000000000000000000000000000000006044820152606401610366565b6000610bc87f0000000000000000000000000000000000000000000000000000000000000012600a611b9f565b610bd7846407620d0700611bae565b610be19086611bae565b610beb9190611bcd565b905060008111610c3d5760405162461bcd60e51b815260206004820152601360248201527f494e53554646494349454e54204f5554505554000000000000000000000000006044820152606401610366565b90505b92915050565b6000546001600160a01b03163314610ca05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b600454600160a01b900460ff1615610cb757600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600080600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6f9190611a27565b905060008111610dc15760405162461bcd60e51b815260206004820181905260248201527f494e53554646494349454e542066455243323020544f4b454e20535550504c596044820152606401610366565b80831115610dcd578092505b8083610dd761057f565b610de19190611bae565b610deb9190611bcd565b9392505050565b336001600160a01b037f00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9161480610e2857503330145b610e695760405162461bcd60e51b81526020600482015260126024820152711393d50811931054d208141493d513d0d3d360721b6044820152606401610366565b6002546001600160a01b031615610ec25760405162461bcd60e51b815260206004820152601a60248201527f46544f4b454e204144445245535320414c5245414459205345540000000000006044820152606401610366565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b610f466001600160a01b037f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f167f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a960006111d0565b610b466001600160a01b037f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f167f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a96000196111d0565b6000336001600160a01b037f00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9161480610fd457503330145b6110155760405162461bcd60e51b81526020600482015260126024820152711393d50811931054d208141493d513d0d3d360721b6044820152606401610366565b816003546110239190611bef565b60035560025460405163e8eda9df60e01b81527f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f6001600160a01b03908116600483015260248201859052306044830152600160a01b90920461ffff1660648201527f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a99091169063e8eda9df90608401600060405180830381600087803b1580156110cd57600080fd5b505af11580156110e1573d6000803e3d6000fd5b505050508190505b919050565b6000546001600160a01b031633146111485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b6001600160a01b0381166111c45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610366565b6111cd81611577565b50565b8015806112595750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561121f57600080fd5b505afa158015611233573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112579190611a27565b155b6112cb5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610366565b6040516001600160a01b03831660248201526044810182905261135b90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526115d4565b505050565b606061136f84846000856116b9565b949350505050565b6040516001600160a01b03831660248201526044810182905261135b90849063a9059cbb60e01b906064016112f7565b604051631a4ca37b60e21b81526001600160a01b037f000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f81166004830152602482018390523060448301526000917f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9909116906369328dec90606401602060405180830381600087803b15801561143c57600080fd5b505af1158015611450573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114749190611a27565b90508181101561148357600080fd5b6040516370a0823160e01b81523060048201526000907f00000000000000000000000035f6b052c598d933d69a4eec4d04c73a191fe6c26001600160a01b0316906370a082319060240160206040518083038186803b1580156114e557600080fd5b505afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d9190611a27565b905061152860035490565b81101561135b5760405162461bcd60e51b815260206004820152601960248201527f5052494e434950414c2042414c414e434520494e56414c4944000000000000006044820152606401610366565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611629826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113609092919063ffffffff16565b80519091501561135b57808060200190518101906116479190611c07565b61135b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610366565b6060824710156117315760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610366565b6001600160a01b0385163b6117885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610366565b600080866001600160a01b031685876040516117a49190611c55565b60006040518083038185875af1925050503d80600081146117e1576040519150601f19603f3d011682016040523d82523d6000602084013e6117e6565b606091505b50915091506117f6828286611801565b979650505050505050565b60608315611810575081610deb565b8251156118205782518084602001fd5b8160405162461bcd60e51b81526004016103669190611c71565b60008083601f84011261184c57600080fd5b50813567ffffffffffffffff81111561186457600080fd5b6020830191508360208260051b850101111561187f57600080fd5b9250929050565b6000806000806040858703121561189c57600080fd5b843567ffffffffffffffff808211156118b457600080fd5b6118c08883890161183a565b909650945060208701359150808211156118d957600080fd5b506118e68782880161183a565b95989497509550505050565b60008060006040848603121561190757600080fd5b833567ffffffffffffffff81111561191e57600080fd5b61192a8682870161183a565b909790965060209590950135949350505050565b80356001600160a01b03811681146110e957600080fd5b60008060006060848603121561196a57600080fd5b83359250602084013591506119816040850161193e565b90509250925092565b60006020828403121561199c57600080fd5b5035919050565b600080604083850312156119b657600080fd5b50508035926020909101359150565b6000602082840312156119d757600080fd5b610deb8261193e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611a2057611a206119f6565b5060010190565b600060208284031215611a3957600080fd5b5051919050565b600082821015611a5257611a526119f6565b500390565b6060808252810184905260008560808301825b87811015611a98576001600160a01b03611a838461193e565b16825260209283019290910190600101611a6a565b50602084019590955250506001600160a01b039190911660409091015292915050565b600181815b80851115611af6578160001904821115611adc57611adc6119f6565b80851615611ae957918102915b93841c9390800290611ac0565b509250929050565b600082611b0d57506001610c40565b81611b1a57506000610c40565b8160018114611b305760028114611b3a57611b56565b6001915050610c40565b60ff841115611b4b57611b4b6119f6565b50506001821b610c40565b5060208310610133831016604e8410600b8410161715611b79575081810a610c40565b611b838383611abb565b8060001904821115611b9757611b976119f6565b029392505050565b6000610deb60ff841683611afe565b6000816000190483118215151615611bc857611bc86119f6565b500290565b600082611bea57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611c0257611c026119f6565b500190565b600060208284031215611c1957600080fd5b81518015158114610c3d57600080fd5b60005b83811015611c44578181015183820152602001611c2c565b8381111561071f5750506000910152565b60008251611c67818460208701611c29565b9190910192915050565b6020815260008251806020840152611c90816040850160208701611c29565b601f01601f1916919091016040019291505056fea164736f6c6343000809000a

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f00000000000000000000000035f6b052c598d933d69a4eec4d04c73a191fe6c200000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9

-----Decoded View---------------
Arg [0] : _lendingPoolAddress (address): 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9
Arg [1] : _principalTokenAddress (address): 0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F
Arg [2] : _interestBearingTokenAddress (address): 0x35f6B052C598d933D69A4EEC4D04c73A191fE6c2
Arg [3] : _flashProtocolAddress (address): 0x78b2d65dd1d3d9Fb2972d7Ef467261Ca101EC2B9

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9
Arg [1] : 000000000000000000000000c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f
Arg [2] : 00000000000000000000000035f6b052c598d933d69a4eec4d04c73a191fe6c2
Arg [3] : 00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.