MATIC Price: $0.550767 (-6.18%)
Gas: 31 GWei
 

Overview

MATIC Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 MATIC

MATIC Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
Initialize325677342022-09-01 19:22:51656 days ago1662060171IN
0xC773bf5a...4Ce5B0577
0 MATIC0.0035679663.88362225
0x60806040325677312022-09-01 19:22:45656 days ago1662060165IN
 Create: Collector
0 MATIC0.0246942763.88362225

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

Contract Source Code Verified (Exact Match)

Contract Name:
Collector

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 100000 runs

Other Settings:
default evmVersion, GNU AGPLv3 license
File 1 of 4 : Collector.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import {VersionedInitializable} from '@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
import {IERC20} from '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
import {ICollector} from './interfaces/ICollector.sol';

/**
 * @title Collector
 * @notice Stores the fees collected by the protocol and allows the fund administrator
 *         to approve or transfer the collected ERC20 tokens.
 * @dev Implementation contract that must be initialized using transparent proxy pattern.
 * @author Aave
 **/
contract Collector is VersionedInitializable, ICollector {
  // Store the current funds administrator address
  address internal _fundsAdmin;

  // Revision version of this implementation contract
  uint256 public constant REVISION = 2;

  /**
   * @dev Allow only the funds administrator address to call functions marked by this modifier
   */
  modifier onlyFundsAdmin() {
    require(msg.sender == _fundsAdmin, 'ONLY_BY_FUNDS_ADMIN');
    _;
  }

  /**
   * @dev Initialize the transparent proxy with the admin of the Collector
   * @param reserveController The address of the admin that controls Collector
   */
  function initialize(address reserveController) external initializer {
    _setFundsAdmin(reserveController);
  }

  /// @inheritdoc VersionedInitializable
  function getRevision() internal pure override returns (uint256) {
    return REVISION;
  }

  /// @inheritdoc ICollector
  function getFundsAdmin() external view returns (address) {
    return _fundsAdmin;
  }

  /// @inheritdoc ICollector
  function approve(
    IERC20 token,
    address recipient,
    uint256 amount
  ) external onlyFundsAdmin {
    token.approve(recipient, amount);
  }

  /// @inheritdoc ICollector
  function transfer(
    IERC20 token,
    address recipient,
    uint256 amount
  ) external onlyFundsAdmin {
    token.transfer(recipient, amount);
  }

  /// @inheritdoc ICollector
  function setFundsAdmin(address admin) external onlyFundsAdmin {
    _setFundsAdmin(admin);
  }

  /**
   * @dev Transfer the ownership of the funds administrator role.
   * @param admin The address of the new funds administrator
   */
  function _setFundsAdmin(address admin) internal {
    _fundsAdmin = admin;
    emit NewFundsAdmin(admin);
  }
}

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

/**
 * @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 : VersionedInitializable.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

/**
 * @title VersionedInitializable
 * @author Aave, inspired by the OpenZeppelin Initializable contract
 * @notice Helper contract to implement initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * @dev 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.
 */
abstract contract VersionedInitializable {
  /**
   * @dev Indicates that the contract has been initialized.
   */
  uint256 private lastInitializedRevision = 0;

  /**
   * @dev Indicates that the contract is in the process of being initialized.
   */
  bool private initializing;

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

    bool isTopLevelCall = !initializing;
    if (isTopLevelCall) {
      initializing = true;
      lastInitializedRevision = revision;
    }

    _;

    if (isTopLevelCall) {
      initializing = false;
    }
  }

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

  /**
   * @notice Returns true if and only if the function is running in the constructor
   * @return True if the function is running in the constructor
   **/
  function isConstructor() private view returns (bool) {
    // extcodesize checks the size of the code stored in an address, and
    // address returns the current address. Since the code is still not
    // deployed when running a constructor, any checks on its code size will
    // yield zero, making it an effective way to detect if a contract is
    // under construction or not.
    uint256 cs;
    //solium-disable-next-line
    assembly {
      cs := extcodesize(address())
    }
    return cs == 0;
  }

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

File 4 of 4 : ICollector.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import {IERC20} from '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol';

/**
 * @title ICollector
 * @notice Defines the interface of the Collector contract
 * @author Aave
 **/
interface ICollector {
  /**
   * @dev Emitted during the transfer of ownership of the funds administrator address
   * @param fundsAdmin The new funds administrator address
   **/
  event NewFundsAdmin(address indexed fundsAdmin);

  /**
   * @dev Retrieve the current implementation Revision of the proxy
   * @return The revision version
   */
  function REVISION() external view returns (uint256);

  /**
   * @dev Retrieve the current funds administrator
   * @return The address of the funds administrator
   */
  function getFundsAdmin() external view returns (address);

  /**
   * @dev Approve an amount of tokens to be pulled by the recipient.
   * @param token The address of the asset
   * @param recipient The address of the entity allowed to pull tokens
   * @param amount The amount allowed to be pulled. If zero it will revoke the approval.
   */
  function approve(
    IERC20 token,
    address recipient,
    uint256 amount
  ) external;

