@pendle/core-v2 4.5.1-beta-2 → 4.5.1-beta-4
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/core/StandardizedYield/implementations/PendleERC20WithSupplyCapSY.sol/PendleERC20WithSupplyCapSY.dbg.json +1 -1
- package/build/artifacts/contracts/core/StandardizedYield/implementations/PendleERC20WithSupplyCapSY.sol/PendleERC20WithSupplyCapSY.json +2 -2
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellRswETHStakingSY.sol/PendleSwellRswETHStakingSY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellRswETHStakingSY.sol/PendleSwellRswETHStakingSY.json +1049 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellStakingERC20SY.sol/PendleSwellStakingERC20SY.dbg.json +4 -0
- package/build/artifacts/contracts/core/StandardizedYield/implementations/Swell/PendleSwellStakingERC20SY.sol/PendleSwellStakingERC20SY.json +1039 -0
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.json +46 -2
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.json +46 -2
- package/build/artifacts/contracts/interfaces/IPGovernanceProxy.sol/IPGovernanceProxy.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPGovernanceProxy.sol/IPGovernanceProxy.json +60 -0
- package/build/artifacts/contracts/interfaces/IPPausingInterface.sol/IPPausingInterface.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPPausingInterface.sol/IPPausingInterface.json +25 -0
- package/build/artifacts/contracts/interfaces/IPPtLpOracle.sol/IPPtLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPReflector.sol/IPReflector.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/IPReflector.sol/IPReflector.json +30 -0
- package/build/artifacts/contracts/interfaces/Swell/ISwellSimpleStakingERC20.sol/ISwellSimpleStakingERC20.dbg.json +4 -0
- package/build/artifacts/contracts/interfaces/Swell/ISwellSimpleStakingERC20.sol/ISwellSimpleStakingERC20.json +207 -0
- package/build/artifacts/contracts/offchain-helpers/PendleGovernanceProxy.sol/PendleGovernanceProxy.dbg.json +4 -0
- package/build/artifacts/contracts/offchain-helpers/PendleGovernanceProxy.sol/PendleGovernanceProxy.json +401 -0
- 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/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/oracles/PendleLpOracleLib.sol/PendleLpOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtLpOracle.sol/PendlePtLpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/PendlePtOracleLib.sol/PendlePtOracleLib.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/BoringLpGlpOracle.sol/BoringLpGlpOracle.dbg.json +1 -1
- package/build/artifacts/contracts/oracles/samples/BoringPtUsdChainlinkOracle.sol/BoringPtUsdChainlinkOracle.dbg.json +1 -1
- 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 +48 -4
- 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/Reflector.sol/Reflector.dbg.json +4 -0
- package/build/artifacts/contracts/router/Reflector.sol/Reflector.json +34 -0
- package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
- package/contracts/core/StandardizedYield/implementations/PendleERC20WithSupplyCapSY.sol +6 -1
- package/contracts/core/StandardizedYield/implementations/Swell/PendleSwellRswETHStakingSY.sol +56 -0
- package/contracts/core/StandardizedYield/implementations/Swell/PendleSwellStakingERC20SY.sol +111 -0
- package/contracts/interfaces/IPActionMiscV3.sol +9 -2
- package/contracts/interfaces/IPGovernanceProxy.sol +14 -0
- package/contracts/interfaces/IPPausingInterface.sol +8 -0
- package/contracts/interfaces/IPReflector.sol +6 -0
- package/contracts/interfaces/Swell/ISwellSimpleStakingERC20.sol +66 -0
- package/contracts/offchain-helpers/PendleGovernanceProxy.sol +84 -0
- package/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol +12 -4
- package/contracts/router/ActionMiscV3.sol +31 -5
- package/contracts/router/Reflector.sol +69 -0
- package/contracts/router/base/ActionBase.sol +0 -16
- package/deployments/1-markets/EZETH-MAINNET-SEP2024.json +11 -0
- package/deployments/1-markets/PUFETH-MAINNET-SEP2024.json +11 -0
- package/deployments/1-markets/RSETH-MAINNET-SEP2024.json +11 -0
- package/deployments/1-markets/RSWETH-SWELL-STAKING-MAINNET-JUL2024.json +11 -0
- package/deployments/1-markets/SUSDE-MAINNET-SEP2024.json +13 -0
- package/deployments/1-markets/UNIETH-MAINNET-SEP2024.json +13 -0
- package/deployments/1-markets/WEETH-MAINNET-SEP2024.json +11 -0
- package/deployments/42161-core.json +1 -1
- package/deployments/42161-markets/EZETH-ARB-SEP2024.json +11 -0
- package/deployments/42161-markets/RSETH-ARBITRUM-SEP2024.json +11 -0
- package/deployments/42161-markets/SILO-PTEETH-ARBITRUM-JUNE2024.json +11 -0
- package/deployments/42161-markets/SILO-PTEZETH-ARBITRUM-JUNE2024.json +11 -0
- package/deployments/42161-markets/WEETH-ARB-SEP2024.json +11 -0
- package/deployments/56-markets/WEETH-BSC-SEP2024.json +11 -0
- package/package.json +1 -1
- package/typechain-types/ActionMiscV3.ts +61 -6
- package/typechain-types/BoringPYUsdChainlinkAssetOracle.ts +244 -0
- package/typechain-types/BoringPYUsdChainlinkSYOracle.ts +243 -0
- package/typechain-types/IPActionMiscV3.ts +61 -6
- package/typechain-types/IPAllActionV3.ts +61 -6
- package/typechain-types/IPGovernanceProxy.ts +142 -0
- package/typechain-types/IPPYLpOracle.ts +379 -0
- package/typechain-types/IPPausingInterface.ts +112 -0
- package/typechain-types/IPReflector.ts +95 -0
- package/typechain-types/IPossibleSupplyCapInterface.ts +142 -0
- package/typechain-types/PendleGovernanceProxy.ts +603 -0
- package/typechain-types/PendlePYLpOracle.ts +612 -0
- package/typechain-types/Reflector.ts +95 -0
- package/typechain-types/SupplyCapReader.ts +105 -0
- package/typechain-types/factories/ActionAddRemoveLiqV3__factory.ts +1 -1
- package/typechain-types/factories/ActionMarketAuxStatic__factory.ts +1 -1
- package/typechain-types/factories/ActionMiscV3__factory.ts +47 -3
- package/typechain-types/factories/ActionSwapPTV3__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYTV3__factory.ts +1 -1
- package/typechain-types/factories/BoringPYUsdChainlinkAssetOracle__factory.ts +269 -0
- package/typechain-types/factories/BoringPYUsdChainlinkSYOracle__factory.ts +267 -0
- package/typechain-types/factories/IPActionMiscV3__factory.ts +46 -2
- package/typechain-types/factories/IPAllActionV3__factory.ts +46 -2
- package/typechain-types/factories/IPGovernanceProxy__factory.ts +75 -0
- package/typechain-types/factories/IPPYLpOracle__factory.ts +214 -0
- package/typechain-types/factories/IPPausingInterface__factory.ts +40 -0
- package/typechain-types/factories/IPReflector__factory.ts +42 -0
- package/typechain-types/factories/IPossibleSupplyCapInterface__factory.ts +82 -0
- package/typechain-types/factories/PendleERC20WithSupplyCapSY__factory.ts +1 -1
- package/typechain-types/factories/PendleGovernanceProxy__factory.ts +458 -0
- package/typechain-types/factories/PendlePYLpOracle__factory.ts +487 -0
- package/typechain-types/factories/PendlePoolDeployHelper__factory.ts +1 -1
- package/typechain-types/factories/PendleSwellRswETHStakingSY__factory.ts +1 -1
- package/typechain-types/factories/Reflector__factory.ts +84 -0
- package/typechain-types/factories/SupplyCapReader__factory.ts +88 -0
- package/typechain-types/hardhat.d.ts +72 -0
- package/typechain-types/index.ts +16 -0
- /package/deployments/1-markets/{EZETH-JUNE2024.json → EZETH-APR2024.json} +0 -0
- /package/deployments/42161-markets/{RSETH-MAY2024.json → RSETH-JUNE2024.json} +0 -0
- /package/deployments/42161-markets/{WEETH-MAY2024.json → WEETH-JUNE2024.json} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../../SYBase.sol";
|
|
5
|
+
import "../../../../interfaces/Swell/ISwellSimpleStakingERC20.sol";
|
|
6
|
+
|
|
7
|
+
contract PendleSwellStakingERC20SY is SYBase {
|
|
8
|
+
using ArrayLib for address[];
|
|
9
|
+
|
|
10
|
+
address public constant SWELL_STAKING = 0x38D43a6Cb8DA0E855A42fB6b0733A0498531d774;
|
|
11
|
+
|
|
12
|
+
// solhint-disable immutable-vars-naming
|
|
13
|
+
address public immutable stakeToken;
|
|
14
|
+
|
|
15
|
+
constructor(string memory _name, string memory _symbol, address _stakeToken) SYBase(_name, _symbol, _stakeToken) {
|
|
16
|
+
stakeToken = _stakeToken;
|
|
17
|
+
_safeApproveInf(_stakeToken, SWELL_STAKING);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*///////////////////////////////////////////////////////////////
|
|
21
|
+
DEPOSIT/REDEEM USING BASE TOKENS
|
|
22
|
+
//////////////////////////////////////////////////////////////*/
|
|
23
|
+
|
|
24
|
+
function _deposit(
|
|
25
|
+
address tokenIn,
|
|
26
|
+
uint256 amountDeposited
|
|
27
|
+
) internal virtual override returns (uint256 /*amountSharesOut*/) {
|
|
28
|
+
if (tokenIn != stakeToken) {
|
|
29
|
+
amountDeposited = _wrapToStakeToken(tokenIn, amountDeposited);
|
|
30
|
+
}
|
|
31
|
+
ISwellSimpleStakingERC20(SWELL_STAKING).deposit(stakeToken, amountDeposited, address(this));
|
|
32
|
+
return amountDeposited;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function _redeem(
|
|
36
|
+
address receiver,
|
|
37
|
+
address /*tokenOut*/,
|
|
38
|
+
uint256 amountSharesToRedeem
|
|
39
|
+
) internal virtual override returns (uint256 /*amountTokenOut*/) {
|
|
40
|
+
ISwellSimpleStakingERC20(SWELL_STAKING).withdraw(stakeToken, amountSharesToRedeem, receiver);
|
|
41
|
+
return amountSharesToRedeem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/*///////////////////////////////////////////////////////////////
|
|
45
|
+
EXCHANGE-RATE
|
|
46
|
+
//////////////////////////////////////////////////////////////*/
|
|
47
|
+
function exchangeRate() public view virtual override returns (uint256) {
|
|
48
|
+
return PMath.ONE;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/*///////////////////////////////////////////////////////////////
|
|
52
|
+
MISC FUNCTIONS FOR METADATA
|
|
53
|
+
//////////////////////////////////////////////////////////////*/
|
|
54
|
+
|
|
55
|
+
function _previewDeposit(address tokenIn, uint256 amountTokenToDeposit) internal view override returns (uint256) {
|
|
56
|
+
if (tokenIn == stakeToken) {
|
|
57
|
+
return amountTokenToDeposit;
|
|
58
|
+
}
|
|
59
|
+
return _previewToStakeToken(tokenIn, amountTokenToDeposit);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function _previewRedeem(
|
|
63
|
+
address /*tokenOut*/,
|
|
64
|
+
uint256 amountSharesToRedeem
|
|
65
|
+
) internal pure override returns (uint256 /*amountTokenOut*/) {
|
|
66
|
+
return amountSharesToRedeem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function getTokensIn() public view virtual override returns (address[] memory) {
|
|
70
|
+
return ArrayLib.create(stakeToken).merge(_getAdditionalTokens());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function getTokensOut() public view virtual override returns (address[] memory) {
|
|
74
|
+
return ArrayLib.create(stakeToken);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function isValidTokenIn(address token) public view virtual override returns (bool) {
|
|
78
|
+
return token == stakeToken || _canWrapToStakeToken(token);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function isValidTokenOut(address token) public view virtual override returns (bool) {
|
|
82
|
+
return token == stakeToken;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function assetInfo()
|
|
86
|
+
external
|
|
87
|
+
view
|
|
88
|
+
virtual
|
|
89
|
+
returns (AssetType assetType, address assetAddress, uint8 assetDecimals)
|
|
90
|
+
{
|
|
91
|
+
return (AssetType.TOKEN, stakeToken, IERC20Metadata(stakeToken).decimals());
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/*///////////////////////////////////////////////////////////////
|
|
95
|
+
ADDITIONAL TOKEN IN FUNCTIONS
|
|
96
|
+
//////////////////////////////////////////////////////////////*/
|
|
97
|
+
|
|
98
|
+
function _getAdditionalTokens() internal view virtual returns (address[] memory) {}
|
|
99
|
+
|
|
100
|
+
function _previewToStakeToken(address, uint256) internal view virtual returns (uint256) {
|
|
101
|
+
assert(false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function _wrapToStakeToken(address, uint256) internal virtual returns (uint256) {
|
|
105
|
+
assert(false);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function _canWrapToStakeToken(address) internal view virtual returns (bool) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -105,7 +105,7 @@ interface IPActionMiscV3 {
|
|
|
105
105
|
address indexed market,
|
|
106
106
|
address indexed token,
|
|
107
107
|
address receiver,
|
|
108
|
-
uint256
|
|
108
|
+
uint256 netLpIn,
|
|
109
109
|
uint256 totalTokenOut,
|
|
110
110
|
ExitPreExpReturnParams params
|
|
111
111
|
);
|
|
@@ -114,7 +114,7 @@ interface IPActionMiscV3 {
|
|
|
114
114
|
address indexed caller,
|
|
115
115
|
address indexed market,
|
|
116
116
|
address indexed receiver,
|
|
117
|
-
uint256
|
|
117
|
+
uint256 netLpIn,
|
|
118
118
|
ExitPreExpReturnParams params
|
|
119
119
|
);
|
|
120
120
|
|
|
@@ -235,6 +235,13 @@ interface IPActionMiscV3 {
|
|
|
235
235
|
uint256 minSyOut
|
|
236
236
|
) external returns (ExitPostExpReturnParams memory params);
|
|
237
237
|
|
|
238
|
+
function callAndReflect(
|
|
239
|
+
address payable reflector,
|
|
240
|
+
bytes calldata selfCall1,
|
|
241
|
+
bytes calldata selfCall2,
|
|
242
|
+
bytes calldata reflectCall
|
|
243
|
+
) external payable returns (bytes memory selfRes1, bytes memory selfRes2, bytes memory reflectRes);
|
|
244
|
+
|
|
238
245
|
function boostMarkets(address[] memory markets) external;
|
|
239
246
|
|
|
240
247
|
function multicall(Call3[] calldata calls) external payable returns (Result[] memory res);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
interface IPGovernanceProxy {
|
|
5
|
+
struct Call {
|
|
6
|
+
address target;
|
|
7
|
+
uint256 value;
|
|
8
|
+
bytes callData;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function pause(address[] calldata addrs) external;
|
|
12
|
+
|
|
13
|
+
function aggregate(Call[] calldata calls) external payable returns (bytes[] memory rtnData);
|
|
14
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// SPDX-License-Identifier: UNLICENSED
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
interface ISwellSimpleStakingERC20 {
|
|
5
|
+
/// @notice Struct to hold the supported booleans
|
|
6
|
+
/// @param deposit true if deposit is supported
|
|
7
|
+
/// @param withdraw true if withdraw is supported
|
|
8
|
+
struct Supported {
|
|
9
|
+
bool deposit;
|
|
10
|
+
bool withdraw;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/// @notice Error emitted when the amount is null
|
|
14
|
+
error AMOUNT_NULL();
|
|
15
|
+
|
|
16
|
+
/// @notice Error emitted when the address is null
|
|
17
|
+
error ADDRESS_NULL();
|
|
18
|
+
|
|
19
|
+
/// @notice Error emitted when the balance is insufficient
|
|
20
|
+
error INSUFFICIENT_BALANCE();
|
|
21
|
+
|
|
22
|
+
/// @notice Error emitted when the token is not allowed
|
|
23
|
+
error TOKEN_NOT_ALLOWED(address token);
|
|
24
|
+
|
|
25
|
+
/// @notice Event emitted when a token is added or removed
|
|
26
|
+
/// @param token address of the token
|
|
27
|
+
/// @param supported struct with deposit and withdraw booleans
|
|
28
|
+
event SupportedToken(address indexed token, Supported supported);
|
|
29
|
+
|
|
30
|
+
/// @notice Event emitted when a deposit is made
|
|
31
|
+
/// @param token address of the token
|
|
32
|
+
/// @param staker address of the staker
|
|
33
|
+
/// @param amount amount of the deposit
|
|
34
|
+
event Deposit(address indexed token, address indexed staker, uint256 amount);
|
|
35
|
+
|
|
36
|
+
/// @notice Event emitted when a withdrawal is made
|
|
37
|
+
/// @param token address of the token
|
|
38
|
+
/// @param staker address of the staker
|
|
39
|
+
/// @param amount amount of the withdrawal
|
|
40
|
+
event Withdraw(address indexed token, address indexed staker, uint256 amount);
|
|
41
|
+
|
|
42
|
+
/// @notice Method to deposit tokens
|
|
43
|
+
/// @dev token are transferred from the sender, and the receiver is credited
|
|
44
|
+
/// @param _token address of the token
|
|
45
|
+
/// @param _amount amount to deposit
|
|
46
|
+
/// @param _receiver address of the receiver
|
|
47
|
+
function deposit(address _token, uint256 _amount, address _receiver) external;
|
|
48
|
+
|
|
49
|
+
/// @notice Method to rescue tokens, only callable by the owner
|
|
50
|
+
/// @dev difference between balance and internal balance is transferred to the owner
|
|
51
|
+
/// @param _token address of the token
|
|
52
|
+
function rescueERC20(address _token) external;
|
|
53
|
+
|
|
54
|
+
/// @notice Method to add or remove a token
|
|
55
|
+
/// @dev only callable by the owner
|
|
56
|
+
/// @param _token address of the token
|
|
57
|
+
/// @param _supported struct with deposit and withdraw booleans
|
|
58
|
+
function supportToken(address _token, Supported calldata _supported) external;
|
|
59
|
+
|
|
60
|
+
/// @notice Method to rescue tokens, only callable by the owner
|
|
61
|
+
/// @dev token are transferred to the receiver and sender is credited
|
|
62
|
+
/// @param _token address of the token
|
|
63
|
+
/// @param _amount amount to withdraw
|
|
64
|
+
/// @param _receiver address of the receiver
|
|
65
|
+
function withdraw(address _token, uint256 _amount, address _receiver) external;
|
|
66
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.23;
|
|
3
|
+
|
|
4
|
+
import "../interfaces/IPPausingInterface.sol";
|
|
5
|
+
import "../interfaces/IPGovernanceProxy.sol";
|
|
6
|
+
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
|
|
7
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
8
|
+
|
|
9
|
+
// solhint-disable custom-errors
|
|
10
|
+
// solhint-disable no-inline-assembly
|
|
11
|
+
// solhint-disable no-empty-blocks
|
|
12
|
+
|
|
13
|
+
contract PendleGovernanceProxy is AccessControlUpgradeable, UUPSUpgradeable, IPGovernanceProxy {
|
|
14
|
+
bytes32 public constant GUARDIAN = keccak256("GUARDIAN");
|
|
15
|
+
|
|
16
|
+
modifier onlyGuardian() {
|
|
17
|
+
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(GUARDIAN, msg.sender), "not authorized");
|
|
18
|
+
_;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
modifier onlyAdmin() {
|
|
22
|
+
require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "not authorized");
|
|
23
|
+
_;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
_disableInitializers();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/*///////////////////////////////////////////////////////////////
|
|
31
|
+
PAUSING
|
|
32
|
+
//////////////////////////////////////////////////////////////*/
|
|
33
|
+
|
|
34
|
+
function pause(address[] calldata addrs) external onlyGuardian {
|
|
35
|
+
uint256 length = addrs.length;
|
|
36
|
+
for (uint256 i = 0; i < length; ) {
|
|
37
|
+
IPPausingInterface(addrs[i]).pause();
|
|
38
|
+
unchecked {
|
|
39
|
+
++i;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/*///////////////////////////////////////////////////////////////
|
|
45
|
+
ADMIN CALL
|
|
46
|
+
//////////////////////////////////////////////////////////////*/
|
|
47
|
+
|
|
48
|
+
function aggregate(
|
|
49
|
+
IPGovernanceProxy.Call[] calldata calls
|
|
50
|
+
) external payable onlyAdmin returns (bytes[] memory rtnData) {
|
|
51
|
+
uint256 length = calls.length;
|
|
52
|
+
rtnData = new bytes[](length);
|
|
53
|
+
|
|
54
|
+
Call calldata call;
|
|
55
|
+
for (uint256 i = 0; i < length; ) {
|
|
56
|
+
call = calls[i];
|
|
57
|
+
|
|
58
|
+
(bool success, bytes memory resp) = call.target.call{value: call.value}(call.callData);
|
|
59
|
+
if (!success) {
|
|
60
|
+
assembly {
|
|
61
|
+
revert(add(32, resp), mload(resp))
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
rtnData[i] = resp;
|
|
66
|
+
|
|
67
|
+
unchecked {
|
|
68
|
+
++i;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
receive() external payable {}
|
|
74
|
+
|
|
75
|
+
/*///////////////////////////////////////////////////////////////
|
|
76
|
+
UPGRADABLE RELATED
|
|
77
|
+
//////////////////////////////////////////////////////////////*/
|
|
78
|
+
|
|
79
|
+
function initialize(address governance) external initializer {
|
|
80
|
+
_grantRole(DEFAULT_ADMIN_ROLE, governance);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function _authorizeUpgrade(address) internal view override onlyAdmin {}
|
|
84
|
+
}
|
|
@@ -114,12 +114,20 @@ contract ActionMarketAuxStatic is IPActionMarketAuxStatic {
|
|
|
114
114
|
function getLpToAssetRate(address market) public view returns (uint256) {
|
|
115
115
|
MarketState memory state = _readState(market);
|
|
116
116
|
PYIndex pyIndexCurrent = _pyIndex(market);
|
|
117
|
-
MarketPreCompute memory comp = state.getMarketPreCompute(pyIndexCurrent, block.timestamp);
|
|
118
117
|
|
|
119
|
-
int256 totalHypotheticalAsset
|
|
120
|
-
|
|
118
|
+
int256 totalHypotheticalAsset;
|
|
119
|
+
if (state.expiry <= block.timestamp) {
|
|
120
|
+
// 1 PT = 1 Asset post-expiry
|
|
121
|
+
totalHypotheticalAsset = state.totalPt + pyIndexCurrent.syToAsset(state.totalSy);
|
|
122
|
+
} else {
|
|
123
|
+
MarketPreCompute memory comp = state.getMarketPreCompute(pyIndexCurrent, block.timestamp);
|
|
124
|
+
|
|
125
|
+
totalHypotheticalAsset =
|
|
126
|
+
comp.totalAsset +
|
|
127
|
+
state.totalPt.mulDown(int256(_getPtToAssetRate(market, state, pyIndexCurrent)));
|
|
128
|
+
}
|
|
121
129
|
|
|
122
|
-
return
|
|
130
|
+
return totalHypotheticalAsset.divDown(state.totalLp).Uint();
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
function getPtToAssetRate(address market) public view returns (uint256) {
|
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.17;
|
|
|
3
3
|
|
|
4
4
|
import "./base/ActionBase.sol";
|
|
5
5
|
import "../interfaces/IPActionMiscV3.sol";
|
|
6
|
+
import "../interfaces/IPReflector.sol";
|
|
6
7
|
|
|
7
8
|
contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
8
9
|
function mintSyFromToken(
|
|
@@ -116,10 +117,6 @@ contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
|
116
117
|
netTokenOut = IStandardizedYield(SY).redeem(receiver, netSyInterm, tokenRedeemSy, minTokenOut, true);
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
// TODO: need to allow exit to SY as well
|
|
120
|
-
// TODO: check against minOut
|
|
121
|
-
// double check event orders
|
|
122
|
-
|
|
123
120
|
function exitPreExpToToken(
|
|
124
121
|
address receiver,
|
|
125
122
|
address market,
|
|
@@ -173,7 +170,7 @@ contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
|
173
170
|
}
|
|
174
171
|
|
|
175
172
|
if (netPtIn > 0) {
|
|
176
|
-
_transferIn(address(PT),
|
|
173
|
+
_transferIn(address(PT), msg.sender, netPtIn);
|
|
177
174
|
}
|
|
178
175
|
|
|
179
176
|
p.netPyRedeem = PMath.min(p.netPtFromRemove + netPtIn, netYtIn);
|
|
@@ -269,8 +266,37 @@ contract ActionMiscV3 is IPActionMiscV3, ActionBase {
|
|
|
269
266
|
}
|
|
270
267
|
}
|
|
271
268
|
|
|
269
|
+
function callAndReflect(
|
|
270
|
+
address payable reflector,
|
|
271
|
+
bytes calldata selfCall1,
|
|
272
|
+
bytes calldata selfCall2,
|
|
273
|
+
bytes calldata reflectCall
|
|
274
|
+
) external payable returns (bytes memory selfRes1, bytes memory selfRes2, bytes memory reflectRes) {
|
|
275
|
+
(, selfRes1) = _delegateToSelf(selfCall1, false);
|
|
276
|
+
if (selfCall2.length > 0) (, selfRes2) = _delegateToSelf(selfCall2, false);
|
|
277
|
+
reflectRes = _callToReflector(reflector, reflectCall);
|
|
278
|
+
}
|
|
279
|
+
|
|
272
280
|
function simulate(address target, bytes calldata data) external payable {
|
|
273
281
|
(bool success, bytes memory result) = target.delegatecall(data);
|
|
274
282
|
revert Errors.SimulationResults(success, result);
|
|
275
283
|
}
|
|
284
|
+
|
|
285
|
+
function _delegateToSelf(
|
|
286
|
+
bytes memory data,
|
|
287
|
+
bool allowFailure
|
|
288
|
+
) internal returns (bool success, bytes memory result) {
|
|
289
|
+
(success, result) = address(this).delegatecall(data);
|
|
290
|
+
|
|
291
|
+
if (!success && !allowFailure) {
|
|
292
|
+
assembly {
|
|
293
|
+
// We use Yul's revert() to bubble up errors from the target contract.
|
|
294
|
+
revert(add(32, result), mload(result))
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function _callToReflector(address payable reflector, bytes memory data) internal returns (bytes memory) {
|
|
300
|
+
return IPReflector(reflector).reflect(data);
|
|
301
|
+
}
|
|
276
302
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
|
+
|
|
4
|
+
import "../interfaces/IPAllActionV3.sol";
|
|
5
|
+
import "../interfaces/IPReflector.sol";
|
|
6
|
+
import "../core/libraries/TokenHelper.sol";
|
|
7
|
+
|
|
8
|
+
contract Reflector is TokenHelper, IPReflector {
|
|
9
|
+
using SafeERC20 for IERC20;
|
|
10
|
+
|
|
11
|
+
mapping(address => bool) internal approved;
|
|
12
|
+
|
|
13
|
+
receive() external payable {}
|
|
14
|
+
|
|
15
|
+
function reflect(bytes calldata inputData) external returns (bytes memory result) {
|
|
16
|
+
(uint256 value, bytes memory newCalldata) = _getNewCalldata(inputData);
|
|
17
|
+
bool success;
|
|
18
|
+
|
|
19
|
+
(success, result) = msg.sender.call{value: value}(newCalldata);
|
|
20
|
+
if (!success) {
|
|
21
|
+
assembly {
|
|
22
|
+
// We use Yul's revert() to bubble up errors from the target contract.
|
|
23
|
+
revert(add(32, result), mload(result))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _getNewCalldata(bytes calldata inputData) internal returns (uint256 value, bytes memory newCalldata) {
|
|
29
|
+
bytes4 selector = bytes4(inputData[:4]);
|
|
30
|
+
bytes calldata data = inputData[4:];
|
|
31
|
+
|
|
32
|
+
if (selector == IPActionAddRemoveLiqV3.addLiquiditySingleToken.selector) {
|
|
33
|
+
(
|
|
34
|
+
address v1,
|
|
35
|
+
address v2,
|
|
36
|
+
uint256 v3,
|
|
37
|
+
ApproxParams memory v4,
|
|
38
|
+
TokenInput memory v5,
|
|
39
|
+
LimitOrderData memory v6
|
|
40
|
+
) = abi.decode(data, (address, address, uint256, ApproxParams, TokenInput, LimitOrderData));
|
|
41
|
+
|
|
42
|
+
value = _scaleTokenInputAndGetValue(v5);
|
|
43
|
+
newCalldata = abi.encodeWithSelector(selector, v1, v2, v3, v4, v5, v6);
|
|
44
|
+
} else if (selector == IPActionAddRemoveLiqV3.addLiquiditySingleTokenKeepYt.selector) {
|
|
45
|
+
(address v1, address v2, uint256 v3, uint256 v4, TokenInput memory v5) = abi.decode(
|
|
46
|
+
data,
|
|
47
|
+
(address, address, uint256, uint256, TokenInput)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
value = _scaleTokenInputAndGetValue(v5);
|
|
51
|
+
newCalldata = abi.encodeWithSelector(selector, v1, v2, v3, v4, v5);
|
|
52
|
+
} else {
|
|
53
|
+
revert("UNSUPPORTED_SELECTOR");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function _scaleTokenInputAndGetValue(TokenInput memory inp) internal returns (uint256 ethValue) {
|
|
58
|
+
require(inp.swapData.swapType == SwapType.NONE, "SWAP_NOT_ALLOWED"); // the exit call should already swap
|
|
59
|
+
|
|
60
|
+
inp.netTokenIn = _selfBalance(inp.tokenIn);
|
|
61
|
+
|
|
62
|
+
if (inp.tokenIn == NATIVE) {
|
|
63
|
+
ethValue = inp.netTokenIn;
|
|
64
|
+
} else if (!approved[inp.tokenIn]) {
|
|
65
|
+
IERC20(inp.tokenIn).forceApprove(msg.sender, type(uint256).max);
|
|
66
|
+
approved[inp.tokenIn] = true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -373,20 +373,4 @@ abstract contract ActionBase is TokenHelper, CallbackHelper, IPLimitOrderType {
|
|
|
373
373
|
function _isEmptyLimit(LimitOrderData calldata a) internal pure returns (bool) {
|
|
374
374
|
return a.normalFills.length == 0 && a.flashFills.length == 0;
|
|
375
375
|
}
|
|
376
|
-
|
|
377
|
-
// ----------------- DELEGATE CALL -----------------
|
|
378
|
-
|
|
379
|
-
function _delegateToSelf(
|
|
380
|
-
bytes memory data,
|
|
381
|
-
bool allowFailure
|
|
382
|
-
) internal returns (bool success, bytes memory result) {
|
|
383
|
-
(success, result) = address(this).delegatecall(data);
|
|
384
|
-
|
|
385
|
-
if (!success && !allowFailure) {
|
|
386
|
-
assembly {
|
|
387
|
-
// We use Yul's revert() to bubble up errors from the target contract.
|
|
388
|
-
revert(add(32, result), mload(result))
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
376
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY ezETH",
|
|
3
|
+
"SY": "0x22E12A50e3ca49FB183074235cB1db84Fe4C716D",
|
|
4
|
+
"YT": "0x1623F1A991584A6b69baBbdbffD26E2B46485465",
|
|
5
|
+
"PT": "0x248241244356D18f63d0c16082996839ecB0C7bF",
|
|
6
|
+
"market": "0xcDBD5ff3E03b6828Db9C32e2131A60ABA5137901",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7728447732000000000",
|
|
9
|
+
"initAnchor": "1116672357000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY pufETH",
|
|
3
|
+
"SY": "0x253008ba4aE2f3E6488DC998a5321D4EB1a0c905",
|
|
4
|
+
"YT": "0x1a65eB80a2ac3ea6E41D456DdD6E9cC5728BEf7C",
|
|
5
|
+
"PT": "0xd4e75971eAF78a8d93D96df530f1FFf5f9F53288",
|
|
6
|
+
"market": "0xA54FC268101c8b97DE19eF3141d34751a11996B2",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7770558179000000000",
|
|
9
|
+
"initAnchor": "1110275954000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY rsETH",
|
|
3
|
+
"SY": "0x730A5E2AcEbccAA5e9095723B3CB862739DA793c",
|
|
4
|
+
"YT": "0xE653E4048620E546AFff02D3689678896d22e236",
|
|
5
|
+
"PT": "0x7bAf258049cc8B9A78097723dc19a8b103D4098F",
|
|
6
|
+
"market": "0x6b4740722e46048874d84306B2877600ABCea3Ae",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7770558179000000000",
|
|
9
|
+
"initAnchor": "1110275954000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY rswETH",
|
|
3
|
+
"SY": "0x4f3A7a07A968B67F1f9692b70242f10E665d38Ad",
|
|
4
|
+
"YT": "0xf0E4244Ca93Ac36752DA5939Afd9CB73B0637b06",
|
|
5
|
+
"PT": "0x0a0E172511114456EC63A85FF32E45C5e0E27D63",
|
|
6
|
+
"market": "0x1e0c2e41f3165ff6B8a660092f63E10BC0EebE26",
|
|
7
|
+
"expiry": 1721865600,
|
|
8
|
+
"scalarRoot": "8113474588000000000",
|
|
9
|
+
"initAnchor": "1061316437000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SUSDE-MAINNET-SEP2024",
|
|
3
|
+
"SY": "0x4139cDC6345aFFbaC0692b43bed4D059Df3e6d65",
|
|
4
|
+
"YT": "0xdc02b77a3986da62C7A78FED73949C9767850809",
|
|
5
|
+
"PT": "0x6c9f097e044506712B58EAC670c9a5fd4BCceF13",
|
|
6
|
+
"market": "0xd1D7D99764f8a52Aff007b7831cc02748b2013b5",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
9
|
+
"scalarRoot": "8580934398000000000",
|
|
10
|
+
"initAnchor": "1120006408000000000",
|
|
11
|
+
"doCacheIndexSameBlock": true,
|
|
12
|
+
"deployTxHash": "0x467c0c15148778d0b99a1d9f3bd7406fd0c58d8a6e3284a57a50e55ae0160165"
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "UNIETH-MAINNET-SEP2024",
|
|
3
|
+
"SY": "0xc430dB19339A3051192233B4c49f9aB3DC6D16b7",
|
|
4
|
+
"YT": "0xdF74bA4436478969A54eCB352093312fE97EBAa5",
|
|
5
|
+
"PT": "0x15fA86404BFbA8b46684552F792558128bFB6418",
|
|
6
|
+
"market": "0xBaE2Df4DfCd0c613018D6056A40077F2d1eFf28A",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"lnFeeRateRoot": "2995508979000000",
|
|
9
|
+
"scalarRoot": "7770558179000000000",
|
|
10
|
+
"initAnchor": "1110275954000000000",
|
|
11
|
+
"doCacheIndexSameBlock": true,
|
|
12
|
+
"deployTxHash": "0x4e509feb8502bee0c719c1a9eb2c73c9e1b070fc8424e1f4f31618bdc764a560"
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY weETH",
|
|
3
|
+
"SY": "0xAC0047886a985071476a1186bE89222659970d65",
|
|
4
|
+
"YT": "0xA54Df645A042D24121a737dAA89a57EbF8E0b71c",
|
|
5
|
+
"PT": "0x1c085195437738d73d75DC64bC5A3E098b7f93b1",
|
|
6
|
+
"market": "0xC8eDd52D0502Aa8b4D5C77361D4B3D300e8fC81c",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7728447732000000000",
|
|
9
|
+
"initAnchor": "1116672357000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"PENDLE": "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8",
|
|
20
20
|
"yieldContractFactory": "0x28dE02Ac3c3F5ef427e55c321F73fDc7F192e8E4",
|
|
21
21
|
"marketFactory": "0xf5a7De2D276dbda3EEf1b62A9E718EFf4d29dDC8",
|
|
22
|
-
"router": "
|
|
22
|
+
"router": "0xaBbCC1E99687b2d5B6db8bC5dD8904B142Eaf04b",
|
|
23
23
|
"routerStatic": "0xAdB09F65bd90d19e3148D9ccb693F3161C6DB3E8",
|
|
24
24
|
"pendleSwap": "0x63a45E0B2686F7be77Bb85735c35704D1046459a",
|
|
25
25
|
"routerHelper": "0x462206b11d185ef6F64B41D344325401C37EC335",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY ezETH",
|
|
3
|
+
"SY": "0x0dE802e3D6Cc9145A150bBDc8da9F988a98c5202",
|
|
4
|
+
"YT": "0xE58AfaA6E2abF9A9F243D5A55Bd5447628c4D811",
|
|
5
|
+
"PT": "0x2CCFce9bE49465CC6f947b5F6aC9383673733Da9",
|
|
6
|
+
"market": "0x35f3dB08a6e9cB4391348b0B404F493E7ae264c0",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7728447732000000000",
|
|
9
|
+
"initAnchor": "1116672357000000000",
|
|
10
|
+
"lnFeeRateRoot": "2995508979000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY rsETH",
|
|
3
|
+
"SY": "0xf176fB51F4eB826136a54FDc71C50fCd2202E272",
|
|
4
|
+
"YT": "0x2FDc424946AA72D42E2F897447d7c335E64845F0",
|
|
5
|
+
"PT": "0x30c98c0139B62290E26aC2a2158AC341Dcaf1333",
|
|
6
|
+
"market": "0x1d38d4204159aA5e767aFbA8f76BE22117De61E5",
|
|
7
|
+
"expiry": 1727308800,
|
|
8
|
+
"scalarRoot": "7770558179000000000",
|
|
9
|
+
"initAnchor": "1110275954000000000",
|
|
10
|
+
"lnFeeRateRoot": "29999550000000"
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "SY sETH-pteETHSilo",
|
|
3
|
+
"SY": "0xd0c4351a18F40b96b6446Da3A191496DF36d60F9",
|
|
4
|
+
"YT": "0x7Cfb81E9c9402D48c6F3161204a21800b210BAeA",
|
|
5
|
+
"PT": "0x2D5405688f253D741a9F1090DD90D8A285CF5C79",
|
|
6
|
+
"market": "0x6aBE9Ac2df48490693BdB9d66Fa898fc9cD7cc36",
|
|
7
|
+
"expiry": 1719446400,
|
|
8
|
+
"scalarRoot": "10324763686000000000",
|
|
9
|
+
"initAnchor": "1041846750000000000",
|
|
10
|
+
"lnFeeRateRoot": "499875041000000"
|
|
11
|
+
}
|