Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Contract Name:
HardPegOracleWrapper
Compiler Version
v0.8.22+commit.4fc1097e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.20;
import "../interface/IOracleWrapper.sol";
contract HardPegOracleWrapper is IOracleWrapper {
uint256 public immutable pricePeg;
address public immutable BASE_CURRENCY;
uint256 public BASE_CURRENCY_UNIT;
constructor(address _baseCurrency, uint256 _baseCurrencyUnit, uint256 _pricePeg) {
BASE_CURRENCY = _baseCurrency;
BASE_CURRENCY_UNIT = _baseCurrencyUnit;
pricePeg = _pricePeg;
}
/**
* @dev Get the price info of an asset
*/
function getPriceInfo(
address // asset
) external view returns (uint256 price, bool isAlive) {
return (pricePeg, true);
}
/**
* @dev Get the price of an asset
*/
function getAssetPrice(
address // asset
) external view override returns (uint256) {
return pricePeg;
}
}// SPDX-License-Identifier: MIT
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.20;
/**
* @dev Interface for the individual oracle wrappers, to unify interface between different oracle providers
*/
interface IOracleWrapper {
/**
* @notice Returns the base currency address
* @dev Address 0x0 is commonly used for USD, but can be any token address based on the implementation.
* @return Returns the base currency address.
*/
function BASE_CURRENCY() external view returns (address);
/**
* @notice Returns the base currency unit
* @dev Represents the decimal precision of the base currency (e.g., 1e8 for USD, 1e18 for ETH).
* @return Returns the base currency unit.
*/
function BASE_CURRENCY_UNIT() external view returns (uint256);
/**
* @notice Returns the asset price in the base currency
* @param asset The address of the asset
* @return The price of the asset
*/
function getAssetPrice(address asset) external view returns (uint256);
/**
* @notice Returns the price and alive status of an asset
* @param asset The address of the asset
* @return price The price of the asset
* @return isAlive The alive status of the asset
*/
function getPriceInfo(address asset) external view returns (uint256 price, bool isAlive);
}{
"evmVersion": "paris",
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"_baseCurrency","type":"address"},{"internalType":"uint256","name":"_baseCurrencyUnit","type":"uint256"},{"internalType":"uint256","name":"_pricePeg","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BASE_CURRENCY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BASE_CURRENCY_UNIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getAssetPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getPriceInfo","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bool","name":"isAlive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePeg","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c060405234801561001057600080fd5b5060405161027d38038061027d83398101604081905261002f91610048565b6001600160a01b0390921660a05260005560805261008b565b60008060006060848603121561005d57600080fd5b83516001600160a01b038116811461007457600080fd5b602085015160409095015190969495509392505050565b60805160a0516101c26100bb600039600061012201526000818160610152818160b0015260fb01526101c26000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80636af8ecae1461005c5780638c89b64f146100965780638edbf4361461009f578063b3596f07146100ea578063e19f47001461011d575b600080fd5b6100837f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b61008360005481565b6100d56100ad36600461015c565b507f000000000000000000000000000000000000000000000000000000000000000090600190565b6040805192835290151560208301520161008d565b6100836100f836600461015c565b507f000000000000000000000000000000000000000000000000000000000000000090565b6101447f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161008d565b60006020828403121561016e57600080fd5b81356001600160a01b038116811461018557600080fd5b939250505056fea2646970667358221220dab71ee1ad2092fdb8bce4f40c7156bf86e6c3f76dc26a0c220c4be60b0341bf64736f6c6343000816003300000000000000000000000055f937def274c6cbd9444f0857639757c5a2a3e90000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100575760003560e01c80636af8ecae1461005c5780638c89b64f146100965780638edbf4361461009f578063b3596f07146100ea578063e19f47001461011d575b600080fd5b6100837f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6040519081526020015b60405180910390f35b61008360005481565b6100d56100ad36600461015c565b507f0000000000000000000000000000000000000000000000000de0b6b3a764000090600190565b6040805192835290151560208301520161008d565b6100836100f836600461015c565b507f0000000000000000000000000000000000000000000000000de0b6b3a764000090565b6101447f00000000000000000000000055f937def274c6cbd9444f0857639757c5a2a3e981565b6040516001600160a01b03909116815260200161008d565b60006020828403121561016e57600080fd5b81356001600160a01b038116811461018557600080fd5b939250505056fea2646970667358221220dab71ee1ad2092fdb8bce4f40c7156bf86e6c3f76dc26a0c220c4be60b0341bf64736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000055f937def274c6cbd9444f0857639757c5a2a3e90000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000
-----Decoded View---------------
Arg [0] : _baseCurrency (address): 0x55F937DEF274C6CBd9444f0857639757C5A2a3E9
Arg [1] : _baseCurrencyUnit (uint256): 1000000000000000000
Arg [2] : _pricePeg (uint256): 1000000000000000000
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000055f937def274c6cbd9444f0857639757c5a2a3e9
Arg [1] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Arg [2] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Loading...
Loading
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.