Description:
Proxy contract enabling upgradeable smart contract patterns. Delegates calls to an implementation contract.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"smart-contracts-public/src/pricing/oracles/SharePriceOracle.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;
import "../../pricing/IPriceOracle.sol";
import "../../pricing/ISharePriceCalculator.sol";
/**
* @title SharePriceOracle
* @notice Bridge contract that exposes SharePriceCalculator's price as an IPriceOracle
* @dev Allows ShareToken price to be used in PriceRouter alongside market oracles
*/
contract SharePriceOracle is IPriceOracle {
// ============ State ============
ISharePriceCalculator public immutable calculator;
// ============ Errors ============
error InvalidCalculator();
// ============ Constructor ============
/**
* @notice Initialize with SharePriceCalculator
* @param _calculator Address of the SharePriceCalculator contract
*/
constructor(address _calculator) {
if (_calculator == address(0)) revert InvalidCalculator();
calculator = ISharePriceCalculator(_calculator);
}
// ============ IPriceOracle Implementation ============
/**
* @notice Get the latest share price
* @return PriceInfo with current share price and VALID status
* @dev Always returns VALID status as share price is admin-controlled
*/
function latestPriceInfo() external view override returns (PriceInfo memory) {
uint256 price = calculator.getSharePrice();
return PriceInfo(price, PriceStatus.VALID);
}
/**
* @notice Get decimals for the price
* @return Always 18 as share price is in WAD format
*/
function decimals() external pure override returns (uint8) {
return 18;
}
}
"
},
"smart-contracts-public/src/pricing/IPriceOracle.sol": {
"content": "pragma solidity 0.8.30;
/**
* @title IPriceOracle
* @notice Standardized price oracle interface returning WAD‑scaled prices with a status code.
* @dev Prices MUST be scaled to 1e18 (WAD). Implementations can surface status information such as
* validity, staleness, capping, or circuit breaker activation.
*/
interface IPriceOracle {
enum PriceStatus {
VALID,
CAPPED,
INVALID,
STALE,
VOLATILE,
CIRCUIT_BREAKER
}
struct PriceInfo {
uint256 price;
PriceStatus status;
}
/**
* @notice Retrieves the latest price information for the configured token
* @return PriceInfo Struct containing the price and its status
*/
function latestPriceInfo() external view returns (PriceInfo memory);
/**
* @notice Retrieves the number of decimals for the token's price feed
* @return uint8 Number of decimals
*/
function decimals() external view returns (uint8);
}
"
},
"smart-contracts-public/src/pricing/ISharePriceCalculator.sol": {
"content": "// SPDX-License-Identifier: ISC
pragma solidity 0.8.30;
interface ISharePriceCalculator {
event SharePriceSet(uint256 oldPrice, uint256 newPrice);
function setSharePrice(uint256 newPrice) external;
function convertToShares(address token, uint256 amount) external view returns (uint256);
function convertFromShares(address token, uint256 shares) external view returns (uint256);
function getSharePrice() external view returns (uint256);
}
"
}
},
"settings": {
"remappings": [
"@chainlink/=smart-contracts-public/lib/chainlink/",
"@openzeppelin/contracts/=smart-contracts-public/lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=smart-contracts-public/lib/openzeppelin-contracts-upgradeable/contracts/",
"forge-std/=smart-contracts-public/lib/forge-std/src/",
"openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
"chainlink/=smart-contracts-public/lib/chainlink/",
"erc4626-tests/=smart-contracts-public/lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=smart-contracts-public/lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=smart-contracts-public/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=smart-contracts-public/lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 500
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true
}
}}
Submitted on: 2025-10-01 12:32:36
Comments
Log in to comment.
No comments yet.