MATIC Price: $0.90 (-2.68%)
Gas: 78 Gwei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Multi Chain

Multichain Addresses

Transaction Hash
Method
Block
From
To
Value
Initialize414422532023-04-12 10:38:37241 days 21 hrs ago1681295917IN
0xFD858c...DC392247
0 MATIC0.01593682151.16311301
0x60806040414422382023-04-12 10:38:05241 days 21 hrs ago1681295885IN
 Create: AaveMigrationCollector
0 MATIC0.05368225151.16311301

Parent Txn Hash Block From To Value
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AaveMigrationCollector

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 3 of 4 : AaveMigrationCollector.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

import {IERC20} from '@aave/core-v2/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
import {IAaveIncentivesController} from '@aave/core-v2/contracts/interfaces/IAaveIncentivesController.sol';
import {VersionedInitializable} from '../../libs/VersionedInitializable.sol';

/**
 * @title AaveMigrationCollector
 * @notice Migrates all assets from this proxy to the new Collector
 * @author Aave
 **/
contract AaveMigrationCollector is VersionedInitializable {
  uint256 public constant REVISION = 3;

  address public RECIPIENT_COLLECTOR;

  IAaveIncentivesController public INCENTIVES_CONTROLLER;

  /**
   * @notice returns the revision of the implementation contract
   */
  function getRevision() internal pure override returns (uint256) {
    return REVISION;
  }

  /**
   * @notice initializes the contract upon assignment to the InitializableAdminUpgradeabilityProxy
   * migrates all the assets to the new collector
   * @param assets list of the aTokens to transfer.
   * @param incentivesController the address of the incentives controller.
   * @param recipientCollector the address of the recipient collector.
   */
  function initialize(
    address[] calldata assets,
    address incentivesController,
    address recipientCollector
  ) external initializer {
    RECIPIENT_COLLECTOR = recipientCollector;
    INCENTIVES_CONTROLLER = IAaveIncentivesController(incentivesController);

    _claimRewards(assets);
    _transferToRecipientCollector(assets);
  }

  /**
   * @notice migrates all the assets to the new collector
   * @param assets list of the aTokens to transfer.
   */
  function _transferToRecipientCollector(address[] memory assets) internal {
    for (uint256 i = 0; i < assets.length; i++) {
      IERC20 token = IERC20(assets[i]);
      uint256 balance = token.balanceOf(address(this));
      if (balance > 0) {
        token.transfer(RECIPIENT_COLLECTOR, balance);
      }
    }
  }

  /**
   * @notice migrates all the rewards to the new recipient collector
   * @param assets list of the aTokens to claim rewards for.
   */
  function _claimRewards(address[] memory assets) internal {
    uint256 balance = INCENTIVES_CONTROLLER.getRewardsBalance(assets, address(this));
    INCENTIVES_CONTROLLER.claimRewards(assets, balance, RECIPIENT_COLLECTOR);
  }
}

File 2 of 4 : IERC20.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @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 3 of 4 : IAaveIncentivesController.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 4 : VersionedInitializable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;

/**
 * @title VersionedInitializable
 *
 * @dev Helper contract to support initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * WARNING: Unlike constructors, initializer functions must be manually
 * invoked. This applies both to deploying an Initializable contract, as well
 * as extending an Initializable contract via inheritance.
 * WARNING: When used with inheritance, manual care must be taken to not invoke
 * a parent initializer twice, or ensure that all initializers are idempotent,
 * because this is not dealt with automatically as with constructors.
 *
 * @author Aave, inspired by the OpenZeppelin Initializable contract
 */
abstract contract VersionedInitializable {
  /**
   * @dev Indicates that the contract has been initialized.
   */
  uint256 internal lastInitializedRevision = 0;

  /**
   * @dev Modifier to use in the initializer function of a contract.
   */
  modifier initializer() {
    uint256 revision = getRevision();
    require(revision > lastInitializedRevision, 'Contract instance has already been initialized');

    lastInitializedRevision = revision;

    _;
  }

  /// @dev returns the revision number of the contract.
  /// Needs to be defined in the inherited class as a constant.
  function getRevision() internal pure virtual returns (uint256);

  // Reserved storage space to allow for layout changes in the future.
  uint256[50] private ______gap;
}

