ETH Price: $3,399.77 (+3.01%)

Contract

0x32e8D4c9d1B711BC958d0Ce8D14b41F77Bb03a64
 
Transaction Hash
Method
Block
From
To
0x60806040134194542021-10-15 0:21:091135 days ago1634257269IN
 Create: ATokenYieldSource
0 ETH0.28934887108.28876159

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ATokenYieldSource

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 21 : ATokenYieldSource.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.6;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@pooltogether/fixed-point/contracts/FixedPoint.sol";
import "@pooltogether/owner-manager-contracts/contracts/Manageable.sol";

import "../external/aave/ILendingPool.sol";
import "../external/aave/ILendingPoolAddressesProvider.sol";
import "../external/aave/ILendingPoolAddressesProviderRegistry.sol";
import "../external/aave/ATokenInterface.sol";
import "../external/aave/IAaveIncentivesController.sol";
import "../external/aave/IProtocolYieldSource.sol";

/// @title Aave Yield Source integration contract, implementing PoolTogether's generic yield source interface
/// @dev This contract inherits from the ERC20 implementation to keep track of users deposits
/// @dev This contract inherits AssetManager which extends OwnableUpgradable
/// @notice Yield source for a PoolTogether prize pool that generates yield by depositing into Aave V2
contract ATokenYieldSource is ERC20, IProtocolYieldSource, Manageable, ReentrancyGuard {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;

  /// @notice Emitted when the yield source is initialized
  event ATokenYieldSourceInitialized(
    IAToken indexed aToken,
    ILendingPoolAddressesProviderRegistry lendingPoolAddressesProviderRegistry,
    uint8 decimals,
    string name,
    string symbol,
    address owner
  );

  /// @notice Emitted when asset tokens are redeemed from the yield source
  event RedeemedToken(
    address indexed from,
    uint256 shares,
    uint256 amount
  );

  /// @notice Emitted when Aave rewards have been claimed
  event Claimed(
    address indexed user,
    address indexed to,
    uint256 amount
  );

  /// @notice Emitted when asset tokens are supplied to the yield source
  event SuppliedTokenTo(
    address indexed from,
    uint256 shares,
    uint256 amount,
    address indexed to
  );

  /// @notice Emitted when asset tokens are supplied to sponsor the yield source
  event Sponsored(
    address indexed from,
    uint256 amount
  );

  /// @notice Emitted when ERC20 tokens other than yield source's aToken are withdrawn from the yield source
  event TransferredERC20(
    address indexed from,
    address indexed to,
    uint256 amount,
    IERC20 indexed token
  );

  /// @notice Interface for the yield-bearing Aave aToken
  ATokenInterface public aToken;

  /// @notice Interface for Aave incentivesController
  IAaveIncentivesController public incentivesController;

  /// @notice Interface for Aave lendingPoolAddressesProviderRegistry
  ILendingPoolAddressesProviderRegistry public lendingPoolAddressesProviderRegistry;

  uint8 internal __decimals;

  /// @dev Aave genesis market LendingPoolAddressesProvider's ID
  /// @dev This variable could evolve in the future if we decide to support other markets
  uint256 private constant ADDRESSES_PROVIDER_ID = uint256(0);

  /// @dev PoolTogether's Aave Referral Code
  uint16 private constant REFERRAL_CODE = uint16(188);

  /// @notice Initializes the yield source with Aave aToken
  /// @param _aToken Aave aToken address
  /// @param _incentivesController Aave incentivesController address
  /// @param _lendingPoolAddressesProviderRegistry Aave lendingPoolAddressesProviderRegistry address
  /// @param _decimals Number of decimals the shares (inhereted ERC20) will have. Set as same as underlying asset to ensure sane ExchangeRates
  /// @param _symbol Token symbol for the underlying shares ERC20
  /// @param _name Token name for the underlying shares ERC20
  constructor (
    ATokenInterface _aToken,
    IAaveIncentivesController _incentivesController,
    ILendingPoolAddressesProviderRegistry _lendingPoolAddressesProviderRegistry,
    uint8 _decimals,
    string memory _symbol,
    string memory _name,
    address _owner
  ) Ownable(_owner) ERC20(_name, _symbol) ReentrancyGuard()
  {
    require(address(_aToken) != address(0), "ATokenYieldSource/aToken-not-zero-address");
    aToken = _aToken;

    require(address(_incentivesController) != address(0), "ATokenYieldSource/incentivesController-not-zero-address");
    incentivesController = _incentivesController;

    require(address(_lendingPoolAddressesProviderRegistry) != address(0), "ATokenYieldSource/lendingPoolRegistry-not-zero-address");
    lendingPoolAddressesProviderRegistry = _lendingPoolAddressesProviderRegistry;

    require(_owner != address(0), "ATokenYieldSource/owner-not-zero-address");

    require(_decimals > 0, "ATokenYieldSource/decimals-gt-zero");
    __decimals = _decimals;

    // approve once for max amount
    IERC20(_tokenAddress()).safeApprove(address(_lendingPool()), type(uint256).max);

    emit ATokenYieldSourceInitialized (
      _aToken,
      _lendingPoolAddressesProviderRegistry,
      _decimals,
      _name,
      _symbol,
      _owner
    );
  }

  function decimals() public override view returns (uint8) {
    return __decimals;
  }

  /// @notice Approve lending pool contract to spend max uint256 amount
  /// @dev Emergency function to re-approve max amount if approval amount dropped too low
  /// @return true if operation is successful
  function approveMaxAmount() external onlyOwner returns (bool) {
    address _lendingPoolAddress = address(_lendingPool());
    IERC20 _underlyingAsset = IERC20(_tokenAddress());
    uint256 _allowance = _underlyingAsset.allowance(address(this), _lendingPoolAddress);

    _underlyingAsset.safeIncreaseAllowance(_lendingPoolAddress, type(uint256).max.sub(_allowance));
    return true;
  }

  /// @notice Returns the ERC20 asset token used for deposits
  /// @return The ERC20 asset token address
  function depositToken() public view override returns (address) {
    return _tokenAddress();
  }

  /// @notice Returns the underlying asset token address
  /// @return Underlying asset token address
  function _tokenAddress() internal view returns (address) {
    return aToken.UNDERLYING_ASSET_ADDRESS();
  }

  /// @notice Returns user total balance (in asset tokens). This includes the deposits and interest.
  /// @param addr User address
  /// @return The underlying balance of asset tokens
  function balanceOfToken(address addr) external override view returns (uint256) {
    return _sharesToToken(balanceOf(addr));
  }

  /// @notice Calculates the number of shares that should be mint or burned when a user deposit or withdraw
  /// @param _tokens Amount of tokens
  /// @return Number of shares
  function _tokenToShares(uint256 _tokens) internal view returns (uint256) {
    uint256 _shares;
    uint256 _totalSupply = totalSupply();

    if (_totalSupply == 0) {
      _shares = _tokens;
    } else {
      // rate = tokens / shares
      // shares = tokens * (totalShares / yieldSourceTotalSupply)
      uint256 _exchangeMantissa = FixedPoint.calculateMantissa(_totalSupply, aToken.balanceOf(address(this)));
      _shares = FixedPoint.multiplyUintByMantissa(_tokens, _exchangeMantissa);
    }

    return _shares;
  }

  /// @notice Calculates the number of tokens a user has in the yield source
  /// @param _shares Amount of shares
  /// @return Number of tokens
  function _sharesToToken(uint256 _shares) internal view returns (uint256) {
    uint256 _tokens;
    uint256 _totalSupply = totalSupply();

    if (_totalSupply == 0) {
      _tokens = _shares;
    } else {
      // tokens = (shares * yieldSourceTotalSupply) / totalShares
      _tokens = _shares.mul(aToken.balanceOf(address(this))).div(_totalSupply);
    }

    return _tokens;
  }

  /// @notice Deposit asset tokens to Aave
  /// @param mintAmount The amount of asset tokens to be deposited
  function _depositToAave(uint256 mintAmount) internal {
    address _underlyingAssetAddress = _tokenAddress();
    ILendingPool __lendingPool = _lendingPool();
    IERC20 _depositToken = IERC20(_underlyingAssetAddress);

    _depositToken.safeTransferFrom(msg.sender, address(this), mintAmount);
    __lendingPool.deposit(_underlyingAssetAddress, mintAmount, address(this), REFERRAL_CODE);
  }

  /// @notice Supplies asset tokens to the yield source
  /// @dev Shares corresponding to the number of tokens supplied are mint to the user's balance
  /// @dev Asset tokens are supplied to the yield source, then deposited into Aave
  /// @param mintAmount The amount of asset tokens to be supplied
  /// @param to The user whose balance will receive the tokens
  function supplyTokenTo(uint256 mintAmount, address to) external override nonReentrant {
    uint256 shares = _tokenToShares(mintAmount);

    require(shares > 0, "ATokenYieldSource/shares-gt-zero");
    _depositToAave(mintAmount);
    _mint(to, shares);

    emit SuppliedTokenTo(msg.sender, shares, mintAmount, to);
  }

  /// @notice Redeems asset tokens from the yield source
  /// @dev Shares corresponding to the number of tokens withdrawn are burnt from the user's balance
  /// @dev Asset tokens are withdrawn from Aave, then transferred from the yield source to the user's wallet
  /// @param redeemAmount The amount of asset tokens to be redeemed
  /// @return The actual amount of asset tokens that were redeemed
  function redeemToken(uint256 redeemAmount) external override nonReentrant returns (uint256) {
    address _underlyingAssetAddress = _tokenAddress();
    IERC20 _depositToken = IERC20(_underlyingAssetAddress);

    uint256 shares = _tokenToShares(redeemAmount);
    _burn(msg.sender, shares);

    uint256 beforeBalance = _depositToken.balanceOf(address(this));
    _lendingPool().withdraw(_underlyingAssetAddress, redeemAmount, address(this));
    uint256 afterBalance = _depositToken.balanceOf(address(this));

    uint256 balanceDiff = afterBalance.sub(beforeBalance);
    _depositToken.safeTransfer(msg.sender, balanceDiff);

    emit RedeemedToken(msg.sender, shares, redeemAmount);
    return balanceDiff;
  }

  /// @notice Transfer ERC20 tokens other than the aTokens held by this contract to the recipient address
  /// @dev This function is only callable by the owner or asset manager
  /// @param erc20Token The ERC20 token to transfer
  /// @param to The recipient of the tokens
  /// @param amount The amount of tokens to transfer
  function transferERC20(IERC20 erc20Token, address to, uint256 amount) external override onlyManagerOrOwner {
    require(address(erc20Token) != address(aToken), "ATokenYieldSource/aToken-transfer-not-allowed");
    erc20Token.safeTransfer(to, amount);
    emit TransferredERC20(msg.sender, to, amount, erc20Token);
  }

  /// @notice Allows someone to deposit into the yield source without receiving any shares
  /// @dev This allows anyone to distribute tokens among the share holders
  /// @param amount The amount of tokens to deposit
  function sponsor(uint256 amount) external override nonReentrant {
    _depositToAave(amount);
    emit Sponsored(msg.sender, amount);
  }

  /// @notice Claims the accrued rewards for the aToken, accumulating any pending rewards.
  /// @param to Address where the claimed rewards will be sent.
  /// @return True if operation was successful.
  function claimRewards(address to) external onlyManagerOrOwner returns (bool) {
    require(to != address(0), "ATokenYieldSource/recipient-not-zero-address");

    IAaveIncentivesController _incentivesController = incentivesController;

    address[] memory _assets = new address[](1);
    _assets[0] = address(aToken);

    uint256 _amount = _incentivesController.getRewardsBalance(_assets, address(this));
    uint256 _amountClaimed = _incentivesController.claimRewards(_assets, _amount, to);

    emit Claimed(msg.sender, to, _amountClaimed);
    return true;
  }

  /// @notice Retrieves Aave LendingPoolAddressesProvider address
  /// @return A reference to LendingPoolAddressesProvider interface
  function _lendingPoolProvider() internal view returns (ILendingPoolAddressesProvider) {
    return ILendingPoolAddressesProvider(lendingPoolAddressesProviderRegistry.getAddressesProvidersList()[ADDRESSES_PROVIDER_ID]);
  }

  /// @notice Retrieves Aave LendingPool address
  /// @return A reference to LendingPool interface
  function _lendingPool() internal view returns (ILendingPool) {
    return ILendingPool(_lendingPoolProvider().getLendingPool());
  }
}

