Source Code
Overview
MNT Balance
MNT Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
PendleRedStoneRateOracleAdapter
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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);
}// 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;
}
// @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);
}
}// 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);
}{
"evmVersion": "paris",
"libraries": {},
"optimizer": {
"enabled": true,
"runs": 1000000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
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"}]Contract Creation Code
60e080604052346100e957604081610550803803809161001f8285610102565b8339810103126100e9578051906001600160a01b0382168083036100e95760049261004d602080940161013b565b9060805260a0526040519283809263313ce56760e01b82525afa9081156100f6576000916100b7575b5060c052604051610406908161014a823960805181818160bf01526102b6015260a05181818160fc015261036c015260c05181818161013601526103110152f35b90506020813d6020116100ee575b816100d260209383610102565b810103126100e9576100e39061013b565b38610076565b600080fd5b3d91506100c5565b6040513d6000823e3d90fd5b601f909101601f19168101906001600160401b0382119082101761012557604052565b634e487b7160e01b600052604160045260246000fd5b519060ff821682036100e95756fe60806040818152600436101561001457600080fd5b600091823560e01c908163313ce56714610335575080633b97423f146102da5780637dc0d1d01461026c5763e6aa216c1461004e57600080fd5b3461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268578051907f50d25bcd00000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000165afa91821561025e5783926101ca575b508282126101c6576101207f0000000000000000000000000000000000000000000000000000000000000000610390565b918281029281840414901517156101995761015a7f0000000000000000000000000000000000000000000000000000000000000000610390565b90811561016c57602093505191048152f35b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526012600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b8280fd5b90915060203d602011610257575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f820116820182811067ffffffffffffffff82111761022a5760209183918552810103126101c6575190386100ef565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b503d6101d8565b81513d85823e3d90fd5b5080fd5b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905160ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b83903461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102685760209060ff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b60ff16604d81116103a157600a0a90565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220052b3ef232e10c2b276fec481917d88ef3a74f3d0993f28d778a377c457ed24364736f6c634300081800330000000000000000000000009b2c948dba5952a1f5ab6fa16101c1392b8da1ab0000000000000000000000000000000000000000000000000000000000000012
Deployed Bytecode
0x60806040818152600436101561001457600080fd5b600091823560e01c908163313ce56714610335575080633b97423f146102da5780637dc0d1d01461026c5763e6aa216c1461004e57600080fd5b3461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268578051907f50d25bcd00000000000000000000000000000000000000000000000000000000825260208260048173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009b2c948dba5952a1f5ab6fa16101c1392b8da1ab165afa91821561025e5783926101ca575b508282126101c6576101207f0000000000000000000000000000000000000000000000000000000000000012610390565b918281029281840414901517156101995761015a7f0000000000000000000000000000000000000000000000000000000000000008610390565b90811561016c57602093505191048152f35b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526012600452fd5b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526011600452fd5b8280fd5b90915060203d602011610257575b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f820116820182811067ffffffffffffffff82111761022a5760209183918552810103126101c6575190386100ef565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b503d6101d8565b81513d85823e3d90fd5b5080fd5b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009b2c948dba5952a1f5ab6fa16101c1392b8da1ab168152f35b503461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610268576020905160ff7f0000000000000000000000000000000000000000000000000000000000000008168152f35b83903461026857817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126102685760209060ff7f0000000000000000000000000000000000000000000000000000000000000012168152f35b60ff16604d81116103a157600a0a90565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220052b3ef232e10c2b276fec481917d88ef3a74f3d0993f28d778a377c457ed24364736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009b2c948dba5952a1f5ab6fa16101c1392b8da1ab0000000000000000000000000000000000000000000000000000000000000012
-----Decoded View---------------
Arg [0] : _redStoneOracle (address): 0x9b2C948dbA5952A1f5Ab6fA16101c1392b8da1ab
Arg [1] : _decimals (uint8): 18
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000009b2c948dba5952a1f5ab6fa16101c1392b8da1ab
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000012
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.