Contract Overview
Balance:
0 AVAX
AVAX Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x4dc315db262a3000fa911fd162982bac5cf4078ccc5a08cf711e1779b265c830 | Add Markets | 9775089 | 495 days 19 hrs ago | 0x08f2112b3ba6c20c76988bab9ad94f7676652608 | IN | 0x8aa57827c3d147e39f1058517939461538d9c56a | 0 AVAX | 0.012408575 | |
0x64dc0c4335d75ee632b9fe91705f656679506888df4509987eb3eaf5d9f33f02 | 0x60a06040 | 9774990 | 495 days 19 hrs ago | 0x08f2112b3ba6c20c76988bab9ad94f7676652608 | IN | Create: AaveWrapperV2 | 0 AVAX | 0.015616675 |
[ Download CSV Export ]
Contract Name:
AaveWrapperV2
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "../interfaces/ILendingPoolV2.sol"; import "../interfaces/IWrapper.sol"; contract AaveWrapperV2 is IWrapper { // solhint-disable-next-line var-name-mixedcase ILendingPoolV2 private immutable _LENDING_POOL; mapping(IERC20 => IERC20) public aTokenToToken; mapping(IERC20 => IERC20) public tokenToaToken; constructor(ILendingPoolV2 lendingPool) { _LENDING_POOL = lendingPool; } function addMarkets(IERC20[] memory tokens) external { unchecked { for (uint256 i = 0; i < tokens.length; i++) { ILendingPoolV2.ReserveData memory reserveData = _LENDING_POOL.getReserveData(address(tokens[i])); IERC20 aToken = IERC20(reserveData.aTokenAddress); require(aToken != IERC20(address(0)), "Token is not supported"); aTokenToToken[aToken] = tokens[i]; tokenToaToken[tokens[i]] = aToken; } } } function removeMarkets(IERC20[] memory tokens) external { unchecked { for (uint256 i = 0; i < tokens.length; i++) { ILendingPoolV2.ReserveData memory reserveData = _LENDING_POOL.getReserveData(address(tokens[i])); IERC20 aToken = IERC20(reserveData.aTokenAddress); require(aToken == IERC20(address(0)), "Token is still supported"); 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("Unsupported token"); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ILendingPoolV2 { struct ReserveConfigurationMap { uint256 data; } struct ReserveData { ReserveConfigurationMap configuration; uint128 liquidityIndex; uint128 variableBorrowIndex; uint128 currentLiquidityRate; uint128 currentVariableBorrowRate; uint128 currentStableBorrowRate; uint40 lastUpdateTimestamp; address aTokenAddress; address stableDebtTokenAddress; address variableDebtTokenAddress; address interestRateStrategyAddress; uint8 id; } function getReserveData(address asset) external view returns (ReserveData memory); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; pragma abicoder v1; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWrapper { function wrap(IERC20 token) external view returns (IERC20 wrappedToken, uint256 rate); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) 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); }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"contract ILendingPoolV2","name":"lendingPool","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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"}]
Contract Creation Code
60a060405234801561001057600080fd5b50604051610aee380380610aee83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610a5c6100926000396000818161025f015261048a0152610a5c6000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c8063a928058b11610050578063a928058b1461010b578063bfef7bdf14610141578063da40385d1461015657600080fd5b8063023276f01461006c57806394a32b4b146100b0575b600080fd5b61007f61007a3660046106f4565b610169565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152015b60405180910390f35b6100e66100be3660046106f4565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100a7565b6100e66101193660046106f4565b60006020819052908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b61015461014f3660046107c0565b61024f565b005b6101546101643660046107c0565b61047a565b73ffffffffffffffffffffffffffffffffffffffff80821660009081526020818152604080832054600190925282205491928392918116911681156101ba575093670de0b6b3a76400009350915050565b73ffffffffffffffffffffffffffffffffffffffff8116156101e85794670de0b6b3a7640000945092505050565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e737570706f7274656420746f6b656e00000000000000000000000000000060448201526064015b60405180910390fd5b60005b81518110156104765760007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335ea6a758484815181106102ab576102ab610872565b60200260200101516040518263ffffffff1660e01b81526004016102eb919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b61018060405180830381865afa158015610309573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032d9190610939565b60e081015190915073ffffffffffffffffffffffffffffffffffffffff8116156103b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f546f6b656e206973207374696c6c20737570706f7274656400000000000000006044820152606401610246565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040812080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905584516001919086908690811061041657610416610872565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160002080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555050600101610252565b5050565b60005b81518110156104765760007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166335ea6a758484815181106104d6576104d6610872565b60200260200101516040518263ffffffff1660e01b8152600401610516919073ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b61018060405180830381865afa158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190610939565b60e081015190915073ffffffffffffffffffffffffffffffffffffffff81166105dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f546f6b656e206973206e6f7420737570706f72746564000000000000000000006044820152606401610246565b8383815181106105ef576105ef610872565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff8381166000908152928390526040832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016919092161790558451829160019187908790811061066457610664610872565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff90811683529082019290925260400160002080547fffffffffffffffffffffffff00000000000000000000000000000000000000001692909116919091179055505060010161047d565b73ffffffffffffffffffffffffffffffffffffffff811681146106f157600080fd5b50565b60006020828403121561070657600080fd5b8135610711816106cf565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610180810167ffffffffffffffff8111828210171561076b5761076b610718565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156107b8576107b8610718565b604052919050565b600060208083850312156107d357600080fd5b823567ffffffffffffffff808211156107eb57600080fd5b818501915085601f8301126107ff57600080fd5b81358181111561081157610811610718565b8060051b9150610822848301610771565b818152918301840191848101908884111561083c57600080fd5b938501935b838510156108665784359250610856836106cf565b8282529385019390850190610841565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000602082840312156108b357600080fd5b6040516020810181811067ffffffffffffffff821117156108d6576108d6610718565b6040529151825250919050565b80516fffffffffffffffffffffffffffffffff8116811461090357600080fd5b919050565b805164ffffffffff8116811461090357600080fd5b8051610903816106cf565b805160ff8116811461090357600080fd5b6000610180828403121561094c57600080fd5b610954610747565b61095e84846108a1565b815261096c602084016108e3565b602082015261097d604084016108e3565b604082015261098e606084016108e3565b606082015261099f608084016108e3565b60808201526109b060a084016108e3565b60a08201526109c160c08401610908565b60c08201526109d260e0840161091d565b60e08201526101006109e581850161091d565b908201526101206109f784820161091d565b90820152610140610a0984820161091d565b90820152610160610a1b848201610928565b90820152939250505056fea2646970667358221220a6f2560060219ee445401b80b274398bee4f0c4247236f8fbee6d73cae69350364736f6c634300080b00330000000000000000000000004f01aed16d97e3ab5ab2b501154dc9bb0f1a5a2c
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004f01aed16d97e3ab5ab2b501154dc9bb0f1a5a2c
-----Decoded View---------------
Arg [0] : lendingPool (address): 0x4f01aed16d97e3ab5ab2b501154dc9bb0f1a5a2c
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004f01aed16d97e3ab5ab2b501154dc9bb0f1a5a2c
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.