ETH Price: $3,578.23 (-0.19%)
Gas: 32 Gwei

Contract

0x1b086779E47509bDc9f49f1ED31eefB1ef156deB
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60806040125897012021-06-07 20:58:301024 days ago1623099510IN
 Create: StethFeed
0 ETH0.0066900420

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StethFeed

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 2 : StethFeed.sol
pragma solidity ^0.5.16;

import "./SafeMath.sol";

interface IFeed {
    function decimals() external view returns (uint8);
    function latestAnswer() external view returns (uint);
}

interface StethEthFeed {
    function current_price() external view returns (uint256 price, bool is_safe);
}

contract StethFeed is IFeed {
    using SafeMath for uint;

    StethEthFeed public stethEthFeed;
    IFeed public ethFeed;

    constructor(StethEthFeed _stethEthFeed, IFeed _ethFeed) public {
        stethEthFeed = _stethEthFeed;
        ethFeed = _ethFeed;
    }

    function decimals() public view returns(uint8) {
        return 18;
    }

    function latestAnswer() public view returns (uint) {
        (uint stethEthPrice, bool isSafe) = stethEthFeed.current_price();
        require(isSafe, "price is not safe");
        return stethEthPrice
            .mul(ethFeed.latestAnswer())
            .div(10**uint256(ethFeed.decimals()));
    }

}

File 2 of 2 : SafeMath.sol
pragma solidity ^0.5.16;

// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, errorMessage);

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction underflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, errorMessage);

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts with custom message on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract StethEthFeed","name":"_stethEthFeed","type":"address"},{"internalType":"contract IFeed","name":"_ethFeed","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ethFeed","outputs":[{"internalType":"contract IFeed","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stethEthFeed","outputs":[{"internalType":"contract StethEthFeed","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516104b93803806104b98339818101604052604081101561003357600080fd5b508051602090910151600080546001600160a01b039384166001600160a01b0319918216179091556001805493909216921691909117905561043f8061007a6000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063313ce5671461005157806350d25bcd1461006f57806355899b77146100895780635e19d05c146100ad575b600080fd5b6100596100b5565b6040805160ff9092168252519081900360200190f35b6100776100ba565b60408051918252519081900360200190f35b61009161028a565b604080516001600160a01b039092168252519081900360200190f35b610091610299565b601290565b600080546040805163ab2b313760e01b81528151849384936001600160a01b039091169263ab2b31379260048083019392829003018186803b1580156100ff57600080fd5b505afa158015610113573d6000803e3d6000fd5b505050506040513d604081101561012957600080fd5b50805160209091015190925090508061017d576040805162461bcd60e51b81526020600482015260116024820152707072696365206973206e6f74207361666560781b604482015290519081900360640190fd5b6001546040805163313ce56760e01b81529051610283926001600160a01b03169163313ce567916004808301926020929190829003018186803b1580156101c357600080fd5b505afa1580156101d7573d6000803e3d6000fd5b505050506040513d60208110156101ed57600080fd5b5051600154604080516350d25bcd60e01b8152905160ff909316600a0a92610277926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b15801561023e57600080fd5b505afa158015610252573d6000803e3d6000fd5b505050506040513d602081101561026857600080fd5b5051859063ffffffff6102a816565b9063ffffffff61030a16565b9250505090565b6000546001600160a01b031681565b6001546001600160a01b031681565b6000826102b757506000610304565b828202828482816102c457fe5b04146103015760405162461bcd60e51b81526004018080602001828103825260218152602001806103ea6021913960400191505060405180910390fd5b90505b92915050565b600061030183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836103d35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610398578181015183820152602001610380565b50505050905090810190601f1680156103c55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816103df57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158209c06f9435f994c4111acf905b746b228fa1c3ba75ed875d38de1071c768a43ff64736f6c63430005100032000000000000000000000000ab55bf4dfbf469ebfe082b7872557d1f87692fe60000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063313ce5671461005157806350d25bcd1461006f57806355899b77146100895780635e19d05c146100ad575b600080fd5b6100596100b5565b6040805160ff9092168252519081900360200190f35b6100776100ba565b60408051918252519081900360200190f35b61009161028a565b604080516001600160a01b039092168252519081900360200190f35b610091610299565b601290565b600080546040805163ab2b313760e01b81528151849384936001600160a01b039091169263ab2b31379260048083019392829003018186803b1580156100ff57600080fd5b505afa158015610113573d6000803e3d6000fd5b505050506040513d604081101561012957600080fd5b50805160209091015190925090508061017d576040805162461bcd60e51b81526020600482015260116024820152707072696365206973206e6f74207361666560781b604482015290519081900360640190fd5b6001546040805163313ce56760e01b81529051610283926001600160a01b03169163313ce567916004808301926020929190829003018186803b1580156101c357600080fd5b505afa1580156101d7573d6000803e3d6000fd5b505050506040513d60208110156101ed57600080fd5b5051600154604080516350d25bcd60e01b8152905160ff909316600a0a92610277926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b15801561023e57600080fd5b505afa158015610252573d6000803e3d6000fd5b505050506040513d602081101561026857600080fd5b5051859063ffffffff6102a816565b9063ffffffff61030a16565b9250505090565b6000546001600160a01b031681565b6001546001600160a01b031681565b6000826102b757506000610304565b828202828482816102c457fe5b04146103015760405162461bcd60e51b81526004018080602001828103825260218152602001806103ea6021913960400191505060405180910390fd5b90505b92915050565b600061030183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836103d35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610398578181015183820152602001610380565b50505050905090810190601f1680156103c55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816103df57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158209c06f9435f994c4111acf905b746b228fa1c3ba75ed875d38de1071c768a43ff64736f6c63430005100032

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

000000000000000000000000ab55bf4dfbf469ebfe082b7872557d1f87692fe60000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419

-----Decoded View---------------
Arg [0] : _stethEthFeed (address): 0xAb55Bf4DfBf469ebfe082b7872557D1F87692Fe6
Arg [1] : _ethFeed (address): 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ab55bf4dfbf469ebfe082b7872557d1f87692fe6
Arg [1] : 0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.