xDAI Price: $0.999957 (-0.01%)
Gas: 3 GWei

Contract

0x0c8fc7a71C28c768FDC1f7d75835229beBEB1573

Overview

xDAI Balance

Gnosis Chain LogoGnosis Chain LogoGnosis Chain Logo0 xDAI

xDAI Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Add Markets315584552023-12-21 20:49:00174 days ago1703191740IN
0x0c8fc7a7...beBEB1573
0 xDAI0.002061033.75000001

Latest 2 internal transactions

Parent Transaction Hash Block From To Value
315584022023-12-21 20:44:25174 days ago1703191465
0x0c8fc7a7...beBEB1573
0 xDAI
315584022023-12-21 20:44:25174 days ago1703191465  Contract Creation0 xDAI
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AaveWrapperV3

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion
File 1 of 4 : AaveWrapperV3.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.23;

import "../interfaces/ILendingPoolV3.sol";
import "../interfaces/IWrapper.sol";

contract AaveWrapperV3 is IWrapper {
    // solhint-disable-next-line var-name-mixedcase
    ILendingPoolV3 private immutable _LENDING_POOL;

    mapping(IERC20 => IERC20) public aTokenToToken;
    mapping(IERC20 => IERC20) public tokenToaToken;

    constructor(ILendingPoolV3 lendingPool) {
        _LENDING_POOL = lendingPool;
    }

    function addMarkets(IERC20[] memory tokens) external {
        unchecked {
            for (uint256 i = 0; i < tokens.length; i++) {
                (address aTokenAddress,,) = _LENDING_POOL.getReserveTokensAddresses(address(tokens[i]));
                IERC20 aToken = IERC20(aTokenAddress);
                if(aToken == IERC20(address(0))) revert NotAddedMarket();
                aTokenToToken[aToken] = tokens[i];
                tokenToaToken[tokens[i]] = aToken;
            }
        }
    }

    function removeMarkets(IERC20[] memory tokens) external {
        unchecked {
            for (uint256 i = 0; i < tokens.length; i++) {
                (address aTokenAddress,,) = _LENDING_POOL.getReserveTokensAddresses(address(tokens[i]));
                IERC20 aToken = IERC20(aTokenAddress);
                if(aToken == IERC20(address(0))) revert NotRemovedMarket();
                delete aTokenToToken[aToken];
                delete tokenToaToken[tokens[i]];
            }
        }
    }

    function wrap(IERC20 token) external view override returns (IERC20 wrappedToken, uint256 rate) {
        IERC20 underlying = aTokenToToken[token];
        IERC20 aToken = tokenToaToken[token];
        if (underlying != IERC20(address(0))) {
            return (underlying, 1e18);
        } else if (aToken != IERC20(address(0))) {
            return (aToken, 1e18);
        } else {
            revert NotSupportedToken();
        }
    }
}

File 2 of 4 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

File 3 of 4 : ILendingPoolV3.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.23;

// AaveProtocolDataProvider
interface ILendingPoolV3 {
    function getReserveTokensAddresses(address asset) external view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress);

    struct TokenData {
        string symbol;
        address tokenAddress;
    }

    function getAllReservesTokens() external view returns (TokenData[] memory);
}

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

pragma solidity 0.8.23;

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

interface IWrapper {
    error NotSupportedToken();
    error NotAddedMarket();
    error NotRemovedMarket();

