@pendle/core-v2 0.11.9-testnet → 0.11.10-testnet
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/SuperComposableYield/SCY-implementations/AaveV3/PendleAaveV3SCY.sol/PendleAaveV3SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/AaveV3/WadRayMath.sol/WadRayMath.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiSAvaxSCY.sol/PendleQiSAvaxSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleQiTokenSCY.sol/PendleQiTokenSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/BenQi/PendleSAvaxSCY.sol/PendleSAvaxSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/Euler/PendleEulerSCY.sol/PendleEulerSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleERC4626SCY.sol/PendleERC4626SCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleStargateSCY.sol/PendleStargateSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleWstEthSCY.sol/PendleWstEthSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/PendleYearnVaultSCY.sol/PendleYearnVaultSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/SCY-implementations/TraderJoe/PendleSJoeSCY.sol/PendleSJoeSCY.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBase.sol/SCYBase.dbg.json +1 -1
- package/build/artifacts/contracts/SuperComposableYield/base-implementations/SCYBaseWithRewards.sol/SCYBaseWithRewards.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerReceiverUpg.sol/CelerReceiverUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/CelerAbstracts/CelerSenderUpg.sol/CelerSenderUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerBaseUpg.sol/PendleGaugeControllerBaseUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerMainchainUpg.sol/PendleGaugeControllerMainchainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/GaugeController/PendleGaugeControllerSidechainUpg.sol/PendleGaugeControllerSidechainUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/PendleGauge.sol/PendleGauge.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/PendleVotingControllerUpg.sol/PendleVotingControllerUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingController/VotingControllerStorageUpg.sol/VotingControllerStorageUpg.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol/VotingEscrowPendleMainchain.json +2 -2
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleSidechain.sol/VotingEscrowPendleSidechain.dbg.json +1 -1
- package/build/artifacts/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowTokenBase.sol/VotingEscrowTokenBase.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarket.sol/PendleMarket.dbg.json +1 -1
- package/build/artifacts/contracts/core/Market/PendleMarketFactory.sol/PendleMarketFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.dbg.json +1 -1
- package/build/artifacts/contracts/core/PendleRouter.sol/PendleRouter.json +2 -2
- package/build/artifacts/contracts/core/YieldContracts/InterestManagerYT.sol/InterestManagerYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendlePrincipalToken.sol/PendlePrincipalToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldContractFactory.sol/PendleYieldContractFactory.dbg.json +1 -1
- package/build/artifacts/contracts/core/YieldContracts/PendleYieldToken.sol/PendleYieldToken.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionAddRemoveLiq.sol/ActionAddRemoveLiq.json +4 -4
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionCallback.sol/ActionCallback.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionMintRedeem.sol/ActionMintRedeem.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionMisc.sol/ActionMisc.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPT.sol/ActionSwapPT.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapPTYT.sol/ActionSwapPTYT.json +2 -2
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/core/actions/ActionSwapYT.sol/ActionSwapYT.json +2 -2
- package/build/artifacts/contracts/core/actions/base/ActionBaseMintRedeem.sol/ActionBaseMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiq.sol/IPActionAddRemoveLiq.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionMintRedeem.sol/IPActionMintRedeem.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPT.sol/IPActionSwapPT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapPTYT.sol/IPActionSwapPTYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPActionSwapYT.sol/IPActionSwapYT.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPAllAction.sol/IPAllAction.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPMarket.sol/IPMarket.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingController.sol/IPVotingController.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.dbg.json +1 -1
- package/build/artifacts/contracts/interfaces/IPVotingEscrow.sol/IPVotingEscrow.json +93 -0
- package/build/artifacts/contracts/interfaces/ISuperComposableYield.sol/ISuperComposableYield.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManager.sol/RewardManager.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/RewardManagerAbstract.sol/RewardManagerAbstract.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeBalanceLib.sol/VeBalanceLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/VeHistoryLib.sol/Checkpoints.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/PYIndex.sol/PYIndexLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/helpers/SSTORE2Deployer.sol/SSTORE2Deployer.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/AggregationRouterHelper.sol/AggregationRouterHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/kyberswap/KyberSwapHelper.sol/KyberSwapHelper.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtInLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/MarketApproxLib.sol/MarketApproxPtOutLib.json +2 -2
- package/build/artifacts/contracts/libraries/math/MarketMathCore.sol/MarketMathCore.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/Math.sol/Math.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/math/WeekMath.sol/WeekMath.dbg.json +1 -1
- package/build/artifacts/contracts/libraries/solmate/SSTORE2.sol/SSTORE2.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/MarketMathStatic.sol/MarketMathStatic.json +2 -2
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.dbg.json +1 -1
- package/build/artifacts/contracts/offchain-helpers/RouterStatic.sol/RouterStatic.json +120 -60
- package/build/artifacts/contracts/offchain-helpers/SSTORE2DeployerContract.sol/SSTORE2DeployerContract.dbg.json +1 -1
- package/contracts/core/LiquidityMining/VotingEscrow/VotingEscrowPendleMainchain.sol +6 -1
- package/contracts/core/PendleRouter.sol +2 -1
- package/contracts/core/actions/ActionAddRemoveLiq.sol +23 -2
- package/contracts/interfaces/IPVotingEscrow.sol +1 -1
- package/contracts/libraries/math/MarketApproxLib.sol +1 -0
- package/contracts/offchain-helpers/MarketMathStatic.sol +16 -8
- package/contracts/offchain-helpers/RouterStatic.sol +52 -3
- package/package.json +1 -1
- package/typechain-types/IPVotingEscrow.ts +131 -0
- package/typechain-types/PendleFeeDistributorFactory.ts +97 -8
- package/typechain-types/RouterStatic.ts +82 -0
- package/typechain-types/factories/ActionAddRemoveLiq__factory.ts +1 -1
- package/typechain-types/factories/ActionCallback__factory.ts +1 -1
- package/typechain-types/factories/ActionMintRedeem__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPTYT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapPT__factory.ts +1 -1
- package/typechain-types/factories/ActionSwapYT__factory.ts +1 -1
- package/typechain-types/factories/IPVotingEscrow__factory.ts +93 -0
- package/typechain-types/factories/MarketMathStatic__factory.ts +1 -1
- package/typechain-types/factories/PendleFeeDistributorFactory__factory.ts +81 -8
- package/typechain-types/factories/PendleFeeDistributor__factory.ts +1 -1
- package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
- package/typechain-types/factories/PendleRouter__factory.ts +1 -1
- package/typechain-types/factories/RouterStatic__factory.ts +65 -1
- package/typechain-types/factories/VotingEscrowPendleMainchain__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +135 -0
- package/typechain-types/index.ts +30 -0
|
@@ -119,7 +119,12 @@ contract VotingEscrowPendleMainchain is IPVotingEscrow, VotingEscrowTokenBase, C
|
|
|
119
119
|
* @dev state changes expected:
|
|
120
120
|
- _totalSupply & lastSlopeChangeAppliedAt is updated
|
|
121
121
|
*/
|
|
122
|
-
function totalSupplyCurrent()
|
|
122
|
+
function totalSupplyCurrent()
|
|
123
|
+
public
|
|
124
|
+
virtual
|
|
125
|
+
override(IPVeToken, VotingEscrowTokenBase)
|
|
126
|
+
returns (uint128)
|
|
127
|
+
{
|
|
123
128
|
(VeBalance memory supply, ) = _applySlopeChange();
|
|
124
129
|
return supply.getCurrentValue();
|
|
125
130
|
}
|
|
@@ -51,7 +51,8 @@ contract PendleRouter is Proxy, Initializable, UUPSUpgradeable, BoringOwnableUpg
|
|
|
51
51
|
sig == IPActionMintRedeem.redeemPyToToken.selector ||
|
|
52
52
|
sig == IPActionMintRedeem.mintPyFromScy.selector ||
|
|
53
53
|
sig == IPActionMintRedeem.redeemPyToScy.selector ||
|
|
54
|
-
sig == IPActionMintRedeem.redeemDueInterestAndRewards.selector
|
|
54
|
+
sig == IPActionMintRedeem.redeemDueInterestAndRewards.selector ||
|
|
55
|
+
sig == IPActionMintRedeem.redeemDueInterestAndRewardsThenSwapAll.selector
|
|
55
56
|
) {
|
|
56
57
|
return ACTION_MINT_REDEEM;
|
|
57
58
|
} else if (
|
|
@@ -369,6 +369,29 @@ contract ActionAddRemoveLiq is IPActionAddRemoveLiq, ActionBaseMintRedeem {
|
|
|
369
369
|
address market,
|
|
370
370
|
uint256 netLpToRemove,
|
|
371
371
|
uint256 minScyOut
|
|
372
|
+
) internal returns (uint256 netScyOut) {
|
|
373
|
+
if (IPMarket(market).isExpired()) {
|
|
374
|
+
netScyOut = __removeLpToScyAfterExpiry(receiver, market, netLpToRemove);
|
|
375
|
+
} else {
|
|
376
|
+
netScyOut = __removeLpToScyBeforeExpiry(receiver, market, netLpToRemove);
|
|
377
|
+
}
|
|
378
|
+
require(netScyOut >= minScyOut, "insufficient lp out");
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function __removeLpToScyAfterExpiry(
|
|
382
|
+
address receiver,
|
|
383
|
+
address market,
|
|
384
|
+
uint256 netLpToRemove
|
|
385
|
+
) internal returns (uint256 netScyOut) {
|
|
386
|
+
(, , IPYieldToken YT) = IPMarket(market).readTokens();
|
|
387
|
+
(uint256 scyFromBurn, ) = IPMarket(market).burn(receiver, address(YT), netLpToRemove);
|
|
388
|
+
netScyOut = scyFromBurn + IPYieldToken(YT).redeemPY(receiver);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function __removeLpToScyBeforeExpiry(
|
|
392
|
+
address receiver,
|
|
393
|
+
address market,
|
|
394
|
+
uint256 netLpToRemove
|
|
372
395
|
) internal returns (uint256 netScyOut) {
|
|
373
396
|
(uint256 scyFromBurn, uint256 ptFromBurn) = IPMarket(market).burn(
|
|
374
397
|
receiver,
|
|
@@ -380,8 +403,6 @@ contract ActionAddRemoveLiq is IPActionAddRemoveLiq, ActionBaseMintRedeem {
|
|
|
380
403
|
ptFromBurn,
|
|
381
404
|
EMPTY_BYTES
|
|
382
405
|
);
|
|
383
|
-
|
|
384
|
-
require(scyFromBurn + scyFromSwap >= minScyOut, "insufficient lp out");
|
|
385
406
|
netScyOut = scyFromBurn + scyFromSwap;
|
|
386
407
|
}
|
|
387
408
|
}
|
|
@@ -5,7 +5,7 @@ pragma solidity 0.8.15;
|
|
|
5
5
|
import "./IPVeToken.sol";
|
|
6
6
|
import "../libraries/VeBalanceLib.sol";
|
|
7
7
|
|
|
8
|
-
interface IPVotingEscrow {
|
|
8
|
+
interface IPVotingEscrow is IPVeToken {
|
|
9
9
|
event NewLockPosition(address indexed user, uint128 amount, uint128 expiry);
|
|
10
10
|
|
|
11
11
|
event Withdraw(address indexed user, uint128 amount);
|
|
@@ -318,6 +318,7 @@ library MarketApproxPtInLib {
|
|
|
318
318
|
|
|
319
319
|
uint256 netPtPayable = netAssetOut + arg.maxPtIn;
|
|
320
320
|
if (guess <= netPtPayable) {
|
|
321
|
+
p.guessMin = guess;
|
|
321
322
|
uint256 netPtIn = guess - netAssetOut; // guess >= netAssetOut (market invariant)
|
|
322
323
|
if (Math.isASmallerApproxB(netPtIn, arg.maxPtIn, p.eps)) {
|
|
323
324
|
return (netAssetOut, netPtIn, guess, arg.index.assetToScy(netAssetToReserve));
|
|
@@ -233,15 +233,22 @@ library MarketMathStatic {
|
|
|
233
233
|
MarketState memory state = IPMarket(market).readState();
|
|
234
234
|
|
|
235
235
|
(uint256 scyFromBurn, uint256 ptFromBurn) = state.removeLiquidity(lpToRemove);
|
|
236
|
-
uint256 scyFromSwap;
|
|
237
|
-
(scyFromSwap, netScyFee) = state.swapExactPtForScy(
|
|
238
|
-
pyIndex(market),
|
|
239
|
-
ptFromBurn,
|
|
240
|
-
block.timestamp
|
|
241
|
-
);
|
|
242
236
|
|
|
243
|
-
|
|
244
|
-
|
|
237
|
+
if (IPMarket(market).isExpired()) {
|
|
238
|
+
(,, IPYieldToken YT) = IPMarket(market).readTokens();
|
|
239
|
+
PYIndex index = PYIndex.wrap(YT.pyIndexCurrent());
|
|
240
|
+
netScyOut = scyFromBurn + index.assetToScy(ptFromBurn);
|
|
241
|
+
} else {
|
|
242
|
+
uint256 scyFromSwap;
|
|
243
|
+
(scyFromSwap, netScyFee) = state.swapExactPtForScy(
|
|
244
|
+
pyIndex(market),
|
|
245
|
+
ptFromBurn,
|
|
246
|
+
block.timestamp
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
netScyOut = scyFromBurn + scyFromSwap;
|
|
250
|
+
priceImpact = calcPriceImpact(market, ptFromBurn.neg());
|
|
251
|
+
}
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
function removeLiquiditySingleBaseTokenStatic(
|
|
@@ -596,6 +603,7 @@ library MarketMathStatic {
|
|
|
596
603
|
public
|
|
597
604
|
returns (uint256)
|
|
598
605
|
{
|
|
606
|
+
if (IPMarket(market).isExpired()) return Math.ONE;
|
|
599
607
|
int256 netPtToAccount = netPtOut;
|
|
600
608
|
MarketState memory state = IPMarket(market).readState();
|
|
601
609
|
MarketPreCompute memory comp = state.getMarketPreCompute(pyIndex(market), block.timestamp);
|
|
@@ -3,14 +3,22 @@ pragma solidity 0.8.15;
|
|
|
3
3
|
|
|
4
4
|
import "../interfaces/IPYieldContractFactory.sol";
|
|
5
5
|
import "../interfaces/IPMarketFactory.sol";
|
|
6
|
+
import "../interfaces/IPVotingEscrow.sol";
|
|
7
|
+
import "../periphery/BoringOwnableUpgradeable.sol";
|
|
6
8
|
import "./MarketMathStatic.sol";
|
|
7
9
|
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
8
10
|
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
9
11
|
import "../periphery/BoringOwnableUpgradeable.sol";
|
|
12
|
+
import "../libraries/math/WeekMath.sol";
|
|
10
13
|
|
|
11
14
|
/// EXCLUDED FROM ALL AUDITS, TO BE CALLED ONLY BY PENDLE's SDK
|
|
12
15
|
contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeable {
|
|
13
16
|
using Math for uint256;
|
|
17
|
+
using VeBalanceLib for VeBalance;
|
|
18
|
+
using VeBalanceLib for LockedPosition;
|
|
19
|
+
|
|
20
|
+
uint128 public constant MAX_LOCK_TIME = 104 weeks;
|
|
21
|
+
uint128 public constant MIN_LOCK_TIME = 1 weeks;
|
|
14
22
|
|
|
15
23
|
struct TokenAmount {
|
|
16
24
|
address token;
|
|
@@ -47,12 +55,16 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
|
|
|
47
55
|
|
|
48
56
|
IPYieldContractFactory internal immutable yieldContractFactory;
|
|
49
57
|
IPMarketFactory internal immutable marketFactory;
|
|
58
|
+
IPVotingEscrow internal immutable vePENDLE;
|
|
50
59
|
|
|
51
|
-
constructor(
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
constructor(
|
|
61
|
+
IPYieldContractFactory _yieldContractFactory,
|
|
62
|
+
IPMarketFactory _marketFactory,
|
|
63
|
+
IPVotingEscrow _vePENDLE
|
|
64
|
+
) initializer {
|
|
54
65
|
yieldContractFactory = _yieldContractFactory;
|
|
55
66
|
marketFactory = _marketFactory;
|
|
67
|
+
vePENDLE = _vePENDLE;
|
|
56
68
|
}
|
|
57
69
|
|
|
58
70
|
function initialize() external initializer {
|
|
@@ -594,6 +606,43 @@ contract RouterStatic is Initializable, BoringOwnableUpgradeable, UUPSUpgradeabl
|
|
|
594
606
|
return MarketMathStatic.swapExactYtForPt(market, exactYtIn, getDefaultApproxParams());
|
|
595
607
|
}
|
|
596
608
|
|
|
609
|
+
// ============= vePENDLE =============
|
|
610
|
+
|
|
611
|
+
function increaseLockPositionStatic(
|
|
612
|
+
address user,
|
|
613
|
+
uint128 additionalAmountToLock,
|
|
614
|
+
uint128 newExpiry
|
|
615
|
+
) external view returns (uint128 newVeBalance) {
|
|
616
|
+
require(
|
|
617
|
+
WeekMath.isValidWTime(newExpiry) && !MiniHelpers.isTimeInThePast(newExpiry),
|
|
618
|
+
"invalid newExpiry"
|
|
619
|
+
);
|
|
620
|
+
|
|
621
|
+
require(newExpiry <= block.timestamp + MAX_LOCK_TIME, "max lock time exceeded");
|
|
622
|
+
require(newExpiry >= block.timestamp + MIN_LOCK_TIME, "insufficient lock time");
|
|
623
|
+
|
|
624
|
+
LockedPosition memory oldPosition;
|
|
625
|
+
|
|
626
|
+
{
|
|
627
|
+
(uint128 amount, uint128 expiry) = vePENDLE.positionData(user);
|
|
628
|
+
oldPosition = LockedPosition(amount, expiry);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
require(oldPosition.expiry <= newExpiry, "new expiry must be after current expiry");
|
|
632
|
+
uint128 newTotalAmountLocked = additionalAmountToLock + oldPosition.amount;
|
|
633
|
+
require(newTotalAmountLocked > 0, "zero total amount locked");
|
|
634
|
+
|
|
635
|
+
uint128 additionalDurationToLock = newExpiry - oldPosition.expiry;
|
|
636
|
+
|
|
637
|
+
LockedPosition memory newPosition = LockedPosition(
|
|
638
|
+
oldPosition.amount + additionalAmountToLock,
|
|
639
|
+
oldPosition.expiry + additionalDurationToLock
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
VeBalance memory newBalance = newPosition.convertToVeBalance();
|
|
643
|
+
return newBalance.getCurrentValue();
|
|
644
|
+
}
|
|
645
|
+
|
|
597
646
|
// ============= OTHER HELPERS =============
|
|
598
647
|
|
|
599
648
|
function mintPYFromScyStatic(address YT, uint256 amountScyToMint)
|
package/package.json
CHANGED
|
@@ -32,20 +32,59 @@ export type VeBalanceStructOutput = [BigNumber, BigNumber] & {
|
|
|
32
32
|
export interface IPVotingEscrowInterface extends utils.Interface {
|
|
33
33
|
contractName: "IPVotingEscrow";
|
|
34
34
|
functions: {
|
|
35
|
+
"balanceOf(address)": FunctionFragment;
|
|
35
36
|
"increaseLockPosition(uint128,uint128)": FunctionFragment;
|
|
37
|
+
"positionData(address)": FunctionFragment;
|
|
38
|
+
"totalSupplyAndBalanceCurrent(address)": FunctionFragment;
|
|
39
|
+
"totalSupplyCurrent()": FunctionFragment;
|
|
40
|
+
"totalSupplyStored()": FunctionFragment;
|
|
36
41
|
"withdraw()": FunctionFragment;
|
|
37
42
|
};
|
|
38
43
|
|
|
44
|
+
encodeFunctionData(functionFragment: "balanceOf", values: [string]): string;
|
|
39
45
|
encodeFunctionData(
|
|
40
46
|
functionFragment: "increaseLockPosition",
|
|
41
47
|
values: [BigNumberish, BigNumberish]
|
|
42
48
|
): string;
|
|
49
|
+
encodeFunctionData(
|
|
50
|
+
functionFragment: "positionData",
|
|
51
|
+
values: [string]
|
|
52
|
+
): string;
|
|
53
|
+
encodeFunctionData(
|
|
54
|
+
functionFragment: "totalSupplyAndBalanceCurrent",
|
|
55
|
+
values: [string]
|
|
56
|
+
): string;
|
|
57
|
+
encodeFunctionData(
|
|
58
|
+
functionFragment: "totalSupplyCurrent",
|
|
59
|
+
values?: undefined
|
|
60
|
+
): string;
|
|
61
|
+
encodeFunctionData(
|
|
62
|
+
functionFragment: "totalSupplyStored",
|
|
63
|
+
values?: undefined
|
|
64
|
+
): string;
|
|
43
65
|
encodeFunctionData(functionFragment: "withdraw", values?: undefined): string;
|
|
44
66
|
|
|
67
|
+
decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result;
|
|
45
68
|
decodeFunctionResult(
|
|
46
69
|
functionFragment: "increaseLockPosition",
|
|
47
70
|
data: BytesLike
|
|
48
71
|
): Result;
|
|
72
|
+
decodeFunctionResult(
|
|
73
|
+
functionFragment: "positionData",
|
|
74
|
+
data: BytesLike
|
|
75
|
+
): Result;
|
|
76
|
+
decodeFunctionResult(
|
|
77
|
+
functionFragment: "totalSupplyAndBalanceCurrent",
|
|
78
|
+
data: BytesLike
|
|
79
|
+
): Result;
|
|
80
|
+
decodeFunctionResult(
|
|
81
|
+
functionFragment: "totalSupplyCurrent",
|
|
82
|
+
data: BytesLike
|
|
83
|
+
): Result;
|
|
84
|
+
decodeFunctionResult(
|
|
85
|
+
functionFragment: "totalSupplyStored",
|
|
86
|
+
data: BytesLike
|
|
87
|
+
): Result;
|
|
49
88
|
decodeFunctionResult(functionFragment: "withdraw", data: BytesLike): Result;
|
|
50
89
|
|
|
51
90
|
events: {
|
|
@@ -119,34 +158,90 @@ export interface IPVotingEscrow extends BaseContract {
|
|
|
119
158
|
removeListener: OnEvent<this>;
|
|
120
159
|
|
|
121
160
|
functions: {
|
|
161
|
+
balanceOf(user: string, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
162
|
+
|
|
122
163
|
increaseLockPosition(
|
|
123
164
|
additionalAmountToLock: BigNumberish,
|
|
124
165
|
expiry: BigNumberish,
|
|
125
166
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
126
167
|
): Promise<ContractTransaction>;
|
|
127
168
|
|
|
169
|
+
positionData(
|
|
170
|
+
user: string,
|
|
171
|
+
overrides?: CallOverrides
|
|
172
|
+
): Promise<
|
|
173
|
+
[BigNumber, BigNumber] & { amount: BigNumber; expiry: BigNumber }
|
|
174
|
+
>;
|
|
175
|
+
|
|
176
|
+
totalSupplyAndBalanceCurrent(
|
|
177
|
+
user: string,
|
|
178
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
179
|
+
): Promise<ContractTransaction>;
|
|
180
|
+
|
|
181
|
+
totalSupplyCurrent(
|
|
182
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
183
|
+
): Promise<ContractTransaction>;
|
|
184
|
+
|
|
185
|
+
totalSupplyStored(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
186
|
+
|
|
128
187
|
withdraw(
|
|
129
188
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
130
189
|
): Promise<ContractTransaction>;
|
|
131
190
|
};
|
|
132
191
|
|
|
192
|
+
balanceOf(user: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
193
|
+
|
|
133
194
|
increaseLockPosition(
|
|
134
195
|
additionalAmountToLock: BigNumberish,
|
|
135
196
|
expiry: BigNumberish,
|
|
136
197
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
137
198
|
): Promise<ContractTransaction>;
|
|
138
199
|
|
|
200
|
+
positionData(
|
|
201
|
+
user: string,
|
|
202
|
+
overrides?: CallOverrides
|
|
203
|
+
): Promise<[BigNumber, BigNumber] & { amount: BigNumber; expiry: BigNumber }>;
|
|
204
|
+
|
|
205
|
+
totalSupplyAndBalanceCurrent(
|
|
206
|
+
user: string,
|
|
207
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
208
|
+
): Promise<ContractTransaction>;
|
|
209
|
+
|
|
210
|
+
totalSupplyCurrent(
|
|
211
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
212
|
+
): Promise<ContractTransaction>;
|
|
213
|
+
|
|
214
|
+
totalSupplyStored(overrides?: CallOverrides): Promise<BigNumber>;
|
|
215
|
+
|
|
139
216
|
withdraw(
|
|
140
217
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
141
218
|
): Promise<ContractTransaction>;
|
|
142
219
|
|
|
143
220
|
callStatic: {
|
|
221
|
+
balanceOf(user: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
222
|
+
|
|
144
223
|
increaseLockPosition(
|
|
145
224
|
additionalAmountToLock: BigNumberish,
|
|
146
225
|
expiry: BigNumberish,
|
|
147
226
|
overrides?: CallOverrides
|
|
148
227
|
): Promise<BigNumber>;
|
|
149
228
|
|
|
229
|
+
positionData(
|
|
230
|
+
user: string,
|
|
231
|
+
overrides?: CallOverrides
|
|
232
|
+
): Promise<
|
|
233
|
+
[BigNumber, BigNumber] & { amount: BigNumber; expiry: BigNumber }
|
|
234
|
+
>;
|
|
235
|
+
|
|
236
|
+
totalSupplyAndBalanceCurrent(
|
|
237
|
+
user: string,
|
|
238
|
+
overrides?: CallOverrides
|
|
239
|
+
): Promise<[BigNumber, BigNumber]>;
|
|
240
|
+
|
|
241
|
+
totalSupplyCurrent(overrides?: CallOverrides): Promise<BigNumber>;
|
|
242
|
+
|
|
243
|
+
totalSupplyStored(overrides?: CallOverrides): Promise<BigNumber>;
|
|
244
|
+
|
|
150
245
|
withdraw(overrides?: CallOverrides): Promise<BigNumber>;
|
|
151
246
|
};
|
|
152
247
|
|
|
@@ -188,24 +283,60 @@ export interface IPVotingEscrow extends BaseContract {
|
|
|
188
283
|
};
|
|
189
284
|
|
|
190
285
|
estimateGas: {
|
|
286
|
+
balanceOf(user: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
287
|
+
|
|
191
288
|
increaseLockPosition(
|
|
192
289
|
additionalAmountToLock: BigNumberish,
|
|
193
290
|
expiry: BigNumberish,
|
|
194
291
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
195
292
|
): Promise<BigNumber>;
|
|
196
293
|
|
|
294
|
+
positionData(user: string, overrides?: CallOverrides): Promise<BigNumber>;
|
|
295
|
+
|
|
296
|
+
totalSupplyAndBalanceCurrent(
|
|
297
|
+
user: string,
|
|
298
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
299
|
+
): Promise<BigNumber>;
|
|
300
|
+
|
|
301
|
+
totalSupplyCurrent(
|
|
302
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
303
|
+
): Promise<BigNumber>;
|
|
304
|
+
|
|
305
|
+
totalSupplyStored(overrides?: CallOverrides): Promise<BigNumber>;
|
|
306
|
+
|
|
197
307
|
withdraw(
|
|
198
308
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
199
309
|
): Promise<BigNumber>;
|
|
200
310
|
};
|
|
201
311
|
|
|
202
312
|
populateTransaction: {
|
|
313
|
+
balanceOf(
|
|
314
|
+
user: string,
|
|
315
|
+
overrides?: CallOverrides
|
|
316
|
+
): Promise<PopulatedTransaction>;
|
|
317
|
+
|
|
203
318
|
increaseLockPosition(
|
|
204
319
|
additionalAmountToLock: BigNumberish,
|
|
205
320
|
expiry: BigNumberish,
|
|
206
321
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
207
322
|
): Promise<PopulatedTransaction>;
|
|
208
323
|
|
|
324
|
+
positionData(
|
|
325
|
+
user: string,
|
|
326
|
+
overrides?: CallOverrides
|
|
327
|
+
): Promise<PopulatedTransaction>;
|
|
328
|
+
|
|
329
|
+
totalSupplyAndBalanceCurrent(
|
|
330
|
+
user: string,
|
|
331
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
332
|
+
): Promise<PopulatedTransaction>;
|
|
333
|
+
|
|
334
|
+
totalSupplyCurrent(
|
|
335
|
+
overrides?: Overrides & { from?: string | Promise<string> }
|
|
336
|
+
): Promise<PopulatedTransaction>;
|
|
337
|
+
|
|
338
|
+
totalSupplyStored(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
339
|
+
|
|
209
340
|
withdraw(
|
|
210
341
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
211
342
|
): Promise<PopulatedTransaction>;
|
|
@@ -27,7 +27,10 @@ export interface PendleFeeDistributorFactoryInterface extends utils.Interface {
|
|
|
27
27
|
functions: {
|
|
28
28
|
"claimOwnership()": FunctionFragment;
|
|
29
29
|
"createFeeDistributor(address,uint64)": FunctionFragment;
|
|
30
|
-
"
|
|
30
|
+
"feeDistributorCreationCodeContractA()": FunctionFragment;
|
|
31
|
+
"feeDistributorCreationCodeContractB()": FunctionFragment;
|
|
32
|
+
"feeDistributorCreationCodeSizeA()": FunctionFragment;
|
|
33
|
+
"feeDistributorCreationCodeSizeB()": FunctionFragment;
|
|
31
34
|
"getUserAndTotalSharesAt(address,address,uint256)": FunctionFragment;
|
|
32
35
|
"lastFinishedEpoch()": FunctionFragment;
|
|
33
36
|
"owner()": FunctionFragment;
|
|
@@ -50,7 +53,19 @@ export interface PendleFeeDistributorFactoryInterface extends utils.Interface {
|
|
|
50
53
|
values: [string, BigNumberish]
|
|
51
54
|
): string;
|
|
52
55
|
encodeFunctionData(
|
|
53
|
-
functionFragment: "
|
|
56
|
+
functionFragment: "feeDistributorCreationCodeContractA",
|
|
57
|
+
values?: undefined
|
|
58
|
+
): string;
|
|
59
|
+
encodeFunctionData(
|
|
60
|
+
functionFragment: "feeDistributorCreationCodeContractB",
|
|
61
|
+
values?: undefined
|
|
62
|
+
): string;
|
|
63
|
+
encodeFunctionData(
|
|
64
|
+
functionFragment: "feeDistributorCreationCodeSizeA",
|
|
65
|
+
values?: undefined
|
|
66
|
+
): string;
|
|
67
|
+
encodeFunctionData(
|
|
68
|
+
functionFragment: "feeDistributorCreationCodeSizeB",
|
|
54
69
|
values?: undefined
|
|
55
70
|
): string;
|
|
56
71
|
encodeFunctionData(
|
|
@@ -98,7 +113,19 @@ export interface PendleFeeDistributorFactoryInterface extends utils.Interface {
|
|
|
98
113
|
data: BytesLike
|
|
99
114
|
): Result;
|
|
100
115
|
decodeFunctionResult(
|
|
101
|
-
functionFragment: "
|
|
116
|
+
functionFragment: "feeDistributorCreationCodeContractA",
|
|
117
|
+
data: BytesLike
|
|
118
|
+
): Result;
|
|
119
|
+
decodeFunctionResult(
|
|
120
|
+
functionFragment: "feeDistributorCreationCodeContractB",
|
|
121
|
+
data: BytesLike
|
|
122
|
+
): Result;
|
|
123
|
+
decodeFunctionResult(
|
|
124
|
+
functionFragment: "feeDistributorCreationCodeSizeA",
|
|
125
|
+
data: BytesLike
|
|
126
|
+
): Result;
|
|
127
|
+
decodeFunctionResult(
|
|
128
|
+
functionFragment: "feeDistributorCreationCodeSizeB",
|
|
102
129
|
data: BytesLike
|
|
103
130
|
): Result;
|
|
104
131
|
decodeFunctionResult(
|
|
@@ -187,10 +214,22 @@ export interface PendleFeeDistributorFactory extends BaseContract {
|
|
|
187
214
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
188
215
|
): Promise<ContractTransaction>;
|
|
189
216
|
|
|
190
|
-
|
|
217
|
+
feeDistributorCreationCodeContractA(
|
|
218
|
+
overrides?: CallOverrides
|
|
219
|
+
): Promise<[string]>;
|
|
220
|
+
|
|
221
|
+
feeDistributorCreationCodeContractB(
|
|
191
222
|
overrides?: CallOverrides
|
|
192
223
|
): Promise<[string]>;
|
|
193
224
|
|
|
225
|
+
feeDistributorCreationCodeSizeA(
|
|
226
|
+
overrides?: CallOverrides
|
|
227
|
+
): Promise<[BigNumber]>;
|
|
228
|
+
|
|
229
|
+
feeDistributorCreationCodeSizeB(
|
|
230
|
+
overrides?: CallOverrides
|
|
231
|
+
): Promise<[BigNumber]>;
|
|
232
|
+
|
|
194
233
|
getUserAndTotalSharesAt(
|
|
195
234
|
user: string,
|
|
196
235
|
pool: string,
|
|
@@ -251,7 +290,21 @@ export interface PendleFeeDistributorFactory extends BaseContract {
|
|
|
251
290
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
252
291
|
): Promise<ContractTransaction>;
|
|
253
292
|
|
|
254
|
-
|
|
293
|
+
feeDistributorCreationCodeContractA(
|
|
294
|
+
overrides?: CallOverrides
|
|
295
|
+
): Promise<string>;
|
|
296
|
+
|
|
297
|
+
feeDistributorCreationCodeContractB(
|
|
298
|
+
overrides?: CallOverrides
|
|
299
|
+
): Promise<string>;
|
|
300
|
+
|
|
301
|
+
feeDistributorCreationCodeSizeA(
|
|
302
|
+
overrides?: CallOverrides
|
|
303
|
+
): Promise<BigNumber>;
|
|
304
|
+
|
|
305
|
+
feeDistributorCreationCodeSizeB(
|
|
306
|
+
overrides?: CallOverrides
|
|
307
|
+
): Promise<BigNumber>;
|
|
255
308
|
|
|
256
309
|
getUserAndTotalSharesAt(
|
|
257
310
|
user: string,
|
|
@@ -311,10 +364,22 @@ export interface PendleFeeDistributorFactory extends BaseContract {
|
|
|
311
364
|
overrides?: CallOverrides
|
|
312
365
|
): Promise<string>;
|
|
313
366
|
|
|
314
|
-
|
|
367
|
+
feeDistributorCreationCodeContractA(
|
|
368
|
+
overrides?: CallOverrides
|
|
369
|
+
): Promise<string>;
|
|
370
|
+
|
|
371
|
+
feeDistributorCreationCodeContractB(
|
|
315
372
|
overrides?: CallOverrides
|
|
316
373
|
): Promise<string>;
|
|
317
374
|
|
|
375
|
+
feeDistributorCreationCodeSizeA(
|
|
376
|
+
overrides?: CallOverrides
|
|
377
|
+
): Promise<BigNumber>;
|
|
378
|
+
|
|
379
|
+
feeDistributorCreationCodeSizeB(
|
|
380
|
+
overrides?: CallOverrides
|
|
381
|
+
): Promise<BigNumber>;
|
|
382
|
+
|
|
318
383
|
getUserAndTotalSharesAt(
|
|
319
384
|
user: string,
|
|
320
385
|
pool: string,
|
|
@@ -387,7 +452,19 @@ export interface PendleFeeDistributorFactory extends BaseContract {
|
|
|
387
452
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
388
453
|
): Promise<BigNumber>;
|
|
389
454
|
|
|
390
|
-
|
|
455
|
+
feeDistributorCreationCodeContractA(
|
|
456
|
+
overrides?: CallOverrides
|
|
457
|
+
): Promise<BigNumber>;
|
|
458
|
+
|
|
459
|
+
feeDistributorCreationCodeContractB(
|
|
460
|
+
overrides?: CallOverrides
|
|
461
|
+
): Promise<BigNumber>;
|
|
462
|
+
|
|
463
|
+
feeDistributorCreationCodeSizeA(
|
|
464
|
+
overrides?: CallOverrides
|
|
465
|
+
): Promise<BigNumber>;
|
|
466
|
+
|
|
467
|
+
feeDistributorCreationCodeSizeB(
|
|
391
468
|
overrides?: CallOverrides
|
|
392
469
|
): Promise<BigNumber>;
|
|
393
470
|
|
|
@@ -443,7 +520,19 @@ export interface PendleFeeDistributorFactory extends BaseContract {
|
|
|
443
520
|
overrides?: Overrides & { from?: string | Promise<string> }
|
|
444
521
|
): Promise<PopulatedTransaction>;
|
|
445
522
|
|
|
446
|
-
|
|
523
|
+
feeDistributorCreationCodeContractA(
|
|
524
|
+
overrides?: CallOverrides
|
|
525
|
+
): Promise<PopulatedTransaction>;
|
|
526
|
+
|
|
527
|
+
feeDistributorCreationCodeContractB(
|
|
528
|
+
overrides?: CallOverrides
|
|
529
|
+
): Promise<PopulatedTransaction>;
|
|
530
|
+
|
|
531
|
+
feeDistributorCreationCodeSizeA(
|
|
532
|
+
overrides?: CallOverrides
|
|
533
|
+
): Promise<PopulatedTransaction>;
|
|
534
|
+
|
|
535
|
+
feeDistributorCreationCodeSizeB(
|
|
447
536
|
overrides?: CallOverrides
|
|
448
537
|
): Promise<PopulatedTransaction>;
|
|
449
538
|
|