HYPE Price: $22.51 (+1.66%)
 

Overview

HYPE Balance

HyperEVM LogoHyperEVM LogoHyperEVM Logo0 HYPE

HYPE Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

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

Contract Source Code Verified (Exact Match)

Contract Name:
PendleRedStoneRateOracleAdapter

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
shanghai EvmVersion
File 1 of 5 : PendleRedStoneRateOracleAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "../../core/libraries/math/PMath.sol";
import "../../interfaces/IPExchangeRateOracle.sol";
import "../../interfaces/IRedstonePriceFeed.sol";

contract PendleRedStoneRateOracleAdapter is IPExchangeRateOracle {
    using PMath for int256;

    address public immutable oracle;
    uint8 public immutable decimals;
    uint8 public immutable rawDecimals;

    constructor(address _redStoneOracle, uint8 _decimals) {
        oracle = _redStoneOracle;
        decimals = _decimals;
        rawDecimals = IRedstonePriceFeed(_redStoneOracle).decimals();
    }

    function getExchangeRate() external view returns (uint256) {
        int256 answer = IRedstonePriceFeed(oracle).latestAnswer();
        return (answer.Uint() * 10 ** decimals) / 10 ** rawDecimals;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(
    uint80 _roundId
  ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

  function latestRoundData()
    external
    view
    returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

File 3 of 5 : PMath.sol
// SPDX-License-Identifier: GPL-3.0-or-later
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.8.0;

/* solhint-disable private-vars-leading-underscore, reason-string */

library PMath {
    uint256 internal constant ONE = 1e18; // 18 decimal places
    int256 internal constant IONE = 1e18; // 18 decimal places

    function subMax0(uint256 a, uint256 b) internal pure returns (uint256) {
        unchecked {
            return (a >= b ? a - b : 0);
        }
    }

    function subNoNeg(int256 a, int256 b) internal pure returns (int256) {
        require(a >= b, "negative");
        return a - b; // no unchecked since if b is very negative, a - b might overflow
    }

    function mulDown(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 product = a * b;
        unchecked {
            return product / ONE;
        }
    }

    function mulDown(int256 a, int256 b) internal pure returns (int256) {
        int256 product = a * b;
        unchecked {
            return product / IONE;
        }
    }

    function divDown(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 aInflated = a * ONE;
        unchecked {
            return aInflated / b;
        }
    }

    function divDown(int256 a, int256 b) internal pure returns (int256) {
        int256 aInflated = a * IONE;
        unchecked {
            return aInflated / b;
        }
    }

    function rawDivUp(uint256 a, uint256 b) internal pure returns (uint256) {
        return (a + b - 1) / b;
    }

    function rawDivUp(int256 a, int256 b) internal pure returns (int256) {
        return (a + b - 1) / b;
    }

    function tweakUp(uint256 a, uint256 factor) internal pure returns (uint256) {
        return mulDown(a, ONE + factor);
    }

    function tweakDown(uint256 a, uint256 factor) internal pure returns (uint256) {
        return mulDown(a, ONE - factor);
    }

    /// @return res = min(a + b, bound)
    /// @dev This function should handle arithmetic operation and bound check without overflow/underflow
    function addWithUpperBound(uint256 a, uint256 b, uint256 bound) internal pure returns (uint256 res) {
        unchecked {
            if (type(uint256).max - b < a) res = bound;
            else res = min(bound, a + b);
        }
    }

    /// @return res = max(a - b, bound)
    /// @dev This function should handle arithmetic operation and bound check without overflow/underflow
    function subWithLowerBound(uint256 a, uint256 b, uint256 bound) internal pure returns (uint256 res) {
        unchecked {
            if (b > a) res = bound;
            else res = max(a - b, bound);
        }
    }

    function clamp(uint256 x, uint256 lower, uint256 upper) internal pure returns (uint256 res) {
        res = x;
        if (x < lower) res = lower;
        else if (x > upper) res = upper;
    }

    // @author Uniswap
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    function square(uint256 x) internal pure returns (uint256) {
        return x * x;
    }

    function squareDown(uint256 x) internal pure returns (uint256) {
        return mulDown(x, x);
    }

    function abs(int256 x) internal pure returns (uint256) {
        return uint256(x > 0 ? x : -x);
    }

    function neg(int256 x) internal pure returns (int256) {
        return x * (-1);
    }

    function neg(uint256 x) internal pure returns (int256) {
        return Int(x) * (-1);
    }

    function max(uint256 x, uint256 y) internal pure returns (uint256) {
        return (x > y ? x : y);
    }

    function max(int256 x, int256 y) internal pure returns (int256) {
        return (x > y ? x : y);
    }

    function min(uint256 x, uint256 y) internal pure returns (uint256) {
        return (x < y ? x : y);
    }

    function min(int256 x, int256 y) internal pure returns (int256) {
        return (x < y ? x : y);
    }

    /*///////////////////////////////////////////////////////////////
                               SIGNED CASTS
    //////////////////////////////////////////////////////////////*/

    function Int(uint256 x) internal pure returns (int256) {
        require(x <= uint256(type(int256).max));
        return int256(x);
    }

    function Int128(int256 x) internal pure returns (int128) {
        require(type(int128).min <= x && x <= type(int128).max);
        return int128(x);
    }

    function Int128(uint256 x) internal pure returns (int128) {
        return Int128(Int(x));
    }

    /*///////////////////////////////////////////////////////////////
                               UNSIGNED CASTS
    //////////////////////////////////////////////////////////////*/

    function Uint(int256 x) internal pure returns (uint256) {
        require(x >= 0);
        return uint256(x);
    }

    function Uint32(uint256 x) internal pure returns (uint32) {
        require(x <= type(uint32).max);
        return uint32(x);
    }

    function Uint64(uint256 x) internal pure returns (uint64) {
        require(x <= type(uint64).max);
        return uint64(x);
    }

    function Uint112(uint256 x) internal pure returns (uint112) {
        require(x <= type(uint112).max);
        return uint112(x);
    }

    function Uint96(uint256 x) internal pure returns (uint96) {
        require(x <= type(uint96).max);
        return uint96(x);
    }

    function Uint128(uint256 x) internal pure returns (uint128) {
        require(x <= type(uint128).max);
        return uint128(x);
    }

    function Uint192(uint256 x) internal pure returns (uint192) {
        require(x <= type(uint192).max);
        return uint192(x);
    }

    function Uint80(uint256 x) internal pure returns (uint80) {
        require(x <= type(uint80).max);
        return uint80(x);
    }

    function isAApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
        return mulDown(b, ONE - eps) <= a && a <= mulDown(b, ONE + eps);
    }

    function isAGreaterApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
        return a >= b && a <= mulDown(b, ONE + eps);
    }

    function isASmallerApproxB(uint256 a, uint256 b, uint256 eps) internal pure returns (bool) {
        return a <= b && a >= mulDown(b, ONE - eps);
    }
}

File 4 of 5 : IPExchangeRateOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IPExchangeRateOracle {
    function getExchangeRate() external view returns (uint256);
}

pragma solidity ^0.8.0;

import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

interface IRedstonePriceFeed is AggregatorV3Interface {
    /**
     * @notice Old Chainlink function for getting the number of latest round
     * @return latestRound The number of the latest update round
     */
    function latestRound() external view returns (uint80);

    /**
     * @notice Old Chainlink function for getting the latest successfully reported value
     * @return latestAnswer The latest successfully reported value
     */
    function latestAnswer() external view returns (int256);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "viaIR": true,
  "evmVersion": "shanghai",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_redStoneOracle","type":"address"},{"internalType":"uint8","name":"_decimals","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rawDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"}]

60e080604052346100e85760408161050d803803809161001f82856100ff565b8339810103126100e8578051906001600160a01b0382168083036100e85760049261004d6020809401610136565b9060805260a0526040519283809263313ce56760e01b82525afa9081156100f4575f916100b6575b5060c0526040516103c89081610145823960805181818160ba01526102a9015260a05181818160f7015261035d015260c05181818161013101526103040152f35b90506020813d6020116100ec575b816100d1602093836100ff565b810103126100e8576100e290610136565b5f610075565b5f80fd5b3d91506100c4565b6040513d5f823e3d90fd5b601f909101601f19168101906001600160401b0382119082101761012257604052565b634e487b7160e01b5f52604160045260245ffd5b519060ff821682036100e85756fe60806040908082526004361015610014575f80fd5b5f3560e01c908163313ce56714610328575080633b97423f146102cd5780637dc0d1d01461025f5763e6aa216c1461004a575f80fd5b346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf5780517f50d25bcd00000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa908115610255575f916101c3575b505f81126101bf5761011b7f0000000000000000000000000000000000000000000000000000000000000000610381565b90818102918183041490151715610192576101557f0000000000000000000000000000000000000000000000000000000000000000610381565b8015610165576020925191048152f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f80fd5b905060203d60201161024e575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f820116820182811067ffffffffffffffff8211176102215760209183918552810103126101bf57515f6100ea565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b503d6101d0565b82513d5f823e3d90fd5b50346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b50346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf576020905160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf5760209060ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b60ff16604d811161019257600a0a9056fea2646970667358221220217841f53221849dd7bd1aaae5edaf7258a4c8b9d80fa24e485e717f0306308e64736f6c6343000818003300000000000000000000000029d295409d5a20b2c851df18054d32a4427913460000000000000000000000000000000000000000000000000000000000000012

Deployed Bytecode

0x60806040908082526004361015610014575f80fd5b5f3560e01c908163313ce56714610328575080633b97423f146102cd5780637dc0d1d01461025f5763e6aa216c1461004a575f80fd5b346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf5780517f50d25bcd00000000000000000000000000000000000000000000000000000000815260208160048173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000029d295409d5a20b2c851df18054d32a442791346165afa908115610255575f916101c3575b505f81126101bf5761011b7f0000000000000000000000000000000000000000000000000000000000000012610381565b90818102918183041490151715610192576101557f0000000000000000000000000000000000000000000000000000000000000008610381565b8015610165576020925191048152f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f80fd5b905060203d60201161024e575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f820116820182811067ffffffffffffffff8211176102215760209183918552810103126101bf57515f6100ea565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b503d6101d0565b82513d5f823e3d90fd5b50346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf576020905173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000029d295409d5a20b2c851df18054d32a442791346168152f35b50346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf576020905160ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b346101bf575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101bf5760209060ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b60ff16604d811161019257600a0a9056fea2646970667358221220217841f53221849dd7bd1aaae5edaf7258a4c8b9d80fa24e485e717f0306308e64736f6c63430008180033

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

00000000000000000000000029d295409d5a20b2c851df18054d32a4427913460000000000000000000000000000000000000000000000000000000000000012

-----Decoded View---------------
Arg [0] : _redStoneOracle (address): 0x29D295409d5A20b2C851df18054D32A442791346
Arg [1] : _decimals (uint8): 18

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000029d295409d5a20b2c851df18054d32a442791346
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000012


Block Transaction Gas Used Reward
view all blocks ##produced##

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

Validator Index Block Amount
View All Withdrawals

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