@pendle/core-v2 5.10.2 → 5.11.0
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/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +9 -3
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol/PendleMsgReceiverAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +9 -3
- package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol/PendleMsgSenderAppUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.json +9 -3
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.json +9 -3
- package/build/artifacts/contracts/LiquidityMining/PendleMerkleDistributor.sol/PendleMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/PendleMerkleDistributor.sol/PendleMerkleDistributor.json +9 -3
- package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.json +9 -3
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.json +2 -2
- package/build/artifacts/contracts/core/Market/v3/PendleMarketFactoryV3.sol/PendleMarketFactoryV3.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/v3/PendleMarketFactoryV3.sol/PendleMarketFactoryV3.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.json +2 -2
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeableV2.sol/BoringOwnableUpgradeableData.dbg.json +4 -0
- package/build/artifacts/contracts/core/libraries/{BoringOwnableUpgradeable.sol → BoringOwnableUpgradeableV2.sol}/BoringOwnableUpgradeableData.json +3 -3
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeableV2.sol/BoringOwnableUpgradeableV2.dbg.json +1 -1
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +4 -0
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +598 -0
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +4 -0
- package/build/artifacts/contracts/deprecated/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +498 -0
- package/build/artifacts/contracts/limit/LimitRouterBase.sol/LimitRouterBase.dbg.json +1 -1
- package/build/artifacts/contracts/limit/LimitRouterBase.sol/LimitRouterBase.json +5 -0
- package/build/artifacts/contracts/limit/PendleLimitRouter.sol/PendleLimitRouter.dbg.json +1 -1
- package/build/artifacts/contracts/limit/PendleLimitRouter.sol/PendleLimitRouter.json +7 -2
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/AddressProvider.sol/AddressProvider.json +9 -3
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/BalanceReader.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BalanceReader.sol/BalanceReader.json +9 -3
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol/BaseSplitCodeFactoryContract.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/Broadcaster.sol/Broadcaster.json +9 -3
- package/build/artifacts/contracts/offchain-helpers/EmptyUUPS.sol/EmptyUUPS.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/EmptyUUPS.sol/EmptyUUPS.json +9 -3
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol/ExpiredLpPtRedeemer.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleExchangeRateOracle.sol/PendleExchangeRateOracle.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleExchangeRateOracle.sol/PendleExchangeRateOracle.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapperFactory.sol/PendleLPWrapperFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/PendleLPWrapperFactory.sol/PendleLPWrapperFactory.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallOwnerV1.sol/PendleMulticallOwnerV1.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/PendleMulticallOwnerV1.sol/PendleMulticallOwnerV1.json +153 -0
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol/PendleCommonPoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol/PendleCommonSYFactory.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol/PendleCommonSYFactory.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol/PendlePoolDeployHelperV2.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol/PendleLpOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol/PendlePYLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol/PendlePYLpOracle.json +7 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol/PendlePYOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol/PendlePYOracleLib.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol/PendleChainlinkOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol/PendleChainlinkOracleFactory.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol/PendleChainlinkOracleWithQuote.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkAssetOracle.sol/BoringPYUsdChainlinkAssetOracle.json +2 -2
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PtYtLpOracle/samples/BoringPYUsdChainlinkSYOracle.sol/BoringPYUsdChainlinkSYOracle.json +2 -2
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
- package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.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/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol +4 -4
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiverAppUpg.sol +1 -1
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol +4 -4
- package/contracts/LiquidityMining/CrossChainMsg/PendleMsgSenderAppUpg.sol +2 -2
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol +2 -2
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol +2 -2
- package/contracts/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol +2 -2
- package/contracts/LiquidityMining/PendleMerkleDistributor.sol +4 -4
- package/contracts/LiquidityMining/VotingController/PendleVotingControllerUpg.sol +2 -2
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +1 -1
- package/contracts/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol +2 -2
- package/contracts/core/Market/v3/PendleMarketFactoryV3.sol +3 -3
- package/contracts/core/YieldContracts/PendleYieldContractFactory.sol +3 -3
- package/contracts/core/libraries/BoringOwnableUpgradeableV2.sol +5 -1
- package/contracts/{LiquidityMining → deprecated}/VeDistributor/PendleFeeDistributor.sol +6 -6
- package/contracts/{LiquidityMining → deprecated}/VeDistributor/PendleFeeDistributorV2.sol +4 -4
- package/contracts/limit/LimitRouterBase.sol +5 -4
- package/contracts/offchain-helpers/AddressProvider.sol +4 -4
- package/contracts/offchain-helpers/BalanceReader.sol +4 -4
- package/contracts/offchain-helpers/BaseSplitCodeFactoryContract.sol +3 -3
- package/contracts/offchain-helpers/Broadcaster.sol +4 -4
- package/contracts/offchain-helpers/EmptyUUPS.sol +4 -4
- package/contracts/offchain-helpers/ExpiredLpPtRedeemer.sol +1 -1
- package/contracts/offchain-helpers/PendleExchangeRateOracle.sol +3 -4
- package/contracts/offchain-helpers/PendleLPWrapperFactory.sol +3 -3
- package/contracts/offchain-helpers/PendleMulticallOwnerV1.sol +39 -0
- package/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol +1 -1
- package/contracts/offchain-helpers/deploy/PendlePoolDeployHelperV2.sol +5 -1
- package/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol +4 -4
- package/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol +1 -1
- package/deployments/80094-core.json +1 -1
- package/package.json +1 -1
- package/typechain-types/AddressProvider.ts +281 -0
- package/typechain-types/BalanceReader.ts +7 -6
- package/typechain-types/BaseSplitCodeFactoryContract.ts +276 -0
- package/typechain-types/BoringOwnableUpgradeableData.ts +100 -0
- package/typechain-types/BoringOwnableUpgradeable__deprecated.ts +204 -0
- package/typechain-types/Broadcaster.ts +7 -6
- package/typechain-types/EmptyUUPS.ts +353 -0
- package/typechain-types/LimitRouterBase.ts +14 -3
- package/typechain-types/PendleFeeDistributor.ts +7 -6
- package/typechain-types/PendleFeeDistributorV2.ts +723 -0
- package/typechain-types/PendleGaugeControllerMainchainUpg.ts +7 -6
- package/typechain-types/PendleGaugeControllerSidechainUpg.ts +7 -6
- package/typechain-types/PendleLimitRouter.ts +14 -3
- package/typechain-types/PendleMerkleDistributor.ts +611 -0
- package/typechain-types/PendleMsgReceiveEndpointUpg.ts +7 -6
- package/typechain-types/PendleMsgReceiverAppUpg.ts +125 -0
- package/typechain-types/PendleMsgSendEndpointUpg.ts +7 -6
- package/typechain-types/PendleMsgSenderAppUpg.ts +353 -0
- package/typechain-types/PendleMulticallOwnerV1.ts +271 -0
- package/typechain-types/PendlePYLpOracle.ts +7 -2
- package/typechain-types/PendleVotingControllerUpg.ts +7 -6
- package/typechain-types/factories/AddressProvider__factory.ts +202 -0
- package/typechain-types/factories/BalanceReader__factory.ts +8 -2
- package/typechain-types/factories/BaseSplitCodeFactoryContract__factory.ts +239 -0
- package/typechain-types/factories/BoringOwnableUpgradeableData__factory.ts +96 -0
- package/typechain-types/factories/BoringOwnableUpgradeable__deprecated__factory.ts +120 -0
- package/typechain-types/factories/BoringPYUsdChainlinkAssetOracle__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkSYOracle__factory.ts +1 -1
- package/typechain-types/factories/Broadcaster__factory.ts +8 -2
- package/typechain-types/factories/EmptyUUPS__factory.ts +256 -0
- package/typechain-types/factories/ExpiredLpPtRedeemer__factory.ts +1 -1
- package/typechain-types/factories/LimitRouterBase__factory.ts +5 -0
- package/typechain-types/factories/PendleChainlinkOracleFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkOracleWithQuote__factory.ts +1 -1
- package/typechain-types/factories/PendleChainlinkOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleCommonPoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendleCommonSYFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleExchangeRateOracle__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorV2__factory.ts +555 -0
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +8 -2
- package/typechain-types/factories/PendleGaugeControllerMainchainUpg__factory.ts +8 -2
- package/typechain-types/factories/PendleGaugeControllerSidechainUpg__factory.ts +8 -2
- package/typechain-types/factories/PendleLPWrapperFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleLimitRouter__factory.ts +6 -1
- package/typechain-types/factories/PendleMarketFactoryV3__factory.ts +1 -1
- package/typechain-types/factories/PendleMarketFactory__factory.ts +1 -1
- package/typechain-types/factories/PendleMerkleDistributor__factory.ts +494 -0
- package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +8 -2
- package/typechain-types/factories/PendleMsgReceiverAppUpg__factory.ts +67 -0
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +8 -2
- package/typechain-types/factories/PendleMsgSenderAppUpg__factory.ts +193 -0
- package/typechain-types/factories/PendleMultiTokenMerkleDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleMulticallOwnerV1__factory.ts +215 -0
- package/typechain-types/factories/PendlePYLpOracle__factory.ts +6 -1
- package/typechain-types/factories/PendlePoolDeployHelperV2__factory.ts +1 -1
- package/typechain-types/factories/PendleSwap__factory.ts +1 -1
- package/typechain-types/factories/PendleVotingControllerUpg__factory.ts +8 -2
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/factories/VotingEscrowPendleSidechain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +27 -45
- package/typechain-types/index.ts +6 -10
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributor.sol/PendleFeeDistributor.json +0 -592
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.dbg.json +0 -4
- package/build/artifacts/contracts/LiquidityMining/VeDistributor/PendleFeeDistributorV2.sol/PendleFeeDistributorV2.json +0 -492
- package/build/artifacts/contracts/core/Market/v1/PendleMarket.sol/PendleMarket.dbg.json +0 -4
- package/build/artifacts/contracts/core/Market/v1/PendleMarket.sol/PendleMarket.json +0 -1139
- package/build/artifacts/contracts/core/Market/v1/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +0 -4
- package/build/artifacts/contracts/core/Market/v1/PendleMarketFactory.sol/PendleMarketFactory.json +0 -664
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.dbg.json +0 -4
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeable.json +0 -99
- package/build/artifacts/contracts/core/libraries/BoringOwnableUpgradeable.sol/BoringOwnableUpgradeableData.dbg.json +0 -4
- package/contracts/core/Market/v1/PendleMarket.sol +0 -348
- package/contracts/core/Market/v1/PendleMarketFactory.sol +0 -154
- package/contracts/core/libraries/BoringOwnableUpgradeable.sol +0 -58
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-artifact-1",
|
|
3
|
-
"contractName": "BoringOwnableUpgradeable",
|
|
4
|
-
"sourceName": "contracts/core/libraries/BoringOwnableUpgradeable.sol",
|
|
5
|
-
"abi": [
|
|
6
|
-
{
|
|
7
|
-
"anonymous": false,
|
|
8
|
-
"inputs": [
|
|
9
|
-
{
|
|
10
|
-
"indexed": false,
|
|
11
|
-
"internalType": "uint8",
|
|
12
|
-
"name": "version",
|
|
13
|
-
"type": "uint8"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"name": "Initialized",
|
|
17
|
-
"type": "event"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"anonymous": false,
|
|
21
|
-
"inputs": [
|
|
22
|
-
{
|
|
23
|
-
"indexed": true,
|
|
24
|
-
"internalType": "address",
|
|
25
|
-
"name": "previousOwner",
|
|
26
|
-
"type": "address"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"indexed": true,
|
|
30
|
-
"internalType": "address",
|
|
31
|
-
"name": "newOwner",
|
|
32
|
-
"type": "address"
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
"name": "OwnershipTransferred",
|
|
36
|
-
"type": "event"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"inputs": [],
|
|
40
|
-
"name": "claimOwnership",
|
|
41
|
-
"outputs": [],
|
|
42
|
-
"stateMutability": "nonpayable",
|
|
43
|
-
"type": "function"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"inputs": [],
|
|
47
|
-
"name": "owner",
|
|
48
|
-
"outputs": [
|
|
49
|
-
{
|
|
50
|
-
"internalType": "address",
|
|
51
|
-
"name": "",
|
|
52
|
-
"type": "address"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
"stateMutability": "view",
|
|
56
|
-
"type": "function"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"inputs": [],
|
|
60
|
-
"name": "pendingOwner",
|
|
61
|
-
"outputs": [
|
|
62
|
-
{
|
|
63
|
-
"internalType": "address",
|
|
64
|
-
"name": "",
|
|
65
|
-
"type": "address"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"stateMutability": "view",
|
|
69
|
-
"type": "function"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"inputs": [
|
|
73
|
-
{
|
|
74
|
-
"internalType": "address",
|
|
75
|
-
"name": "newOwner",
|
|
76
|
-
"type": "address"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"internalType": "bool",
|
|
80
|
-
"name": "direct",
|
|
81
|
-
"type": "bool"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"internalType": "bool",
|
|
85
|
-
"name": "renounce",
|
|
86
|
-
"type": "bool"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"name": "transferOwnership",
|
|
90
|
-
"outputs": [],
|
|
91
|
-
"stateMutability": "nonpayable",
|
|
92
|
-
"type": "function"
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"bytecode": "0x",
|
|
96
|
-
"deployedBytecode": "0x",
|
|
97
|
-
"linkReferences": {},
|
|
98
|
-
"deployedLinkReferences": {}
|
|
99
|
-
}
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.17;
|
|
3
|
-
|
|
4
|
-
import "../../../interfaces/IPMarket.sol";
|
|
5
|
-
import "../../../interfaces/IPMarketFactory.sol";
|
|
6
|
-
import "../../../interfaces/IPMarketSwapCallback.sol";
|
|
7
|
-
|
|
8
|
-
import "../../erc20/PendleERC20.sol";
|
|
9
|
-
import "../PendleGauge.sol";
|
|
10
|
-
import "../OracleLib.sol";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
Invariance to maintain:
|
|
14
|
-
- Internal balances totalPt & totalSy not interfered by people transferring tokens in directly
|
|
15
|
-
- address(0) & address(this) should never have any rewards & activeBalance accounting done. This is
|
|
16
|
-
guaranteed by address(0) & address(this) check in each updateForTwo function
|
|
17
|
-
*/
|
|
18
|
-
contract PendleMarket is PendleERC20, PendleGauge, IPMarket {
|
|
19
|
-
using PMath for uint256;
|
|
20
|
-
using PMath for int256;
|
|
21
|
-
using MarketMathCore for MarketState;
|
|
22
|
-
using SafeERC20 for IERC20;
|
|
23
|
-
using PYIndexLib for IPYieldToken;
|
|
24
|
-
using OracleLib for OracleLib.Observation[65535];
|
|
25
|
-
|
|
26
|
-
struct MarketStorage {
|
|
27
|
-
int128 totalPt;
|
|
28
|
-
int128 totalSy;
|
|
29
|
-
// 1 SLOT = 256 bits
|
|
30
|
-
uint96 lastLnImpliedRate;
|
|
31
|
-
uint16 observationIndex;
|
|
32
|
-
uint16 observationCardinality;
|
|
33
|
-
uint16 observationCardinalityNext;
|
|
34
|
-
// 1 SLOT = 144 bits
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
string private constant NAME = "Pendle Market";
|
|
38
|
-
string private constant SYMBOL = "PENDLE-LPT";
|
|
39
|
-
|
|
40
|
-
IPPrincipalToken internal immutable PT;
|
|
41
|
-
IStandardizedYield internal immutable SY;
|
|
42
|
-
IPYieldToken internal immutable YT;
|
|
43
|
-
|
|
44
|
-
address public immutable factory;
|
|
45
|
-
uint256 public immutable expiry;
|
|
46
|
-
int256 public immutable scalarRoot;
|
|
47
|
-
int256 public immutable initialAnchor;
|
|
48
|
-
|
|
49
|
-
MarketStorage public _storage;
|
|
50
|
-
|
|
51
|
-
OracleLib.Observation[65535] public observations;
|
|
52
|
-
|
|
53
|
-
modifier notExpired() {
|
|
54
|
-
if (isExpired()) revert Errors.MarketExpired();
|
|
55
|
-
_;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
constructor(
|
|
59
|
-
address _PT,
|
|
60
|
-
int256 _scalarRoot,
|
|
61
|
-
int256 _initialAnchor,
|
|
62
|
-
address _vePendle,
|
|
63
|
-
address _gaugeController
|
|
64
|
-
) PendleERC20(NAME, SYMBOL, 18) PendleGauge(IPPrincipalToken(_PT).SY(), _vePendle, _gaugeController) {
|
|
65
|
-
PT = IPPrincipalToken(_PT);
|
|
66
|
-
SY = IStandardizedYield(PT.SY());
|
|
67
|
-
YT = IPYieldToken(PT.YT());
|
|
68
|
-
|
|
69
|
-
(_storage.observationCardinality, _storage.observationCardinalityNext) = observations.initialize(
|
|
70
|
-
uint32(block.timestamp)
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
if (_scalarRoot <= 0) revert Errors.MarketScalarRootBelowZero(_scalarRoot);
|
|
74
|
-
|
|
75
|
-
scalarRoot = _scalarRoot;
|
|
76
|
-
initialAnchor = _initialAnchor;
|
|
77
|
-
expiry = IPPrincipalToken(_PT).expiry();
|
|
78
|
-
factory = msg.sender;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which
|
|
83
|
-
* will grant LP holders more exchange fee over time
|
|
84
|
-
* @dev will mint as much LP as possible such that the corresponding SY and PT used do
|
|
85
|
-
* not exceed `netSyDesired` and `netPtDesired`, respectively
|
|
86
|
-
* @dev PT and SY should be transferred to this contract prior to calling
|
|
87
|
-
* @dev will revert if PT is expired
|
|
88
|
-
*/
|
|
89
|
-
function mint(
|
|
90
|
-
address receiver,
|
|
91
|
-
uint256 netSyDesired,
|
|
92
|
-
uint256 netPtDesired
|
|
93
|
-
) external nonReentrant notExpired returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed) {
|
|
94
|
-
MarketState memory market = readState(msg.sender);
|
|
95
|
-
PYIndex index = YT.newIndex();
|
|
96
|
-
|
|
97
|
-
uint256 lpToReserve;
|
|
98
|
-
|
|
99
|
-
(lpToReserve, netLpOut, netSyUsed, netPtUsed) = market.addLiquidity(
|
|
100
|
-
netSyDesired,
|
|
101
|
-
netPtDesired,
|
|
102
|
-
block.timestamp
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
// initializing the market
|
|
106
|
-
if (lpToReserve != 0) {
|
|
107
|
-
market.setInitialLnImpliedRate(index, initialAnchor, block.timestamp);
|
|
108
|
-
_mint(address(1), lpToReserve);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
_mint(receiver, netLpOut);
|
|
112
|
-
|
|
113
|
-
_writeState(market);
|
|
114
|
-
|
|
115
|
-
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
116
|
-
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
117
|
-
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
118
|
-
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
119
|
-
|
|
120
|
-
emit Mint(receiver, netLpOut, netSyUsed, netPtUsed);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @notice LP Holders can burn their LP to receive back SY & PT proportionally
|
|
125
|
-
* to their share of the market
|
|
126
|
-
*/
|
|
127
|
-
function burn(
|
|
128
|
-
address receiverSy,
|
|
129
|
-
address receiverPt,
|
|
130
|
-
uint256 netLpToBurn
|
|
131
|
-
) external nonReentrant returns (uint256 netSyOut, uint256 netPtOut) {
|
|
132
|
-
MarketState memory market = readState(msg.sender);
|
|
133
|
-
|
|
134
|
-
_burn(address(this), netLpToBurn);
|
|
135
|
-
|
|
136
|
-
(netSyOut, netPtOut) = market.removeLiquidity(netLpToBurn);
|
|
137
|
-
|
|
138
|
-
if (receiverSy != address(this)) IERC20(SY).safeTransfer(receiverSy, netSyOut);
|
|
139
|
-
if (receiverPt != address(this)) IERC20(PT).safeTransfer(receiverPt, netPtOut);
|
|
140
|
-
|
|
141
|
-
_writeState(market);
|
|
142
|
-
|
|
143
|
-
emit Burn(receiverSy, receiverPt, netLpToBurn, netSyOut, netPtOut);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
148
|
-
* aims to swap an exact amount of PT to SY.
|
|
149
|
-
* @dev steps working of this contract
|
|
150
|
-
- The outcome amount of SY will be precomputed by MarketMathLib
|
|
151
|
-
- Release the calculated amount of SY to receiver
|
|
152
|
-
- Callback to msg.sender if data.length > 0
|
|
153
|
-
- Ensure exactPtIn amount of PT has been transferred to this address
|
|
154
|
-
* @dev will revert if PT is expired
|
|
155
|
-
* @param data bytes data to be sent in the callback (if any)
|
|
156
|
-
*/
|
|
157
|
-
function swapExactPtForSy(
|
|
158
|
-
address receiver,
|
|
159
|
-
uint256 exactPtIn,
|
|
160
|
-
bytes calldata data
|
|
161
|
-
) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyFee) {
|
|
162
|
-
MarketState memory market = readState(msg.sender);
|
|
163
|
-
|
|
164
|
-
uint256 netSyToReserve;
|
|
165
|
-
(netSyOut, netSyFee, netSyToReserve) = market.swapExactPtForSy(YT.newIndex(), exactPtIn, block.timestamp);
|
|
166
|
-
|
|
167
|
-
if (receiver != address(this)) IERC20(SY).safeTransfer(receiver, netSyOut);
|
|
168
|
-
IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
|
|
169
|
-
|
|
170
|
-
_writeState(market);
|
|
171
|
-
|
|
172
|
-
if (data.length > 0) {
|
|
173
|
-
IPMarketSwapCallback(msg.sender).swapCallback(exactPtIn.neg(), netSyOut.Int(), data);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (_selfBalance(PT) < market.totalPt.Uint())
|
|
177
|
-
revert Errors.MarketInsufficientPtReceived(_selfBalance(PT), market.totalPt.Uint());
|
|
178
|
-
|
|
179
|
-
emit Swap(msg.sender, receiver, exactPtIn.neg(), netSyOut.Int(), netSyFee, netSyToReserve);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* @notice Pendle Market allows swaps between PT & SY it is holding. This function
|
|
184
|
-
* aims to swap SY for an exact amount of PT.
|
|
185
|
-
* @dev steps working of this function
|
|
186
|
-
- The exact outcome amount of PT will be transferred to receiver
|
|
187
|
-
- Callback to msg.sender if data.length > 0
|
|
188
|
-
- Ensure the calculated required amount of SY is transferred to this address
|
|
189
|
-
* @dev will revert if PT is expired
|
|
190
|
-
* @param data bytes data to be sent in the callback (if any)
|
|
191
|
-
*/
|
|
192
|
-
function swapSyForExactPt(
|
|
193
|
-
address receiver,
|
|
194
|
-
uint256 exactPtOut,
|
|
195
|
-
bytes calldata data
|
|
196
|
-
) external nonReentrant notExpired returns (uint256 netSyIn, uint256 netSyFee) {
|
|
197
|
-
MarketState memory market = readState(msg.sender);
|
|
198
|
-
|
|
199
|
-
uint256 netSyToReserve;
|
|
200
|
-
(netSyIn, netSyFee, netSyToReserve) = market.swapSyForExactPt(YT.newIndex(), exactPtOut, block.timestamp);
|
|
201
|
-
|
|
202
|
-
if (receiver != address(this)) IERC20(PT).safeTransfer(receiver, exactPtOut);
|
|
203
|
-
IERC20(SY).safeTransfer(market.treasury, netSyToReserve);
|
|
204
|
-
|
|
205
|
-
_writeState(market);
|
|
206
|
-
|
|
207
|
-
if (data.length > 0) {
|
|
208
|
-
IPMarketSwapCallback(msg.sender).swapCallback(exactPtOut.Int(), netSyIn.neg(), data);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// have received enough SY
|
|
212
|
-
if (_selfBalance(SY) < market.totalSy.Uint())
|
|
213
|
-
revert Errors.MarketInsufficientSyReceived(_selfBalance(SY), market.totalSy.Uint());
|
|
214
|
-
|
|
215
|
-
emit Swap(msg.sender, receiver, exactPtOut.Int(), netSyIn.neg(), netSyFee, netSyToReserve);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/// @notice forces balances to match reserves
|
|
219
|
-
function skim() external nonReentrant {
|
|
220
|
-
MarketState memory market = readState(msg.sender);
|
|
221
|
-
uint256 excessPt = _selfBalance(PT) - market.totalPt.Uint();
|
|
222
|
-
uint256 excessSy = _selfBalance(SY) - market.totalSy.Uint();
|
|
223
|
-
if (excessPt != 0) IERC20(PT).safeTransfer(market.treasury, excessPt);
|
|
224
|
-
if (excessSy != 0) IERC20(SY).safeTransfer(market.treasury, excessSy);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* @notice redeems the user's reward
|
|
229
|
-
* @return amount of reward token redeemed, in the same order as `getRewardTokens()`
|
|
230
|
-
*/
|
|
231
|
-
function redeemRewards(address user) external nonReentrant returns (uint256[] memory) {
|
|
232
|
-
return _redeemRewards(user);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/// @notice returns the list of reward tokens
|
|
236
|
-
function getRewardTokens() external view returns (address[] memory) {
|
|
237
|
-
return _getRewardTokens();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/*///////////////////////////////////////////////////////////////
|
|
241
|
-
ORACLE
|
|
242
|
-
//////////////////////////////////////////////////////////////*/
|
|
243
|
-
|
|
244
|
-
function observe(uint32[] memory secondsAgos) external view returns (uint216[] memory lnImpliedRateCumulative) {
|
|
245
|
-
return
|
|
246
|
-
observations.observe(
|
|
247
|
-
uint32(block.timestamp),
|
|
248
|
-
secondsAgos,
|
|
249
|
-
_storage.lastLnImpliedRate,
|
|
250
|
-
_storage.observationIndex,
|
|
251
|
-
_storage.observationCardinality
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function increaseObservationsCardinalityNext(uint16 cardinalityNext) external nonReentrant {
|
|
256
|
-
uint16 cardinalityNextOld = _storage.observationCardinalityNext;
|
|
257
|
-
uint16 cardinalityNextNew = observations.grow(cardinalityNextOld, cardinalityNext);
|
|
258
|
-
if (cardinalityNextOld != cardinalityNextNew) {
|
|
259
|
-
_storage.observationCardinalityNext = cardinalityNextNew;
|
|
260
|
-
emit IncreaseObservationCardinalityNext(cardinalityNextOld, cardinalityNextNew);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/*///////////////////////////////////////////////////////////////
|
|
265
|
-
READ/WRITE STATES
|
|
266
|
-
//////////////////////////////////////////////////////////////*/
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @notice read the state of the market from storage into memory for gas-efficient manipulation
|
|
270
|
-
*/
|
|
271
|
-
function readState(address router) public view returns (MarketState memory market) {
|
|
272
|
-
market.totalPt = _storage.totalPt;
|
|
273
|
-
market.totalSy = _storage.totalSy;
|
|
274
|
-
market.totalLp = totalSupply().Int();
|
|
275
|
-
|
|
276
|
-
(market.treasury, market.lnFeeRateRoot, market.reserveFeePercent) = IPMarketFactory(factory).getMarketConfig(
|
|
277
|
-
router
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
market.scalarRoot = scalarRoot;
|
|
281
|
-
market.expiry = expiry;
|
|
282
|
-
|
|
283
|
-
market.lastLnImpliedRate = _storage.lastLnImpliedRate;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/// @notice write back the state of the market from memory to storage
|
|
287
|
-
function _writeState(MarketState memory market) internal {
|
|
288
|
-
uint96 lastLnImpliedRate96 = market.lastLnImpliedRate.Uint96();
|
|
289
|
-
int128 totalPt128 = market.totalPt.Int128();
|
|
290
|
-
int128 totalSy128 = market.totalSy.Int128();
|
|
291
|
-
|
|
292
|
-
(uint16 observationIndex, uint16 observationCardinality) = observations.write(
|
|
293
|
-
_storage.observationIndex,
|
|
294
|
-
uint32(block.timestamp),
|
|
295
|
-
_storage.lastLnImpliedRate,
|
|
296
|
-
_storage.observationCardinality,
|
|
297
|
-
_storage.observationCardinalityNext
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
_storage.totalPt = totalPt128;
|
|
301
|
-
_storage.totalSy = totalSy128;
|
|
302
|
-
_storage.lastLnImpliedRate = lastLnImpliedRate96;
|
|
303
|
-
_storage.observationIndex = observationIndex;
|
|
304
|
-
_storage.observationCardinality = observationCardinality;
|
|
305
|
-
|
|
306
|
-
emit UpdateImpliedRate(block.timestamp, market.lastLnImpliedRate);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/*///////////////////////////////////////////////////////////////
|
|
310
|
-
TRIVIAL FUNCTIONS
|
|
311
|
-
//////////////////////////////////////////////////////////////*/
|
|
312
|
-
|
|
313
|
-
function readTokens() external view returns (IStandardizedYield _SY, IPPrincipalToken _PT, IPYieldToken _YT) {
|
|
314
|
-
_SY = SY;
|
|
315
|
-
_PT = PT;
|
|
316
|
-
_YT = YT;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
function isExpired() public view returns (bool) {
|
|
320
|
-
return MiniHelpers.isCurrentlyExpired(expiry);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/*///////////////////////////////////////////////////////////////
|
|
324
|
-
PENDLE GAUGE - RELATED
|
|
325
|
-
//////////////////////////////////////////////////////////////*/
|
|
326
|
-
|
|
327
|
-
function _stakedBalance(address user) internal view override returns (uint256) {
|
|
328
|
-
return balanceOf(user);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function _totalStaked() internal view override returns (uint256) {
|
|
332
|
-
return totalSupply();
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// solhint-disable-next-line ordering
|
|
336
|
-
function _beforeTokenTransfer(
|
|
337
|
-
address from,
|
|
338
|
-
address to,
|
|
339
|
-
uint256 amount
|
|
340
|
-
) internal override(PendleERC20, PendleGauge) {
|
|
341
|
-
PendleGauge._beforeTokenTransfer(from, to, amount);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// solhint-disable-next-line ordering
|
|
345
|
-
function _afterTokenTransfer(address from, address to, uint256 amount) internal override(PendleERC20, PendleGauge) {
|
|
346
|
-
PendleGauge._afterTokenTransfer(from, to, amount);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.17;
|
|
3
|
-
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
4
|
-
|
|
5
|
-
import "../../../interfaces/IPMarket.sol";
|
|
6
|
-
import "../../../interfaces/IPYieldContractFactory.sol";
|
|
7
|
-
import "../../../interfaces/IPMarketFactory.sol";
|
|
8
|
-
|
|
9
|
-
import "../../libraries/BaseSplitCodeFactory.sol";
|
|
10
|
-
import "../../libraries/Errors.sol";
|
|
11
|
-
import "../../libraries/BoringOwnableUpgradeable.sol";
|
|
12
|
-
|
|
13
|
-
contract PendleMarketFactory is BoringOwnableUpgradeable, IPMarketFactory {
|
|
14
|
-
using EnumerableSet for EnumerableSet.AddressSet;
|
|
15
|
-
|
|
16
|
-
address public immutable marketCreationCodeContractA;
|
|
17
|
-
uint256 public immutable marketCreationCodeSizeA;
|
|
18
|
-
address public immutable marketCreationCodeContractB;
|
|
19
|
-
uint256 public immutable marketCreationCodeSizeB;
|
|
20
|
-
|
|
21
|
-
address public immutable yieldContractFactory;
|
|
22
|
-
uint256 public immutable maxLnFeeRateRoot;
|
|
23
|
-
uint8 public constant maxReserveFeePercent = 100;
|
|
24
|
-
int256 public constant minInitialAnchor = PMath.IONE;
|
|
25
|
-
|
|
26
|
-
address public treasury;
|
|
27
|
-
FeeConfig public defaultFee;
|
|
28
|
-
/// 1 SLOT
|
|
29
|
-
|
|
30
|
-
// router -> overriddenFee
|
|
31
|
-
mapping(address => FeeConfig) public overriddenFee;
|
|
32
|
-
|
|
33
|
-
// PT -> scalarRoot -> initialAnchor
|
|
34
|
-
mapping(address => mapping(int256 => mapping(int256 => address))) internal markets;
|
|
35
|
-
EnumerableSet.AddressSet internal allMarkets;
|
|
36
|
-
address public vePendle;
|
|
37
|
-
address public gaugeController;
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
address _yieldContractFactory,
|
|
41
|
-
address _marketCreationCodeContractA,
|
|
42
|
-
uint256 _marketCreationCodeSizeA,
|
|
43
|
-
address _marketCreationCodeContractB,
|
|
44
|
-
uint256 _marketCreationCodeSizeB
|
|
45
|
-
) {
|
|
46
|
-
yieldContractFactory = _yieldContractFactory;
|
|
47
|
-
maxLnFeeRateRoot = uint256(LogExpMath.ln(int256((105 * PMath.IONE) / 100))); // ln(1.05)
|
|
48
|
-
|
|
49
|
-
marketCreationCodeContractA = _marketCreationCodeContractA;
|
|
50
|
-
marketCreationCodeSizeA = _marketCreationCodeSizeA;
|
|
51
|
-
marketCreationCodeContractB = _marketCreationCodeContractB;
|
|
52
|
-
marketCreationCodeSizeB = _marketCreationCodeSizeB;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function initialize(
|
|
56
|
-
address _treasury,
|
|
57
|
-
uint80 _defaultLnFeeRateRoot,
|
|
58
|
-
uint8 _defaultReserveFeePercent,
|
|
59
|
-
address newVePendle,
|
|
60
|
-
address newGaugeController
|
|
61
|
-
) external initializer {
|
|
62
|
-
__BoringOwnable_init();
|
|
63
|
-
setTreasury(_treasury);
|
|
64
|
-
setDefaultFee(_defaultLnFeeRateRoot, _defaultReserveFeePercent);
|
|
65
|
-
|
|
66
|
-
vePendle = newVePendle;
|
|
67
|
-
gaugeController = newGaugeController;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @notice Create a market between PT and its corresponding SY with scalar & anchor config.
|
|
72
|
-
* Anyone is allowed to create a market on their own.
|
|
73
|
-
*/
|
|
74
|
-
function createNewMarket(address PT, int256 scalarRoot, int256 initialAnchor) external returns (address market) {
|
|
75
|
-
if (!IPYieldContractFactory(yieldContractFactory).isPT(PT)) revert Errors.MarketFactoryInvalidPt();
|
|
76
|
-
if (IPPrincipalToken(PT).isExpired()) revert Errors.MarketFactoryExpiredPt();
|
|
77
|
-
|
|
78
|
-
if (markets[PT][scalarRoot][initialAnchor] != address(0)) revert Errors.MarketFactoryMarketExists();
|
|
79
|
-
|
|
80
|
-
if (initialAnchor < minInitialAnchor)
|
|
81
|
-
revert Errors.MarketFactoryInitialAnchorTooLow(initialAnchor, minInitialAnchor);
|
|
82
|
-
|
|
83
|
-
market = BaseSplitCodeFactory._create2(
|
|
84
|
-
0,
|
|
85
|
-
bytes32(block.chainid),
|
|
86
|
-
abi.encode(PT, scalarRoot, initialAnchor, vePendle, gaugeController),
|
|
87
|
-
marketCreationCodeContractA,
|
|
88
|
-
marketCreationCodeSizeA,
|
|
89
|
-
marketCreationCodeContractB,
|
|
90
|
-
marketCreationCodeSizeB
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
markets[PT][scalarRoot][initialAnchor] = market;
|
|
94
|
-
|
|
95
|
-
if (!allMarkets.add(market)) assert(false);
|
|
96
|
-
|
|
97
|
-
emit CreateNewMarket(market, PT, scalarRoot, initialAnchor);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function getMarketConfig(
|
|
101
|
-
address router
|
|
102
|
-
) external view returns (address _treasury, uint80 _lnFeeRateRoot, uint8 _reserveFeePercent) {
|
|
103
|
-
(_treasury, _lnFeeRateRoot, _reserveFeePercent) = (
|
|
104
|
-
treasury,
|
|
105
|
-
defaultFee.lnFeeRateRoot,
|
|
106
|
-
defaultFee.reserveFeePercent
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
FeeConfig memory over = overriddenFee[router];
|
|
110
|
-
if (over.active) {
|
|
111
|
-
(_lnFeeRateRoot, _reserveFeePercent) = (over.lnFeeRateRoot, over.reserveFeePercent);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/// @dev for gas-efficient verification of market
|
|
116
|
-
function isValidMarket(address market) external view returns (bool) {
|
|
117
|
-
return allMarkets.contains(market);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function setTreasury(address newTreasury) public onlyOwner {
|
|
121
|
-
if (newTreasury == address(0)) revert Errors.MarketFactoryZeroTreasury();
|
|
122
|
-
|
|
123
|
-
treasury = newTreasury;
|
|
124
|
-
_emitNewMarketConfigEvent();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function setDefaultFee(uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) public onlyOwner {
|
|
128
|
-
_verifyFeeConfig(newLnFeeRateRoot, newReserveFeePercent);
|
|
129
|
-
defaultFee = FeeConfig(newLnFeeRateRoot, newReserveFeePercent, true);
|
|
130
|
-
_emitNewMarketConfigEvent();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function setOverriddenFee(address router, uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) public onlyOwner {
|
|
134
|
-
_verifyFeeConfig(newLnFeeRateRoot, newReserveFeePercent);
|
|
135
|
-
overriddenFee[router] = FeeConfig(newLnFeeRateRoot, newReserveFeePercent, true);
|
|
136
|
-
emit SetOverriddenFee(router, newLnFeeRateRoot, newReserveFeePercent);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function unsetOverriddenFee(address router) external onlyOwner {
|
|
140
|
-
delete overriddenFee[router];
|
|
141
|
-
emit UnsetOverriddenFee(router);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _verifyFeeConfig(uint80 newLnFeeRateRoot, uint8 newReserveFeePercent) internal view {
|
|
145
|
-
if (newLnFeeRateRoot > maxLnFeeRateRoot)
|
|
146
|
-
revert Errors.MarketFactoryLnFeeRateRootTooHigh(newLnFeeRateRoot, maxLnFeeRateRoot);
|
|
147
|
-
if (newReserveFeePercent > maxReserveFeePercent)
|
|
148
|
-
revert Errors.MarketFactoryReserveFeePercentTooHigh(newReserveFeePercent, maxReserveFeePercent);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function _emitNewMarketConfigEvent() internal {
|
|
152
|
-
emit NewMarketConfig(treasury, defaultFee.lnFeeRateRoot, defaultFee.reserveFeePercent);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
5
|
-
|
|
6
|
-
contract BoringOwnableUpgradeableData {
|
|
7
|
-
address public owner;
|
|
8
|
-
address public pendingOwner;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
abstract contract BoringOwnableUpgradeable is BoringOwnableUpgradeableData, Initializable {
|
|
12
|
-
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
13
|
-
|
|
14
|
-
function __BoringOwnable_init() internal onlyInitializing {
|
|
15
|
-
owner = msg.sender;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
|
|
19
|
-
/// Can only be invoked by the current `owner`.
|
|
20
|
-
/// @param newOwner Address of the new owner.
|
|
21
|
-
/// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
|
|
22
|
-
/// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
|
|
23
|
-
function transferOwnership(address newOwner, bool direct, bool renounce) public onlyOwner {
|
|
24
|
-
if (direct) {
|
|
25
|
-
// Checks
|
|
26
|
-
require(newOwner != address(0) || renounce, "Ownable: zero address");
|
|
27
|
-
|
|
28
|
-
// Effects
|
|
29
|
-
emit OwnershipTransferred(owner, newOwner);
|
|
30
|
-
owner = newOwner;
|
|
31
|
-
pendingOwner = address(0);
|
|
32
|
-
} else {
|
|
33
|
-
// Effects
|
|
34
|
-
pendingOwner = newOwner;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/// @notice Needs to be called by `pendingOwner` to claim ownership.
|
|
39
|
-
function claimOwnership() public {
|
|
40
|
-
address _pendingOwner = pendingOwner;
|
|
41
|
-
|
|
42
|
-
// Checks
|
|
43
|
-
require(msg.sender == _pendingOwner, "Ownable: caller != pending owner");
|
|
44
|
-
|
|
45
|
-
// Effects
|
|
46
|
-
emit OwnershipTransferred(owner, _pendingOwner);
|
|
47
|
-
owner = _pendingOwner;
|
|
48
|
-
pendingOwner = address(0);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/// @notice Only allows the `owner` to execute the function.
|
|
52
|
-
modifier onlyOwner() {
|
|
53
|
-
require(msg.sender == owner, "Ownable: caller is not the owner");
|
|
54
|
-
_;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
uint256[48] private __gap;
|
|
58
|
-
}
|