@pendle/core-v2 5.1.1 → 5.2.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +23 -67
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.json +6 -19
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithoutPermitUpg.sol/SYBaseUpg.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithoutPermitUpg.sol/{SYBaseWithoutPermitUpg.json → SYBaseUpg.json} +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.json +2 -2
- package/build/artifacts/contracts/interfaces/IPChainlinkOracle.sol/IPChainlinkOracle.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPChainlinkOracle.sol/IPChainlinkOracle.json +122 -0
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleFactory.sol/IPChainlinkOracleFactory.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleFactory.sol/IPChainlinkOracleFactory.json +91 -0
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleWithQuote.sol/IPChainlinkOracleWithQuote.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleWithQuote.sol/IPChainlinkOracleWithQuote.json +262 -0
- package/build/artifacts/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol/SDKErrorsDirectory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol/SDKErrorsDirectory.json +2 -27
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracle.sol/PendleChainlinkOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracle.sol/PendleChainlinkOracle.json +274 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleBase.sol/PendleChainlinkOracleBase.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleBase.sol/PendleChainlinkOracleBase.json +253 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.json +289 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.json +305 -0
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +6 -27
- package/contracts/LiquidityMining/VotingController/VotingControllerStorageUpg.sol +2 -3
- package/contracts/core/StandardizedYield/SYBaseWithoutPermitUpg.sol +1 -1
- package/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol +2 -1
- package/contracts/interfaces/IPChainlinkOracle.sol +15 -0
- package/contracts/interfaces/IPChainlinkOracleFactory.sol +22 -0
- package/contracts/interfaces/IPChainlinkOracleWithQuote.sol +8 -0
- package/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol +0 -5
- package/contracts/oracles/factory/PendleChainlinkOracle.sol +21 -0
- package/contracts/oracles/factory/PendleChainlinkOracleBase.sol +138 -0
- package/contracts/oracles/factory/PendleChainlinkOracleFactory.sol +99 -0
- package/contracts/oracles/factory/PendleChainlinkOracleWithQuote.sol +46 -0
- package/package.json +1 -1
- package/typechain-types/IPChainlinkOracle.ts +221 -0
- package/typechain-types/IPChainlinkOracleFactory.ts +123 -0
- package/typechain-types/IPChainlinkOracleWithQuote.ts +404 -0
- package/typechain-types/PendleChainlinkOracle.ts +299 -0
- package/typechain-types/PendleChainlinkOracleBase.ts +299 -0
- package/typechain-types/PendleChainlinkOracleFactory.ts +389 -0
- package/typechain-types/PendleChainlinkOracleWithQuote.ts +335 -0
- package/typechain-types/PendleVotingControllerUpg.ts +43 -135
- package/typechain-types/VotingControllerStorageUpg.ts +15 -34
- package/typechain-types/factories/IPChainlinkOracleFactory__factory.ts +110 -0
- package/typechain-types/factories/IPChainlinkOracleWithQuote__factory.ts +281 -0
- package/typechain-types/factories/IPChainlinkOracle__factory.ts +137 -0
- package/typechain-types/factories/PendleChainlinkOracleBase__factory.ts +272 -0
- package/typechain-types/factories/PendleChainlinkOracleFactory__factory.ts +351 -0
- package/typechain-types/factories/PendleChainlinkOracleWithQuote__factory.ts +389 -0
- package/typechain-types/factories/PendleChainlinkOracle__factory.ts +354 -0
- package/typechain-types/factories/PendleGlpSY__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +22 -66
- package/typechain-types/factories/SDKErrorsDirectory__factory.ts +1 -26
- package/typechain-types/factories/VotingControllerStorageUpg__factory.ts +6 -19
- package/typechain-types/hardhat.d.ts +72 -0
- package/typechain-types/index.ts +14 -0
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithoutPermitUpg.sol/SYBaseWithoutPermitUpg.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/AaveV3/PendleStkGHOSY.sol/PendleStkGHOSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/AaveV3/PendleStkGHOSY.sol/PendleStkGHOSY.json +0 -1160
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Mantle/PendleCMETHSY.sol/PendleCMETHSY.dbg.json +0 -4
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Mantle/PendleCMETHSY.sol/PendleCMETHSY.json +0 -1049
- package/build/artifacts/contracts/interfaces/AaveV3/IAaveStkGHO.sol/IAaveStkGHO.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/AaveV3/IAaveStkGHO.sol/IAaveStkGHO.json +0 -116
- package/build/artifacts/contracts/interfaces/Angle/IAngleDistributor.sol/IAngleDistributor.dbg.json +0 -4
- package/build/artifacts/contracts/interfaces/Angle/IAngleDistributor.sol/IAngleDistributor.json +0 -39
- package/contracts/core/StandardizedYield/implementations/AaveV3/PendleStkGHOSY.sol +0 -130
- package/contracts/core/StandardizedYield/implementations/Mantle/PendleCMETHSY.sol +0 -82
- package/contracts/interfaces/AaveV3/IAaveStkGHO.sol +0 -17
- package/contracts/interfaces/Angle/IAngleDistributor.sol +0 -12
- package/deployments/1-markets/STKGHO-MAINNET-APR2025.json +0 -14
- package/deployments/42161-markets/DOLOMITE-USDC-ARBITRUM-JUN2025.json +0 -14
- package/deployments/42161-markets/DOLOMITE-WBTC-ARBITRUM-JUN2025.json +0 -14
- package/deployments/5000-markets/CMETH-MANTLE-FEB2025.json +0 -14
- package/deployments/56-markets/VENUS-BNB-BSC-JUN2025.json +0 -14
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../../interfaces/IPChainlinkOracle.sol";
|
|
5
|
+
import "../PendleLpOracleLib.sol";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @dev The round data returned from this contract will follow:
|
|
9
|
+
* - There will be only one round (roundId=0)
|
|
10
|
+
* - startedAt=0, updatedAt=block.timestamp
|
|
11
|
+
*/
|
|
12
|
+
abstract contract PendleChainlinkOracleBase is IPChainlinkOracle {
|
|
13
|
+
using PendlePYOracleLib for IPMarket;
|
|
14
|
+
using PendleLpOracleLib for IPMarket;
|
|
15
|
+
|
|
16
|
+
error InvalidRoundId();
|
|
17
|
+
|
|
18
|
+
uint8 internal constant LP_DECIMALS = 18;
|
|
19
|
+
|
|
20
|
+
// solhint-disable immutable-vars-naming
|
|
21
|
+
address public immutable factory;
|
|
22
|
+
address public immutable market;
|
|
23
|
+
uint16 public immutable twapDuration;
|
|
24
|
+
|
|
25
|
+
uint8 public immutable fromTokenDecimals;
|
|
26
|
+
uint8 public immutable toTokenDecimals;
|
|
27
|
+
|
|
28
|
+
PendleOracleType public immutable baseOracleType;
|
|
29
|
+
|
|
30
|
+
function(IPMarket, uint32) internal view returns (uint256) internal immutable getRate;
|
|
31
|
+
|
|
32
|
+
modifier validateRoundId(uint80 roundId) {
|
|
33
|
+
if (roundId != 0) {
|
|
34
|
+
revert InvalidRoundId();
|
|
35
|
+
}
|
|
36
|
+
_;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
constructor(address _market, uint16 _twapDuration, PendleOracleType _baseOracleType) {
|
|
40
|
+
factory = msg.sender;
|
|
41
|
+
market = _market;
|
|
42
|
+
twapDuration = _twapDuration;
|
|
43
|
+
baseOracleType = _baseOracleType;
|
|
44
|
+
(fromTokenDecimals, toTokenDecimals) = _readDecimals(_market, _baseOracleType);
|
|
45
|
+
getRate = getMethod();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// =================================================================
|
|
49
|
+
// CHAINLINK INTERFACE
|
|
50
|
+
// =================================================================
|
|
51
|
+
|
|
52
|
+
function latestRoundData()
|
|
53
|
+
public
|
|
54
|
+
view
|
|
55
|
+
virtual
|
|
56
|
+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
|
|
57
|
+
{
|
|
58
|
+
roundId = 0;
|
|
59
|
+
answer = _getFinalPrice();
|
|
60
|
+
startedAt = 0;
|
|
61
|
+
updatedAt = block.timestamp;
|
|
62
|
+
answeredInRound = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getRoundData(
|
|
66
|
+
uint80 roundId
|
|
67
|
+
) external view validateRoundId(roundId) returns (uint80, int256, uint256, uint256, uint80) {
|
|
68
|
+
return latestRoundData();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function decimals() external pure returns (uint8) {
|
|
72
|
+
return 18;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function description() external pure returns (string memory) {
|
|
76
|
+
return "Pendle Chainlink-compatible Oracle";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function version() external pure returns (uint256) {
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// =================================================================
|
|
84
|
+
// PRICING FUNCTIONS
|
|
85
|
+
// =================================================================
|
|
86
|
+
|
|
87
|
+
function _getFinalPrice() internal view virtual returns (int256);
|
|
88
|
+
|
|
89
|
+
function _getPendleTokenPrice() internal view returns (int256) {
|
|
90
|
+
return _descalePrice(getRate(IPMarket(market), twapDuration));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function _descalePrice(uint256 price) internal view returns (int256 unwrappedPrice) {
|
|
94
|
+
unwrappedPrice = PMath.Int((price * (10 ** fromTokenDecimals)) / (10 ** toTokenDecimals));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// =================================================================
|
|
98
|
+
// USE ONLY AT INITIALIZATION
|
|
99
|
+
// =================================================================
|
|
100
|
+
|
|
101
|
+
function getMethod() internal view returns (function(IPMarket, uint32) internal view returns (uint256)) {
|
|
102
|
+
if (baseOracleType == PendleOracleType.PT_TO_SY) {
|
|
103
|
+
return PendlePYOracleLib.getPtToSyRate;
|
|
104
|
+
} else if (baseOracleType == PendleOracleType.PT_TO_ASSET) {
|
|
105
|
+
return PendlePYOracleLib.getPtToAssetRate;
|
|
106
|
+
} else if (baseOracleType == PendleOracleType.YT_TO_SY) {
|
|
107
|
+
return PendlePYOracleLib.getYtToSyRate;
|
|
108
|
+
} else if (baseOracleType == PendleOracleType.YT_TO_ASSET) {
|
|
109
|
+
return PendlePYOracleLib.getYtToAssetRate;
|
|
110
|
+
} else if (baseOracleType == PendleOracleType.LP_TO_SY) {
|
|
111
|
+
return PendleLpOracleLib.getLpToSyRate;
|
|
112
|
+
} else if (baseOracleType == PendleOracleType.LP_TO_ASSET) {
|
|
113
|
+
return PendleLpOracleLib.getLpToAssetRate;
|
|
114
|
+
} else {
|
|
115
|
+
revert("not supported");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function _readDecimals(
|
|
120
|
+
address _market,
|
|
121
|
+
PendleOracleType _oracleType
|
|
122
|
+
) internal view returns (uint8 _fromDecimals, uint8 _toDecimals) {
|
|
123
|
+
(IStandardizedYield SY, , ) = IPMarket(_market).readTokens();
|
|
124
|
+
|
|
125
|
+
uint8 syDecimals = SY.decimals();
|
|
126
|
+
(, , uint8 assetDecimals) = SY.assetInfo();
|
|
127
|
+
|
|
128
|
+
if (_oracleType == PendleOracleType.LP_TO_ASSET) {
|
|
129
|
+
return (LP_DECIMALS, assetDecimals);
|
|
130
|
+
} else if (_oracleType == PendleOracleType.LP_TO_SY) {
|
|
131
|
+
return (LP_DECIMALS, syDecimals);
|
|
132
|
+
} else if (_oracleType == PendleOracleType.PT_TO_ASSET || _oracleType == PendleOracleType.YT_TO_ASSET) {
|
|
133
|
+
return (assetDecimals, assetDecimals);
|
|
134
|
+
} else if (_oracleType == PendleOracleType.PT_TO_SY || _oracleType == PendleOracleType.YT_TO_SY) {
|
|
135
|
+
return (assetDecimals, syDecimals);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./PendleChainlinkOracle.sol";
|
|
5
|
+
import "./PendleChainlinkOracleWithQuote.sol";
|
|
6
|
+
import "../../interfaces/IPChainlinkOracleFactory.sol";
|
|
7
|
+
import "../../interfaces/IPPYLpOracle.sol";
|
|
8
|
+
|
|
9
|
+
contract PendleChainlinkOracleFactory is IPChainlinkOracleFactory {
|
|
10
|
+
error OracleAlreadyExists();
|
|
11
|
+
error OracleNotReady();
|
|
12
|
+
|
|
13
|
+
// [keccak256(market, duration, baseOracleType)]
|
|
14
|
+
mapping(bytes32 oracleId => address oracleAddr) public oracles;
|
|
15
|
+
|
|
16
|
+
// [keccak256(market, duration, baseOracleType, quoteOracle)]
|
|
17
|
+
mapping(bytes32 oracleId => address oracleAddr) public oraclesWithQuote;
|
|
18
|
+
|
|
19
|
+
address public immutable pyLpOracle;
|
|
20
|
+
|
|
21
|
+
constructor(address _pyLpOracle) {
|
|
22
|
+
pyLpOracle = _pyLpOracle;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function createOracle(
|
|
26
|
+
address market,
|
|
27
|
+
uint16 twapDuration,
|
|
28
|
+
PendleOracleType baseOracleType
|
|
29
|
+
) external returns (address oracle) {
|
|
30
|
+
bytes32 oracleId = _getOracleId(market, twapDuration, baseOracleType);
|
|
31
|
+
if (oracles[oracleId] != address(0)) revert OracleAlreadyExists();
|
|
32
|
+
|
|
33
|
+
_checkOracleState(market, twapDuration);
|
|
34
|
+
|
|
35
|
+
oracle = address(new PendleChainlinkOracle(market, twapDuration, baseOracleType));
|
|
36
|
+
oracles[oracleId] = oracle;
|
|
37
|
+
emit OracleCreated(market, twapDuration, baseOracleType, oracle, oracleId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createOracleWithQuote(
|
|
41
|
+
address market,
|
|
42
|
+
uint16 twapDuration,
|
|
43
|
+
PendleOracleType baseOracleType,
|
|
44
|
+
address quoteOracle
|
|
45
|
+
) external returns (address oracle) {
|
|
46
|
+
bytes32 oracleId = _getOracleWithQuoteId(market, twapDuration, baseOracleType, quoteOracle);
|
|
47
|
+
if (oraclesWithQuote[oracleId] != address(0)) revert OracleAlreadyExists();
|
|
48
|
+
|
|
49
|
+
_checkOracleState(market, twapDuration);
|
|
50
|
+
|
|
51
|
+
oracle = address(new PendleChainlinkOracleWithQuote(market, twapDuration, baseOracleType, quoteOracle));
|
|
52
|
+
oraclesWithQuote[oracleId] = oracle;
|
|
53
|
+
emit OracleWithQuoteCreated(market, twapDuration, baseOracleType, quoteOracle, oracle, oracleId);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getOracle(
|
|
57
|
+
address market,
|
|
58
|
+
uint16 twapDuration,
|
|
59
|
+
PendleOracleType baseOracleType
|
|
60
|
+
) public view returns (address) {
|
|
61
|
+
return oracles[_getOracleId(market, twapDuration, baseOracleType)];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getOracleWithQuote(
|
|
65
|
+
address market,
|
|
66
|
+
uint16 twapDuration,
|
|
67
|
+
PendleOracleType baseOracleType,
|
|
68
|
+
address quoteOracle
|
|
69
|
+
) public view returns (address) {
|
|
70
|
+
return oraclesWithQuote[_getOracleWithQuoteId(market, twapDuration, baseOracleType, quoteOracle)];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function _getOracleId(
|
|
74
|
+
address market,
|
|
75
|
+
uint16 twapDuration,
|
|
76
|
+
PendleOracleType baseOracleType
|
|
77
|
+
) internal pure returns (bytes32) {
|
|
78
|
+
return keccak256(abi.encode(market, twapDuration, baseOracleType));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _getOracleWithQuoteId(
|
|
82
|
+
address market,
|
|
83
|
+
uint16 twapDuration,
|
|
84
|
+
PendleOracleType baseOracleType,
|
|
85
|
+
address quoteOracle
|
|
86
|
+
) internal pure returns (bytes32) {
|
|
87
|
+
return keccak256(abi.encode(market, twapDuration, baseOracleType, quoteOracle));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function _checkOracleState(address market, uint16 twapDuration) internal view {
|
|
91
|
+
(bool increaseCardinalityRequired, , bool oldestObservationSatisfied) = IPPYLpOracle(pyLpOracle).getOracleState(
|
|
92
|
+
market,
|
|
93
|
+
twapDuration
|
|
94
|
+
);
|
|
95
|
+
if (increaseCardinalityRequired || !oldestObservationSatisfied) {
|
|
96
|
+
revert OracleNotReady();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import "./PendleChainlinkOracleBase.sol";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @dev The round data returned from this contract will follow:
|
|
8
|
+
* - There will be only one round (roundId=0)
|
|
9
|
+
* - startedAt=0, updatedAt=quoteOracle.updatedAt()
|
|
10
|
+
*/
|
|
11
|
+
contract PendleChainlinkOracleWithQuote is PendleChainlinkOracleBase {
|
|
12
|
+
// solhint-disable immutable-vars-naming
|
|
13
|
+
address public immutable quoteOracle;
|
|
14
|
+
int256 public immutable quoteScale;
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
address _market,
|
|
18
|
+
uint16 _twapDuration,
|
|
19
|
+
PendleOracleType _baseOracleType,
|
|
20
|
+
address _quoteOracle
|
|
21
|
+
) PendleChainlinkOracleBase(_market, _twapDuration, _baseOracleType) {
|
|
22
|
+
quoteOracle = _quoteOracle;
|
|
23
|
+
quoteScale = PMath.Int(10 ** AggregatorV3Interface(quoteOracle).decimals());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function _getFinalPrice() internal view virtual override returns (int256) {
|
|
27
|
+
(, int256 quoteAnswer, , , ) = AggregatorV3Interface(quoteOracle).latestRoundData();
|
|
28
|
+
return (_getPendleTokenPrice() * quoteAnswer) / quoteScale;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function latestRoundData()
|
|
32
|
+
public
|
|
33
|
+
view
|
|
34
|
+
virtual
|
|
35
|
+
override
|
|
36
|
+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
|
|
37
|
+
{
|
|
38
|
+
(, int256 quoteAnswer, , uint256 quoteUpdatedAt, ) = AggregatorV3Interface(quoteOracle).latestRoundData();
|
|
39
|
+
|
|
40
|
+
roundId = 0;
|
|
41
|
+
answer = (_getPendleTokenPrice() * quoteAnswer) / quoteScale;
|
|
42
|
+
startedAt = 0;
|
|
43
|
+
updatedAt = quoteUpdatedAt;
|
|
44
|
+
answeredInRound = 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import {
|
|
5
|
+
BaseContract,
|
|
6
|
+
BigNumber,
|
|
7
|
+
BigNumberish,
|
|
8
|
+
BytesLike,
|
|
9
|
+
CallOverrides,
|
|
10
|
+
PopulatedTransaction,
|
|
11
|
+
Signer,
|
|
12
|
+
utils,
|
|
13
|
+
} from "ethers";
|
|
14
|
+
import { FunctionFragment, Result } from "@ethersproject/abi";
|
|
15
|
+
import { Listener, Provider } from "@ethersproject/providers";
|
|
16
|
+
import type {
|
|
17
|
+
TypedEventFilter,
|
|
18
|
+
TypedEvent,
|
|
19
|
+
TypedListener,
|
|
20
|
+
OnEvent,
|
|
21
|
+
} from "./common";
|
|
22
|
+
|
|
23
|
+
export interface IPChainlinkOracleInterface extends utils.Interface {
|
|
24
|
+
contractName: "IPChainlinkOracle";
|
|
25
|
+
functions: {
|
|
26
|
+
"decimals()": FunctionFragment;
|
|
27
|
+
"description()": FunctionFragment;
|
|
28
|
+
"getRoundData(uint80)": FunctionFragment;
|
|
29
|
+
"latestRoundData()": FunctionFragment;
|
|
30
|
+
"version()": FunctionFragment;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
encodeFunctionData(functionFragment: "decimals", values?: undefined): string;
|
|
34
|
+
encodeFunctionData(
|
|
35
|
+
functionFragment: "description",
|
|
36
|
+
values?: undefined
|
|
37
|
+
): string;
|
|
38
|
+
encodeFunctionData(
|
|
39
|
+
functionFragment: "getRoundData",
|
|
40
|
+
values: [BigNumberish]
|
|
41
|
+
): string;
|
|
42
|
+
encodeFunctionData(
|
|
43
|
+
functionFragment: "latestRoundData",
|
|
44
|
+
values?: undefined
|
|
45
|
+
): string;
|
|
46
|
+
encodeFunctionData(functionFragment: "version", values?: undefined): string;
|
|
47
|
+
|
|
48
|
+
decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result;
|
|
49
|
+
decodeFunctionResult(
|
|
50
|
+
functionFragment: "description",
|
|
51
|
+
data: BytesLike
|
|
52
|
+
): Result;
|
|
53
|
+
decodeFunctionResult(
|
|
54
|
+
functionFragment: "getRoundData",
|
|
55
|
+
data: BytesLike
|
|
56
|
+
): Result;
|
|
57
|
+
decodeFunctionResult(
|
|
58
|
+
functionFragment: "latestRoundData",
|
|
59
|
+
data: BytesLike
|
|
60
|
+
): Result;
|
|
61
|
+
decodeFunctionResult(functionFragment: "version", data: BytesLike): Result;
|
|
62
|
+
|
|
63
|
+
events: {};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface IPChainlinkOracle extends BaseContract {
|
|
67
|
+
contractName: "IPChainlinkOracle";
|
|
68
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
69
|
+
attach(addressOrName: string): this;
|
|
70
|
+
deployed(): Promise<this>;
|
|
71
|
+
|
|
72
|
+
interface: IPChainlinkOracleInterface;
|
|
73
|
+
|
|
74
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
75
|
+
event: TypedEventFilter<TEvent>,
|
|
76
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
77
|
+
toBlock?: string | number | undefined
|
|
78
|
+
): Promise<Array<TEvent>>;
|
|
79
|
+
|
|
80
|
+
listeners<TEvent extends TypedEvent>(
|
|
81
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
82
|
+
): Array<TypedListener<TEvent>>;
|
|
83
|
+
listeners(eventName?: string): Array<Listener>;
|
|
84
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
85
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
86
|
+
): this;
|
|
87
|
+
removeAllListeners(eventName?: string): this;
|
|
88
|
+
off: OnEvent<this>;
|
|
89
|
+
on: OnEvent<this>;
|
|
90
|
+
once: OnEvent<this>;
|
|
91
|
+
removeListener: OnEvent<this>;
|
|
92
|
+
|
|
93
|
+
functions: {
|
|
94
|
+
decimals(overrides?: CallOverrides): Promise<[number]>;
|
|
95
|
+
|
|
96
|
+
description(overrides?: CallOverrides): Promise<[string]>;
|
|
97
|
+
|
|
98
|
+
getRoundData(
|
|
99
|
+
_roundId: BigNumberish,
|
|
100
|
+
overrides?: CallOverrides
|
|
101
|
+
): Promise<
|
|
102
|
+
[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
|
|
103
|
+
roundId: BigNumber;
|
|
104
|
+
answer: BigNumber;
|
|
105
|
+
startedAt: BigNumber;
|
|
106
|
+
updatedAt: BigNumber;
|
|
107
|
+
answeredInRound: BigNumber;
|
|
108
|
+
}
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
latestRoundData(
|
|
112
|
+
overrides?: CallOverrides
|
|
113
|
+
): Promise<
|
|
114
|
+
[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
|
|
115
|
+
roundId: BigNumber;
|
|
116
|
+
answer: BigNumber;
|
|
117
|
+
startedAt: BigNumber;
|
|
118
|
+
updatedAt: BigNumber;
|
|
119
|
+
answeredInRound: BigNumber;
|
|
120
|
+
}
|
|
121
|
+
>;
|
|
122
|
+
|
|
123
|
+
version(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
decimals(overrides?: CallOverrides): Promise<number>;
|
|
127
|
+
|
|
128
|
+
description(overrides?: CallOverrides): Promise<string>;
|
|
129
|
+
|
|
130
|
+
getRoundData(
|
|
131
|
+
_roundId: BigNumberish,
|
|
132
|
+
overrides?: CallOverrides
|
|
133
|
+
): Promise<
|
|
134
|
+
[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
|
|
135
|
+
roundId: BigNumber;
|
|
136
|
+
answer: BigNumber;
|
|
137
|
+
startedAt: BigNumber;
|
|
138
|
+
updatedAt: BigNumber;
|
|
139
|
+
answeredInRound: BigNumber;
|
|
140
|
+
}
|
|
141
|
+
>;
|
|
142
|
+
|
|
143
|
+
latestRoundData(
|
|
144
|
+
overrides?: CallOverrides
|
|
145
|
+
): Promise<
|
|
146
|
+
[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
|
|
147
|
+
roundId: BigNumber;
|
|
148
|
+
answer: BigNumber;
|
|
149
|
+
startedAt: BigNumber;
|
|
150
|
+
updatedAt: BigNumber;
|
|
151
|
+
answeredInRound: BigNumber;
|
|
152
|
+
}
|
|
153
|
+
>;
|
|
154
|
+
|
|
155
|
+
version(overrides?: CallOverrides): Promise<BigNumber>;
|
|
156
|
+
|
|
157
|
+
callStatic: {
|
|
158
|
+
decimals(overrides?: CallOverrides): Promise<number>;
|
|
159
|
+
|
|
160
|
+
description(overrides?: CallOverrides): Promise<string>;
|
|
161
|
+
|
|
162
|
+
getRoundData(
|
|
163
|
+
_roundId: BigNumberish,
|
|
164
|
+
overrides?: CallOverrides
|
|
165
|
+
): Promise<
|
|
166
|
+
[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
|
|
167
|
+
roundId: BigNumber;
|
|
168
|
+
answer: BigNumber;
|
|
169
|
+
startedAt: BigNumber;
|
|
170
|
+
updatedAt: BigNumber;
|
|
171
|
+
answeredInRound: BigNumber;
|
|
172
|
+
}
|
|
173
|
+
>;
|
|
174
|
+
|
|
175
|
+
latestRoundData(
|
|
176
|
+
overrides?: CallOverrides
|
|
177
|
+
): Promise<
|
|
178
|
+
[BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
|
|
179
|
+
roundId: BigNumber;
|
|
180
|
+
answer: BigNumber;
|
|
181
|
+
startedAt: BigNumber;
|
|
182
|
+
updatedAt: BigNumber;
|
|
183
|
+
answeredInRound: BigNumber;
|
|
184
|
+
}
|
|
185
|
+
>;
|
|
186
|
+
|
|
187
|
+
version(overrides?: CallOverrides): Promise<BigNumber>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
filters: {};
|
|
191
|
+
|
|
192
|
+
estimateGas: {
|
|
193
|
+
decimals(overrides?: CallOverrides): Promise<BigNumber>;
|
|
194
|
+
|
|
195
|
+
description(overrides?: CallOverrides): Promise<BigNumber>;
|
|
196
|
+
|
|
197
|
+
getRoundData(
|
|
198
|
+
_roundId: BigNumberish,
|
|
199
|
+
overrides?: CallOverrides
|
|
200
|
+
): Promise<BigNumber>;
|
|
201
|
+
|
|
202
|
+
latestRoundData(overrides?: CallOverrides): Promise<BigNumber>;
|
|
203
|
+
|
|
204
|
+
version(overrides?: CallOverrides): Promise<BigNumber>;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
populateTransaction: {
|
|
208
|
+
decimals(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
209
|
+
|
|
210
|
+
description(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
211
|
+
|
|
212
|
+
getRoundData(
|
|
213
|
+
_roundId: BigNumberish,
|
|
214
|
+
overrides?: CallOverrides
|
|
215
|
+
): Promise<PopulatedTransaction>;
|
|
216
|
+
|
|
217
|
+
latestRoundData(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
218
|
+
|
|
219
|
+
version(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import { BaseContract, Signer, utils } from "ethers";
|
|
5
|
+
import { EventFragment } from "@ethersproject/abi";
|
|
6
|
+
import { Listener, Provider } from "@ethersproject/providers";
|
|
7
|
+
import type {
|
|
8
|
+
TypedEventFilter,
|
|
9
|
+
TypedEvent,
|
|
10
|
+
TypedListener,
|
|
11
|
+
OnEvent,
|
|
12
|
+
} from "./common";
|
|
13
|
+
|
|
14
|
+
export interface IPChainlinkOracleFactoryInterface extends utils.Interface {
|
|
15
|
+
contractName: "IPChainlinkOracleFactory";
|
|
16
|
+
functions: {};
|
|
17
|
+
|
|
18
|
+
events: {
|
|
19
|
+
"OracleCreated(address,uint16,uint8,address,bytes32)": EventFragment;
|
|
20
|
+
"OracleWithQuoteCreated(address,uint16,uint8,address,address,bytes32)": EventFragment;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
getEvent(nameOrSignatureOrTopic: "OracleCreated"): EventFragment;
|
|
24
|
+
getEvent(nameOrSignatureOrTopic: "OracleWithQuoteCreated"): EventFragment;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type OracleCreatedEvent = TypedEvent<
|
|
28
|
+
[string, number, number, string, string],
|
|
29
|
+
{
|
|
30
|
+
market: string;
|
|
31
|
+
twapDuration: number;
|
|
32
|
+
baseOracleType: number;
|
|
33
|
+
oracle: string;
|
|
34
|
+
oracleId: string;
|
|
35
|
+
}
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
export type OracleCreatedEventFilter = TypedEventFilter<OracleCreatedEvent>;
|
|
39
|
+
|
|
40
|
+
export type OracleWithQuoteCreatedEvent = TypedEvent<
|
|
41
|
+
[string, number, number, string, string, string],
|
|
42
|
+
{
|
|
43
|
+
market: string;
|
|
44
|
+
twapDuration: number;
|
|
45
|
+
baseOracleType: number;
|
|
46
|
+
quoteOracle: string;
|
|
47
|
+
oracle: string;
|
|
48
|
+
oracleId: string;
|
|
49
|
+
}
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
export type OracleWithQuoteCreatedEventFilter =
|
|
53
|
+
TypedEventFilter<OracleWithQuoteCreatedEvent>;
|
|
54
|
+
|
|
55
|
+
export interface IPChainlinkOracleFactory extends BaseContract {
|
|
56
|
+
contractName: "IPChainlinkOracleFactory";
|
|
57
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
58
|
+
attach(addressOrName: string): this;
|
|
59
|
+
deployed(): Promise<this>;
|
|
60
|
+
|
|
61
|
+
interface: IPChainlinkOracleFactoryInterface;
|
|
62
|
+
|
|
63
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
64
|
+
event: TypedEventFilter<TEvent>,
|
|
65
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
66
|
+
toBlock?: string | number | undefined
|
|
67
|
+
): Promise<Array<TEvent>>;
|
|
68
|
+
|
|
69
|
+
listeners<TEvent extends TypedEvent>(
|
|
70
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
71
|
+
): Array<TypedListener<TEvent>>;
|
|
72
|
+
listeners(eventName?: string): Array<Listener>;
|
|
73
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
74
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
75
|
+
): this;
|
|
76
|
+
removeAllListeners(eventName?: string): this;
|
|
77
|
+
off: OnEvent<this>;
|
|
78
|
+
on: OnEvent<this>;
|
|
79
|
+
once: OnEvent<this>;
|
|
80
|
+
removeListener: OnEvent<this>;
|
|
81
|
+
|
|
82
|
+
functions: {};
|
|
83
|
+
|
|
84
|
+
callStatic: {};
|
|
85
|
+
|
|
86
|
+
filters: {
|
|
87
|
+
"OracleCreated(address,uint16,uint8,address,bytes32)"(
|
|
88
|
+
market?: string | null,
|
|
89
|
+
twapDuration?: null,
|
|
90
|
+
baseOracleType?: null,
|
|
91
|
+
oracle?: string | null,
|
|
92
|
+
oracleId?: null
|
|
93
|
+
): OracleCreatedEventFilter;
|
|
94
|
+
OracleCreated(
|
|
95
|
+
market?: string | null,
|
|
96
|
+
twapDuration?: null,
|
|
97
|
+
baseOracleType?: null,
|
|
98
|
+
oracle?: string | null,
|
|
99
|
+
oracleId?: null
|
|
100
|
+
): OracleCreatedEventFilter;
|
|
101
|
+
|
|
102
|
+
"OracleWithQuoteCreated(address,uint16,uint8,address,address,bytes32)"(
|
|
103
|
+
market?: string | null,
|
|
104
|
+
twapDuration?: null,
|
|
105
|
+
baseOracleType?: null,
|
|
106
|
+
quoteOracle?: string | null,
|
|
107
|
+
oracle?: string | null,
|
|
108
|
+
oracleId?: null
|
|
109
|
+
): OracleWithQuoteCreatedEventFilter;
|
|
110
|
+
OracleWithQuoteCreated(
|
|
111
|
+
market?: string | null,
|
|
112
|
+
twapDuration?: null,
|
|
113
|
+
baseOracleType?: null,
|
|
114
|
+
quoteOracle?: string | null,
|
|
115
|
+
oracle?: string | null,
|
|
116
|
+
oracleId?: null
|
|
117
|
+
): OracleWithQuoteCreatedEventFilter;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
estimateGas: {};
|
|
121
|
+
|
|
122
|
+
populateTransaction: {};
|
|
123
|
+
}
|