@pendle/core-v2 5.2.0-beta-2 → 5.2.0-beta-3
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/interfaces/IPChainlinkOracleFactory.sol/IPChainlinkOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPChainlinkOracleFactory.sol/IPChainlinkOracleFactory.json +14 -8
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendleLpOracleLib.sol → PtYtLpOracle/PendleLpOracleLib.sol}/PendleLpOracleLib.json +3 -3
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol/PendlePYLpOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendlePYLpOracle.sol → PtYtLpOracle/PendlePYLpOracle.sol}/PendlePYLpOracle.json +3 -3
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol/PendlePYOracleLib.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendlePYOracleLib.sol → PtYtLpOracle/PendlePYOracleLib.sol}/PendlePYOracleLib.json +3 -3
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.json +274 -0
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleBase.sol/PendleChainlinkOracleBase.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{factory → PtYtLpOracle/chainlink}/PendleChainlinkOracleBase.sol/PendleChainlinkOracleBase.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.json +316 -0
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.json +336 -0
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringLpGlpOracle.sol/BoringLpGlpOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringLpGlpOracle.sol/BoringLpGlpOracle.json +3 -3
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringLpSeller.sol/BoringLpSeller.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringLpSeller.sol/BoringLpSeller.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.json +3 -3
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.json +3 -3
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPtSeller.sol/BoringPtSeller.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPtSeller.sol/BoringPtSeller.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleBoringOneracle.sol/PendleBoringOneracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendleBoringOneracle.sol → internal/PendleBoringOneracle.sol}/PendleBoringOneracle.json +3 -3
- package/build/artifacts/contracts/oracles/internal/PendleBoringSolvBTCOneracle.sol/PendleBoringSolvBTCOneracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendleBoringSolvBTCOneracle.sol → internal/PendleBoringSolvBTCOneracle.sol}/PendleBoringSolvBTCOneracle.json +3 -3
- package/build/artifacts/contracts/oracles/internal/PendleRedStoneRateOracleAdapter.sol/PendleRedStoneRateOracleAdapter.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendleRedStoneRateOracleAdapter.sol → internal/PendleRedStoneRateOracleAdapter.sol}/PendleRedStoneRateOracleAdapter.json +3 -3
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PTExpiry.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendleSparkLinearDiscountOracle.sol → internal/PendleSparkLinearDiscountOracle.sol}/PTExpiry.json +1 -1
- package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PendleSparkLinearDiscountOracle.dbg.json +4 -0
- package/build/artifacts/contracts/oracles/{PendleSparkLinearDiscountOracle.sol → internal/PendleSparkLinearDiscountOracle.sol}/PendleSparkLinearDiscountOracle.json +3 -3
- package/contracts/interfaces/IPChainlinkOracleFactory.sol +8 -7
- package/contracts/oracles/{PendlePYLpOracle.sol → PtYtLpOracle/PendlePYLpOracle.sol} +2 -2
- package/contracts/oracles/{PendlePYOracleLib.sol → PtYtLpOracle/PendlePYOracleLib.sol} +2 -2
- package/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol +40 -0
- package/contracts/oracles/{factory → PtYtLpOracle/chainlink}/PendleChainlinkOracleBase.sol +7 -16
- package/contracts/oracles/{factory → PtYtLpOracle/chainlink}/PendleChainlinkOracleFactory.sol +17 -10
- package/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol +76 -0
- package/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringLpGlpOracle.sol +3 -3
- package/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringLpSeller.sol +1 -1
- package/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPYUsdChainlinkAssetOracle.sol +3 -3
- package/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPYUsdChainlinkSYOracle.sol +3 -3
- package/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPtSeller.sol +1 -1
- package/contracts/oracles/{PendleBoringOneracle.sol → internal/PendleBoringOneracle.sol} +2 -2
- package/contracts/oracles/{PendleBoringSolvBTCOneracle.sol → internal/PendleBoringSolvBTCOneracle.sol} +2 -2
- package/contracts/oracles/{PendleRedStoneRateOracleAdapter.sol → internal/PendleRedStoneRateOracleAdapter.sol} +3 -3
- package/package.json +1 -1
- package/typechain-types/IPChainlinkOracleFactory.ts +22 -19
- package/typechain-types/PendleChainlinkOracleFactory.ts +45 -32
- package/typechain-types/PendleChainlinkOracleWithQuote.ts +57 -16
- package/typechain-types/factories/BoringLpGlpOracle__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkAssetOracle__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkSYOracle__factory.ts +1 -1
- package/typechain-types/factories/IPChainlinkOracleFactory__factory.ts +14 -8
- package/typechain-types/factories/PendleBoringOneracle__factory.ts +1 -1
- package/typechain-types/factories/PendleBoringSolvBTCOneracle__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkOracleFactory__factory.ts +27 -11
- package/typechain-types/factories/PendleChainlinkOracleWithQuote__factory.ts +43 -8
- package/typechain-types/factories/PendleChainlinkOracle__factory.ts +1 -1
- package/typechain-types/factories/PendlePYLpOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleRedStoneRateOracleAdapter__factory.ts +1 -1
- package/typechain-types/factories/PendleSparkLinearDiscountOracle__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +117 -0
- package/typechain-types/index.ts +2 -2
- package/build/artifacts/contracts/oracles/PendleBoringOneracle.sol/PendleBoringOneracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendleBoringSolvBTCOneracle.sol/PendleBoringSolvBTCOneracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendlePYLpOracle.sol/PendlePYLpOracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendlePYOracleLib.sol/PendlePYOracleLib.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendleRedStoneRateOracleAdapter.sol/PendleRedStoneRateOracleAdapter.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendleSparkLinearDiscountOracle.sol/PTExpiry.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/PendleSparkLinearDiscountOracle.sol/PendleSparkLinearDiscountOracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracle.sol/PendleChainlinkOracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracle.sol/PendleChainlinkOracle.json +0 -274
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleBase.sol/PendleChainlinkOracleBase.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.json +0 -300
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/factory/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.json +0 -305
- package/build/artifacts/contracts/oracles/samples/BoringLpGlpOracle.sol/BoringLpGlpOracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/samples/BoringLpSeller.sol/BoringLpSeller.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.dbg.json +0 -4
- package/build/artifacts/contracts/oracles/samples/BoringPtSeller.sol/BoringPtSeller.dbg.json +0 -4
- package/contracts/oracles/factory/PendleChainlinkOracle.sol +0 -21
- package/contracts/oracles/factory/PendleChainlinkOracleWithQuote.sol +0 -46
- /package/contracts/oracles/{PendleLpOracleLib.sol → PtYtLpOracle/PendleLpOracleLib.sol} +0 -0
- /package/contracts/oracles/{PendleSparkLinearDiscountOracle.sol → internal/PendleSparkLinearDiscountOracle.sol} +0 -0
package/contracts/oracles/{factory → PtYtLpOracle/chainlink}/PendleChainlinkOracleFactory.sol
RENAMED
|
@@ -3,8 +3,8 @@ pragma solidity ^0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "./PendleChainlinkOracle.sol";
|
|
5
5
|
import "./PendleChainlinkOracleWithQuote.sol";
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
6
|
+
import "../../../interfaces/IPChainlinkOracleFactory.sol";
|
|
7
|
+
import "../../../interfaces/IPPYLpOracle.sol";
|
|
8
8
|
|
|
9
9
|
contract PendleChainlinkOracleFactory is IPChainlinkOracleFactory {
|
|
10
10
|
error OracleAlreadyExists();
|
|
@@ -39,20 +39,24 @@ contract PendleChainlinkOracleFactory is IPChainlinkOracleFactory {
|
|
|
39
39
|
emit OracleCreated(market, twapDuration, baseOracleType, oracle, oracleId);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/// @dev quoteOracle must has Chainlink-compatible interface
|
|
42
43
|
function createOracleWithQuote(
|
|
43
44
|
address market,
|
|
44
45
|
uint32 twapDuration,
|
|
45
46
|
PendleOracleType baseOracleType,
|
|
46
|
-
address
|
|
47
|
+
address quoteOracle1,
|
|
48
|
+
address quoteOracle2
|
|
47
49
|
) external returns (address oracle) {
|
|
48
|
-
bytes32 oracleId = _getOracleWithQuoteId(market, twapDuration, baseOracleType,
|
|
50
|
+
bytes32 oracleId = _getOracleWithQuoteId(market, twapDuration, baseOracleType, quoteOracle1, quoteOracle2);
|
|
49
51
|
if (oraclesWithQuote[oracleId] != address(0)) revert OracleAlreadyExists();
|
|
50
52
|
|
|
51
53
|
_checkOracleState(market, twapDuration);
|
|
52
54
|
|
|
53
|
-
oracle = address(
|
|
55
|
+
oracle = address(
|
|
56
|
+
new PendleChainlinkOracleWithQuote(market, twapDuration, baseOracleType, quoteOracle1, quoteOracle2)
|
|
57
|
+
);
|
|
54
58
|
oraclesWithQuote[oracleId] = oracle;
|
|
55
|
-
emit OracleWithQuoteCreated(market, twapDuration, baseOracleType,
|
|
59
|
+
emit OracleWithQuoteCreated(market, twapDuration, baseOracleType, quoteOracle1, quoteOracle2, oracle, oracleId);
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
function getOracle(
|
|
@@ -67,9 +71,11 @@ contract PendleChainlinkOracleFactory is IPChainlinkOracleFactory {
|
|
|
67
71
|
address market,
|
|
68
72
|
uint32 twapDuration,
|
|
69
73
|
PendleOracleType baseOracleType,
|
|
70
|
-
address
|
|
74
|
+
address quoteOracle1,
|
|
75
|
+
address quoteOracle2
|
|
71
76
|
) public view returns (address) {
|
|
72
|
-
return
|
|
77
|
+
return
|
|
78
|
+
oraclesWithQuote[_getOracleWithQuoteId(market, twapDuration, baseOracleType, quoteOracle1, quoteOracle2)];
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
function _getOracleId(
|
|
@@ -84,9 +90,10 @@ contract PendleChainlinkOracleFactory is IPChainlinkOracleFactory {
|
|
|
84
90
|
address market,
|
|
85
91
|
uint32 twapDuration,
|
|
86
92
|
PendleOracleType baseOracleType,
|
|
87
|
-
address
|
|
93
|
+
address quoteOracle1,
|
|
94
|
+
address quoteOracle2
|
|
88
95
|
) internal pure returns (bytes32) {
|
|
89
|
-
return keccak256(abi.encode(market, twapDuration, baseOracleType,
|
|
96
|
+
return keccak256(abi.encode(market, twapDuration, baseOracleType, quoteOracle1, quoteOracle2));
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
function _checkOracleState(address market, uint32 twapDuration) internal view {
|
|
@@ -0,0 +1,76 @@
|
|
|
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 quoteOracle1;
|
|
14
|
+
address public immutable quoteOracle2;
|
|
15
|
+
int256 public immutable quoteScale1;
|
|
16
|
+
int256 public immutable quoteScale2;
|
|
17
|
+
int256 internal immutable quoteScaleProduct;
|
|
18
|
+
|
|
19
|
+
function() internal view returns (int256, uint256) internal immutable getPriceWithQuote;
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
address _market,
|
|
23
|
+
uint32 _twapDuration,
|
|
24
|
+
PendleOracleType _baseOracleType,
|
|
25
|
+
address _quoteOracle1,
|
|
26
|
+
address _quoteOracle2
|
|
27
|
+
) PendleChainlinkOracleBase(_market, _twapDuration, _baseOracleType) {
|
|
28
|
+
quoteOracle1 = _quoteOracle1;
|
|
29
|
+
quoteScale1 = PMath.Int(10 ** AggregatorV3Interface(_quoteOracle1).decimals());
|
|
30
|
+
|
|
31
|
+
quoteOracle2 = _quoteOracle2;
|
|
32
|
+
quoteScale2 = quoteOracle2 == address(0)
|
|
33
|
+
? PMath.Int(1)
|
|
34
|
+
: PMath.Int(10 ** AggregatorV3Interface(_quoteOracle2).decimals());
|
|
35
|
+
|
|
36
|
+
quoteScaleProduct = quoteScale1 * quoteScale2;
|
|
37
|
+
getPriceWithQuote = quoteOracle2 == address(0) ? _getPriceOneQuote : _getPriceTwoQuotes;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @notice The round data returned from this contract will follow:
|
|
42
|
+
* - answer will satisfy 1 natural unit of PendleToken = (answer/1e18) natural unit of quoteToken
|
|
43
|
+
* - In other words, 10**(PendleToken.decimals) = (answer/1e18) * 10**(quoteToken.decimals)
|
|
44
|
+
* @return roundId always 0 for this contract
|
|
45
|
+
* @return answer The answer (in 18 decimals)
|
|
46
|
+
* @return startedAt always 0 for this contract
|
|
47
|
+
* @return updatedAt will be the same as quoteOracle.updatedAt()
|
|
48
|
+
* @return answeredInRound always 0 for this contract
|
|
49
|
+
*/
|
|
50
|
+
function latestRoundData()
|
|
51
|
+
public
|
|
52
|
+
view
|
|
53
|
+
virtual
|
|
54
|
+
override
|
|
55
|
+
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
|
|
56
|
+
{
|
|
57
|
+
(answer, updatedAt) = quoteOracle2 == address(0) ? _getPriceOneQuote() : _getPriceTwoQuotes();
|
|
58
|
+
roundId = 0;
|
|
59
|
+
startedAt = 0;
|
|
60
|
+
answeredInRound = 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function _getPriceOneQuote() internal view returns (int256 answer, uint256 updatedAt) {
|
|
64
|
+
(, int256 quoteAnswer1, , uint256 quoteUpdatedAt1, ) = AggregatorV3Interface(quoteOracle1).latestRoundData();
|
|
65
|
+
answer = (_getPendleTokenPrice() * quoteAnswer1) / quoteScale1;
|
|
66
|
+
updatedAt = quoteUpdatedAt1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function _getPriceTwoQuotes() internal view returns (int256 answer, uint256 updatedAt) {
|
|
70
|
+
(, int256 quoteAnswer1, , uint256 quoteUpdatedAt1, ) = AggregatorV3Interface(quoteOracle1).latestRoundData();
|
|
71
|
+
(, int256 quoteAnswer2, , uint256 quoteUpdatedAt2, ) = AggregatorV3Interface(quoteOracle2).latestRoundData();
|
|
72
|
+
|
|
73
|
+
answer = (_getPendleTokenPrice() * quoteAnswer1 * quoteAnswer2) / quoteScaleProduct;
|
|
74
|
+
updatedAt = quoteUpdatedAt1 < quoteUpdatedAt2 ? quoteUpdatedAt1 : quoteUpdatedAt2;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import "../PendleLpOracleLib.sol";
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
5
|
+
import "../../../interfaces/IPPYLpOracle.sol";
|
|
6
|
+
import "../../../interfaces/GMX/IGlpManager.sol";
|
|
7
|
+
import "../../../core/libraries/math/PMath.sol";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @notice The LP/GLP price gotten from the market using the LpOracleLib is multiplied with the USD price of GLP read from
|
package/contracts/oracles/{samples → PtYtLpOracle/samples}/BoringPYUsdChainlinkAssetOracle.sol
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
4
|
+
import "../../../interfaces/IPPYLpOracle.sol";
|
|
5
|
+
import "../../../interfaces/IPMarket.sol";
|
|
6
|
+
import "../../../core/libraries/math/PMath.sol";
|
|
7
7
|
import "../PendleLpOracleLib.sol";
|
|
8
8
|
|
|
9
9
|
import {AggregatorV2V3Interface as IChainlinkAggregator} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
4
|
+
import "../../../interfaces/IPPYLpOracle.sol";
|
|
5
|
+
import "../../../interfaces/IPMarket.sol";
|
|
6
|
+
import "../../../core/libraries/math/PMath.sol";
|
|
7
7
|
import "../PendleLpOracleLib.sol";
|
|
8
8
|
|
|
9
9
|
import {AggregatorV2V3Interface as IChainlinkAggregator} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
4
|
+
import "../../core/libraries/math/PMath.sol";
|
|
5
|
+
import "../../interfaces/IPExchangeRateOracle.sol";
|
|
6
6
|
|
|
7
7
|
contract PendleBoringOneracle is IPExchangeRateOracle {
|
|
8
8
|
function getExchangeRate() external pure returns (uint256) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
4
|
+
import "../../core/libraries/math/PMath.sol";
|
|
5
|
+
import "../../interfaces/IPExchangeRateOracle.sol";
|
|
6
6
|
|
|
7
7
|
contract PendleBoringSolvBTCOneracle is IPExchangeRateOracle {
|
|
8
8
|
function getExchangeRate() external pure returns (uint256) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
4
|
+
import "../../core/libraries/math/PMath.sol";
|
|
5
|
+
import "../../interfaces/IPExchangeRateOracle.sol";
|
|
6
|
+
import "../../interfaces/IRedstonePriceFeed.sol";
|
|
7
7
|
|
|
8
8
|
contract PendleRedStoneRateOracleAdapter is IPExchangeRateOracle {
|
|
9
9
|
using PMath for int256;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Autogenerated file. Do not edit manually. */
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
/* eslint-disable */
|
|
4
|
-
import { BaseContract, Signer, utils } from "ethers";
|
|
4
|
+
import { BaseContract, BigNumberish, Signer, utils } from "ethers";
|
|
5
5
|
import { EventFragment } from "@ethersproject/abi";
|
|
6
6
|
import { Listener, Provider } from "@ethersproject/providers";
|
|
7
7
|
import type {
|
|
@@ -17,7 +17,7 @@ export interface IPChainlinkOracleFactoryInterface extends utils.Interface {
|
|
|
17
17
|
|
|
18
18
|
events: {
|
|
19
19
|
"OracleCreated(address,uint32,uint8,address,bytes32)": EventFragment;
|
|
20
|
-
"OracleWithQuoteCreated(address,uint32,uint8,address,address,bytes32)": EventFragment;
|
|
20
|
+
"OracleWithQuoteCreated(address,uint32,uint8,address,address,address,bytes32)": EventFragment;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
getEvent(nameOrSignatureOrTopic: "OracleCreated"): EventFragment;
|
|
@@ -38,12 +38,13 @@ export type OracleCreatedEvent = TypedEvent<
|
|
|
38
38
|
export type OracleCreatedEventFilter = TypedEventFilter<OracleCreatedEvent>;
|
|
39
39
|
|
|
40
40
|
export type OracleWithQuoteCreatedEvent = TypedEvent<
|
|
41
|
-
[string, number, number, string, string, string],
|
|
41
|
+
[string, number, number, string, string, string, string],
|
|
42
42
|
{
|
|
43
43
|
market: string;
|
|
44
44
|
twapDuration: number;
|
|
45
45
|
baseOracleType: number;
|
|
46
|
-
|
|
46
|
+
quoteOracle1: string;
|
|
47
|
+
quoteOracle2: string;
|
|
47
48
|
oracle: string;
|
|
48
49
|
oracleId: string;
|
|
49
50
|
}
|
|
@@ -86,33 +87,35 @@ export interface IPChainlinkOracleFactory extends BaseContract {
|
|
|
86
87
|
filters: {
|
|
87
88
|
"OracleCreated(address,uint32,uint8,address,bytes32)"(
|
|
88
89
|
market?: string | null,
|
|
89
|
-
twapDuration?: null,
|
|
90
|
-
baseOracleType?: null,
|
|
91
|
-
oracle?:
|
|
90
|
+
twapDuration?: BigNumberish | null,
|
|
91
|
+
baseOracleType?: BigNumberish | null,
|
|
92
|
+
oracle?: null,
|
|
92
93
|
oracleId?: null
|
|
93
94
|
): OracleCreatedEventFilter;
|
|
94
95
|
OracleCreated(
|
|
95
96
|
market?: string | null,
|
|
96
|
-
twapDuration?: null,
|
|
97
|
-
baseOracleType?: null,
|
|
98
|
-
oracle?:
|
|
97
|
+
twapDuration?: BigNumberish | null,
|
|
98
|
+
baseOracleType?: BigNumberish | null,
|
|
99
|
+
oracle?: null,
|
|
99
100
|
oracleId?: null
|
|
100
101
|
): OracleCreatedEventFilter;
|
|
101
102
|
|
|
102
|
-
"OracleWithQuoteCreated(address,uint32,uint8,address,address,bytes32)"(
|
|
103
|
+
"OracleWithQuoteCreated(address,uint32,uint8,address,address,address,bytes32)"(
|
|
103
104
|
market?: string | null,
|
|
104
|
-
twapDuration?: null,
|
|
105
|
-
baseOracleType?: null,
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
twapDuration?: BigNumberish | null,
|
|
106
|
+
baseOracleType?: BigNumberish | null,
|
|
107
|
+
quoteOracle1?: null,
|
|
108
|
+
quoteOracle2?: null,
|
|
109
|
+
oracle?: null,
|
|
108
110
|
oracleId?: null
|
|
109
111
|
): OracleWithQuoteCreatedEventFilter;
|
|
110
112
|
OracleWithQuoteCreated(
|
|
111
113
|
market?: string | null,
|
|
112
|
-
twapDuration?: null,
|
|
113
|
-
baseOracleType?: null,
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
twapDuration?: BigNumberish | null,
|
|
115
|
+
baseOracleType?: BigNumberish | null,
|
|
116
|
+
quoteOracle1?: null,
|
|
117
|
+
quoteOracle2?: null,
|
|
118
|
+
oracle?: null,
|
|
116
119
|
oracleId?: null
|
|
117
120
|
): OracleWithQuoteCreatedEventFilter;
|
|
118
121
|
};
|
|
@@ -26,9 +26,9 @@ export interface PendleChainlinkOracleFactoryInterface extends utils.Interface {
|
|
|
26
26
|
contractName: "PendleChainlinkOracleFactory";
|
|
27
27
|
functions: {
|
|
28
28
|
"createOracle(address,uint32,uint8)": FunctionFragment;
|
|
29
|
-
"createOracleWithQuote(address,uint32,uint8,address)": FunctionFragment;
|
|
29
|
+
"createOracleWithQuote(address,uint32,uint8,address,address)": FunctionFragment;
|
|
30
30
|
"getOracle(address,uint32,uint8)": FunctionFragment;
|
|
31
|
-
"getOracleWithQuote(address,uint32,uint8,address)": FunctionFragment;
|
|
31
|
+
"getOracleWithQuote(address,uint32,uint8,address,address)": FunctionFragment;
|
|
32
32
|
"oracles(bytes32)": FunctionFragment;
|
|
33
33
|
"oraclesWithQuote(bytes32)": FunctionFragment;
|
|
34
34
|
"pyLpOracle()": FunctionFragment;
|
|
@@ -40,7 +40,7 @@ export interface PendleChainlinkOracleFactoryInterface extends utils.Interface {
|
|
|
40
40
|
): string;
|
|
41
41
|
encodeFunctionData(
|
|
42
42
|
functionFragment: "createOracleWithQuote",
|
|
43
|
-
values: [string, BigNumberish, BigNumberish, string]
|
|
43
|
+
values: [string, BigNumberish, BigNumberish, string, string]
|
|
44
44
|
): string;
|
|
45
45
|
encodeFunctionData(
|
|
46
46
|
functionFragment: "getOracle",
|
|
@@ -48,7 +48,7 @@ export interface PendleChainlinkOracleFactoryInterface extends utils.Interface {
|
|
|
48
48
|
): string;
|
|
49
49
|
encodeFunctionData(
|
|
50
50
|
functionFragment: "getOracleWithQuote",
|
|
51
|
-
values: [string, BigNumberish, BigNumberish, string]
|
|
51
|
+
values: [string, BigNumberish, BigNumberish, string, string]
|
|
52
52
|
): string;
|
|
53
53
|
encodeFunctionData(functionFragment: "oracles", values: [BytesLike]): string;
|
|
54
54
|
encodeFunctionData(
|
|
@@ -82,7 +82,7 @@ export interface PendleChainlinkOracleFactoryInterface extends utils.Interface {
|
|
|
82
82
|
|
|
83
83
|
events: {
|
|
84
84
|
"OracleCreated(address,uint32,uint8,address,bytes32)": EventFragment;
|
|
85
|
-
"OracleWithQuoteCreated(address,uint32,uint8,address,address,bytes32)": EventFragment;
|
|
85
|
+
"OracleWithQuoteCreated(address,uint32,uint8,address,address,address,bytes32)": EventFragment;
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
getEvent(nameOrSignatureOrTopic: "OracleCreated"): EventFragment;
|
|
@@ -103,12 +103,13 @@ export type OracleCreatedEvent = TypedEvent<
|
|
|
103
103
|
export type OracleCreatedEventFilter = TypedEventFilter<OracleCreatedEvent>;
|
|
104
104
|
|
|
105
105
|
export type OracleWithQuoteCreatedEvent = TypedEvent<
|
|
106
|
-
[string, number, number, string, string, string],
|
|
106
|
+
[string, number, number, string, string, string, string],
|
|
107
107
|
{
|
|
108
108
|
market: string;
|
|
109
109
|
twapDuration: number;
|
|
110
110
|
baseOracleType: number;
|
|
111
|
-
|
|
111
|
+
quoteOracle1: string;
|
|
112
|
+
quoteOracle2: string;
|
|
112
113
|
oracle: string;
|
|
113
114
|
oracleId: string;
|
|
114
115
|
}
|
|
@@ -156,7 +157,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
156
157
|
market: string,
|
|
157
158
|
twapDuration: BigNumberish,
|
|
158
159
|
baseOracleType: BigNumberish,
|
|
159
|
-
|
|
160
|
+
quoteOracle1: string,
|
|
161
|
+
quoteOracle2: string,
|
|
160
162
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
161
163
|
): Promise<ContractTransaction>;
|
|
162
164
|
|
|
@@ -171,7 +173,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
171
173
|
market: string,
|
|
172
174
|
twapDuration: BigNumberish,
|
|
173
175
|
baseOracleType: BigNumberish,
|
|
174
|
-
|
|
176
|
+
quoteOracle1: string,
|
|
177
|
+
quoteOracle2: string,
|
|
175
178
|
overrides?: CallOverrides
|
|
176
179
|
): Promise<[string]>;
|
|
177
180
|
|
|
@@ -199,7 +202,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
199
202
|
market: string,
|
|
200
203
|
twapDuration: BigNumberish,
|
|
201
204
|
baseOracleType: BigNumberish,
|
|
202
|
-
|
|
205
|
+
quoteOracle1: string,
|
|
206
|
+
quoteOracle2: string,
|
|
203
207
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
204
208
|
): Promise<ContractTransaction>;
|
|
205
209
|
|
|
@@ -214,7 +218,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
214
218
|
market: string,
|
|
215
219
|
twapDuration: BigNumberish,
|
|
216
220
|
baseOracleType: BigNumberish,
|
|
217
|
-
|
|
221
|
+
quoteOracle1: string,
|
|
222
|
+
quoteOracle2: string,
|
|
218
223
|
overrides?: CallOverrides
|
|
219
224
|
): Promise<string>;
|
|
220
225
|
|
|
@@ -239,7 +244,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
239
244
|
market: string,
|
|
240
245
|
twapDuration: BigNumberish,
|
|
241
246
|
baseOracleType: BigNumberish,
|
|
242
|
-
|
|
247
|
+
quoteOracle1: string,
|
|
248
|
+
quoteOracle2: string,
|
|
243
249
|
overrides?: CallOverrides
|
|
244
250
|
): Promise<string>;
|
|
245
251
|
|
|
@@ -254,7 +260,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
254
260
|
market: string,
|
|
255
261
|
twapDuration: BigNumberish,
|
|
256
262
|
baseOracleType: BigNumberish,
|
|
257
|
-
|
|
263
|
+
quoteOracle1: string,
|
|
264
|
+
quoteOracle2: string,
|
|
258
265
|
overrides?: CallOverrides
|
|
259
266
|
): Promise<string>;
|
|
260
267
|
|
|
@@ -271,33 +278,35 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
271
278
|
filters: {
|
|
272
279
|
"OracleCreated(address,uint32,uint8,address,bytes32)"(
|
|
273
280
|
market?: string | null,
|
|
274
|
-
twapDuration?: null,
|
|
275
|
-
baseOracleType?: null,
|
|
276
|
-
oracle?:
|
|
281
|
+
twapDuration?: BigNumberish | null,
|
|
282
|
+
baseOracleType?: BigNumberish | null,
|
|
283
|
+
oracle?: null,
|
|
277
284
|
oracleId?: null
|
|
278
285
|
): OracleCreatedEventFilter;
|
|
279
286
|
OracleCreated(
|
|
280
287
|
market?: string | null,
|
|
281
|
-
twapDuration?: null,
|
|
282
|
-
baseOracleType?: null,
|
|
283
|
-
oracle?:
|
|
288
|
+
twapDuration?: BigNumberish | null,
|
|
289
|
+
baseOracleType?: BigNumberish | null,
|
|
290
|
+
oracle?: null,
|
|
284
291
|
oracleId?: null
|
|
285
292
|
): OracleCreatedEventFilter;
|
|
286
293
|
|
|
287
|
-
"OracleWithQuoteCreated(address,uint32,uint8,address,address,bytes32)"(
|
|
294
|
+
"OracleWithQuoteCreated(address,uint32,uint8,address,address,address,bytes32)"(
|
|
288
295
|
market?: string | null,
|
|
289
|
-
twapDuration?: null,
|
|
290
|
-
baseOracleType?: null,
|
|
291
|
-
|
|
292
|
-
|
|
296
|
+
twapDuration?: BigNumberish | null,
|
|
297
|
+
baseOracleType?: BigNumberish | null,
|
|
298
|
+
quoteOracle1?: null,
|
|
299
|
+
quoteOracle2?: null,
|
|
300
|
+
oracle?: null,
|
|
293
301
|
oracleId?: null
|
|
294
302
|
): OracleWithQuoteCreatedEventFilter;
|
|
295
303
|
OracleWithQuoteCreated(
|
|
296
304
|
market?: string | null,
|
|
297
|
-
twapDuration?: null,
|
|
298
|
-
baseOracleType?: null,
|
|
299
|
-
|
|
300
|
-
|
|
305
|
+
twapDuration?: BigNumberish | null,
|
|
306
|
+
baseOracleType?: BigNumberish | null,
|
|
307
|
+
quoteOracle1?: null,
|
|
308
|
+
quoteOracle2?: null,
|
|
309
|
+
oracle?: null,
|
|
301
310
|
oracleId?: null
|
|
302
311
|
): OracleWithQuoteCreatedEventFilter;
|
|
303
312
|
};
|
|
@@ -314,7 +323,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
314
323
|
market: string,
|
|
315
324
|
twapDuration: BigNumberish,
|
|
316
325
|
baseOracleType: BigNumberish,
|
|
317
|
-
|
|
326
|
+
quoteOracle1: string,
|
|
327
|
+
quoteOracle2: string,
|
|
318
328
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
319
329
|
): Promise<BigNumber>;
|
|
320
330
|
|
|
@@ -329,7 +339,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
329
339
|
market: string,
|
|
330
340
|
twapDuration: BigNumberish,
|
|
331
341
|
baseOracleType: BigNumberish,
|
|
332
|
-
|
|
342
|
+
quoteOracle1: string,
|
|
343
|
+
quoteOracle2: string,
|
|
333
344
|
overrides?: CallOverrides
|
|
334
345
|
): Promise<BigNumber>;
|
|
335
346
|
|
|
@@ -355,7 +366,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
355
366
|
market: string,
|
|
356
367
|
twapDuration: BigNumberish,
|
|
357
368
|
baseOracleType: BigNumberish,
|
|
358
|
-
|
|
369
|
+
quoteOracle1: string,
|
|
370
|
+
quoteOracle2: string,
|
|
359
371
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
360
372
|
): Promise<PopulatedTransaction>;
|
|
361
373
|
|
|
@@ -370,7 +382,8 @@ export interface PendleChainlinkOracleFactory extends BaseContract {
|
|
|
370
382
|
market: string,
|
|
371
383
|
twapDuration: BigNumberish,
|
|
372
384
|
baseOracleType: BigNumberish,
|
|
373
|
-
|
|
385
|
+
quoteOracle1: string,
|
|
386
|
+
quoteOracle2: string,
|
|
374
387
|
overrides?: CallOverrides
|
|
375
388
|
): Promise<PopulatedTransaction>;
|
|
376
389
|
|