    function wrap(IERC20 token) external view returns (IERC20 wrappedToken, uint256 rate);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "evmVersion": "paris",
  "viaIR": true,
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ILendingPoolV3","name":"lendingPool","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotAddedMarket","type":"error"},{"inputs":[],"name":"NotRemovedMarket","type":"error"},{"inputs":[],"name":"NotSupportedToken","type":"error"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"aTokenToToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"addMarkets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"removeMarkets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"tokenToaToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"wrap","outputs":[{"internalType":"contract IERC20","name":"wrappedToken","type":"address"},{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a03461007057601f6107a238819003918201601f19168301916001600160401b038311848410176100755780849260209460405283398101031261007057516001600160a01b038116810361007057608052604051610716908161008c8239608051818181608201526102060152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe604060808152600490600436101561001657600080fd5b6000803560e01c8063023276f01461040757806394a32b4b146103a2578063a928058b1461033e578063bfef7bdf146101db5763da40385d1461005857600080fd5b346101d85761006636610502565b92819273ffffffffffffffffffffffffffffffffffffffff92837f000000000000000000000000000000000000000000000000000000000000000016945b86518110156101d457846100b8828961064c565b51168351907fd2493b6c0000000000000000000000000000000000000000000000000000000082528582015260609081816024818b5afa9182156101ca5790879291859261019b575b5050168015610172579060019186610119838b61064c565b511690808552838a8961015d866020938a85528b8b207fffffffffffffffffffffffff0000000000000000000000000000000000000000988982541617905561064c565b511687525285852091825416179055016100a4565b505050517f54279e74000000000000000000000000000000000000000000000000000000008152fd5b6101ba9250803d106101c3575b6101b28183610492565b8101906106b0565b50503880610101565b503d6101a8565b85513d86823e3d90fd5b5080f35b80fd5b50903461033a576101eb36610502565b908273ffffffffffffffffffffffffffffffffffffffff94857f000000000000000000000000000000000000000000000000000000000000000016945b8451811015610336578661023c828761064c565b51168451907fd2493b6c0000000000000000000000000000000000000000000000000000000082528382015260609081816024818b5afa91821561032c5790899291869261030d575b50501680156102e557906001918452602084815282868620917fffffffffffffffffffffffff0000000000000000000000000000000000000000928381541690558a6102d1858b61064c565b511687525285852090815416905501610228565b8285517f7b609a5b000000000000000000000000000000000000000000000000000000008152fd5b6103239250803d106101c3576101b28183610492565b50503880610285565b86513d87823e3d90fd5b8280f35b5080fd5b50903461033a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261033a576020918173ffffffffffffffffffffffffffffffffffffffff918261039261046a565b1681528085522054169051908152f35b50903461033a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261033a576020918173ffffffffffffffffffffffffffffffffffffffff91826103f661046a565b168152600185522054169051908152f35b50346101d85760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101d8575061044861044361046a565b6105c0565b73ffffffffffffffffffffffffffffffffffffffff8351921682526020820152f35b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361048d57565b600080fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176104d357604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc83011261048d5767ffffffffffffffff9160043583811161048d578160238201121561048d5780600401359384116104d3578360051b906040519461056e6020840187610492565b85526024602086019282010192831161048d57602401905b828210610594575050505090565b813573ffffffffffffffffffffffffffffffffffffffff8116810361048d578152908301908301610586565b73ffffffffffffffffffffffffffffffffffffffff809116600052600060205280604060002054169060016020526040600020541681151560001461060d575090670de0b6b3a764000090565b905080156106225790670de0b6b3a764000090565b60046040517fc8a08d6f000000000000000000000000000000000000000000000000000000008152fd5b80518210156106605760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b519073ffffffffffffffffffffffffffffffffffffffff8216820361048d57565b9081606091031261048d576106c48161068f565b916106dd60406106d66020850161068f565b930161068f565b9056fea2646970667358221220065609fae4446b57eb6c7cb87814770721ab01b22f7d08c925d98ecbd1ef993564736f6c63430008170033000000000000000000000000501b4c19dd9c2e06e94da7b6d5ed4dda013ec741

Deployed Bytecode

0x604060808152600490600436101561001657600080fd5b6000803560e01c8063023276f01461040757806394a32b4b146103a2578063a928058b1461033e578063bfef7bdf146101db5763da40385d1461005857600080fd5b346101d85761006636610502565b92819273ffffffffffffffffffffffffffffffffffffffff92837f000000000000000000000000501b4c19dd9c2e06e94da7b6d5ed4dda013ec74116945b86518110156101d457846100b8828961064c565b51168351907fd2493b6c0000000000000000000000000000000000000000000000000000000082528582015260609081816024818b5afa9182156101ca5790879291859261019b575b5050168015610172579060019186610119838b61064c565b511690808552838a8961015d866020938a85528b8b207fffffffffffffffffffffffff0000000000000000000000000000000000000000988982541617905561064c565b511687525285852091825416179055016100a4565b505050517f54279e74000000000000000000000000000000000000000000000000000000008152fd5b6101ba9250803d106101c3575b6101b28183610492565b8101906106b0565b50503880610101565b503d6101a8565b85513d86823e3d90fd5b5080f35b80fd5b50903461033a576101eb36610502565b908273ffffffffffffffffffffffffffffffffffffffff94857f000000000000000000000000501b4c19dd9c2e06e94da7b6d5ed4dda013ec74116945b8451811015610336578661023c828761064c565b51168451907fd2493b6c0000000000000000000000000000000000000000000000000000000082528382015260609081816024818b5afa91821561032c5790899291869261030d575b50501680156102e557906001918452602084815282868620917fffffffffffffffffffffffff0000000000000000000000000000000000000000928381541690558a6102d1858b61064c565b511687525285852090815416905501610228565b8285517f7b609a5b000000000000000000000000000000000000000000000000000000008152fd5b6103239250803d106101c3576101b28183610492565b50503880610285565b86513d87823e3d90fd5b8280f35b5080fd5b50903461033a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261033a576020918173ffffffffffffffffffffffffffffffffffffffff918261039261046a565b1681528085522054169051908152f35b50903461033a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261033a576020918173ffffffffffffffffffffffffffffffffffffffff91826103f661046a565b168152600185522054169051908152f35b50346101d85760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101d8575061044861044361046a565b6105c0565b73ffffffffffffffffffffffffffffffffffffffff8351921682526020820152f35b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361048d57565b600080fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176104d357604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6020807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc83011261048d5767ffffffffffffffff9160043583811161048d578160238201121561048d5780600401359384116104d3578360051b906040519461056e6020840187610492565b85526024602086019282010192831161048d57602401905b828210610594575050505090565b813573ffffffffffffffffffffffffffffffffffffffff8116810361048d578152908301908301610586565b73ffffffffffffffffffffffffffffffffffffffff809116600052600060205280604060002054169060016020526040600020541681151560001461060d575090670de0b6b3a764000090565b905080156106225790670de0b6b3a764000090565b60046040517fc8a08d6f000000000000000000000000000000000000000000000000000000008152fd5b80518210156106605760209160051b010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b519073ffffffffffffffffffffffffffffffffffffffff8216820361048d57565b9081606091031261048d576106c48161068f565b916106dd60406106d66020850161068f565b930161068f565b9056fea2646970667358221220065609fae4446b57eb6c7cb87814770721ab01b22f7d08c925d98ecbd1ef993564736f6c63430008170033

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

000000000000000000000000501b4c19dd9c2e06e94da7b6d5ed4dda013ec741

-----Decoded View---------------
Arg [0] : lendingPool (address): 0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000501b4c19dd9c2e06e94da7b6d5ed4dda013ec741


Block Transaction Gas Used Reward
view all blocks validated

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  ]
[ 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.