Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Loading...
Loading
Contract Name:
ATokenOracle
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../../interfaces/external/aave/IAToken.sol"; import "../../interfaces/periphery/IOracle.sol"; import "../../interfaces/periphery/ITokenOracle.sol"; /** * @title Oracle for `ATokens` */ contract ATokenOracle is ITokenOracle { /// @inheritdoc ITokenOracle function getPriceInUsd(address _asset) external view returns (uint256 _priceInUsd) { // Note: `msg.sender` is the `MasterOracle` contract return IOracle(msg.sender).getPriceInUsd(IAToken(_asset).UNDERLYING_ASSET_ADDRESS()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IAToken is IERC20 { function UNDERLYING_ASSET_ADDRESS() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface IOracle { /** * @notice Get USD (or equivalent) price of an asset * @param token_ The address of asset * @return _priceInUsd The USD price */ function getPriceInUsd(address token_) external view returns (uint256 _priceInUsd); /** * @notice Get quote * @param tokenIn_ The address of assetIn * @param tokenOut_ The address of assetOut * @param amountIn_ Amount of input token * @return _amountOut Amount out */ function quote( address tokenIn_, address tokenOut_, uint256 amountIn_ ) external view returns (uint256 _amountOut); /** * @notice Get quote in USD (or equivalent) amount * @param token_ The address of assetIn * @param amountIn_ Amount of input token. * @return amountOut_ Amount in USD */ function quoteTokenToUsd(address token_, uint256 amountIn_) external view returns (uint256 amountOut_); /** * @notice Get quote from USD (or equivalent) amount to amount of token * @param token_ The address of assetOut * @param amountIn_ Input amount in USD * @return _amountOut Output amount of token */ function quoteUsdToToken(address token_, uint256 amountIn_) external view returns (uint256 _amountOut); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; interface ITokenOracle { /** * @notice Get USD (or equivalent) price of an asset * @param token_ The address of asset * @return _priceInUsd The USD price */ function getPriceInUsd(address token_) external view returns (uint256 _priceInUsd); }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 5000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getPriceInUsd","outputs":[{"internalType":"uint256","name":"_priceInUsd","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610248806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806307ee40bf14610030575b600080fd5b61004361003e3660046101b8565b610055565b60405190815260200160405180910390f35b60003373ffffffffffffffffffffffffffffffffffffffff166307ee40bf8373ffffffffffffffffffffffffffffffffffffffff1663b16a19de6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100b957600080fd5b505afa1580156100cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f191906101dc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff909116600482015260240160206040518083038186803b15801561015557600080fd5b505afa158015610169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018d91906101f9565b92915050565b73ffffffffffffffffffffffffffffffffffffffff811681146101b557600080fd5b50565b6000602082840312156101ca57600080fd5b81356101d581610193565b9392505050565b6000602082840312156101ee57600080fd5b81516101d581610193565b60006020828403121561020b57600080fd5b505191905056fea264697066735822122013e0e51f82cc428bb1b26ac2bfe44255a08c4eae45cca77355e087456fb0d56064736f6c63430008090033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c806307ee40bf14610030575b600080fd5b61004361003e3660046101b8565b610055565b60405190815260200160405180910390f35b60003373ffffffffffffffffffffffffffffffffffffffff166307ee40bf8373ffffffffffffffffffffffffffffffffffffffff1663b16a19de6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100b957600080fd5b505afa1580156100cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f191906101dc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff909116600482015260240160206040518083038186803b15801561015557600080fd5b505afa158015610169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018d91906101f9565b92915050565b73ffffffffffffffffffffffffffffffffffffffff811681146101b557600080fd5b50565b6000602082840312156101ca57600080fd5b81356101d581610193565b9392505050565b6000602082840312156101ee57600080fd5b81516101d581610193565b60006020828403121561020b57600080fd5b505191905056fea264697066735822122013e0e51f82cc428bb1b26ac2bfe44255a08c4eae45cca77355e087456fb0d56064736f6c63430008090033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.