File 2 of 21 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

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 make 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 3 of 21 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 4 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

File 5 of 21 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 6 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

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 7 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 8 of 21 : Context.sol
// SPDX-License-Identifier: MIT

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 9 of 21 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 10 of 21 : ATokenInterface.sol
// SPDX-License-Identifier: agpl-3.0

pragma solidity 0.8.6;

import "./IAToken.sol";

interface ATokenInterface is IAToken {
  /**
   * @dev Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
   **/
  /* solhint-disable-next-line func-name-mixedcase */
  function UNDERLYING_ASSET_ADDRESS() external view returns (address);
}

File 11 of 21 : IAToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.6;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IAToken is IERC20 {
  /**
   * @dev Emitted after the mint action
   * @param from The address performing the mint
   * @param value The amount being
   * @param index The new liquidity index of the reserve
   **/
  event Mint(address indexed from, uint256 value, uint256 index);

  /**
   * @dev Mints `amount` aTokens to `user`
   * @param user The address receiving the minted tokens
   * @param amount The amount of tokens getting minted
   * @param index The new liquidity index of the reserve
   * @return `true` if the the previous balance of the user was 0
   */
  function mint(
    address user,
    uint256 amount,
    uint256 index
  ) external returns (bool);

  /**
   * @dev Emitted after aTokens are burned
   * @param from The owner of the aTokens, getting them burned
   * @param target The address that will receive the underlying
   * @param value The amount being burned
   * @param index The new liquidity index of the reserve
   **/
  event Burn(address indexed from, address indexed target, uint256 value, uint256 index);

  /**
   * @dev Emitted during the transfer action
   * @param from The user whose tokens are being transferred
   * @param to The recipient
   * @param value The amount being transferred
   * @param index The new liquidity index of the reserve
   **/
  event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);

  /**
   * @dev Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`
   * @param user The owner of the aTokens, getting them burned
   * @param receiverOfUnderlying The address that will receive the underlying
   * @param amount The amount being burned
   * @param index The new liquidity index of the reserve
   **/
  function burn(
    address user,
    address receiverOfUnderlying,
    uint256 amount,
    uint256 index
  ) external;

  /**
   * @dev Mints aTokens to the reserve treasury
   * @param amount The amount of tokens getting minted
   * @param index The new liquidity index of the reserve
   */
  function mintToTreasury(uint256 amount, uint256 index) external;

  /**
   * @dev Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
   * @param from The address getting liquidated, current owner of the aTokens
   * @param to The recipient
   * @param value The amount of tokens getting transferred
   **/
  function transferOnLiquidation(
    address from,
    address to,
    uint256 value
  ) external;

  /**
   * @dev Transfers the underlying asset to `target`. Used by the LendingPool to transfer
   * assets in borrow(), withdraw() and flashLoan()
   * @param user The recipient of the aTokens
   * @param amount The amount getting transferred
   * @return The amount transferred
   **/
  function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);
}

File 12 of 21 : IAaveIncentivesController.sol
// SPDX-License-Identifier: agpl-3.0

pragma solidity 0.8.6;

pragma experimental ABIEncoderV2;

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

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

  // Commented out to avoid displaying warnings about duplicate definition
  // 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
    );

  /**
   * @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 13 of 21 : ILendingPool.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.6;

interface ILendingPool {

  /**
   * @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);

}

File 14 of 21 : ILendingPoolAddressesProvider.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.6;

/**
 * @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 15 of 21 : ILendingPoolAddressesProviderRegistry.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.8.6;

/**
 * @title LendingPoolAddressesProviderRegistry contract
 * @dev Main registry of LendingPoolAddressesProvider of multiple Aave protocol's markets
 * - Used for indexing purposes of Aave protocol's markets
 * - The id assigned to a LendingPoolAddressesProvider refers to the market it is connected with,
 *   for example with `0` for the Aave main market and `1` for the next created
 * @author Aave
 **/