  /**
   * @dev Transfer an amount of tokens to the recipient.
   * @param token The address of the asset
   * @param recipient The address of the entity to transfer the tokens.
   * @param amount The amount to be transferred.
   */
  function transfer(
    IERC20 token,
    address recipient,
    uint256 amount
  ) external;

  /**
   * @dev Transfer the ownership of the funds administrator role.
          This function should only be callable by the current funds administrator.
   * @param admin The address of the new funds administrator
   */
  function setFundsAdmin(address admin) external;
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"fundsAdmin","type":"address"}],"name":"NewFundsAdmin","type":"event"},{"inputs":[],"name":"REVISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getFundsAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"reserveController","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"setFundsAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526000805534801561001457600080fd5b5061060a806100246000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063dde43cba11610050578063dde43cba146100cc578063e1f21c67146100e2578063ed0d2371146100f557600080fd5b806306bc2ee014610077578063beabacc8146100a4578063c4d66de8146100b9575b600080fd5b60345460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100b76100b236600461054d565b610108565b005b6100b76100c736600461058e565b61022e565b6100d4600281565b60405190815260200161009b565b6100b76100f036600461054d565b610353565b6100b761010336600461058e565b61042f565b60345473ffffffffffffffffffffffffffffffffffffffff16331461018e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f42595f46554e44535f41444d494e0000000000000000000000000060448201526064015b60405180910390fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063a9059cbb906044015b6020604051808303816000875af1158015610204573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022891906105b2565b50505050565b60015460029060ff16806102415750303b155b8061024d575060005481115b6102d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560448201527f656e20696e697469616c697a65640000000000000000000000000000000000006064820152608401610185565b60015460ff1615801561031657600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168117905560008290555b61031f836104bc565b801561034e57600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050565b60345473ffffffffffffffffffffffffffffffffffffffff1633146103d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f42595f46554e44535f41444d494e000000000000000000000000006044820152606401610185565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063095ea7b3906044016101e5565b60345473ffffffffffffffffffffffffffffffffffffffff1633146104b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f42595f46554e44535f41444d494e000000000000000000000000006044820152606401610185565b6104b9816104bc565b50565b603480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1ab77a654795da4cfe37c33188e862203ade9a5c7f1a9d4957669b3ccbec9e1190600090a250565b73ffffffffffffffffffffffffffffffffffffffff811681146104b957600080fd5b60008060006060848603121561056257600080fd5b833561056d8161052b565b9250602084013561057d8161052b565b929592945050506040919091013590565b6000602082840312156105a057600080fd5b81356105ab8161052b565b9392505050565b6000602082840312156105c457600080fd5b815180151581146105ab57600080fdfea264697066735822122035ef16b72a96ae54e337baebbe7aa55067a0b8842193a0a7d82a741eaa611ede64736f6c634300080a0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063dde43cba11610050578063dde43cba146100cc578063e1f21c67146100e2578063ed0d2371146100f557600080fd5b806306bc2ee014610077578063beabacc8146100a4578063c4d66de8146100b9575b600080fd5b60345460405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100b76100b236600461054d565b610108565b005b6100b76100c736600461058e565b61022e565b6100d4600281565b60405190815260200161009b565b6100b76100f036600461054d565b610353565b6100b761010336600461058e565b61042f565b60345473ffffffffffffffffffffffffffffffffffffffff16331461018e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f42595f46554e44535f41444d494e0000000000000000000000000060448201526064015b60405180910390fd5b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063a9059cbb906044015b6020604051808303816000875af1158015610204573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022891906105b2565b50505050565b60015460029060ff16806102415750303b155b8061024d575060005481115b6102d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560448201527f656e20696e697469616c697a65640000000000000000000000000000000000006064820152608401610185565b60015460ff1615801561031657600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168117905560008290555b61031f836104bc565b801561034e57600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050565b60345473ffffffffffffffffffffffffffffffffffffffff1633146103d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f42595f46554e44535f41444d494e000000000000000000000000006044820152606401610185565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526024820183905284169063095ea7b3906044016101e5565b60345473ffffffffffffffffffffffffffffffffffffffff1633146104b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f42595f46554e44535f41444d494e000000000000000000000000006044820152606401610185565b6104b9816104bc565b50565b603480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1ab77a654795da4cfe37c33188e862203ade9a5c7f1a9d4957669b3ccbec9e1190600090a250565b73ffffffffffffffffffffffffffffffffffffffff811681146104b957600080fd5b60008060006060848603121561056257600080fd5b833561056d8161052b565b9250602084013561057d8161052b565b929592945050506040919091013590565b6000602082840312156105a057600080fd5b81356105ab8161052b565b9392505050565b6000602082840312156105c457600080fd5b815180151581146105ab57600080fdfea264697066735822122035ef16b72a96ae54e337baebbe7aa55067a0b8842193a0a7d82a741eaa611ede64736f6c634300080a0033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction 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.