ETH Price: $2,036.70 (+4.52%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x49C6858B...b4Ccb7843
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ERC4626Oracle

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, BSD-3-Clause license

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

import { IERC4626 } from "../interfaces/IERC4626.sol";
import { CorrelatedTokenOracle } from "./common/CorrelatedTokenOracle.sol";

/**
 * @title ERC4626Oracle
 * @author Venus
 * @notice This oracle fetches the price of ERC4626 tokens
 */
contract ERC4626Oracle is CorrelatedTokenOracle {
    uint256 public immutable ONE_CORRELATED_TOKEN;

    /// @notice Constructor for the implementation contract.
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(
        address correlatedToken,
        address underlyingToken,
        address resilientOracle
    ) CorrelatedTokenOracle(correlatedToken, underlyingToken, resilientOracle) {
        ONE_CORRELATED_TOKEN = 10 ** IERC4626(correlatedToken).decimals();
    }

    /**
     * @notice Fetches the amount of underlying token for 1 correlated token
     * @return amount The amount of underlying token for correlated token
     */
    function _getUnderlyingAmount() internal view override returns (uint256) {
        return IERC4626(CORRELATED_TOKEN).convertToAssets(ONE_CORRELATED_TOKEN);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

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);
}

File 4 of 7 : validators.sol
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

/// @notice Thrown if the supplied address is a zero address where it is not allowed
error ZeroAddressNotAllowed();

/// @notice Thrown if the supplied value is 0 where it is not allowed
error ZeroValueNotAllowed();

/// @notice Checks if the provided address is nonzero, reverts otherwise
/// @param address_ Address to check
/// @custom:error ZeroAddressNotAllowed is thrown if the provided address is a zero address
function ensureNonzeroAddress(address address_) pure {
    if (address_ == address(0)) {
        revert ZeroAddressNotAllowed();
    }
}

/// @notice Checks if the provided value is nonzero, reverts otherwise
/// @param value_ Value to check
/// @custom:error ZeroValueNotAllowed is thrown if the provided value is 0
function ensureNonzeroValue(uint256 value_) pure {
    if (value_ == 0) {
        revert ZeroValueNotAllowed();
    }
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

interface IERC4626 {
    function convertToAssets(uint256 shares) external view returns (uint256);
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.25;

interface OracleInterface {
    function getPrice(address asset) external view returns (uint256);
}

interface ResilientOracleInterface is OracleInterface {
    function updatePrice(address vToken) external;

    function updateAssetPrice(address asset) external;

    function getUnderlyingPrice(address vToken) external view returns (uint256);
}

interface TwapInterface is OracleInterface {
    function updateTwap(address asset) external returns (uint256);
}

interface BoundValidatorInterface {
    function validatePriceWithAnchorPrice(
        address asset,
        uint256 reporterPrice,
        uint256 anchorPrice
    ) external view returns (bool);
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.25;

import { OracleInterface } from "../../interfaces/OracleInterface.sol";
import { ensureNonzeroAddress } from "@venusprotocol/solidity-utilities/contracts/validators.sol";
import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

/**
 * @title CorrelatedTokenOracle
 * @notice This oracle fetches the price of a token that is correlated to another token.
 */
abstract contract CorrelatedTokenOracle is OracleInterface {
    /// @notice Address of the correlated token
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address public immutable CORRELATED_TOKEN;

    /// @notice Address of the underlying token
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address public immutable UNDERLYING_TOKEN;

    /// @notice Address of Resilient Oracle
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    OracleInterface public immutable RESILIENT_ORACLE;

    /// @notice Thrown if the token address is invalid
    error InvalidTokenAddress();

    /// @notice Constructor for the implementation contract.
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address correlatedToken, address underlyingToken, address resilientOracle) {
        ensureNonzeroAddress(correlatedToken);
        ensureNonzeroAddress(underlyingToken);
        ensureNonzeroAddress(resilientOracle);
        CORRELATED_TOKEN = correlatedToken;
        UNDERLYING_TOKEN = underlyingToken;
        RESILIENT_ORACLE = OracleInterface(resilientOracle);
    }

    /**
     * @notice Fetches the price of the correlated token
     * @param asset Address of the correlated token
     * @return price The price of the correlated token in scaled decimal places
     */
    function getPrice(address asset) external view override returns (uint256) {
        if (asset != CORRELATED_TOKEN) revert InvalidTokenAddress();

        // get underlying token amount for 1 correlated token scaled by underlying token decimals
        uint256 underlyingAmount = _getUnderlyingAmount();

        // oracle returns (36 - asset decimal) scaled price
        uint256 underlyingUSDPrice = RESILIENT_ORACLE.getPrice(UNDERLYING_TOKEN);

        IERC20Metadata token = IERC20Metadata(CORRELATED_TOKEN);
        uint256 decimals = token.decimals();

        // underlyingAmount (for 1 correlated token) * underlyingUSDPrice / decimals(correlated token)
        return (underlyingAmount * underlyingUSDPrice) / (10 ** decimals);
    }

    /**
     * @notice Gets the underlying amount for correlated token
     * @return underlyingAmount Amount of underlying token
     */
    function _getUnderlyingAmount() internal view virtual returns (uint256);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"correlatedToken","type":"address"},{"internalType":"address","name":"underlyingToken","type":"address"},{"internalType":"address","name":"resilientOracle","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidTokenAddress","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"inputs":[],"name":"CORRELATED_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_CORRELATED_TOKEN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RESILIENT_ORACLE","outputs":[{"internalType":"contract OracleInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNDERLYING_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

0x61010060405234801561001157600080fd5b5060405161088f38038061088f83398101604081905261003091610127565b82828261003c836100e1565b610045826100e1565b61004e816100e1565b6001600160a01b0392831660805290821660a052811660c0526040805163313ce56760e01b815290519185169163313ce567916004808201926020929091908290030181865afa1580156100a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100ca919061016a565b6100d590600a610290565b60e0525061029f915050565b6001600160a01b038116610108576040516342bcdf7f60e11b815260040160405180910390fd5b50565b80516001600160a01b038116811461012257600080fd5b919050565b60008060006060848603121561013c57600080fd5b6101458461010b565b92506101536020850161010b565b91506101616040850161010b565b90509250925092565b60006020828403121561017c57600080fd5b815160ff8116811461018d57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156101e55781600019048211156101cb576101cb610194565b808516156101d857918102915b93841c93908002906101af565b509250929050565b6000826101fc5750600161028a565b816102095750600061028a565b816001811461021f576002811461022957610245565b600191505061028a565b60ff84111561023a5761023a610194565b50506001821b61028a565b5060208310610133831016604e8410600b8410161715610268575081810a61028a565b61027283836101aa565b806000190482111561028657610286610194565b0290505b92915050565b600061018d60ff8416836101ed565b60805160a05160c05160e0516105906102ff6000396000818160ed015261030c01526000818161011401526101d9015260008181606101526101ab01526000818160c60152818161013a0152818161024a015261033501526105906000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806329db1be61461005c57806341976e09146100a057806369818a35146100c157806386f23a75146100e8578063a4edcd4c1461010f575b600080fd5b6100837f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b36100ae3660046103ad565b610136565b604051908152602001610097565b6100837f000000000000000000000000000000000000000000000000000000000000000081565b6100b37f000000000000000000000000000000000000000000000000000000000000000081565b6100837f000000000000000000000000000000000000000000000000000000000000000081565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461018a57604051630f58058360e11b815260040160405180910390fd5b60006101946102fd565b6040516341976e0960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906341976e0990602401602060405180830381865afa158015610220573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024491906103dd565b905060007f000000000000000000000000000000000000000000000000000000000000000090506000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102cf91906103f6565b60ff1690506102df81600a610515565b6102e98486610521565b6102f39190610538565b9695505050505050565b6040516303d1689d60e11b81527f000000000000000000000000000000000000000000000000000000000000000060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307a2d13a90602401602060405180830381865afa158015610384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a891906103dd565b905090565b6000602082840312156103bf57600080fd5b81356001600160a01b03811681146103d657600080fd5b9392505050565b6000602082840312156103ef57600080fd5b5051919050565b60006020828403121561040857600080fd5b815160ff811681146103d657600080fd5b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561046a57816000190482111561045057610450610419565b8085161561045d57918102915b93841c9390800290610434565b509250929050565b6000826104815750600161050f565b8161048e5750600061050f565b81600181146104a457600281146104ae576104ca565b600191505061050f565b60ff8411156104bf576104bf610419565b50506001821b61050f565b5060208310610133831016604e8410600b84101617156104ed575081810a61050f565b6104f7838361042f565b806000190482111561050b5761050b610419565b0290505b92915050565b60006103d68383610472565b808202811582820484141761050f5761050f610419565b60008261055557634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122066bdbfdcfcfeda2396955cd118d3cc8263a7137fbda8f4ea984339c45ee8d40d64736f6c63430008190033000000000000000000000000182863131f9a4630ff9e27830d945b1413e347e8000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f000000000000000000000000d2ce3fb018805ef92b8c5976cb31f84b4e295f94

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c806329db1be61461005c57806341976e09146100a057806369818a35146100c157806386f23a75146100e8578063a4edcd4c1461010f575b600080fd5b6100837f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f81565b6040516001600160a01b0390911681526020015b60405180910390f35b6100b36100ae3660046103ad565b610136565b604051908152602001610097565b6100837f000000000000000000000000182863131f9a4630ff9e27830d945b1413e347e881565b6100b37f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6100837f000000000000000000000000d2ce3fb018805ef92b8c5976cb31f84b4e295f9481565b60007f000000000000000000000000182863131f9a4630ff9e27830d945b1413e347e86001600160a01b0316826001600160a01b03161461018a57604051630f58058360e11b815260040160405180910390fd5b60006101946102fd565b6040516341976e0960e01b81526001600160a01b037f000000000000000000000000dc035d45d973e3ec169d2276ddab16f1e407384f811660048301529192506000917f000000000000000000000000d2ce3fb018805ef92b8c5976cb31f84b4e295f9416906341976e0990602401602060405180830381865afa158015610220573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061024491906103dd565b905060007f000000000000000000000000182863131f9a4630ff9e27830d945b1413e347e890506000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102cf91906103f6565b60ff1690506102df81600a610515565b6102e98486610521565b6102f39190610538565b9695505050505050565b6040516303d1689d60e11b81527f0000000000000000000000000000000000000000000000000de0b6b3a764000060048201526000907f000000000000000000000000182863131f9a4630ff9e27830d945b1413e347e86001600160a01b0316906307a2d13a90602401602060405180830381865afa158015610384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a891906103dd565b905090565b6000602082840312156103bf57600080fd5b81356001600160a01b03811681146103d657600080fd5b9392505050565b6000602082840312156103ef57600080fd5b5051919050565b60006020828403121561040857600080fd5b815160ff811681146103d657600080fd5b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561046a57816000190482111561045057610450610419565b8085161561045d57918102915b93841c9390800290610434565b509250929050565b6000826104815750600161050f565b8161048e5750600061050f565b81600181146104a457600281146104ae576104ca565b600191505061050f565b60ff8411156104bf576104bf610419565b50506001821b61050f565b5060208310610133831016604e8410600b84101617156104ed575081810a61050f565b6104f7838361042f565b806000190482111561050b5761050b610419565b0290505b92915050565b60006103d68383610472565b808202811582820484141761050f5761050f610419565b60008261055557634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122066bdbfdcfcfeda2396955cd118d3cc8263a7137fbda8f4ea984339c45ee8d40d64736f6c63430008190033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
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.