interface ILendingPoolAddressesProviderRegistry {
  event AddressesProviderRegistered(address indexed newAddress);
  event AddressesProviderUnregistered(address indexed newAddress);

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

  function getAddressesProviderIdByAddress(address addressesProvider)
    external
    view
    returns (uint256);

  function registerAddressesProvider(address provider, uint256 id) external;

  function unregisterAddressesProvider(address provider) external;
}

File 16 of 21 : IProtocolYieldSource.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.6;

import "@pooltogether/yield-source-interface/contracts/IYieldSource.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @title The interface used for all Yield Sources for the PoolTogether protocol
/// @dev There are two privileged roles: the owner and the asset manager.  The owner can configure the asset managers.
interface IProtocolYieldSource is IYieldSource {
  /// @notice Allows the owner to transfer ERC20 tokens held by this contract to the target address.
  /// @dev This function is callable by the owner or asset manager.
  /// This function should not be able to transfer any tokens that represent user deposits.
  /// @param token The ERC20 token to transfer
  /// @param to The recipient of the tokens
  /// @param amount The amount of tokens to transfer
  function transferERC20(IERC20 token, address to, uint256 amount) external;

  /// @notice Allows someone to deposit into the yield source without receiving any shares.  The deposited token will be the same as token()
  /// This allows anyone to distribute tokens among the share holders.
  function sponsor(uint256 amount) external;
}

File 17 of 21 : FixedPoint.sol
/**
Copyright 2020 PoolTogether Inc.

This file is part of PoolTogether.

PoolTogether is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation under version 3 of the License.

PoolTogether is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PoolTogether.  If not, see <https://www.gnu.org/licenses/>.
*/

pragma solidity >=0.4.0;

import "./external/openzeppelin/OpenZeppelinSafeMath_V3_3_0.sol";

/**
 * @author Brendan Asselstine
 * @notice Provides basic fixed point math calculations.
 *
 * This library calculates integer fractions by scaling values by 1e18 then performing standard integer math.
 */
library FixedPoint {
    using OpenZeppelinSafeMath_V3_3_0 for uint256;

    // The scale to use for fixed point numbers.  Same as Ether for simplicity.
    uint256 internal constant SCALE = 1e18;

    /**
        * Calculates a Fixed18 mantissa given the numerator and denominator
        *
        * The mantissa = (numerator * 1e18) / denominator
        *
        * @param numerator The mantissa numerator
        * @param denominator The mantissa denominator
        * @return The mantissa of the fraction
        */
    function calculateMantissa(uint256 numerator, uint256 denominator) internal pure returns (uint256) {
        uint256 mantissa = numerator.mul(SCALE);
        mantissa = mantissa.div(denominator);
        return mantissa;
    }

    /**
        * Multiplies a Fixed18 number by an integer.
        *
        * @param b The whole integer to multiply
        * @param mantissa The Fixed18 number
        * @return An integer that is the result of multiplying the params.
        */
    function multiplyUintByMantissa(uint256 b, uint256 mantissa) internal pure returns (uint256) {
        uint256 result = mantissa.mul(b);
        result = result.div(SCALE);
        return result;
    }

    /**
    * Divides an integer by a fixed point 18 mantissa
    *
    * @param dividend The integer to divide
    * @param mantissa The fixed point 18 number to serve as the divisor
    * @return An integer that is the result of dividing an integer by a fixed point 18 mantissa
    */
    function divideUintByMantissa(uint256 dividend, uint256 mantissa) internal pure returns (uint256) {
        uint256 result = SCALE.mul(dividend);
        result = result.div(mantissa);
        return result;
    }
}

File 18 of 21 : OpenZeppelinSafeMath_V3_3_0.sol
// SPDX-License-Identifier: MIT

// NOTE: Copied from OpenZeppelin Contracts version 3.3.0

