@pendle/core-v2 2.19.0 → 2.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,8 @@ library LayerZeroHelper {
13
13
  // avax mainnet
14
14
  else if (chainId == 42161) return 110;
15
15
  // arbitrum one
16
+ else if (chainId == 56) return 102;
17
+ // binance smart chain
16
18
  else if (chainId == 1) return 101;
17
19
  assert(false);
18
20
  }
@@ -26,6 +28,8 @@ library LayerZeroHelper {
26
28
  // avax mainnet
27
29
  else if (chainId == 110) return 42161;
28
30
  // arbitrum one
31
+ else if (chainId == 102) return 56;
32
+ // binance smart chain
29
33
  else if (chainId == 101) return 1;
30
34
  assert(false);
31
35
  }
@@ -40,10 +40,11 @@ abstract contract PendleGauge is RewardManager, IPGauge {
40
40
  rewards is updated
41
41
  * @dev It's intended to have user's activeBalance updated when rewards is redeemed
42
42
  */
43
- function _redeemRewards(address user) internal virtual returns (uint256[] memory) {
43
+ function _redeemRewards(address user) internal virtual returns (uint256[] memory rewardsOut) {
44
44
  _updateAndDistributeRewards(user);
45
45
  _updateUserActiveBalance(user);
46
- return _doTransferOutRewards(user, user);
46
+ rewardsOut = _doTransferOutRewards(user, user);
47
+ emit RedeemRewards(user, rewardsOut);
47
48
  }
48
49
 
49
50
  function _updateUserActiveBalance(address user) internal virtual {
@@ -0,0 +1,108 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity 0.8.17;
3
+
4
+ import "../SYBase.sol";
5
+ import "../../../interfaces/BinanceEth/IWBETH.sol";
6
+
7
+ contract PendleWbEthSY is SYBase {
8
+ using Math for uint256;
9
+
10
+ address public immutable eth;
11
+ address public immutable wbETH;
12
+
13
+ constructor(
14
+ string memory _name,
15
+ string memory _symbol,
16
+ address _eth,
17
+ address _wbETH
18
+ ) SYBase(_name, _symbol, _wbETH) {
19
+ eth = _eth;
20
+ wbETH = _wbETH;
21
+ _safeApproveInf(eth, wbETH);
22
+ }
23
+
24
+ /*///////////////////////////////////////////////////////////////
25
+ DEPOSIT/REDEEM USING BASE TOKENS
26
+ //////////////////////////////////////////////////////////////*/
27
+
28
+ function _deposit(
29
+ address tokenIn,
30
+ uint256 amountDeposited
31
+ ) internal override returns (uint256 amountSharesOut) {
32
+ if (tokenIn == eth) {
33
+ uint256 previousBalance = _selfBalance(wbETH);
34
+ IWBETH(wbETH).deposit(amountDeposited, address(this));
35
+ amountSharesOut = _selfBalance(wbETH) - previousBalance;
36
+ } else {
37
+ // wbETH
38
+ amountSharesOut = amountDeposited;
39
+ }
40
+ }
41
+
42
+ function _redeem(
43
+ address receiver,
44
+ address tokenOut,
45
+ uint256 amountSharesToRedeem
46
+ ) internal override returns (uint256 /*amountTokenOut*/) {
47
+ _transferOut(tokenOut, receiver, amountSharesToRedeem);
48
+ return amountSharesToRedeem;
49
+ }
50
+
51
+ /*///////////////////////////////////////////////////////////////
52
+ EXCHANGE-RATE
53
+ //////////////////////////////////////////////////////////////*/
54
+
55
+ function exchangeRate() public view override returns (uint256) {
56
+ // exchangeRate is set by wbETH's oracle
57
+ return IWBETH(wbETH).exchangeRate();
58
+ }
59
+
60
+ /*///////////////////////////////////////////////////////////////
61
+ MISC FUNCTIONS FOR METADATA
62
+ //////////////////////////////////////////////////////////////*/
63
+
64
+ function _previewDeposit(
65
+ address tokenIn,
66
+ uint256 amountTokenToDeposit
67
+ ) internal view override returns (uint256 /*amountSharesOut*/) {
68
+ if (tokenIn == eth) {
69
+ return amountTokenToDeposit.divDown(exchangeRate());
70
+ } else {
71
+ return amountTokenToDeposit;
72
+ }
73
+ }
74
+
75
+ function _previewRedeem(
76
+ address,
77
+ uint256 amountSharesToRedeem
78
+ ) internal pure override returns (uint256 /*amountTokenOut*/) {
79
+ return amountSharesToRedeem;
80
+ }
81
+
82
+ function getTokensIn() public view override returns (address[] memory res) {
83
+ res = new address[](2);
84
+ res[0] = wbETH;
85
+ res[1] = eth;
86
+ }
87
+
88
+ function getTokensOut() public view override returns (address[] memory res) {
89
+ res = new address[](1);
90
+ res[0] = wbETH;
91
+ }
92
+
93
+ function isValidTokenIn(address token) public view override returns (bool) {
94
+ return token == eth || token == wbETH;
95
+ }
96
+
97
+ function isValidTokenOut(address token) public view override returns (bool) {
98
+ return token == wbETH;
99
+ }
100
+
101
+ function assetInfo()
102
+ external
103
+ view
104
+ returns (AssetType assetType, address assetAddress, uint8 assetDecimals)
105
+ {
106
+ return (AssetType.TOKEN, eth, 18);
107
+ }
108
+ }
@@ -0,0 +1,9 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+
3
+ pragma solidity 0.8.17;
4
+
5
+ interface IWBETH {
6
+ function deposit(uint256 amount, address referral) external;
7
+
8
+ function exchangeRate() external view returns (uint256 _exchangeRate);
9
+ }
@@ -5,4 +5,7 @@ interface IPGauge {
5
5
  function totalActiveSupply() external view returns (uint256);
6
6
 
7
7
  function activeBalance(address user) external view returns (uint256);
8
+
9
+ // only available for newer factories. please check the verified contracts
10
+ event RedeemRewards(address indexed user, uint256[] rewardsOut);
8
11
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "SY wstETH",
3
3
  "SY": "0x80c12D5b6Cc494632Bf11b03F09436c8B61Cc5Df",
4
- "YT": "0xC8D9369809e48d03FF7B69D7979b174e2D34874C",
5
- "PT": "0x1255638EFeca62e12E344E0b6B22ea853eC6e2c7",
6
- "market": "0x08a152834de126d2ef83D612ff36e4523FD0017F",
7
- "expiry": 1750896000,
8
- "scalarRoot": "111711700000000000000",
9
- "initAnchor": "1097874000000000000"
4
+ "YT": "0x0052B6096f8c1DCBEfB9ba381EB6b67479b5c56b",
5
+ "PT": "0x9741CAc1a22Ff3615FA074fD0B439975a5E137e9",
6
+ "market": "0xFd8AeE8FCC10aac1897F8D5271d112810C79e022",
7
+ "expiry": 1719446400,
8
+ "scalarRoot": "125538500000000000000",
9
+ "initAnchor": "1042619000000000000"
10
10
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "SY wstETH",
3
+ "SY": "0x80c12D5b6Cc494632Bf11b03F09436c8B61Cc5Df",
4
+ "YT": "0xC8D9369809e48d03FF7B69D7979b174e2D34874C",
5
+ "PT": "0x1255638EFeca62e12E344E0b6B22ea853eC6e2c7",
6
+ "market": "0x08a152834de126d2ef83D612ff36e4523FD0017F",
7
+ "expiry": 1750896000,
8
+ "scalarRoot": "111711700000000000000",
9
+ "initAnchor": "1097874000000000000"
10
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "deployer": "0x1FcCC097db89A86Bfc474A1028F93958295b1Fb7",
3
+ "network": {
4
+ "chainId": 56,
5
+ "treasury": "0xd77E9062c6DF3F2d1CB5Bf45855fa1E7712A059e",
6
+ "governance": "0xA06627d9884996BC27a7c20fDA94FC94C13aa9Ec",
7
+ "pendle": "0xb3Ed0A426155B79B898849803E3B36552f7ED507",
8
+ "lzEndpoint": "0x3c2269811836af69497E5F486A85D7316753cf62",
9
+ "wrappedNative": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
10
+ "initialRewardFee": "30000000000000000",
11
+ "initialInterestFee": "30000000000000000",
12
+ "initialFeeRateRoot": "999500333083533",
13
+ "initialReserveFeePercent": "80",
14
+ "safeWaitTime": 15000
15
+ },
16
+ "baseCodeSplitter": "0x0E669e08bd717d7F9c9DE158636BD8561295fbB5",
17
+ "PENDLE": "0xb3Ed0A426155B79B898849803E3B36552f7ED507",
18
+ "yieldContractFactory": "0xa2530b4cfBF271e2B409A05C2CE520e4cB5fCc88",
19
+ "marketFactory": "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E",
20
+ "router": "0x00000000025EFaDc0b8d17d3d87aB5056e3D2510",
21
+ "routerStatic": "0x2700ADB035F82a11899ce1D3f1BF8451c296eABb",
22
+ "pendleSwap": "0x6f41855CdF6861a1F8A017e8bB0F90927582cCf6",
23
+ "routerHelper": "0x09D65812dCD0f276e052583d41885cA5C7Dd0086",
24
+ "ptOracle": "0x4d717868F4Bd14ac8B29Bb6361901e30Ae05e340",
25
+ "receiverEndpoint": "0x998CF52b2585e05494BF9F2bF502351a9C7FdA8f",
26
+ "vePendle": "0x8A09574b0401A856d89d1b583eE22E8cb0C5530B",
27
+ "gaugeController": "0x704478Dd72FD7F9B83d1F1e0fc18C14B54F034d0"
28
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "SY Thena frxETH-ETH",
3
+ "SY": "0xf86DDA825885674F85C5420079E1Df1bC0F372c6",
4
+ "YT": "0x8D0884EBA8E481CcADf2F91E62170cdF79AE9C64",
5
+ "PT": "0x5eC2ae0AFDEc891E7702344dc2A31C636B3627Eb",
6
+ "market": "0x66317Dec4a3d8d1e47b85f704E5DF675a68BB7C9",
7
+ "expiry": 1719446400,
8
+ "scalarRoot": "29290520000000000000",
9
+ "initAnchor": "1075220000000000000"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "SY wbETH",
3
+ "SY": "0x96F77F24b3d17166FcaF3a9E3B8330fF38B966F9",
4
+ "YT": "0x429c77E193Ff7e6c6c3B2e1f00877B91792e87ee",
5
+ "PT": "0x70c1138B54ba212776d3A9d29b6160C54C31cd5d",
6
+ "market": "0x080f52A881ba96EEE2268682733C857c560e5dd4",
7
+ "expiry": 1735171200,
8
+ "scalarRoot": "114833600000000000000",
9
+ "initAnchor": "1062697999000000000"
10
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "multicall": "0xfd6Df9EFACfEfdF4E610d687A9c9b941D1b1Bf75",
3
+ "implicitSwapfeeContract": "0xed18de5442297a4ec1ce59c7c7d9427adc2a012b"
4
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pendle/core-v2",
3
3
  "description": "Core smart contracts of Pendle Protocol.",
4
4
  "license": "BUSL-1.1",
5
- "version": "2.19.0",
5
+ "version": "2.20.1",
6
6
  "homepage": "https://pendle.finance",
7
7
  "keywords": [
8
8
  "pendle",