ETH Price: $3,136.93 (+3.64%)

Contract

0x0aD197DE3091F489810E4F54164C59bD59Af33C2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60e08060207122832024-09-09 9:53:1167 days ago1725875591IN
 Create: PendleRedStoneRateOracleAdapter
0 ETH0.001144633.9743686

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
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:
paris 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;
    }
}

File 2 of 5 : AggregatorV3Interface.sol
// 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 slipUp(uint256 a, uint256 factor) internal pure returns (uint256) {
        return mulDown(a, ONE + factor);
    }

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

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

File 5 of 5 : IRedstonePriceFeed.sol
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": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"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"}]

60e080604052346100e957604081610550803803809161001f8285610102565b8339810103126100e9578051906001600160a01b0382168083036100e95760049261004d602080940161013b565b9060805260a0526040519283809263313ce56760e01b82525afa9081156100f6576000916100b7575b5060c052604051610406908161014a823960805181818160bf01526102b6015260a05181818160fc015261036c015260c05181818161013601526103110152f35b90506020813d6020116100ee575b816100d260209383610102565b810103126100e9576100e39061013b565b38610076565b600080fd5b3d91506100c5565b6040513d6000823e3d90fd5b601f909101601f19168101906001600160401b0382119082101761012557604052565b634e487b7160e01b600052604160045260246000fd5b519060ff821682036100e95756fe60806040818152600436101561001457600080fd5b600091823560e01c908163313ce56714610335575080633b97423f146102da5780637dc0d1d01461026c5763e6aa216c1461004e57600080fd5b3461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268578051907f50d25bcd00000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa91821561025e5783926101ca575b508282126101c6576101207f0000000000000000000000000000000000000000000000000000000000000000610390565b918281029281840414901517156101995761015a7f0000000000000000000000000000000000000000000000000000000000000000610390565b90811561016c57602093505191048152f35b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526012600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b8280fd5b90915060203d602011610257575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f820116820182811067ffffffffffffffff82111761022a5760209183918552810103126101c6575190386100ef565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b503d6101d8565b81513d85823e3d90fd5b5080fd5b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b83903461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102685760209060ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b60ff16604d81116103a157600a0a90565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220c7d17c2f0ddd1107204b9d6626ea82664c7fa76eb0818781e18457cf33fb607564736f6c63430008180033000000000000000000000000b415eaa355d8440ac7ecb602d3fb67ccc1f0bc810000000000000000000000000000000000000000000000000000000000000012

Deployed Bytecode

0x60806040818152600436101561001457600080fd5b600091823560e01c908163313ce56714610335575080633b97423f146102da5780637dc0d1d01461026c5763e6aa216c1461004e57600080fd5b3461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268578051907f50d25bcd00000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b415eaa355d8440ac7ecb602d3fb67ccc1f0bc81165afa91821561025e5783926101ca575b508282126101c6576101207f0000000000000000000000000000000000000000000000000000000000000012610390565b918281029281840414901517156101995761015a7f0000000000000000000000000000000000000000000000000000000000000008610390565b90811561016c57602093505191048152f35b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526012600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b8280fd5b90915060203d602011610257575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f820116820182811067ffffffffffffffff82111761022a5760209183918552810103126101c6575190386100ef565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b503d6101d8565b81513d85823e3d90fd5b5080fd5b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000b415eaa355d8440ac7ecb602d3fb67ccc1f0bc81168152f35b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905160ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b83903461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102685760209060ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b60ff16604d81116103a157600a0a90565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220c7d17c2f0ddd1107204b9d6626ea82664c7fa76eb0818781e18457cf33fb607564736f6c63430008180033

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

000000000000000000000000b415eaa355d8440ac7ecb602d3fb67ccc1f0bc810000000000000000000000000000000000000000000000000000000000000012

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

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b415eaa355d8440ac7ecb602d3fb67ccc1f0bc81
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000012


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

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