pragma solidity >=0.4.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library OpenZeppelinSafeMath_V3_3_0 {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 19 of 21 : Manageable.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @title Abstract manageable contract that can be inherited by other contracts
 * @notice Contract module based on Ownable which provides a basic access control mechanism, where
 * there is an owner and a manager that can be granted exclusive access to specific functions.
 *
 * By default, the owner is the deployer of the contract.
 *
 * The owner account is set through a two steps process.
 *      1. The current `owner` calls {transferOwnership} to set a `pendingOwner`
 *      2. The `pendingOwner` calls {acceptOwnership} to accept the ownership transfer
 *
 * The manager account needs to be set using {setManager}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyManager`, which can be applied to your functions to restrict their use to
 * the manager.
 */
abstract contract Manageable is Ownable {
    address private _manager;

    /**
     * @dev Emitted when `_manager` has been changed.
     * @param previousManager previous `_manager` address.
     * @param newManager new `_manager` address.
     */
    event ManagerTransferred(address indexed previousManager, address indexed newManager);

    /* ============ External Functions ============ */

    /**
     * @notice Gets current `_manager`.
     * @return Current `_manager` address.
     */
    function manager() public view virtual returns (address) {
        return _manager;
    }

    /**
     * @notice Set or change of manager.
     * @dev Throws if called by any account other than the owner.
     * @param _newManager New _manager address.
     * @return Boolean to indicate if the operation was successful or not.
     */
    function setManager(address _newManager) external onlyOwner returns (bool) {
        return _setManager(_newManager);
    }

    /* ============ Internal Functions ============ */

    /**
     * @notice Set or change of manager.
     * @param _newManager New _manager address.
     * @return Boolean to indicate if the operation was successful or not.
     */
    function _setManager(address _newManager) private returns (bool) {
        address _previousManager = _manager;

        require(_newManager != _previousManager, "Manageable/existing-manager-address");

        _manager = _newManager;

        emit ManagerTransferred(_previousManager, _newManager);
        return true;
    }

    /* ============ Modifier Functions ============ */

    /**
     * @dev Throws if called by any account other than the manager.
     */
    modifier onlyManager() {
        require(manager() == msg.sender, "Manageable/caller-not-manager");
        _;
    }

    /**
     * @dev Throws if called by any account other than the manager or the owner.
     */
    modifier onlyManagerOrOwner() {
        require(manager() == msg.sender || owner() == msg.sender, "Manageable/caller-not-manager-or-owner");
        _;
    }
}

File 20 of 21 : Ownable.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.0;

/**
 * @title Abstract ownable contract that can be inherited by other contracts
 * @notice 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 is the deployer of the contract.
 *
 * The owner account is set through a two steps process.
 *      1. The current `owner` calls {transferOwnership} to set a `pendingOwner`
 *      2. The `pendingOwner` calls {acceptOwnership} to accept the ownership transfer
 *
 * The manager account needs to be set using {setManager}.
 *
 * 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 {
    address private _owner;
    address private _pendingOwner;

    /**
     * @dev Emitted when `_pendingOwner` has been changed.
     * @param pendingOwner new `_pendingOwner` address.
     */
    event OwnershipOffered(address indexed pendingOwner);

    /**
     * @dev Emitted when `_owner` has been changed.
     * @param previousOwner previous `_owner` address.
     * @param newOwner new `_owner` address.
     */
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /* ============ Deploy ============ */

    /**
     * @notice Initializes the contract setting `_initialOwner` as the initial owner.
     * @param _initialOwner Initial owner of the contract.
     */
    constructor(address _initialOwner) {
        _setOwner(_initialOwner);
    }

    /* ============ External Functions ============ */

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

    /**
     * @notice Gets current `_pendingOwner`.
     * @return Current `_pendingOwner` address.
     */
    function pendingOwner() external view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @notice Renounce ownership of the contract.
     * @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() external virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
    * @notice Allows current owner to set the `_pendingOwner` address.
    * @param _newOwner Address to transfer ownership to.
    */
    function transferOwnership(address _newOwner) external onlyOwner {
        require(_newOwner != address(0), "Ownable/pendingOwner-not-zero-address");

        _pendingOwner = _newOwner;

        emit OwnershipOffered(_newOwner);
    }

    /**
    * @notice Allows the `_pendingOwner` address to finalize the transfer.
    * @dev This function is only callable by the `_pendingOwner`.
    */
    function claimOwnership() external onlyPendingOwner {
        _setOwner(_pendingOwner);
        _pendingOwner = address(0);
    }

    /* ============ Internal Functions ============ */

    /**
     * @notice Internal function to set the `_owner` of the contract.
     * @param _newOwner New `_owner` address.
     */
    function _setOwner(address _newOwner) private {
        address _oldOwner = _owner;
        _owner = _newOwner;
        emit OwnershipTransferred(_oldOwner, _newOwner);
    }

    /* ============ Modifier Functions ============ */

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

    /**
    * @dev Throws if called by any account other than the `pendingOwner`.
    */
    modifier onlyPendingOwner() {
        require(msg.sender == _pendingOwner, "Ownable/caller-not-pendingOwner");
        _;
    }
}

File 21 of 21 : IYieldSource.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.6.0;

/// @title Defines the functions used to interact with a yield source.  The Prize Pool inherits this contract.
/// @notice Prize Pools subclasses need to implement this interface so that yield can be generated.
interface IYieldSource {
    /// @notice Returns the ERC20 asset token used for deposits.
    /// @return The ERC20 asset token address.
    function depositToken() external view returns (address);

    /// @notice Returns the total balance (in asset tokens).  This includes the deposits and interest.
    /// @return The underlying balance of asset tokens.
    function balanceOfToken(address addr) external returns (uint256);

    /// @notice Supplies tokens to the yield source.  Allows assets to be supplied on other user's behalf using the `to` param.
    /// @param amount The amount of asset tokens to be supplied.  Denominated in `depositToken()` as above.
    /// @param to The user whose balance will receive the tokens
    function supplyTokenTo(uint256 amount, address to) external;

    /// @notice Redeems tokens from the yield source.
    /// @param amount The amount of asset tokens to withdraw.  Denominated in `depositToken()` as above.
    /// @return The actual amount of interst bearing tokens that were redeemed.
    function redeemToken(uint256 amount) external returns (uint256);
}

Settings
{
  "evmVersion": "berlin",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 2000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ATokenInterface","name":"_aToken","type":"address"},{"internalType":"contract IAaveIncentivesController","name":"_incentivesController","type":"address"},{"internalType":"contract ILendingPoolAddressesProviderRegistry","name":"_lendingPoolAddressesProviderRegistry","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IAToken","name":"aToken","type":"address"},{"indexed":false,"internalType":"contract ILendingPoolAddressesProviderRegistry","name":"lendingPoolAddressesProviderRegistry","type":"address"},{"indexed":false,"internalType":"uint8","name":"decimals","type":"uint8"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"ATokenYieldSourceInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousManager","type":"address"},{"indexed":true,"internalType":"address","name":"newManager","type":"address"}],"name":"ManagerTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipOffered","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RedeemedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Sponsored","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"SuppliedTokenTo","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"}],"name":"TransferredERC20","type":"event"},{"inputs":[],"name":"aToken","outputs":[{"internalType":"contract ATokenInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"approveMaxAmount","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"balanceOfToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"depositToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incentivesController","outputs":[{"internalType":"contract IAaveIncentivesController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lendingPoolAddressesProviderRegistry","outputs":[{"internalType":"contract ILendingPoolAddressesProviderRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"name":"redeemToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newManager","type":"address"}],"name":"setManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"sponsor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"supplyTokenTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"erc20Token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200383938038062003839833981016040819052620000349162000b64565b80828481600390805190602001906200004f9291906200092f565b508051620000659060049060208401906200092f565b5050506200007981620003a360201b60201c565b5060016008556001600160a01b038716620000ed5760405162461bcd60e51b815260206004820152602960248201527f41546f6b656e5969656c64536f757263652f61546f6b656e2d6e6f742d7a65726044820152686f2d6164647265737360b81b60648201526084015b60405180910390fd5b600980546001600160a01b0319166001600160a01b03898116919091179091558616620001835760405162461bcd60e51b815260206004820152603760248201527f41546f6b656e5969656c64536f757263652f696e63656e7469766573436f6e7460448201527f726f6c6c65722d6e6f742d7a65726f2d616464726573730000000000000000006064820152608401620000e4565b600a80546001600160a01b0319166001600160a01b03888116919091179091558516620002195760405162461bcd60e51b815260206004820152603660248201527f41546f6b656e5969656c64536f757263652f6c656e64696e67506f6f6c52656760448201527f69737472792d6e6f742d7a65726f2d61646472657373000000000000000000006064820152608401620000e4565b600b80546001600160a01b0319166001600160a01b038781169190911790915581166200029a5760405162461bcd60e51b815260206004820152602860248201527f41546f6b656e5969656c64536f757263652f6f776e65722d6e6f742d7a65726f6044820152672d6164647265737360c01b6064820152608401620000e4565b60008460ff1611620002fa5760405162461bcd60e51b815260206004820152602260248201527f41546f6b656e5969656c64536f757263652f646563696d616c732d67742d7a65604482015261726f60f01b6064820152608401620000e4565b600b805460ff60a01b1916600160a01b60ff8716021790556200034b62000320620003f5565b6000196200032d6200047a565b6001600160a01b0316620004c060201b620013d2179092919060201c565b866001600160a01b03167ffba57dff735bfaf5226b0a6e4ea8161ce10896963a36f6db20759f10b0055b4086868587866040516200038e95949392919062000ca2565b60405180910390a25050505050505062000df6565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000620004016200061f565b6001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200043a57600080fd5b505afa1580156200044f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000475919062000a5b565b905090565b600954604080516358b50cef60e11b815290516000926001600160a01b03169163b16a19de916004808301926020929190829003018186803b1580156200043a57600080fd5b8015806200054e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156200051157600080fd5b505afa15801562000526573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200054c919062000c3c565b155b620005c25760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401620000e4565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b179091526200061a918591620006c516565b505050565b600b546040805163365ccbbf60e01b815290516000926001600160a01b03169163365ccbbf9160048083019286929190829003018186803b1580156200066457600080fd5b505afa15801562000679573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620006a3919081019062000a7b565b600081518110620006b857620006b862000db1565b6020026020010151905090565b600062000721826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620007a360201b6200157b179092919060201c565b8051909150156200061a578080602001905181019062000742919062000b40565b6200061a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620000e4565b6060620007b48484600085620007be565b90505b9392505050565b606082471015620008215760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620000e4565b843b620008715760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620000e4565b600080866001600160a01b031685876040516200088f919062000c84565b60006040518083038185875af1925050503d8060008114620008ce576040519150601f19603f3d011682016040523d82523d6000602084013e620008d3565b606091505b509092509050620008e6828286620008f1565b979650505050505050565b6060831562000902575081620007b7565b825115620009135782518084602001fd5b8160405162461bcd60e51b8152600401620000e4919062000cf9565b8280546200093d9062000d74565b90600052602060002090601f016020900481019282620009615760008555620009ac565b82601f106200097c57805160ff1916838001178555620009ac565b82800160010185558215620009ac579182015b82811115620009ac5782518255916020019190600101906200098f565b50620009ba929150620009be565b5090565b5b80821115620009ba5760008155600101620009bf565b8051620009e28162000ddd565b919050565b600082601f830112620009f957600080fd5b81516001600160401b0381111562000a155762000a1562000dc7565b62000a2a601f8201601f191660200162000d0e565b81815284602083860101111562000a4057600080fd5b62000a5382602083016020870162000d41565b949350505050565b60006020828403121562000a6e57600080fd5b8151620007b78162000ddd565b6000602080838503121562000a8f57600080fd5b82516001600160401b038082111562000aa757600080fd5b818501915085601f83011262000abc57600080fd5b81518181111562000ad15762000ad162000dc7565b8060051b915062000ae484830162000d0e565b8181528481019084860184860187018a101562000b0057600080fd5b600095505b8386101562000b33578051945062000b1d8562000ddd565b8483526001959095019491860191860162000b05565b5098975050505050505050565b60006020828403121562000b5357600080fd5b81518015158114620007b757600080fd5b600080600080600080600060e0888a03121562000b8057600080fd5b875162000b8d8162000ddd565b602089015190975062000ba08162000ddd565b604089015190965062000bb38162000ddd565b606089015190955060ff8116811462000bcb57600080fd5b60808901519094506001600160401b038082111562000be957600080fd5b62000bf78b838c01620009e7565b945060a08a015191508082111562000c0e57600080fd5b5062000c1d8a828b01620009e7565b92505062000c2e60c08901620009d5565b905092959891949750929550565b60006020828403121562000c4f57600080fd5b5051919050565b6000815180845262000c7081602086016020860162000d41565b601f01601f19169290920160200192915050565b6000825162000c9881846020870162000d41565b9190910192915050565b600060018060a01b03808816835260ff8716602084015260a0604084015262000ccf60a084018762000c56565b838103606085015262000ce3818762000c56565b9250508084166080840152509695505050505050565b602081526000620007b7602083018462000c56565b604051601f8201601f191681016001600160401b038111828210171562000d395762000d3962000dc7565b604052919050565b60005b8381101562000d5e57818101518382015260200162000d44565b8381111562000d6e576000848401525b50505050565b600181811c9082168062000d8957607f821691505b6020821081141562000dab57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811462000df357600080fd5b50565b612a338062000e066000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806395d89b4111610104578063b99152d0116100a2578063dd62ed3e11610071578063dd62ed3e146103d7578063e30c397814610410578063ef5cfb8c14610421578063f2fde38b1461043457600080fd5b8063b99152d0146103a1578063c89039c5146103b4578063d0ebdbe7146103bc578063daa4f975146103cf57600080fd5b8063a457c2d7116100de578063a457c2d714610355578063a9059cbb14610368578063af1df2551461037b578063b6cce5e21461038e57600080fd5b806395d89b41146103275780639db5dbe41461032f578063a0c1f15e1461034257600080fd5b8063481c6a7511610171578063715018a61161014b578063715018a6146102e8578063873ba41e146102f057806387a6eeef146103035780638da5cb5b1461031657600080fd5b8063481c6a75146102905780634e71e0c8146102b557806370a08231146102bf57600080fd5b806318160ddd116101ad57806318160ddd1461023257806323b872dd1461023a578063313ce5671461024d578063395093511461027d57600080fd5b8063013054c2146101d457806306fdde03146101fa578063095ea7b31461020f575b600080fd5b6101e76101e2366004612785565b610447565b6040519081526020015b60405180910390f35b6102026106db565b6040516101f19190612899565b61022261021d36600461266b565b61076d565b60405190151581526020016101f1565b6002546101e7565b61022261024836600461262a565b610784565b600b5474010000000000000000000000000000000000000000900460ff1660405160ff90911681526020016101f1565b61022261028b36600461266b565b610845565b6007546001600160a01b03165b6040516001600160a01b0390911681526020016101f1565b6102bd610881565b005b6101e76102cd3660046125b7565b6001600160a01b031660009081526020819052604090205490565b6102bd61090f565b600b5461029d906001600160a01b031681565b6102bd6103113660046127b7565b610984565b6005546001600160a01b031661029d565b610202610a9c565b6102bd61033d36600461262a565b610aab565b60095461029d906001600160a01b031681565b61022261036336600461266b565b610c52565b61022261037636600461266b565b610d03565b600a5461029d906001600160a01b031681565b6102bd61039c366004612785565b610d10565b6101e76103af3660046125b7565b610dae565b61029d610dd0565b6102226103ca3660046125b7565b610ddf565b610222610e58565b6101e76103e53660046125f1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6006546001600160a01b031661029d565b61022261042f3660046125b7565b610f8b565b6102bd6104423660046125b7565b611296565b6000600260085414156104a15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260085560006104b0611592565b90508060006104be85611628565b90506104ca33826116e3565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561050c57600080fd5b505afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610544919061279e565b905061054e611868565b6040517f69328dec0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301526024820189905230604483015291909116906369328dec90606401602060405180830381600087803b1580156105b957600080fd5b505af11580156105cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f1919061279e565b506040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b15801561063457600080fd5b505afa158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c919061279e565b9050600061067a82846118aa565b90506106906001600160a01b03861633836118b6565b60408051858152602081018a905233917f5c9b0a8fe13a826ca676f5ad4f98c747b5086beb79ab58589b8211b62fa32fb9910160405180910390a26001600855979650505050505050565b6060600380546106ea90612968565b80601f016020809104026020016040519081016040528092919081815260200182805461071690612968565b80156107635780601f1061073857610100808354040283529160200191610763565b820191906000526020600020905b81548152906001019060200180831161074657829003601f168201915b5050505050905090565b600061077a3384846118ff565b5060015b92915050565b6000610791848484611a57565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561082b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e63650000000000000000000000000000000000000000000000006064820152608401610498565b61083885338584036118ff565b60019150505b9392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161077a91859061087c9086906128cc565b6118ff565b6006546001600160a01b031633146108db5760405162461bcd60e51b815260206004820152601f60248201527f4f776e61626c652f63616c6c65722d6e6f742d70656e64696e674f776e6572006044820152606401610498565b6006546108f0906001600160a01b0316611c70565b6006805473ffffffffffffffffffffffffffffffffffffffff19169055565b336109226005546001600160a01b031690565b6001600160a01b0316146109785760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b6109826000611c70565b565b600260085414156109d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610498565b600260085560006109e783611628565b905060008111610a395760405162461bcd60e51b815260206004820181905260248201527f41546f6b656e5969656c64536f757263652f7368617265732d67742d7a65726f6044820152606401610498565b610a4283611ccf565b610a4c8282611d8b565b60408051828152602081018590526001600160a01b0384169133917fdef5cc95ad9b1c65c586d0fce815ec764b575719636edf58ff2553ae6f110452910160405180910390a35050600160085550565b6060600480546106ea90612968565b33610abe6007546001600160a01b031690565b6001600160a01b03161480610aec575033610ae16005546001600160a01b031690565b6001600160a01b0316145b610b5e5760405162461bcd60e51b815260206004820152602660248201527f4d616e61676561626c652f63616c6c65722d6e6f742d6d616e616765722d6f7260448201527f2d6f776e657200000000000000000000000000000000000000000000000000006064820152608401610498565b6009546001600160a01b0384811691161415610be25760405162461bcd60e51b815260206004820152602d60248201527f41546f6b656e5969656c64536f757263652f61546f6b656e2d7472616e73666560448201527f722d6e6f742d616c6c6f776564000000000000000000000000000000000000006064820152608401610498565b610bf66001600160a01b03841683836118b6565b826001600160a01b0316826001600160a01b0316336001600160a01b03167f29fcb7bb954d37295343e742bab21760748bdba4e026e4469a8100183996913884604051610c4591815260200190565b60405180910390a4505050565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610cec5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610498565b610cf933858584036118ff565b5060019392505050565b600061077a338484611a57565b60026008541415610d635760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610498565b6002600855610d7181611ccf565b60405181815233907fbb2c10eb8b0d65523a501a1c079906e38af3c4231e31b799d408daacd7ce72269060200160405180910390a2506001600855565b6001600160a01b03811660009081526020819052604081205461077e90611e6a565b6000610dda611592565b905090565b600033610df46005546001600160a01b031690565b6001600160a01b031614610e4a5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b61077e82611f17565b919050565b600033610e6d6005546001600160a01b031690565b6001600160a01b031614610ec35760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b6000610ecd611868565b90506000610ed9611592565b604051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291925060009183169063dd62ed3e9060440160206040518083038186803b158015610f2657600080fd5b505afa158015610f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5e919061279e565b9050610f8183610f70600019846118aa565b6001600160a01b0385169190612003565b6001935050505090565b600033610fa06007546001600160a01b031690565b6001600160a01b03161480610fce575033610fc36005546001600160a01b031690565b6001600160a01b0316145b6110405760405162461bcd60e51b815260206004820152602660248201527f4d616e61676561626c652f63616c6c65722d6e6f742d6d616e616765722d6f7260448201527f2d6f776e657200000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b0382166110bc5760405162461bcd60e51b815260206004820152602c60248201527f41546f6b656e5969656c64536f757263652f726563697069656e742d6e6f742d60448201527f7a65726f2d6164647265737300000000000000000000000000000000000000006064820152608401610498565b600a546040805160018082528183019092526001600160a01b039092169160009160208083019080368337505060095482519293506001600160a01b03169183915060009061110d5761110d6129b9565b6001600160a01b0392831660209182029290920101526040517f8b599f26000000000000000000000000000000000000000000000000000000008152600091841690638b599f2690611165908590309060040161283c565b60206040518083038186803b15801561117d57600080fd5b505afa158015611191573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b5919061279e565b90506000836001600160a01b0316633111e7b38484896040518463ffffffff1660e01b81526004016111e993929190612867565b602060405180830381600087803b15801561120357600080fd5b505af1158015611217573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123b919061279e565b9050856001600160a01b0316336001600160a01b03167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161128291815260200190565b60405180910390a350600195945050505050565b336112a96005546001600160a01b031690565b6001600160a01b0316146112ff5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b6001600160a01b03811661137b5760405162461bcd60e51b815260206004820152602560248201527f4f776e61626c652f70656e64696e674f776e65722d6e6f742d7a65726f2d616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610498565b6006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f239a2ddded15777fa246aed5f7e1a9bc69a39d4eb4a397034d1d85766cca7d4c90600090a250565b80158061145b5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561142157600080fd5b505afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611459919061279e565b155b6114cd5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610498565b6040516001600160a01b0383166024820152604481018290526115769084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526120dd565b505050565b606061158a84846000856121c2565b949350505050565b600954604080517fb16a19de00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163b16a19de916004808301926020929190829003018186803b1580156115f057600080fd5b505afa158015611604573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda91906125d4565b600080600061163660025490565b905080611645578391506116dc565b6009546040516370a0823160e01b81523060048201526000916116cc9184916001600160a01b0316906370a082319060240160206040518083038186803b15801561168f57600080fd5b505afa1580156116a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c7919061279e565b612301565b90506116d88582612322565b9250505b5092915050565b6001600160a01b03821661175f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b038216600090815260208190526040902054818110156117ee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b038316600090815260208190526040812083830390556002805484929061181d908490612925565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000611872612343565b6001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f057600080fd5b600061083e8284612925565b6040516001600160a01b0383166024820152604481018290526115769084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611512565b6001600160a01b03831661197a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b0382166119f65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611ad35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b038216611b4f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b03831660009081526020819052604090205481811015611bde5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611c159084906128cc565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611c6191815260200190565b60405180910390a35b50505050565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611cd9611592565b90506000611ce5611868565b905081611cfd6001600160a01b0382163330876123fb565b6040517fe8eda9df0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820186905230604483015260bc606483015283169063e8eda9df90608401600060405180830381600087803b158015611d6d57600080fd5b505af1158015611d81573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038216611de15760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610498565b8060026000828254611df391906128cc565b90915550506001600160a01b03821660009081526020819052604081208054839290611e209084906128cc565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000806000611e7860025490565b905080611e87578391506116dc565b6009546040516370a0823160e01b815230600482015261158a918391611f11916001600160a01b0316906370a082319060240160206040518083038186803b158015611ed257600080fd5b505afa158015611ee6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0a919061279e565b879061244c565b90612458565b6007546000906001600160a01b03908116908316811415611fa05760405162461bcd60e51b815260206004820152602360248201527f4d616e61676561626c652f6578697374696e672d6d616e616765722d6164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610498565b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385811691821790925560405190918316907f9cb45c728de594dab506a1f1a8554e24c8eeaf983618d5ec5dd7bc6f3c49feee90600090a350600192915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561204f57600080fd5b505afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612087919061279e565b61209191906128cc565b6040516001600160a01b038516602482015260448101829052909150611c6a9085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611512565b6000612132826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661157b9092919063ffffffff16565b80519091501561157657808060200190518101906121509190612763565b6115765760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610498565b60608247101561223a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610498565b843b6122885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610498565b600080866001600160a01b031685876040516122a49190612820565b60006040518083038185875af1925050503d80600081146122e1576040519150601f19603f3d011682016040523d82523d6000602084013e6122e6565b606091505b50915091506122f6828286612464565b979650505050505050565b60008061231684670de0b6b3a764000061249d565b905061158a8184612538565b60008061232f838561249d565b905061158a81670de0b6b3a7640000612538565b600b54604080517f365ccbbf00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163365ccbbf9160048083019286929190829003018186803b1580156123a057600080fd5b505afa1580156123b4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123dc9190810190612697565b6000815181106123ee576123ee6129b9565b6020026020010151905090565b6040516001600160a01b0380851660248301528316604482015260648101829052611c6a9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611512565b600061083e8284612906565b600061083e82846128e4565b6060831561247357508161083e565b8251156124835782518084602001fd5b8160405162461bcd60e51b81526004016104989190612899565b6000826124ac5750600061077e565b60006124b88385612906565b9050826124c585836128e4565b1461083e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f77000000000000000000000000000000000000000000000000000000000000006064820152608401610498565b600061083e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836125965760405162461bcd60e51b81526004016104989190612899565b5060006125a384866128e4565b95945050505050565b8051610e53816129e5565b6000602082840312156125c957600080fd5b813561083e816129e5565b6000602082840312156125e657600080fd5b815161083e816129e5565b6000806040838503121561260457600080fd5b823561260f816129e5565b9150602083013561261f816129e5565b809150509250929050565b60008060006060848603121561263f57600080fd5b833561264a816129e5565b9250602084013561265a816129e5565b929592945050506040919091013590565b6000806040838503121561267e57600080fd5b8235612689816129e5565b946020939093013593505050565b600060208083850312156126aa57600080fd5b825167ffffffffffffffff808211156126c257600080fd5b818501915085601f8301126126d657600080fd5b8151818111156126e8576126e86129cf565b8060051b604051601f19603f8301168101818110858211171561270d5761270d6129cf565b604052828152858101935084860182860187018a101561272c57600080fd5b600095505b8386101561275657612742816125ac565b855260019590950194938601938601612731565b5098975050505050505050565b60006020828403121561277557600080fd5b8151801515811461083e57600080fd5b60006020828403121561279757600080fd5b5035919050565b6000602082840312156127b057600080fd5b5051919050565b600080604083850312156127ca57600080fd5b82359150602083013561261f816129e5565b600081518084526020808501945080840160005b838110156128155781516001600160a01b0316875295820195908201906001016127f0565b509495945050505050565b6000825161283281846020870161293c565b9190910192915050565b60408152600061284f60408301856127dc565b90506001600160a01b03831660208301529392505050565b60608152600061287a60608301866127dc565b90508360208301526001600160a01b0383166040830152949350505050565b60208152600082518060208401526128b881604085016020870161293c565b601f01601f19169190910160400192915050565b600082198211156128df576128df6129a3565b500190565b60008261290157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612920576129206129a3565b500290565b600082821015612937576129376129a3565b500390565b60005b8381101561295757818101518382015260200161293f565b83811115611c6a5750506000910152565b600181811c9082168061297c57607f821691505b6020821081141561299d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146129fa57600080fd5b5056fea2646970667358221220bafefb8a602953385da2093e50f6477e48073573dabaa176d9c977920a5676dc64736f6c63430008060033000000000000000000000000bcca60bb61934080951369a648fb03df4f96263c000000000000000000000000d784927ff2f95ba542bfc824c8a8a98f3495f6b500000000000000000000000052d306e36e3b6b02c153d0266ff0f85d18bcd413000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000da63d70332139e6a8eca7513f4b6e2e0dc93b693000000000000000000000000000000000000000000000000000000000000000850546155534443590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018506f6f6c546f676574686572206155534443205969656c640000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c806395d89b4111610104578063b99152d0116100a2578063dd62ed3e11610071578063dd62ed3e146103d7578063e30c397814610410578063ef5cfb8c14610421578063f2fde38b1461043457600080fd5b8063b99152d0146103a1578063c89039c5146103b4578063d0ebdbe7146103bc578063daa4f975146103cf57600080fd5b8063a457c2d7116100de578063a457c2d714610355578063a9059cbb14610368578063af1df2551461037b578063b6cce5e21461038e57600080fd5b806395d89b41146103275780639db5dbe41461032f578063a0c1f15e1461034257600080fd5b8063481c6a7511610171578063715018a61161014b578063715018a6146102e8578063873ba41e146102f057806387a6eeef146103035780638da5cb5b1461031657600080fd5b8063481c6a75146102905780634e71e0c8146102b557806370a08231146102bf57600080fd5b806318160ddd116101ad57806318160ddd1461023257806323b872dd1461023a578063313ce5671461024d578063395093511461027d57600080fd5b8063013054c2146101d457806306fdde03146101fa578063095ea7b31461020f575b600080fd5b6101e76101e2366004612785565b610447565b6040519081526020015b60405180910390f35b6102026106db565b6040516101f19190612899565b61022261021d36600461266b565b61076d565b60405190151581526020016101f1565b6002546101e7565b61022261024836600461262a565b610784565b600b5474010000000000000000000000000000000000000000900460ff1660405160ff90911681526020016101f1565b61022261028b36600461266b565b610845565b6007546001600160a01b03165b6040516001600160a01b0390911681526020016101f1565b6102bd610881565b005b6101e76102cd3660046125b7565b6001600160a01b031660009081526020819052604090205490565b6102bd61090f565b600b5461029d906001600160a01b031681565b6102bd6103113660046127b7565b610984565b6005546001600160a01b031661029d565b610202610a9c565b6102bd61033d36600461262a565b610aab565b60095461029d906001600160a01b031681565b61022261036336600461266b565b610c52565b61022261037636600461266b565b610d03565b600a5461029d906001600160a01b031681565b6102bd61039c366004612785565b610d10565b6101e76103af3660046125b7565b610dae565b61029d610dd0565b6102226103ca3660046125b7565b610ddf565b610222610e58565b6101e76103e53660046125f1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6006546001600160a01b031661029d565b61022261042f3660046125b7565b610f8b565b6102bd6104423660046125b7565b611296565b6000600260085414156104a15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260085560006104b0611592565b90508060006104be85611628565b90506104ca33826116e3565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561050c57600080fd5b505afa158015610520573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610544919061279e565b905061054e611868565b6040517f69328dec0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301526024820189905230604483015291909116906369328dec90606401602060405180830381600087803b1580156105b957600080fd5b505af11580156105cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f1919061279e565b506040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b15801561063457600080fd5b505afa158015610648573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066c919061279e565b9050600061067a82846118aa565b90506106906001600160a01b03861633836118b6565b60408051858152602081018a905233917f5c9b0a8fe13a826ca676f5ad4f98c747b5086beb79ab58589b8211b62fa32fb9910160405180910390a26001600855979650505050505050565b6060600380546106ea90612968565b80601f016020809104026020016040519081016040528092919081815260200182805461071690612968565b80156107635780601f1061073857610100808354040283529160200191610763565b820191906000526020600020905b81548152906001019060200180831161074657829003601f168201915b5050505050905090565b600061077a3384846118ff565b5060015b92915050565b6000610791848484611a57565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561082b5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e63650000000000000000000000000000000000000000000000006064820152608401610498565b61083885338584036118ff565b60019150505b9392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161077a91859061087c9086906128cc565b6118ff565b6006546001600160a01b031633146108db5760405162461bcd60e51b815260206004820152601f60248201527f4f776e61626c652f63616c6c65722d6e6f742d70656e64696e674f776e6572006044820152606401610498565b6006546108f0906001600160a01b0316611c70565b6006805473ffffffffffffffffffffffffffffffffffffffff19169055565b336109226005546001600160a01b031690565b6001600160a01b0316146109785760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b6109826000611c70565b565b600260085414156109d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610498565b600260085560006109e783611628565b905060008111610a395760405162461bcd60e51b815260206004820181905260248201527f41546f6b656e5969656c64536f757263652f7368617265732d67742d7a65726f6044820152606401610498565b610a4283611ccf565b610a4c8282611d8b565b60408051828152602081018590526001600160a01b0384169133917fdef5cc95ad9b1c65c586d0fce815ec764b575719636edf58ff2553ae6f110452910160405180910390a35050600160085550565b6060600480546106ea90612968565b33610abe6007546001600160a01b031690565b6001600160a01b03161480610aec575033610ae16005546001600160a01b031690565b6001600160a01b0316145b610b5e5760405162461bcd60e51b815260206004820152602660248201527f4d616e61676561626c652f63616c6c65722d6e6f742d6d616e616765722d6f7260448201527f2d6f776e657200000000000000000000000000000000000000000000000000006064820152608401610498565b6009546001600160a01b0384811691161415610be25760405162461bcd60e51b815260206004820152602d60248201527f41546f6b656e5969656c64536f757263652f61546f6b656e2d7472616e73666560448201527f722d6e6f742d616c6c6f776564000000000000000000000000000000000000006064820152608401610498565b610bf66001600160a01b03841683836118b6565b826001600160a01b0316826001600160a01b0316336001600160a01b03167f29fcb7bb954d37295343e742bab21760748bdba4e026e4469a8100183996913884604051610c4591815260200190565b60405180910390a4505050565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610cec5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610498565b610cf933858584036118ff565b5060019392505050565b600061077a338484611a57565b60026008541415610d635760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610498565b6002600855610d7181611ccf565b60405181815233907fbb2c10eb8b0d65523a501a1c079906e38af3c4231e31b799d408daacd7ce72269060200160405180910390a2506001600855565b6001600160a01b03811660009081526020819052604081205461077e90611e6a565b6000610dda611592565b905090565b600033610df46005546001600160a01b031690565b6001600160a01b031614610e4a5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b61077e82611f17565b919050565b600033610e6d6005546001600160a01b031690565b6001600160a01b031614610ec35760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b6000610ecd611868565b90506000610ed9611592565b604051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291925060009183169063dd62ed3e9060440160206040518083038186803b158015610f2657600080fd5b505afa158015610f3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5e919061279e565b9050610f8183610f70600019846118aa565b6001600160a01b0385169190612003565b6001935050505090565b600033610fa06007546001600160a01b031690565b6001600160a01b03161480610fce575033610fc36005546001600160a01b031690565b6001600160a01b0316145b6110405760405162461bcd60e51b815260206004820152602660248201527f4d616e61676561626c652f63616c6c65722d6e6f742d6d616e616765722d6f7260448201527f2d6f776e657200000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b0382166110bc5760405162461bcd60e51b815260206004820152602c60248201527f41546f6b656e5969656c64536f757263652f726563697069656e742d6e6f742d60448201527f7a65726f2d6164647265737300000000000000000000000000000000000000006064820152608401610498565b600a546040805160018082528183019092526001600160a01b039092169160009160208083019080368337505060095482519293506001600160a01b03169183915060009061110d5761110d6129b9565b6001600160a01b0392831660209182029290920101526040517f8b599f26000000000000000000000000000000000000000000000000000000008152600091841690638b599f2690611165908590309060040161283c565b60206040518083038186803b15801561117d57600080fd5b505afa158015611191573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b5919061279e565b90506000836001600160a01b0316633111e7b38484896040518463ffffffff1660e01b81526004016111e993929190612867565b602060405180830381600087803b15801561120357600080fd5b505af1158015611217573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123b919061279e565b9050856001600160a01b0316336001600160a01b03167ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd39926838360405161128291815260200190565b60405180910390a350600195945050505050565b336112a96005546001600160a01b031690565b6001600160a01b0316146112ff5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610498565b6001600160a01b03811661137b5760405162461bcd60e51b815260206004820152602560248201527f4f776e61626c652f70656e64696e674f776e65722d6e6f742d7a65726f2d616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610498565b6006805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f239a2ddded15777fa246aed5f7e1a9bc69a39d4eb4a397034d1d85766cca7d4c90600090a250565b80158061145b5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561142157600080fd5b505afa158015611435573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611459919061279e565b155b6114cd5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610498565b6040516001600160a01b0383166024820152604481018290526115769084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526120dd565b505050565b606061158a84846000856121c2565b949350505050565b600954604080517fb16a19de00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163b16a19de916004808301926020929190829003018186803b1580156115f057600080fd5b505afa158015611604573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda91906125d4565b600080600061163660025490565b905080611645578391506116dc565b6009546040516370a0823160e01b81523060048201526000916116cc9184916001600160a01b0316906370a082319060240160206040518083038186803b15801561168f57600080fd5b505afa1580156116a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c7919061279e565b612301565b90506116d88582612322565b9250505b5092915050565b6001600160a01b03821661175f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b038216600090815260208190526040902054818110156117ee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b038316600090815260208190526040812083830390556002805484929061181d908490612925565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6000611872612343565b6001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f057600080fd5b600061083e8284612925565b6040516001600160a01b0383166024820152604481018290526115769084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611512565b6001600160a01b03831661197a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b0382166119f65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611ad35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b038216611b4f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b03831660009081526020819052604090205481811015611bde5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610498565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290611c159084906128cc565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611c6191815260200190565b60405180910390a35b50505050565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611cd9611592565b90506000611ce5611868565b905081611cfd6001600160a01b0382163330876123fb565b6040517fe8eda9df0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301526024820186905230604483015260bc606483015283169063e8eda9df90608401600060405180830381600087803b158015611d6d57600080fd5b505af1158015611d81573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038216611de15760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610498565b8060026000828254611df391906128cc565b90915550506001600160a01b03821660009081526020819052604081208054839290611e209084906128cc565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6000806000611e7860025490565b905080611e87578391506116dc565b6009546040516370a0823160e01b815230600482015261158a918391611f11916001600160a01b0316906370a082319060240160206040518083038186803b158015611ed257600080fd5b505afa158015611ee6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0a919061279e565b879061244c565b90612458565b6007546000906001600160a01b03908116908316811415611fa05760405162461bcd60e51b815260206004820152602360248201527f4d616e61676561626c652f6578697374696e672d6d616e616765722d6164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610498565b6007805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385811691821790925560405190918316907f9cb45c728de594dab506a1f1a8554e24c8eeaf983618d5ec5dd7bc6f3c49feee90600090a350600192915050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561204f57600080fd5b505afa158015612063573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612087919061279e565b61209191906128cc565b6040516001600160a01b038516602482015260448101829052909150611c6a9085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611512565b6000612132826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661157b9092919063ffffffff16565b80519091501561157657808060200190518101906121509190612763565b6115765760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610498565b60608247101561223a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610498565b843b6122885760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610498565b600080866001600160a01b031685876040516122a49190612820565b60006040518083038185875af1925050503d80600081146122e1576040519150601f19603f3d011682016040523d82523d6000602084013e6122e6565b606091505b50915091506122f6828286612464565b979650505050505050565b60008061231684670de0b6b3a764000061249d565b905061158a8184612538565b60008061232f838561249d565b905061158a81670de0b6b3a7640000612538565b600b54604080517f365ccbbf00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163365ccbbf9160048083019286929190829003018186803b1580156123a057600080fd5b505afa1580156123b4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123dc9190810190612697565b6000815181106123ee576123ee6129b9565b6020026020010151905090565b6040516001600160a01b0380851660248301528316604482015260648101829052611c6a9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611512565b600061083e8284612906565b600061083e82846128e4565b6060831561247357508161083e565b8251156124835782518084602001fd5b8160405162461bcd60e51b81526004016104989190612899565b6000826124ac5750600061077e565b60006124b88385612906565b9050826124c585836128e4565b1461083e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f77000000000000000000000000000000000000000000000000000000000000006064820152608401610498565b600061083e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836125965760405162461bcd60e51b81526004016104989190612899565b5060006125a384866128e4565b95945050505050565b8051610e53816129e5565b6000602082840312156125c957600080fd5b813561083e816129e5565b6000602082840312156125e657600080fd5b815161083e816129e5565b6000806040838503121561260457600080fd5b823561260f816129e5565b9150602083013561261f816129e5565b809150509250929050565b60008060006060848603121561263f57600080fd5b833561264a816129e5565b9250602084013561265a816129e5565b929592945050506040919091013590565b6000806040838503121561267e57600080fd5b8235612689816129e5565b946020939093013593505050565b600060208083850312156126aa57600080fd5b825167ffffffffffffffff808211156126c257600080fd5b818501915085601f8301126126d657600080fd5b8151818111156126e8576126e86129cf565b8060051b604051601f19603f8301168101818110858211171561270d5761270d6129cf565b604052828152858101935084860182860187018a101561272c57600080fd5b600095505b8386101561275657612742816125ac565b855260019590950194938601938601612731565b5098975050505050505050565b60006020828403121561277557600080fd5b8151801515811461083e57600080fd5b60006020828403121561279757600080fd5b5035919050565b6000602082840312156127b057600080fd5b5051919050565b600080604083850312156127ca57600080fd5b82359150602083013561261f816129e5565b600081518084526020808501945080840160005b838110156128155781516001600160a01b0316875295820195908201906001016127f0565b509495945050505050565b6000825161283281846020870161293c565b9190910192915050565b60408152600061284f60408301856127dc565b90506001600160a01b03831660208301529392505050565b60608152600061287a60608301866127dc565b90508360208301526001600160a01b0383166040830152949350505050565b60208152600082518060208401526128b881604085016020870161293c565b601f01601f19169190910160400192915050565b600082198211156128df576128df6129a3565b500190565b60008261290157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612920576129206129a3565b500290565b600082821015612937576129376129a3565b500390565b60005b8381101561295757818101518382015260200161293f565b83811115611c6a5750506000910152565b600181811c9082168061297c57607f821691505b6020821081141561299d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146129fa57600080fd5b5056fea2646970667358221220bafefb8a602953385da2093e50f6477e48073573dabaa176d9c977920a5676dc64736f6c63430008060033

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

000000000000000000000000bcca60bb61934080951369a648fb03df4f96263c000000000000000000000000d784927ff2f95ba542bfc824c8a8a98f3495f6b500000000000000000000000052d306e36e3b6b02c153d0266ff0f85d18bcd413000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000da63d70332139e6a8eca7513f4b6e2e0dc93b693000000000000000000000000000000000000000000000000000000000000000850546155534443590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018506f6f6c546f676574686572206155534443205969656c640000000000000000

-----Decoded View---------------
Arg [0] : _aToken (address): 0xBcca60bB61934080951369a648Fb03DF4F96263C
Arg [1] : _incentivesController (address): 0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5
Arg [2] : _lendingPoolAddressesProviderRegistry (address): 0x52D306e36E3B6B02c153d0266ff0f85d18BCD413
Arg [3] : _decimals (uint8): 6
Arg [4] : _symbol (string): PTaUSDCY
Arg [5] : _name (string): PoolTogether aUSDC Yield
Arg [6] : _owner (address): 0xDa63D70332139E6A8eCA7513f4b6E2E0Dc93b693

-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 000000000000000000000000bcca60bb61934080951369a648fb03df4f96263c
Arg [1] : 000000000000000000000000d784927ff2f95ba542bfc824c8a8a98f3495f6b5
Arg [2] : 00000000000000000000000052d306e36e3b6b02c153d0266ff0f85d18bcd413
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [6] : 000000000000000000000000da63d70332139e6a8eca7513f4b6e2e0dc93b693
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [8] : 5054615553444359000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000018
Arg [10] : 506f6f6c546f676574686572206155534443205969656c640000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

PoolTogether is a protocol for no-loss prize games.

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.