Settings
{
  "remappings": [
    "@aave/core-v2/=lib/protocol-v2/",
    "@aave/core-v3/=lib/aave-address-book/lib/aave-v3-core/",
    "@aave/periphery-v3/=lib/aave-address-book/lib/aave-v3-periphery/",
    "aave-address-book/=lib/aave-address-book/src/",
    "aave-helpers/=lib/aave-helpers/src/",
    "aave-v3-core/=lib/aave-address-book/lib/aave-v3-core/",
    "aave-v3-periphery/=lib/aave-address-book/lib/aave-v3-periphery/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "protocol-v2/=lib/protocol-v2/",
    "solidity-utils/=lib/solidity-utils/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "istanbul",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"INCENTIVES_CONTROLLER","outputs":[{"internalType":"contract IAaveIncentivesController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECIPIENT_COLLECTOR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REVISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets","type":"address[]"},{"internalType":"address","name":"incentivesController","type":"address"},{"internalType":"address","name":"recipientCollector","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526000805534801561001457600080fd5b5061056c806100246000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806310d0ab221461005157806390482d7214610075578063c9e9650e146100f8578063dde43cba14610100575b600080fd5b61005961011a565b604080516001600160a01b039092168252519081900360200190f35b6100f66004803603606081101561008b57600080fd5b8101906020810181356401000000008111156100a657600080fd5b8201836020820111156100b857600080fd5b803590602001918460208302840111640100000000831117156100da57600080fd5b91935091506001600160a01b0381358116916020013516610129565b005b610059610226565b610108610235565b60408051918252519081900360200190f35b6034546001600160a01b031681565b600061013361023a565b905060005481116101755760405162461bcd60e51b815260040180806020018281038252602e815260200180610509602e913960400191505060405180910390fd5b6000819055603380546001600160a01b038085166001600160a01b031992831617909255603480549286169290911691909117905560408051602080870282810182019093528682526101e39288918891829185019084908082843760009201919091525061023f92505050565b61021f8585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506103d092505050565b5050505050565b6033546001600160a01b031681565b600381565b600390565b603454604080516345accf9360e11b81523060248201819052600482019283528451604483015284516000946001600160a01b031693638b599f2693879392829160640190602080870191028083838c5b838110156102a8578181015183820152602001610290565b50505050905001935050505060206040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d60208110156102f657600080fd5b5051603454603354604051633111e7b360e01b8152602481018490526001600160a01b03918216604482018190526060600483019081528751606484015287519596509290931693633111e7b393879387939192909182916084909101906020878101910280838360005b83811015610379578181015183820152602001610361565b50505050905001945050505050602060405180830381600087803b1580156103a057600080fd5b505af11580156103b4573d6000803e3d6000fd5b505050506040513d60208110156103ca57600080fd5b50505050565b60005b81518110156105045760008282815181106103ea57fe5b602002602001015190506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561044357600080fd5b505afa158015610457573d6000803e3d6000fd5b505050506040513d602081101561046d57600080fd5b5051905080156104fa576033546040805163a9059cbb60e01b81526001600160a01b0392831660048201526024810184905290519184169163a9059cbb916044808201926020929091908290030181600087803b1580156104cd57600080fd5b505af11580156104e1573d6000803e3d6000fd5b505050506040513d60208110156104f757600080fd5b50505b50506001016103d3565b505056fe436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a26469706673582212206d1b1a212c9a1f65483c3d577697f9ca611430d7d77d59c32d8ef2881416217f64736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806310d0ab221461005157806390482d7214610075578063c9e9650e146100f8578063dde43cba14610100575b600080fd5b61005961011a565b604080516001600160a01b039092168252519081900360200190f35b6100f66004803603606081101561008b57600080fd5b8101906020810181356401000000008111156100a657600080fd5b8201836020820111156100b857600080fd5b803590602001918460208302840111640100000000831117156100da57600080fd5b91935091506001600160a01b0381358116916020013516610129565b005b610059610226565b610108610235565b60408051918252519081900360200190f35b6034546001600160a01b031681565b600061013361023a565b905060005481116101755760405162461bcd60e51b815260040180806020018281038252602e815260200180610509602e913960400191505060405180910390fd5b6000819055603380546001600160a01b038085166001600160a01b031992831617909255603480549286169290911691909117905560408051602080870282810182019093528682526101e39288918891829185019084908082843760009201919091525061023f92505050565b61021f8585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506103d092505050565b5050505050565b6033546001600160a01b031681565b600381565b600390565b603454604080516345accf9360e11b81523060248201819052600482019283528451604483015284516000946001600160a01b031693638b599f2693879392829160640190602080870191028083838c5b838110156102a8578181015183820152602001610290565b50505050905001935050505060206040518083038186803b1580156102cc57600080fd5b505afa1580156102e0573d6000803e3d6000fd5b505050506040513d60208110156102f657600080fd5b5051603454603354604051633111e7b360e01b8152602481018490526001600160a01b03918216604482018190526060600483019081528751606484015287519596509290931693633111e7b393879387939192909182916084909101906020878101910280838360005b83811015610379578181015183820152602001610361565b50505050905001945050505050602060405180830381600087803b1580156103a057600080fd5b505af11580156103b4573d6000803e3d6000fd5b505050506040513d60208110156103ca57600080fd5b50505050565b60005b81518110156105045760008282815181106103ea57fe5b602002602001015190506000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561044357600080fd5b505afa158015610457573d6000803e3d6000fd5b505050506040513d602081101561046d57600080fd5b5051905080156104fa576033546040805163a9059cbb60e01b81526001600160a01b0392831660048201526024810184905290519184169163a9059cbb916044808201926020929091908290030181600087803b1580156104cd57600080fd5b505af11580156104e1573d6000803e3d6000fd5b505050506040513d60208110156104f757600080fd5b50505b50506001016103d3565b505056fe436f6e747261637420696e7374616e63652068617320616c7265616479206265656e20696e697469616c697a6564a26469706673582212206d1b1a212c9a1f65483c3d577697f9ca611430d7d77d59c32d8ef2881416217f64736f6c634300060c0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.