@pendle/core-v2 0.1.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/LICENSE +100 -0
- package/contracts/SuperComposableYield/ISuperComposableYield.sol +68 -0
- package/contracts/SuperComposableYield/SCYUtils.sol +14 -0
- package/contracts/SuperComposableYield/implementations/RewardManager.sol +117 -0
- package/contracts/SuperComposableYield/implementations/SCYBase.sol +126 -0
- package/contracts/SuperComposableYield/implementations/SCYBaseWithRewards.sol +79 -0
- package/contracts/core/PendleBaseToken.sol +39 -0
- package/contracts/core/PendleMarket.sol +248 -0
- package/contracts/core/PendleMarketFactory.sol +60 -0
- package/contracts/core/PendleOwnershipToken.sol +44 -0
- package/contracts/core/PendleSCYImpl/AaveV3/PendleAaveV3SCY.sol +139 -0
- package/contracts/core/PendleSCYImpl/AaveV3/WadRayMath.sol +126 -0
- package/contracts/core/PendleSCYImpl/PendleBenQiErc20SCY.sol +127 -0
- package/contracts/core/PendleSCYImpl/PendleBtrflySCY.sol +125 -0
- package/contracts/core/PendleSCYImpl/PendleYearnVaultSCY.sol +115 -0
- package/contracts/core/PendleYieldContractFactory.sol +109 -0
- package/contracts/core/PendleYieldToken.sol +240 -0
- package/contracts/core/misc/BoringOwnable.sol +62 -0
- package/contracts/core/misc/BoringOwnableUpg.sol +64 -0
- package/contracts/core/misc/PendleJoeSwapHelperUpg.sol +82 -0
- package/contracts/core/router/PendleRouterCoreUpg.sol +219 -0
- package/contracts/core/router/PendleRouterProxy.sol +64 -0
- package/contracts/core/router/PendleRouterYTUpg.sol +134 -0
- package/contracts/core/router/base/PendleRouterOTBaseUpg.sol +218 -0
- package/contracts/core/router/base/PendleRouterSCYAndForgeBaseUpg.sol +141 -0
- package/contracts/core/router/base/PendleRouterYTBaseUpg.sol +212 -0
- package/contracts/interfaces/IAToken.sol +34 -0
- package/contracts/interfaces/IAavePool.sol +41 -0
- package/contracts/interfaces/IAaveRewardsController.sol +32 -0
- package/contracts/interfaces/IBenQiComptroller.sol +33 -0
- package/contracts/interfaces/IJoePair.sol +98 -0
- package/contracts/interfaces/IJoeRouter01.sol +162 -0
- package/contracts/interfaces/IPBaseToken.sol +9 -0
- package/contracts/interfaces/IPFlashCallBack.sol +10 -0
- package/contracts/interfaces/IPGovernanceManager.sol +28 -0
- package/contracts/interfaces/IPMarket.sol +57 -0
- package/contracts/interfaces/IPMarketAddRemoveCallback.sol +18 -0
- package/contracts/interfaces/IPMarketFactory.sol +8 -0
- package/contracts/interfaces/IPMarketSwapCallback.sol +10 -0
- package/contracts/interfaces/IPOwnershipToken.sol +15 -0
- package/contracts/interfaces/IPPermissionsV2.sol +28 -0
- package/contracts/interfaces/IPRouterCore.sol +108 -0
- package/contracts/interfaces/IPRouterYT.sol +47 -0
- package/contracts/interfaces/IPYieldContractFactory.sol +36 -0
- package/contracts/interfaces/IPYieldToken.sol +19 -0
- package/contracts/interfaces/IQiErc20.sol +35 -0
- package/contracts/interfaces/IQiToken.sol +29 -0
- package/contracts/interfaces/IREDACTEDStaking.sol +35 -0
- package/contracts/interfaces/IWETH.sol +34 -0
- package/contracts/interfaces/IWXBTRFLY.sol +37 -0
- package/contracts/interfaces/IYearnVault.sol +32 -0
- package/contracts/libraries/JoeLibrary.sol +121 -0
- package/contracts/libraries/SCYIndex.sol +55 -0
- package/contracts/libraries/helpers/ExpiryUtilsLib.sol +166 -0
- package/contracts/libraries/math/FixedPoint.sol +208 -0
- package/contracts/libraries/math/LogExpMath.sol +515 -0
- package/contracts/libraries/math/MarketApproxLib.sol +140 -0
- package/contracts/libraries/math/MarketMathLib.sol +606 -0
- package/contracts/periphery/PendleGovernanceManager.sol +36 -0
- package/contracts/periphery/PermissionsV2.sol +23 -0
- package/package.json +76 -0
- package/typechain-types/BoringOwnable.ts +194 -0
- package/typechain-types/BoringOwnableData.ts +100 -0
- package/typechain-types/BoringOwnableUpg.ts +194 -0
- package/typechain-types/BoringOwnableUpgData.ts +100 -0
- package/typechain-types/ERC1967UpgradeUpgradeable.ts +97 -0
- package/typechain-types/ERC20.ts +417 -0
- package/typechain-types/IAToken.ts +331 -0
- package/typechain-types/IAavePool.ts +192 -0
- package/typechain-types/IAaveRewardsController.ts +148 -0
- package/typechain-types/IBeaconUpgradeable.ts +87 -0
- package/typechain-types/IBenQiComptroller.ts +125 -0
- package/typechain-types/IERC1822ProxiableUpgradeable.ts +87 -0
- package/typechain-types/IERC20.ts +300 -0
- package/typechain-types/IERC20Metadata.ts +339 -0
- package/typechain-types/IJoePair.ts +888 -0
- package/typechain-types/IJoeRouter01.ts +1107 -0
- package/typechain-types/IPBaseToken.ts +365 -0
- package/typechain-types/IPFlashCallback.ts +115 -0
- package/typechain-types/IPGovernanceManager.ts +84 -0
- package/typechain-types/IPMarket.ts +701 -0
- package/typechain-types/IPMarketAddRemoveCallback.ts +169 -0
- package/typechain-types/IPMarketFactory.ts +109 -0
- package/typechain-types/IPMarketSwapCallback.ts +115 -0
- package/typechain-types/IPOwnershipToken.ts +488 -0
- package/typechain-types/IPRouterCore.ts +759 -0
- package/typechain-types/IPRouterYT.ts +405 -0
- package/typechain-types/IPYieldContractFactory.ts +192 -0
- package/typechain-types/IPYieldToken.ts +525 -0
- package/typechain-types/IPermissionsV2.ts +87 -0
- package/typechain-types/IQiErc20.ts +402 -0
- package/typechain-types/IQiToken.ts +327 -0
- package/typechain-types/IREDACTEDStaking.ts +216 -0
- package/typechain-types/ISuperComposableYield.ts +652 -0
- package/typechain-types/IWETH.ts +380 -0
- package/typechain-types/IWXBTRFLY.ts +254 -0
- package/typechain-types/IYearnVault.ts +152 -0
- package/typechain-types/PendleAaveV3SCY.ts +901 -0
- package/typechain-types/PendleBaseToken.ts +505 -0
- package/typechain-types/PendleBenQiErc20SCY.ts +914 -0
- package/typechain-types/PendleBtrflyScy.ts +794 -0
- package/typechain-types/PendleGovernanceManager.ts +187 -0
- package/typechain-types/PendleJoeSwapHelperUpg.ts +97 -0
- package/typechain-types/PendleMarket.ts +1008 -0
- package/typechain-types/PendleMarketFactory.ts +246 -0
- package/typechain-types/PendleOwnershipToken.ts +628 -0
- package/typechain-types/PendleRouterCoreUpg.ts +780 -0
- package/typechain-types/PendleRouterProxy.ts +417 -0
- package/typechain-types/PendleRouterSCYAndForgeBaseUpg.ts +98 -0
- package/typechain-types/PendleRouterYTBaseUpg.ts +134 -0
- package/typechain-types/PendleRouterYTUpg.ts +453 -0
- package/typechain-types/PendleYearnVaultScy.ts +784 -0
- package/typechain-types/PendleYieldContractFactory.ts +479 -0
- package/typechain-types/PendleYieldToken.ts +1030 -0
- package/typechain-types/PermissionsV2.ts +87 -0
- package/typechain-types/Proxy.ts +57 -0
- package/typechain-types/RewardManager.ts +172 -0
- package/typechain-types/SCYBase.ts +734 -0
- package/typechain-types/SCYBaseWithRewards.ts +819 -0
- package/typechain-types/UUPSUpgradeable.ts +197 -0
- package/typechain-types/common.ts +44 -0
- package/typechain-types/factories/BoringOwnableData__factory.ts +90 -0
- package/typechain-types/factories/BoringOwnableUpgData__factory.ts +94 -0
- package/typechain-types/factories/BoringOwnableUpg__factory.ts +139 -0
- package/typechain-types/factories/BoringOwnable__factory.ts +149 -0
- package/typechain-types/factories/ERC1967UpgradeUpgradeable__factory.ts +75 -0
- package/typechain-types/factories/ERC20__factory.ts +348 -0
- package/typechain-types/factories/IAToken__factory.ts +225 -0
- package/typechain-types/factories/IAavePool__factory.ts +99 -0
- package/typechain-types/factories/IAaveRewardsController__factory.ts +78 -0
- package/typechain-types/factories/IBeaconUpgradeable__factory.ts +39 -0
- package/typechain-types/factories/IBenQiComptroller__factory.ts +59 -0
- package/typechain-types/factories/IERC1822ProxiableUpgradeable__factory.ts +43 -0
- package/typechain-types/factories/IERC20Metadata__factory.ts +248 -0
- package/typechain-types/factories/IERC20__factory.ts +203 -0
- package/typechain-types/factories/IJoePair__factory.ts +674 -0
- package/typechain-types/factories/IJoeRouter01__factory.ts +772 -0
- package/typechain-types/factories/IPBaseToken__factory.ts +271 -0
- package/typechain-types/factories/IPFlashCallback__factory.ts +49 -0
- package/typechain-types/factories/IPGovernanceManager__factory.ts +39 -0
- package/typechain-types/factories/IPMarketAddRemoveCallback__factory.ts +86 -0
- package/typechain-types/factories/IPMarketFactory__factory.ts +58 -0
- package/typechain-types/factories/IPMarketSwapCallback__factory.ts +53 -0
- package/typechain-types/factories/IPMarket__factory.ts +559 -0
- package/typechain-types/factories/IPOwnershipToken__factory.ts +349 -0
- package/typechain-types/factories/IPRouterCore__factory.ts +516 -0
- package/typechain-types/factories/IPRouterYT__factory.ts +246 -0
- package/typechain-types/factories/IPYieldContractFactory__factory.ts +117 -0
- package/typechain-types/factories/IPYieldToken__factory.ts +383 -0
- package/typechain-types/factories/IPermissionsV2__factory.ts +39 -0
- package/typechain-types/factories/IQiErc20__factory.ts +270 -0
- package/typechain-types/factories/IQiToken__factory.ts +219 -0
- package/typechain-types/factories/IREDACTEDStaking__factory.ts +107 -0
- package/typechain-types/factories/ISuperComposableYield__factory.ts +438 -0
- package/typechain-types/factories/IWETH__factory.ts +261 -0
- package/typechain-types/factories/IWXBTRFLY__factory.ts +131 -0
- package/typechain-types/factories/IYearnVault__factory.ts +74 -0
- package/typechain-types/factories/PendleAaveV3SCY__factory.ts +727 -0
- package/typechain-types/factories/PendleBaseToken__factory.ts +386 -0
- package/typechain-types/factories/PendleBenQiErc20SCY__factory.ts +753 -0
- package/typechain-types/factories/PendleBtrflyScy__factory.ts +652 -0
- package/typechain-types/factories/PendleGovernanceManager__factory.ts +149 -0
- package/typechain-types/factories/PendleJoeSwapHelperUpg__factory.ts +56 -0
- package/typechain-types/factories/PendleMarketFactory__factory.ts +207 -0
- package/typechain-types/factories/PendleMarket__factory.ts +891 -0
- package/typechain-types/factories/PendleOwnershipToken__factory.ts +565 -0
- package/typechain-types/factories/PendleRouterCoreUpg__factory.ts +620 -0
- package/typechain-types/factories/PendleRouterProxy__factory.ts +316 -0
- package/typechain-types/factories/PendleRouterSCYAndForgeBaseUpg__factory.ts +56 -0
- package/typechain-types/factories/PendleRouterYTBaseUpg__factory.ts +66 -0
- package/typechain-types/factories/PendleRouterYTUpg__factory.ts +363 -0
- package/typechain-types/factories/PendleYearnVaultScy__factory.ts +630 -0
- package/typechain-types/factories/PendleYieldContractFactory__factory.ts +368 -0
- package/typechain-types/factories/PendleYieldToken__factory.ts +814 -0
- package/typechain-types/factories/PermissionsV2__factory.ts +36 -0
- package/typechain-types/factories/Proxy__factory.ts +28 -0
- package/typechain-types/factories/RewardManager__factory.ts +89 -0
- package/typechain-types/factories/SCYBaseWithRewards__factory.ts +535 -0
- package/typechain-types/factories/SCYBase__factory.ts +479 -0
- package/typechain-types/factories/UUPSUpgradeable__factory.ts +115 -0
- package/typechain-types/hardhat.d.ts +564 -0
- package/typechain-types/index.ts +122 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.9;
|
|
3
|
+
|
|
4
|
+
import "./IPBaseToken.sol";
|
|
5
|
+
import "../libraries/math/MarketMathLib.sol";
|
|
6
|
+
|
|
7
|
+
interface IPMarket is IPBaseToken {
|
|
8
|
+
function addLiquidity(
|
|
9
|
+
address receiver,
|
|
10
|
+
uint256 scyDesired,
|
|
11
|
+
uint256 otDesired,
|
|
12
|
+
bytes calldata data
|
|
13
|
+
)
|
|
14
|
+
external
|
|
15
|
+
returns (
|
|
16
|
+
uint256 lpToAccount,
|
|
17
|
+
uint256 scyUsed,
|
|
18
|
+
uint256 otUsed
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
function removeLiquidity(
|
|
22
|
+
address receiver,
|
|
23
|
+
uint256 lpToRemove,
|
|
24
|
+
bytes calldata data
|
|
25
|
+
) external returns (uint256 scyToAccount, uint256 otToAccount);
|
|
26
|
+
|
|
27
|
+
function swapExactOtForScy(
|
|
28
|
+
address receiver,
|
|
29
|
+
uint256 exactOtIn,
|
|
30
|
+
uint256 minScyOut,
|
|
31
|
+
bytes calldata data
|
|
32
|
+
) external returns (uint256 netScyOut, uint256 netScyToReserve);
|
|
33
|
+
|
|
34
|
+
function swapScyForExactOt(
|
|
35
|
+
address receiver,
|
|
36
|
+
uint256 exactOtOut,
|
|
37
|
+
uint256 maxScyIn,
|
|
38
|
+
bytes calldata data
|
|
39
|
+
) external returns (uint256 netScyIn, uint256 netScyToReserve);
|
|
40
|
+
|
|
41
|
+
function readState() external view returns (MarketParameters memory market);
|
|
42
|
+
|
|
43
|
+
function OT() external view returns (address);
|
|
44
|
+
|
|
45
|
+
function YT() external view returns (address);
|
|
46
|
+
|
|
47
|
+
function SCY() external view returns (address);
|
|
48
|
+
|
|
49
|
+
function readTokens()
|
|
50
|
+
external
|
|
51
|
+
view
|
|
52
|
+
returns (
|
|
53
|
+
ISuperComposableYield _SCY,
|
|
54
|
+
IPOwnershipToken _OT,
|
|
55
|
+
IPYieldToken _YT
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.9;
|
|
3
|
+
|
|
4
|
+
interface IPMarketAddRemoveCallback {
|
|
5
|
+
function addLiquidityCallback(
|
|
6
|
+
uint256 lpToAccount,
|
|
7
|
+
uint256 scyOwed,
|
|
8
|
+
uint256 otOwed,
|
|
9
|
+
bytes calldata data
|
|
10
|
+
) external;
|
|
11
|
+
|
|
12
|
+
function removeLiquidityCallback(
|
|
13
|
+
uint256 lpOwed,
|
|
14
|
+
uint256 scyToAccount,
|
|
15
|
+
uint256 otToAccount,
|
|
16
|
+
bytes calldata data
|
|
17
|
+
) external;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.9;
|
|
3
|
+
import "./IPBaseToken.sol";
|
|
4
|
+
|
|
5
|
+
interface IPOwnershipToken is IPBaseToken {
|
|
6
|
+
function initialize(address _YT) external;
|
|
7
|
+
|
|
8
|
+
function burnByYT(address user, uint256 amount) external;
|
|
9
|
+
|
|
10
|
+
function mintByYT(address user, uint256 amount) external;
|
|
11
|
+
|
|
12
|
+
function SCY() external view returns (address);
|
|
13
|
+
|
|
14
|
+
function YT() external view returns (address);
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.9;
|
|
25
|
+
|
|
26
|
+
interface IPermissionsV2 {
|
|
27
|
+
function governanceManager() external view returns (address);
|
|
28
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.9;
|
|
3
|
+
|
|
4
|
+
interface IPRouterCore {
|
|
5
|
+
function addLiquidity(
|
|
6
|
+
address receiver,
|
|
7
|
+
address market,
|
|
8
|
+
uint256 scyDesired,
|
|
9
|
+
uint256 otDesired,
|
|
10
|
+
uint256 minLpOut
|
|
11
|
+
)
|
|
12
|
+
external
|
|
13
|
+
returns (
|
|
14
|
+
uint256 netLpOut,
|
|
15
|
+
uint256 scyUsed,
|
|
16
|
+
uint256 otUsed
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
function removeLiquidity(
|
|
20
|
+
address receiver,
|
|
21
|
+
address market,
|
|
22
|
+
uint256 lpToRemove,
|
|
23
|
+
uint256 scyOutMin,
|
|
24
|
+
uint256 otOutMin
|
|
25
|
+
) external returns (uint256 netScyOut, uint256 netOtOut);
|
|
26
|
+
|
|
27
|
+
function swapExactOtForScy(
|
|
28
|
+
address receiver,
|
|
29
|
+
address market,
|
|
30
|
+
uint256 exactOtIn,
|
|
31
|
+
uint256 minScyOut
|
|
32
|
+
) external returns (uint256 netScyOut);
|
|
33
|
+
|
|
34
|
+
function swapOtForExactScy(
|
|
35
|
+
address receiver,
|
|
36
|
+
address market,
|
|
37
|
+
uint256 maxOtIn,
|
|
38
|
+
uint256 exactScyOut,
|
|
39
|
+
uint256 netOtInGuessMin,
|
|
40
|
+
uint256 netOtInGuessMax
|
|
41
|
+
) external returns (uint256 netOtIn);
|
|
42
|
+
|
|
43
|
+
function swapScyForExactOt(
|
|
44
|
+
address receiver,
|
|
45
|
+
address market,
|
|
46
|
+
uint256 exactOtOut,
|
|
47
|
+
uint256 maxScyIn
|
|
48
|
+
) external returns (uint256 netScyIn);
|
|
49
|
+
|
|
50
|
+
function swapExactScyForOt(
|
|
51
|
+
address receiver,
|
|
52
|
+
address market,
|
|
53
|
+
uint256 exactScyIn,
|
|
54
|
+
uint256 minOtOut,
|
|
55
|
+
uint256 netOtOutGuessMin,
|
|
56
|
+
uint256 netOtOutGuessMax
|
|
57
|
+
) external returns (uint256 netOtOut);
|
|
58
|
+
|
|
59
|
+
function mintScyFromRawToken(
|
|
60
|
+
uint256 netRawTokenIn,
|
|
61
|
+
address SCY,
|
|
62
|
+
uint256 minScyOut,
|
|
63
|
+
address receiver,
|
|
64
|
+
address[] calldata path
|
|
65
|
+
) external returns (uint256 netScyOut);
|
|
66
|
+
|
|
67
|
+
function redeemScyToRawToken(
|
|
68
|
+
address SCY,
|
|
69
|
+
uint256 netScyIn,
|
|
70
|
+
uint256 minRawTokenOut,
|
|
71
|
+
address receiver,
|
|
72
|
+
address[] memory path
|
|
73
|
+
) external returns (uint256 netRawTokenOut);
|
|
74
|
+
|
|
75
|
+
function mintYoFromRawToken(
|
|
76
|
+
uint256 netRawTokenIn,
|
|
77
|
+
address YT,
|
|
78
|
+
uint256 minYoOut,
|
|
79
|
+
address receiver,
|
|
80
|
+
address[] calldata path
|
|
81
|
+
) external returns (uint256 netYoOut);
|
|
82
|
+
|
|
83
|
+
function redeemYoToRawToken(
|
|
84
|
+
address YT,
|
|
85
|
+
uint256 netYoIn,
|
|
86
|
+
uint256 minRawTokenOut,
|
|
87
|
+
address receiver,
|
|
88
|
+
address[] memory path
|
|
89
|
+
) external returns (uint256 netRawTokenOut);
|
|
90
|
+
|
|
91
|
+
function swapExactRawTokenForOt(
|
|
92
|
+
uint256 exactRawTokenIn,
|
|
93
|
+
address receiver,
|
|
94
|
+
address[] calldata path,
|
|
95
|
+
address market,
|
|
96
|
+
uint256 minOtOut,
|
|
97
|
+
uint256 netOtOutGuessMin,
|
|
98
|
+
uint256 netOtOutGuessMax
|
|
99
|
+
) external returns (uint256 netOtOut);
|
|
100
|
+
|
|
101
|
+
function swapExactOtForRawToken(
|
|
102
|
+
uint256 exactOtIn,
|
|
103
|
+
address receiver,
|
|
104
|
+
address[] calldata path,
|
|
105
|
+
address market,
|
|
106
|
+
uint256 minRawTokenOut
|
|
107
|
+
) external returns (uint256 netRawTokenOut);
|
|
108
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.9;
|
|
3
|
+
|
|
4
|
+
import "./IPMarketSwapCallback.sol";
|
|
5
|
+
|
|
6
|
+
interface IPRouterYT is IPMarketSwapCallback {
|
|
7
|
+
function swapExactYtForScy(
|
|
8
|
+
address receiver,
|
|
9
|
+
address market,
|
|
10
|
+
uint256 exactYtIn,
|
|
11
|
+
uint256 minScyOut
|
|
12
|
+
) external returns (uint256 netScyOut);
|
|
13
|
+
|
|
14
|
+
function swapScyForExactYt(
|
|
15
|
+
address receiver,
|
|
16
|
+
address market,
|
|
17
|
+
uint256 exactYtOut,
|
|
18
|
+
uint256 maxScyIn
|
|
19
|
+
) external returns (uint256 netScyIn);
|
|
20
|
+
|
|
21
|
+
function swapExactScyForYt(
|
|
22
|
+
address receiver,
|
|
23
|
+
address market,
|
|
24
|
+
uint256 exactScyIn,
|
|
25
|
+
uint256 minYtOut,
|
|
26
|
+
uint256 netYtOutGuessMin,
|
|
27
|
+
uint256 netYtOutGuessMax
|
|
28
|
+
) external returns (uint256 netYtOut);
|
|
29
|
+
|
|
30
|
+
function swapExactRawTokenForYt(
|
|
31
|
+
uint256 exactRawTokenIn,
|
|
32
|
+
address receiver,
|
|
33
|
+
address[] calldata path,
|
|
34
|
+
address market,
|
|
35
|
+
uint256 minYtOut,
|
|
36
|
+
uint256 netYtOutGuessMin,
|
|
37
|
+
uint256 netYtOutGuessMax
|
|
38
|
+
) external returns (uint256 netYtOut);
|
|
39
|
+
|
|
40
|
+
function swapExactYtForRawToken(
|
|
41
|
+
uint256 exactYtIn,
|
|
42
|
+
address receiver,
|
|
43
|
+
address[] calldata path,
|
|
44
|
+
address market,
|
|
45
|
+
uint256 minRawTokenOut
|
|
46
|
+
) external returns (uint256 netRawTokenOut);
|
|
47
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.9;
|
|
25
|
+
|
|
26
|
+
interface IPYieldContractFactory {
|
|
27
|
+
function getOT(address SCY, uint256 expiry) external view returns (address);
|
|
28
|
+
|
|
29
|
+
function getYT(address SCY, uint256 expiry) external view returns (address);
|
|
30
|
+
|
|
31
|
+
function expiryDivisor() external view returns (uint256);
|
|
32
|
+
|
|
33
|
+
function interestFeeRate() external view returns (uint256);
|
|
34
|
+
|
|
35
|
+
function treasury() external view returns (address);
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity 0.8.9;
|
|
3
|
+
import "./IPBaseToken.sol";
|
|
4
|
+
|
|
5
|
+
interface IPYieldToken is IPBaseToken {
|
|
6
|
+
function mintYO(address receiverOT, address receiverYT) external returns (uint256 amountYOOut);
|
|
7
|
+
|
|
8
|
+
function redeemYO(address receiver) external returns (uint256 amountScyOut);
|
|
9
|
+
|
|
10
|
+
function redeemDueInterest(address user) external returns (uint256 interestOut);
|
|
11
|
+
|
|
12
|
+
function redeemDueRewards(address user, address receiver)
|
|
13
|
+
external
|
|
14
|
+
returns (uint256[] memory rewardsOut);
|
|
15
|
+
|
|
16
|
+
function SCY() external view returns (address);
|
|
17
|
+
|
|
18
|
+
function OT() external view returns (address);
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.9;
|
|
25
|
+
import "./IQiToken.sol";
|
|
26
|
+
|
|
27
|
+
interface IQiErc20 is IQiToken {
|
|
28
|
+
function mint(uint256 mintAmount) external returns (uint256);
|
|
29
|
+
|
|
30
|
+
function redeem(uint256 redeemTokens) external returns (uint256);
|
|
31
|
+
|
|
32
|
+
function balanceOf(address owner) external view returns (uint256);
|
|
33
|
+
|
|
34
|
+
function underlying() external view returns (address);
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.9;
|
|
25
|
+
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
|
26
|
+
|
|
27
|
+
interface IQiToken is IERC20 {
|
|
28
|
+
function exchangeRateCurrent() external returns (uint256);
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
pragma solidity 0.8.9;
|
|
24
|
+
|
|
25
|
+
interface IREDACTEDStaking {
|
|
26
|
+
function stake(uint256 _amount, address _receiver) external returns (bool);
|
|
27
|
+
|
|
28
|
+
function unstake(uint256 _amount, bool _trigger) external returns (bool);
|
|
29
|
+
|
|
30
|
+
function claim(address _receiver) external;
|
|
31
|
+
|
|
32
|
+
function rebase() external;
|
|
33
|
+
|
|
34
|
+
function warmupPeriod() external returns (uint256);
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
pragma solidity 0.8.9;
|
|
24
|
+
|
|
25
|
+
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
|
|
26
|
+
|
|
27
|
+
interface IWETH is IERC20 {
|
|
28
|
+
event Deposit(address indexed dst, uint256 wad);
|
|
29
|
+
event Withdrawal(address indexed src, uint256 wad);
|
|
30
|
+
|
|
31
|
+
function deposit() external payable;
|
|
32
|
+
|
|
33
|
+
function withdraw(uint256 wad) external;
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
pragma solidity 0.8.9;
|
|
24
|
+
|
|
25
|
+
interface IWXBTRFLY {
|
|
26
|
+
function wrapFromBTRFLY(uint256 _amount) external returns (uint256);
|
|
27
|
+
|
|
28
|
+
function unwrapToBTRFLY(uint256 _amount) external returns (uint256);
|
|
29
|
+
|
|
30
|
+
function wrapFromxBTRFLY(uint256 _amount) external returns (uint256);
|
|
31
|
+
|
|
32
|
+
function unwrapToxBTRFLY(uint256 _amount) external returns (uint256);
|
|
33
|
+
|
|
34
|
+
function xBTRFLY() external view returns (address);
|
|
35
|
+
|
|
36
|
+
function xBTRFLYValue(uint256 _amount) external view returns (uint256);
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
* ===========
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
pragma solidity 0.8.9;
|
|
25
|
+
|
|
26
|
+
interface IYearnVault {
|
|
27
|
+
function deposit(uint256 amount) external returns (uint256);
|
|
28
|
+
|
|
29
|
+
function withdraw(uint256 maxShares) external returns (uint256);
|
|
30
|
+
|
|
31
|
+
function pricePerShare() external view returns (uint256);
|
|
32
|
+
}
|