Contract Overview
Balance:
0 Ether
EtherValue:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Index
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x8b0160b4a8b8296e53110cd15aea9600c36a9b90fdabde303db1a0679e672e81 | 0x60c06040 | 11845356 | 17 days 19 hrs ago | 0x2b6dbde60278f19c742bd6861aa39e0a565f5aa3 | IN | Create: AAVEV3Silo | 0 Ether | 0 |
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
AAVEV3Silo
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Unlicense pragma solidity ^0.8.10; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "contracts/libraries/FullMath.sol"; import "contracts/interfaces/ISilo.sol"; interface IPoolAddressesProvider { function getPool() external view returns (IPool); function getPoolDataProvider() external view returns (IPoolDataProvider); } interface IPoolDataProvider { function getReserveTokensAddresses(address asset) external view returns ( address aToken, address stableDebtToken, address variableDebtToken ); } interface IPool { /** * @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens. * - E.g. User supplies 100 USDC and gets in return 100 aUSDC * @param asset The address of the underlying asset to supply * @param amount The amount to be supplied * @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 supply( address asset, uint256 amount, address onBehalfOf, uint16 referralCode ) external; /** * @notice 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 The 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); } contract AAVEV3Silo is ISilo { /// @inheritdoc ISilo string public name; IPoolAddressesProvider public immutable poolAddressesProvider; address public immutable uToken; constructor(IPoolAddressesProvider _poolAddressesProvider, address _uToken) { poolAddressesProvider = _poolAddressesProvider; uToken = _uToken; IPoolDataProvider poolDataProvider = poolAddressesProvider.getPoolDataProvider(); (address aToken, , ) = poolDataProvider.getReserveTokensAddresses(uToken); require(aToken != address(0), "Unsupported by AAVE"); name = string(abi.encodePacked("AAVE ", IERC20Metadata(uToken).symbol(), " Silo")); } /// @inheritdoc ISilo function poke() external override {} /// @inheritdoc ISilo function deposit(uint256 amount) external override { if (amount == 0) return; IPool pool = poolAddressesProvider.getPool(); _approve(uToken, address(pool), amount); pool.supply(uToken, amount, address(this), 0); } /// @inheritdoc ISilo function withdraw(uint256 amount) external override { if (amount == 0) return; IPool pool = poolAddressesProvider.getPool(); require(pool.withdraw(uToken, amount, address(this)) == amount, "Failed to withdraw all, remov"); } /// @inheritdoc ISilo function balanceOf(address account) external view override returns (uint256 balance) { IPoolDataProvider poolDataProvider = poolAddressesProvider.getPoolDataProvider(); (address aToken, , ) = poolDataProvider.getReserveTokensAddresses(uToken); return IERC20(aToken).balanceOf(account); } /// @inheritdoc ISilo function shouldAllowRemovalOf(address token) external view override returns (bool shouldAllow) { IPoolDataProvider poolDataProvider = poolAddressesProvider.getPoolDataProvider(); (address aToken, , ) = poolDataProvider.getReserveTokensAddresses(uToken); shouldAllow = token != aToken; } function _approve( address token, address spender, uint256 amount ) private { // 200 gas to read uint256 if (IERC20(token).allowance(address(this), spender) < amount) { // 20000 gas to write uint256 if changing from zero to non-zero // 5000 gas to write uint256 if changing from non-zero to non-zero IERC20(token).approve(spender, type(uint256).max); } } }
// 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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // Handle division by zero require(denominator != 0); // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Short circuit 256 by 256 division // This saves gas when a * b is small, at the cost of making the // large case a bit more expensive. Depending on your use case you // may want to remove this short circuit and always go through the // 512 bit path. if (prod1 == 0) { assembly { result := div(prod0, denominator) } return result; } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Handle overflow, the result must be < 2**256 require(prod1 < denominator); // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod // Note mulmod(_, _, 0) == 0 uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. unchecked { // https://ethereum.stackexchange.com/a/96646 uint256 twos = (type(uint256).max - denominator + 1) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 // If denominator is zero the inverse starts with 2 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // If denominator is zero, inv is now 128 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface ISilo { /// @notice A descriptive name for the silo (ex: Compound USDC Silo) function name() external view returns (string memory); /// @notice A place to update the silo's internal state /// @dev After this has been called, balances reported by `balanceOf` MUST be correct function poke() external; /// @notice Deposits `amount` of the underlying token function deposit(uint256 amount) external; /// @notice Withdraws EXACTLY `amount` of the underlying token function withdraw(uint256 amount) external; /// @notice Reports how much of the underlying token `account` has stored /// @dev Must never overestimate `balance`. Should give the exact, correct value after `poke` is called function balanceOf(address account) external view returns (uint256 balance); /** * @notice Whether the given token is irrelevant to the silo's strategy (`shouldAllow = true`) or * is required for proper management (`shouldAllow = false`). ex: Compound silos shouldn't allow * removal of cTokens, but the may allow removal of COMP rewards. * @dev Removed tokens are used to help incentivize rebalances for the Blend vault that uses the silo. So * if you want something like COMP rewards to go to Blend *users* instead, you'd have to implement a * trading function as part of `poke()` to convert COMP to the underlying token. */ function shouldAllowRemovalOf(address token) external view returns (bool shouldAllow); }
// 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); }
{ "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IPoolAddressesProvider","name":"_poolAddressesProvider","type":"address"},{"internalType":"address","name":"_uToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"poolAddressesProvider","outputs":[{"internalType":"contract IPoolAddressesProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"shouldAllowRemovalOf","outputs":[{"internalType":"bool","name":"shouldAllow","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162000fab38038062000fab8339810160408190526200003491620002f3565b6001600160a01b03808316608081905290821660a0526040805163e860accb60e01b815290516000929163e860accb9160048083019260209291908290030181865afa15801562000089573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000af919062000332565b60a0516040516334924edb60e21b81526001600160a01b0391821660048201529192506000919083169063d2493b6c90602401606060405180830381865afa15801562000100573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000126919062000359565b50909150506001600160a01b038116620001865760405162461bcd60e51b815260206004820152601360248201527f556e737570706f72746564206279204141564500000000000000000000000000604482015260640160405180910390fd5b60a0516001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620001c7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620001f19190810190620003f6565b604051602001620002039190620004ae565b604051602081830303815290604052600090805190602001906200022992919062000234565b505050505062000529565b8280546200024290620004ec565b90600052602060002090601f016020900481019282620002665760008555620002b1565b82601f106200028157805160ff1916838001178555620002b1565b82800160010185558215620002b1579182015b82811115620002b157825182559160200191906001019062000294565b50620002bf929150620002c3565b5090565b5b80821115620002bf5760008155600101620002c4565b6001600160a01b0381168114620002f057600080fd5b50565b600080604083850312156200030757600080fd5b82516200031481620002da565b60208401519092506200032781620002da565b809150509250929050565b6000602082840312156200034557600080fd5b81516200035281620002da565b9392505050565b6000806000606084860312156200036f57600080fd5b83516200037c81620002da565b60208501519093506200038f81620002da565b6040850151909250620003a281620002da565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620003e0578181015183820152602001620003c6565b83811115620003f0576000848401525b50505050565b6000602082840312156200040957600080fd5b81516001600160401b03808211156200042157600080fd5b818401915084601f8301126200043657600080fd5b8151818111156200044b576200044b620003ad565b604051601f8201601f19908116603f01168101908382118183101715620004765762000476620003ad565b816040528281528760208487010111156200049057600080fd5b620004a3836020830160208801620003c3565b979650505050505050565b64020a0ab22960dd1b815260008251620004d0816005850160208701620003c3565b642053696c6f60d81b6005939091019283015250600a01919050565b600181811c908216806200050157607f821691505b602082108114156200052357634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a051610a1e6200058d6000396000818160e8015281816102a7015281816103de01528181610556015281816106da01526107170152600081816101480152818161021001528181610347015281816104bf01526106530152610a1e6000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063633156371161005b57806363315637146100e357806370a082311461012257806380e17d8714610143578063b6b55f251461016a57600080fd5b806306fdde031461008d5780631363efd8146100ab57806318178358146100ce5780632e1a7d4d146100d0575b600080fd5b61009561017d565b6040516100a29190610887565b60405180910390f35b6100be6100b93660046108f4565b61020b565b60405190151581526020016100a2565b005b6100ce6100de366004610918565b61033b565b61010a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a2565b6101356101303660046108f4565b6104ba565b6040519081526020016100a2565b61010a7f000000000000000000000000000000000000000000000000000000000000000081565b6100ce610178366004610918565b610647565b6000805461018a90610931565b80601f01602080910402602001604051908101604052809291908181526020018280546101b690610931565b80156102035780601f106101d857610100808354040283529160200191610203565b820191906000526020600020905b8154815290600101906020018083116101e657829003601f168201915b505050505081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e860accb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561026c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610290919061096c565b6040516334924edb60e21b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015291925060009183169063d2493b6c90602401606060405180830381865afa1580156102fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103209190610989565b50506001600160a01b03948516941693909314159392505050565b806103435750565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663026b1d5f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c7919061096c565b604051631a4ca37b60e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820185905230604483015291925083918316906369328dec906064016020604051808303816000875af1158015610441573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046591906109d6565b146104b65760405162461bcd60e51b815260206004820152601d60248201527f4661696c656420746f20776974686472617720616c6c2c2072656d6f76000000604482015260640160405180910390fd5b5050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e860accb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561051b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053f919061096c565b6040516334924edb60e21b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015291925060009183169063d2493b6c90602401606060405180830381865afa1580156105ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cf9190610989565b50506040516370a0823160e01b81526001600160a01b038681166004830152919250908216906370a0823190602401602060405180830381865afa15801561061b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063f91906109d6565b949350505050565b8061064f5750565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663026b1d5f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d3919061096c565b90506107007f00000000000000000000000000000000000000000000000000000000000000008284610793565b60405163617ba03760e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490523060448301526000606483015282169063617ba03790608401600060405180830381600087803b15801561077757600080fd5b505af115801561078b573d6000803e3d6000fd5b505050505050565b604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015282919085169063dd62ed3e90604401602060405180830381865afa1580156107e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080691906109d6565b10156108825760405163095ea7b360e01b81526001600160a01b038381166004830152600019602483015284169063095ea7b3906044016020604051808303816000875af115801561085c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088091906109ef565b505b505050565b600060208083528351808285015260005b818110156108b457858101830151858201604001528201610898565b818111156108c6576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146108f157600080fd5b50565b60006020828403121561090657600080fd5b8135610911816108dc565b9392505050565b60006020828403121561092a57600080fd5b5035919050565b600181811c9082168061094557607f821691505b6020821081141561096657634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561097e57600080fd5b8151610911816108dc565b60008060006060848603121561099e57600080fd5b83516109a9816108dc565b60208501519093506109ba816108dc565b60408501519092506109cb816108dc565b809150509250925092565b6000602082840312156109e857600080fd5b5051919050565b600060208284031215610a0157600080fd5b8151801515811461091157600080fdfea164736f6c634300080a000a000000000000000000000000a97684ead0e402dc232d5a977953df7ecbab3cdb0000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a97684ead0e402dc232d5a977953df7ecbab3cdb0000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607
-----Decoded View---------------
Arg [0] : _poolAddressesProvider (address): 0xa97684ead0e402dc232d5a977953df7ecbab3cdb
Arg [1] : _uToken (address): 0x7f5c764cbc14f9669b88837ca1490cca17c31607
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a97684ead0e402dc232d5a977953df7ecbab3cdb
Arg [1] : 0000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.