Verified contractExactSEE
PendleLpLinearDiscountOracleFactory
Address0x44fb16d078e9c39b65d6c15e78ede9736a9f2df5
- Balance
0 ETH
- Transactions
3
- Compiler
solc 0.8.30
- Same code
Only this contract
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 1,000,000 runs
- EVM version
- shanghai
- Via IR
- yes
- License
- SEE
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 23,215,574
- Creation transaction
- 0xd6351e54b6…d56f18ba85
lib/pendle-core-v2/contracts/oracles/internal/PendleLpLinearDiscountOracleFactory.sol
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.8.19;
import {PendleLpLinearDiscountOracle} from "./PendleLpLinearDiscountOracle.sol";
contract PendleLpLinearDiscountOracleFactory {
event OracleCreated(address indexed market, uint256 basePtDiscountPerYear, uint256 lpBasePrice, address oracle);
/**
* @notice Creates a new LP linear discount oracle
* @param market The Pendle Market address (LP token)
* @param basePtDiscountPerYear Annual discount rate for PT (max: 1e18 = 100%)
* @param lpBasePrice Base price multiplier for LP (min: 1e18 = 1x)
* @return res The address of the deployed oracle contract
*/
function create(address market, uint256 basePtDiscountPerYear, uint256 lpBasePrice) external returns (address res) {
res = address(new PendleLpLinearDiscountOracle(market, basePtDiscountPerYear, lpBasePrice));
emit OracleCreated(market, basePtDiscountPerYear, lpBasePrice, res);
}
}
lib/pendle-core-v2/contracts/oracles/internal/PendleLpLinearDiscountOracle.sol
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.8.19;
/**
* @title PendleLpLinearDiscountOracle
* @notice Oracle for pricing Pendle LP tokens using a linear discount model based on time to maturity
* @dev Implements Chainlink-compatible price feed interface for LP tokens
* The oracle calculates LP price by applying a time-based linear discount to the PT component
*/
contract PendleLpLinearDiscountOracle {
uint256 private constant SECONDS_PER_YEAR = 365 days;
uint256 private constant ONE = 1e18;
/// @notice The LP token address (Pendle Market)
address public immutable LP;
/// @notice The maturity timestamp of the LP token
uint256 public immutable maturity;
/// @notice Annual discount rate for LP tokens (1e18 = 100%)
uint256 public immutable baseLpDiscountPerYear;
/// @notice Base price multiplier for LP tokens (1e18 = 1x)
uint256 public immutable lpMaturedPrice;
constructor(address _lp, uint256 _baseLpDiscountPerYear, uint256 _lpMaturedPrice) {
require(_lpMaturedPrice >= 1e18, "invalid price");
LP = _lp;
maturity = LPExpiry(LP).expiry();
baseLpDiscountPerYear = _baseLpDiscountPerYear;
lpMaturedPrice = _lpMaturedPrice;
}
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
{
uint256 timeLeft = (maturity > block.timestamp) ? maturity - block.timestamp : 0;
uint256 lpPrice = getLpPrice(timeLeft);
return (0, int256(lpPrice), 0, 0, 0);
}
function getLpPrice(uint256 timeLeft) public view returns (uint256) {
uint256 lpDiscount = getLpDiscount(timeLeft);
require(lpDiscount <= ONE, "discount overflow");
uint256 lpPrice = ((ONE - lpDiscount) * lpMaturedPrice) / ONE;
return lpPrice;
}
function getLpDiscount(uint256 timeLeft) public view returns (uint256) {
return (timeLeft * baseLpDiscountPerYear) / SECONDS_PER_YEAR;
}
function decimals() external pure returns (uint8) {
return 18;
}
}
interface LPExpiry {
function expiry() external view returns (uint256);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 1000000,
"enabled": true
},
"evmVersion": "shanghai",
"remappings": [
"lib/pendle-core-v3/:@openzeppelin/contracts/=node_modules/@openzeppelin-v5/contracts/",
"lib/pendle-core-v3/:@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin-v5/contracts-upgradeable/",
"node_modules/@layerzerolabs/test-devtools-evm-foundry/:forge-std/=node_modules/forge-std/src/",
"node_modules/@layerzerolabs/oapp-evm/:@openzeppelin/=node_modules/@openzeppelin/",
"node_modules/@layerzerolabs/oft-evm/:@openzeppelin/=node_modules/@openzeppelin/",
"node_modules/@layerzerolabs/:@openzeppelin/=node_modules/@openzeppelin-v5/",
"@axelar-network/=node_modules/@axelar-network/",
"@chainlink/=node_modules/@chainlink/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/",
"@openzeppelin-v5/contracts/=node_modules/@openzeppelin-v5/contracts/",
"@openzeppelin-v5/contracts-upgradeable/=node_modules/@openzeppelin-v5/contracts-upgradeable/",
"@eth-optimism/=node_modules/@eth-optimism/",
"@prb/test/=node_modules/@prb/test/",
"forge-std/=node_modules/forge-std/",
"@pendle/core-v2/=lib/pendle-core-v2/",
"@pendle/core-v3/=lib/pendle-core-v3/",
"@pendle/sy/=lib/pendle-sy/",
"pendle-sy/=lib/pendle-sy/contracts/",
"hardhat-deploy/=node_modules/hardhat-deploy/",
"ds-test/=lib/surl/lib/forge-std/lib/ds-test/src/",
"solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
"solidity-stringutils/=lib/surl/lib/solidity-stringutils/src/",
"surl/=lib/surl/src/",
"@layerzerolabs/=node_modules/@layerzerolabs/",
"pendle-core-v2/=lib/pendle-core-v2/contracts/",
"pendle-core-v3/=lib/pendle-core-v3/contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.