@pendle/core-v2 5.1.1-beta-2 → 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/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/SYBaseWithoutPermitUpg.sol/SYBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ethena/PendleSUSDEMantleSY.sol/PendleSUSDEMantleSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ethena/PendleSUSDEMantleSY.sol/PendleSUSDEMantleSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ethena/PendleUSDEL2SY.sol/PendleUSDEL2SY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Ethena/PendleUSDEL2SY.sol/PendleUSDEL2SY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleEBTCSY.sol/PendleEBTCSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleEBTCSY.sol/PendleEBTCSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleEEigenSYUpg.sol/PendleEEigenSYUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleEEigenSYUpg.sol/PendleEEigenSYUpg.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthkSY.sol/PendleWEEthkSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthkSY.sol/PendleWEEthkSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthsSY.sol/PendleWEEthsSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/EtherFi/PendleWEEthsSY.sol/PendleWEEthsSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/GLP/PendleGlpSY.sol/PendleGlpSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC20SYUpg.sol/PendleERC20SYUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC20SYUpg.sol/PendleERC20SYUpg.json +2 -2
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiqV3.sol/IPActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSimple.sol/IPActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionStorageV4.sol/IPActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTV3.sol/IPActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYTV3.sol/IPActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionAddRemoveLiqV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionMiscV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionStorageEvents.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapPTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapYTV3Events.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPAllEventsV3.dbg.json +1 -1
- 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/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/errors/SDKErrorsDirectory.sol/SDKErrorsDirectory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
- 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/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionAddRemoveLiqV3.sol/ActionAddRemoveLiqV3.json +2 -2
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionMiscV3.sol/ActionMiscV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSimple.sol/ActionSimple.json +2 -2
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapPTV3.sol/ActionSwapPTV3.json +2 -2
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.dbg.json +1 -1
- package/build/artifacts/contracts/router/ActionSwapYTV3.sol/ActionSwapYTV3.json +2 -2
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.dbg.json +1 -1
- package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.json +2 -2
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +1 -1
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.json +2 -2
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.dbg.json +1 -1
- package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.json +2 -2
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.dbg.json +1 -1
- package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.json +2 -2
- package/contracts/core/StandardizedYield/implementations/EtherFi/PendleEEigenSYUpg.sol +6 -2
- package/contracts/core/StandardizedYield/implementations/PendleERC20SYUpg.sol +6 -1
- package/contracts/interfaces/IPChainlinkOracle.sol +15 -0
- package/contracts/interfaces/IPChainlinkOracleFactory.sol +22 -0
- package/contracts/interfaces/IPChainlinkOracleWithQuote.sol +8 -0
- 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/contracts/router/swap-aggregator/IPSwapAggregator.sol +1 -1
- package/contracts/router/swap-aggregator/PendleSwap.sol +0 -43
- package/deployments/1-core.json +1 -1
- package/deployments/10-core.json +1 -1
- package/deployments/42161-core.json +1 -1
- package/deployments/5000-core.json +1 -1
- package/deployments/56-core.json +1 -1
- package/package.json +1 -1
- package/typechain-types/IAaveStkGHO.ts +269 -0
- package/typechain-types/IAngleDistributor.ts +117 -0
- package/typechain-types/IPChainlinkOracle.ts +221 -0
- package/typechain-types/IPChainlinkOracleFactory.ts +123 -0
- package/typechain-types/IPChainlinkOracleWithQuote.ts +404 -0
- package/typechain-types/PendleCMETHSY.ts +1349 -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/PendleStkGHOSY.ts +1522 -0
- package/typechain-types/SYBaseWithoutPermitUpg.ts +1101 -0
- package/typechain-types/factories/ActionAddRemoveLiqV3__factory.ts +1 -1
- package/typechain-types/factories/ActionInfoStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketCoreStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeemStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMiscV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSimple__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionStorageV4__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionVePendleStatic__factory.ts +1 -1
- package/typechain-types/factories/IAaveStkGHO__factory.ts +128 -0
- package/typechain-types/factories/IAngleDistributor__factory.ts +54 -0
- 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/PendleCMETHSY__factory.ts +1099 -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/PendleEBTCSY__factory.ts +1 -1
- package/typechain-types/factories/PendleEEigenSYUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleERC20SYUpg__factory.ts +1 -1
- package/typechain-types/factories/PendlePoolDeployHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleRouterV4__factory.ts +1 -1
- package/typechain-types/factories/PendleSUSDEMantleSY__factory.ts +1 -1
- package/typechain-types/factories/PendleStkGHOSY__factory.ts +1213 -0
- package/typechain-types/factories/PendleSwap__factory.ts +1 -1
- package/typechain-types/factories/PendleUSDEL2SY__factory.ts +1 -1
- package/typechain-types/factories/PendleWEEthkSY__factory.ts +1 -1
- package/typechain-types/factories/PendleWEEthsSY__factory.ts +1 -1
- package/typechain-types/factories/Reflector__factory.ts +1 -1
- package/typechain-types/factories/SYBaseWithoutPermitUpg__factory.ts +871 -0
- package/typechain-types/hardhat.d.ts +108 -9
- package/typechain-types/index.ts +24 -2
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.dbg.json +0 -4
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.json +0 -82
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"contractName": "MarketApproxPtInLib",
|
|
4
4
|
"sourceName": "contracts/router/math/MarketApproxLib.sol",
|
|
5
5
|
"abi": [],
|
|
6
|
-
"bytecode": "
|
|
7
|
-
"deployedBytecode": "
|
|
6
|
+
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d2de33a62a0433751e7fab74313f6fe1c53f3958d792893c45ff75f8ff7ed6e964736f6c63430008170033",
|
|
7
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d2de33a62a0433751e7fab74313f6fe1c53f3958d792893c45ff75f8ff7ed6e964736f6c63430008170033",
|
|
8
8
|
"linkReferences": {},
|
|
9
9
|
"deployedLinkReferences": {}
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"contractName": "MarketApproxPtOutLib",
|
|
4
4
|
"sourceName": "contracts/router/math/MarketApproxLib.sol",
|
|
5
5
|
"abi": [],
|
|
6
|
-
"bytecode": "
|
|
7
|
-
"deployedBytecode": "
|
|
6
|
+
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e1b98481c9ecd178ed7ac6fdf1c1a456e263ff34c05267454ff02e7b8d96c2bf64736f6c63430008170033",
|
|
7
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220e1b98481c9ecd178ed7ac6fdf1c1a456e263ff34c05267454ff02e7b8d96c2bf64736f6c63430008170033",
|
|
8
8
|
"linkReferences": {},
|
|
9
9
|
"deployedLinkReferences": {}
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"contractName": "MarketApproxPtInLibOnchain",
|
|
4
4
|
"sourceName": "contracts/router/math/MarketApproxLibOnchain.sol",
|
|
5
5
|
"abi": [],
|
|
6
|
-
"bytecode": "
|
|
7
|
-
"deployedBytecode": "
|
|
6
|
+
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ba609af17d6a906f12570187994d6ff54e303f2ff7df003bfd0a50395f0efceb64736f6c63430008170033",
|
|
7
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220ba609af17d6a906f12570187994d6ff54e303f2ff7df003bfd0a50395f0efceb64736f6c63430008170033",
|
|
8
8
|
"linkReferences": {},
|
|
9
9
|
"deployedLinkReferences": {}
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"contractName": "MarketApproxPtOutLibOnchain",
|
|
4
4
|
"sourceName": "contracts/router/math/MarketApproxLibOnchain.sol",
|
|
5
5
|
"abi": [],
|
|
6
|
-
"bytecode": "
|
|
7
|
-
"deployedBytecode": "
|
|
6
|
+
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a1e2c5f1680419fc14e0dcd1a8697a8da1d2cd0874b903a29aef58e74e29048d64736f6c63430008170033",
|
|
7
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a1e2c5f1680419fc14e0dcd1a8697a8da1d2cd0874b903a29aef58e74e29048d64736f6c63430008170033",
|
|
8
8
|
"linkReferences": {},
|
|
9
9
|
"deployedLinkReferences": {}
|
|
10
10
|
}
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"type": "receive"
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
|
-
"bytecode": "
|
|
70
|
-
"deployedBytecode": "
|
|
69
|
+
"bytecode": "0x60a0604052732f577a41bec1be1152aeea12e73b7391d15f655d60805234801561002857600080fd5b506080516109b261004a600039600081816060015261026f01526109b26000f3fe60806040526004361061002d5760003560e01c80632bdb823c146100395780638930af571461004e57600080fd5b3661003457005b600080fd5b61004c61004736600461061e565b61009e565b005b34801561005a57600080fd5b506100827f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6100b7836100b2604084016020850161067b565b610176565b6101706100ca60808301606084016106ae565b610115576100db60408301836106cb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013892505050565b6101386101256020840184610718565b61013260408501856106cb565b8661023a565b6001600160a01b0385161561014e576000610150565b835b610160604085016020860161067b565b6001600160a01b03169190610359565b50505050565b6001600160a01b038216610188575050565b61019a60026001600160601b03610739565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526001600160601b03929092169184169063dd62ed3e90604401602060405180830381865afa1580156101f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610217919061076d565b1015610236576102298282600061037f565b610236828260001961037f565b5050565b6060600185600381111561025057610250610786565b036103495760405163726d379760e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e4da6f2e906102a89088908890889060040161079c565b600060405180830381865afa1580156102c5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102ed919081019061080f565b92509050806103435760405162461bcd60e51b815260206004820181905260248201527f50656e646c65537761703a204b79626572207363616c696e67206661696c656460448201526064015b60405180910390fd5b50610351565b6103516108d1565b949350505050565b606061035184848460405180606001604052806029815260200161095460299139610489565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916103db91906108e7565b6000604051808303816000865af19150503d8060008114610418576040519150601f19603f3d011682016040523d82523d6000602084013e61041d565b606091505b50915091508180156104475750805115806104475750808060200190518101906104479190610903565b6104825760405162461bcd60e51b815260206004820152600c60248201526b5361666520417070726f766560a01b604482015260640161033a565b5050505050565b6060824710156104ea5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161033a565b600080866001600160a01b0316858760405161050691906108e7565b60006040518083038185875af1925050503d8060008114610543576040519150601f19603f3d011682016040523d82523d6000602084013e610548565b606091505b509150915061055987838387610564565b979650505050505050565b606083156105d35782516000036105cc576001600160a01b0385163b6105cc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161033a565b5081610351565b61035183838151156105e85781518083602001fd5b8060405162461bcd60e51b815260040161033a9190610920565b80356001600160a01b038116811461061957600080fd5b919050565b60008060006060848603121561063357600080fd5b61063c84610602565b92506020840135915060408401356001600160401b0381111561065e57600080fd5b84016080818703121561067057600080fd5b809150509250925092565b60006020828403121561068d57600080fd5b61069682610602565b9392505050565b80151581146106ab57600080fd5b50565b6000602082840312156106c057600080fd5b81356106968161069d565b6000808335601e198436030181126106e257600080fd5b8301803591506001600160401b038211156106fc57600080fd5b60200191503681900382131561071157600080fd5b9250929050565b60006020828403121561072a57600080fd5b81356004811061069657600080fd5b60006001600160601b038381168061076157634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b60006020828403121561077f57600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156108065781810151838201526020016107ee565b50506000910152565b6000806040838503121561082257600080fd5b825161082d8161069d565b60208401519092506001600160401b038082111561084a57600080fd5b818501915085601f83011261085e57600080fd5b815181811115610870576108706107d5565b604051601f8201601f19908116603f01168101908382118183101715610898576108986107d5565b816040528281528860208487010111156108b157600080fd5b6108c28360208301602088016107eb565b80955050505050509250929050565b634e487b7160e01b600052600160045260246000fd5b600082516108f98184602087016107eb565b9190910192915050565b60006020828403121561091557600080fd5b81516106968161069d565b602081526000825180602084015261093f8160408501602087016107eb565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212206591470c2f8d6c170503826a8e695308f346c84d36432f84e1b82ac848722c1364736f6c63430008170033",
|
|
70
|
+
"deployedBytecode": "0x60806040526004361061002d5760003560e01c80632bdb823c146100395780638930af571461004e57600080fd5b3661003457005b600080fd5b61004c61004736600461061e565b61009e565b005b34801561005a57600080fd5b506100827f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6100b7836100b2604084016020850161067b565b610176565b6101706100ca60808301606084016106ae565b610115576100db60408301836106cb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013892505050565b6101386101256020840184610718565b61013260408501856106cb565b8661023a565b6001600160a01b0385161561014e576000610150565b835b610160604085016020860161067b565b6001600160a01b03169190610359565b50505050565b6001600160a01b038216610188575050565b61019a60026001600160601b03610739565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526001600160601b03929092169184169063dd62ed3e90604401602060405180830381865afa1580156101f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610217919061076d565b1015610236576102298282600061037f565b610236828260001961037f565b5050565b6060600185600381111561025057610250610786565b036103495760405163726d379760e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e4da6f2e906102a89088908890889060040161079c565b600060405180830381865afa1580156102c5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526102ed919081019061080f565b92509050806103435760405162461bcd60e51b815260206004820181905260248201527f50656e646c65537761703a204b79626572207363616c696e67206661696c656460448201526064015b60405180910390fd5b50610351565b6103516108d1565b949350505050565b606061035184848460405180606001604052806029815260200161095460299139610489565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b17905291516000928392908716916103db91906108e7565b6000604051808303816000865af19150503d8060008114610418576040519150601f19603f3d011682016040523d82523d6000602084013e61041d565b606091505b50915091508180156104475750805115806104475750808060200190518101906104479190610903565b6104825760405162461bcd60e51b815260206004820152600c60248201526b5361666520417070726f766560a01b604482015260640161033a565b5050505050565b6060824710156104ea5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161033a565b600080866001600160a01b0316858760405161050691906108e7565b60006040518083038185875af1925050503d8060008114610543576040519150601f19603f3d011682016040523d82523d6000602084013e610548565b606091505b509150915061055987838387610564565b979650505050505050565b606083156105d35782516000036105cc576001600160a01b0385163b6105cc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161033a565b5081610351565b61035183838151156105e85781518083602001fd5b8060405162461bcd60e51b815260040161033a9190610920565b80356001600160a01b038116811461061957600080fd5b919050565b60008060006060848603121561063357600080fd5b61063c84610602565b92506020840135915060408401356001600160401b0381111561065e57600080fd5b84016080818703121561067057600080fd5b809150509250925092565b60006020828403121561068d57600080fd5b61069682610602565b9392505050565b80151581146106ab57600080fd5b50565b6000602082840312156106c057600080fd5b81356106968161069d565b6000808335601e198436030181126106e257600080fd5b8301803591506001600160401b038211156106fc57600080fd5b60200191503681900382131561071157600080fd5b9250929050565b60006020828403121561072a57600080fd5b81356004811061069657600080fd5b60006001600160601b038381168061076157634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b60006020828403121561077f57600080fd5b5051919050565b634e487b7160e01b600052602160045260246000fd5b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050826020830152949350505050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156108065781810151838201526020016107ee565b50506000910152565b6000806040838503121561082257600080fd5b825161082d8161069d565b60208401519092506001600160401b038082111561084a57600080fd5b818501915085601f83011261085e57600080fd5b815181811115610870576108706107d5565b604051601f8201601f19908116603f01168101908382118183101715610898576108986107d5565b816040528281528860208487010111156108b157600080fd5b6108c28360208301602088016107eb565b80955050505050509250929050565b634e487b7160e01b600052600160045260246000fd5b600082516108f98184602087016107eb565b9190910192915050565b60006020828403121561091557600080fd5b81516106968161069d565b602081526000825180602084015261093f8160408501602087016107eb565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212206591470c2f8d6c170503826a8e695308f346c84d36432f84e1b82ac848722c1364736f6c63430008170033",
|
|
71
71
|
"linkReferences": {},
|
|
72
72
|
"deployedLinkReferences": {}
|
|
73
73
|
}
|
|
@@ -56,12 +56,16 @@ contract PendleEEigenSYUpg is PendleERC20SYUpg {
|
|
|
56
56
|
|
|
57
57
|
/// =================================================================
|
|
58
58
|
|
|
59
|
-
|
|
60
59
|
function exchangeRate() public view virtual override returns (uint256) {
|
|
61
60
|
return IVedaAccountant(vedaAccountant).getRateInQuoteSafe(EIGEN);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
function assetInfo()
|
|
63
|
+
function assetInfo()
|
|
64
|
+
external
|
|
65
|
+
view
|
|
66
|
+
override
|
|
67
|
+
returns (AssetType assetType, address assetAddress, uint8 assetDecimals)
|
|
68
|
+
{
|
|
65
69
|
return (AssetType.TOKEN, EIGEN, IERC20Metadata(EIGEN).decimals());
|
|
66
70
|
}
|
|
67
71
|
}
|
|
@@ -64,7 +64,12 @@ contract PendleERC20SYUpg is SYBaseUpg {
|
|
|
64
64
|
return token == yieldToken;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
function assetInfo()
|
|
67
|
+
function assetInfo()
|
|
68
|
+
external
|
|
69
|
+
view
|
|
70
|
+
virtual
|
|
71
|
+
returns (AssetType assetType, address assetAddress, uint8 assetDecimals)
|
|
72
|
+
{
|
|
68
73
|
return (AssetType.TOKEN, yieldToken, IERC20Metadata(yieldToken).decimals());
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
|
|
5
|
+
|
|
6
|
+
enum PendleOracleType {
|
|
7
|
+
PT_TO_SY,
|
|
8
|
+
PT_TO_ASSET,
|
|
9
|
+
YT_TO_SY,
|
|
10
|
+
YT_TO_ASSET,
|
|
11
|
+
LP_TO_SY,
|
|
12
|
+
LP_TO_ASSET
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface IPChainlinkOracle is AggregatorV3Interface {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "./IPChainlinkOracle.sol";
|
|
5
|
+
|
|
6
|
+
interface IPChainlinkOracleFactory {
|
|
7
|
+
event OracleCreated(
|
|
8
|
+
address indexed market,
|
|
9
|
+
uint16 twapDuration,
|
|
10
|
+
PendleOracleType baseOracleType,
|
|
11
|
+
address indexed oracle,
|
|
12
|
+
bytes32 oracleId
|
|
13
|
+
);
|
|
14
|
+
event OracleWithQuoteCreated(
|
|
15
|
+
address indexed market,
|
|
16
|
+
uint16 twapDuration,
|
|
17
|
+
PendleOracleType baseOracleType,
|
|
18
|
+
address indexed quoteOracle,
|
|
19
|
+
address indexed oracle,
|
|
20
|
+
bytes32 oracleId
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol";
|
|
5
|
+
|
|
6
|
+
interface IPChainlinkOracleWithQuote is AggregatorV2V3Interface {
|
|
7
|
+
function quoteOracle() external view returns (address);
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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, updatedAt will always be 0
|
|
10
|
+
*/
|
|
11
|
+
contract PendleChainlinkOracle is PendleChainlinkOracleBase {
|
|
12
|
+
constructor(
|
|
13
|
+
address _market,
|
|
14
|
+
uint16 _twapDuration,
|
|
15
|
+
PendleOracleType _baseOracleType
|
|
16
|
+
) PendleChainlinkOracleBase(_market, _twapDuration, _baseOracleType) {}
|
|
17
|
+
|
|
18
|
+
function _getFinalPrice() internal view override returns (int256) {
|
|
19
|
+
return _getPendleTokenPrice();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -32,35 +32,11 @@ contract PendleSwap is IPSwapAggregator, TokenHelper {
|
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
require(isSuccess, "PendleSwap: Kyber scaling failed");
|
|
35
|
-
} else if (swapType == SwapType.ODOS) {
|
|
36
|
-
scaledCallData = _odosScaling(rawCallData, amountIn);
|
|
37
35
|
} else {
|
|
38
36
|
assert(false);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
function _odosScaling(
|
|
43
|
-
bytes calldata rawCallData,
|
|
44
|
-
uint256 amountIn
|
|
45
|
-
) internal pure returns (bytes memory scaledCallData) {
|
|
46
|
-
bytes4 selector = bytes4(rawCallData[:4]);
|
|
47
|
-
bytes calldata dataToDecode = rawCallData[4:];
|
|
48
|
-
|
|
49
|
-
assert(selector == IOdosRouterV2.swap.selector);
|
|
50
|
-
(
|
|
51
|
-
IOdosRouterV2.swapTokenInfo memory tokenInfo,
|
|
52
|
-
bytes memory pathDefinition,
|
|
53
|
-
address executor,
|
|
54
|
-
uint32 referralCode
|
|
55
|
-
) = abi.decode(dataToDecode, (IOdosRouterV2.swapTokenInfo, bytes, address, uint32));
|
|
56
|
-
|
|
57
|
-
tokenInfo.outputQuote = (tokenInfo.outputQuote * amountIn) / tokenInfo.inputAmount;
|
|
58
|
-
tokenInfo.outputMin = (tokenInfo.outputMin * amountIn) / tokenInfo.inputAmount;
|
|
59
|
-
tokenInfo.inputAmount = amountIn;
|
|
60
|
-
|
|
61
|
-
return abi.encodeWithSelector(selector, tokenInfo, pathDefinition, executor, referralCode);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
40
|
receive() external payable {}
|
|
65
41
|
}
|
|
66
42
|
|
|
@@ -70,22 +46,3 @@ interface IKyberScalingHelper {
|
|
|
70
46
|
uint256 newAmount
|
|
71
47
|
) external view returns (bool isSuccess, bytes memory data);
|
|
72
48
|
}
|
|
73
|
-
|
|
74
|
-
interface IOdosRouterV2 {
|
|
75
|
-
struct swapTokenInfo {
|
|
76
|
-
address inputToken;
|
|
77
|
-
uint256 inputAmount;
|
|
78
|
-
address inputReceiver;
|
|
79
|
-
address outputToken;
|
|
80
|
-
uint256 outputQuote;
|
|
81
|
-
uint256 outputMin;
|
|
82
|
-
address outputReceiver;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function swap(
|
|
86
|
-
swapTokenInfo memory tokenInfo,
|
|
87
|
-
bytes calldata pathDefinition,
|
|
88
|
-
address executor,
|
|
89
|
-
uint32 referralCode
|
|
90
|
-
) external payable returns (uint256 amountOut);
|
|
91
|
-
}
|
package/deployments/1-core.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"ActionStorageV4": "0x6a0Ed0A9193FCBe7ae9B0F3D90F88e365Cca64fC"
|
|
32
32
|
},
|
|
33
33
|
"routerStatic": "0x263833d47eA3fA4a30f269323aba6a107f9eB14C",
|
|
34
|
-
"pendleSwap": "
|
|
34
|
+
"pendleSwap": "0x2E6ffA05cd6920dcc0d169efce2F4C96E774eCd2",
|
|
35
35
|
"pyYtLpOracle": "0x9a9fa8338dd5e5b2188006f1cd2ef26d921650c2",
|
|
36
36
|
"yieldContractFactoryV3": "0xdF3601014686674e53d1Fa52F7602525483F9122",
|
|
37
37
|
"marketFactoryV3": "0x1A6fCc85557BC4fB7B534ed835a03EF056552D52",
|
package/deployments/10-core.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"ActionStorageV4": "0x6a0Ed0A9193FCBe7ae9B0F3D90F88e365Cca64fC"
|
|
31
31
|
},
|
|
32
32
|
"routerStatic": "0x704478Dd72FD7F9B83d1F1e0fc18C14B54F034d0",
|
|
33
|
-
"pendleSwap": "
|
|
33
|
+
"pendleSwap": "0x2E6ffA05cd6920dcc0d169efce2F4C96E774eCd2",
|
|
34
34
|
"pyYtLpOracle": "0x9a9fa8338dd5e5b2188006f1cd2ef26d921650c2",
|
|
35
35
|
"yieldContractFactoryV3": "0xfa6B22FC4c3Ad88B68c16b3061a16b1714F6Bd57",
|
|
36
36
|
"marketFactoryV3": "0x4A2B38b9cBd83c86F261a4d64c243795D4d44aBC",
|