@pendle/core-v2 5.4.2 → 5.4.3

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.
Files changed (60) hide show
  1. package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.dbg.json +4 -0
  2. package/build/artifacts/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol/PendleMultiTokenMerkleDistributor.json +462 -0
  3. package/build/artifacts/contracts/interfaces/IPActionAddRemoveLiqV3.sol/IPActionAddRemoveLiqV3.dbg.json +1 -1
  4. package/build/artifacts/contracts/interfaces/IPActionMarketAuxStatic.sol/IPActionMarketAuxStatic.dbg.json +1 -1
  5. package/build/artifacts/contracts/interfaces/IPActionMiscV3.sol/IPActionMiscV3.dbg.json +1 -1
  6. package/build/artifacts/contracts/interfaces/IPActionSimple.sol/IPActionSimple.dbg.json +1 -1
  7. package/build/artifacts/contracts/interfaces/IPActionStorageStatic.sol/IPActionStorageStatic.dbg.json +1 -1
  8. package/build/artifacts/contracts/interfaces/IPActionStorageV4.sol/IPActionStorageV4.dbg.json +1 -1
  9. package/build/artifacts/contracts/interfaces/IPActionSwapPTV3.sol/IPActionSwapPTV3.dbg.json +1 -1
  10. package/build/artifacts/contracts/interfaces/IPActionSwapYTV3.sol/IPActionSwapYTV3.dbg.json +1 -1
  11. package/build/artifacts/contracts/interfaces/IPAllActionV3.sol/IPAllActionV3.dbg.json +1 -1
  12. package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionAddRemoveLiqV3Events.dbg.json +1 -1
  13. package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionMiscV3Events.dbg.json +1 -1
  14. package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionStorageEvents.dbg.json +1 -1
  15. package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapPTV3Events.dbg.json +1 -1
  16. package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPActionSwapYTV3Events.dbg.json +1 -1
  17. package/build/artifacts/contracts/interfaces/IPAllEventsV3.sol/IPAllEventsV3.dbg.json +1 -1
  18. package/build/artifacts/contracts/interfaces/IPMultiTokenMerkleDistributor.sol/IPMultiTokenMerkleDistributor.dbg.json +4 -0
  19. package/build/artifacts/contracts/interfaces/IPMultiTokenMerkleDistributor.sol/IPMultiTokenMerkleDistributor.json +190 -0
  20. package/build/artifacts/contracts/interfaces/IPRouterStatic.sol/IPRouterStatic.dbg.json +1 -1
  21. package/build/artifacts/contracts/offchain-helpers/PendlePoolDeployHelper.sol/PendlePoolDeployHelper.dbg.json +1 -1
  22. package/build/artifacts/contracts/offchain-helpers/router-static/PendleRouterStatic.sol/PendleRouterStatic.dbg.json +1 -1
  23. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionInfoStatic.sol/ActionInfoStatic.dbg.json +1 -1
  24. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketAuxStatic.sol/ActionMarketAuxStatic.dbg.json +1 -1
  25. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMarketCoreStatic.sol/ActionMarketCoreStatic.dbg.json +1 -1
  26. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionMintRedeemStatic.sol/ActionMintRedeemStatic.dbg.json +1 -1
  27. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionStorageStatic.sol/ActionStorageStatic.dbg.json +1 -1
  28. package/build/artifacts/contracts/offchain-helpers/router-static/base/ActionVePendleStatic.sol/ActionVePendleStatic.dbg.json +1 -1
  29. package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtInLibV1.dbg.json +1 -1
  30. package/build/artifacts/contracts/offchain-helpers/router-static/base/MarketApproxLibV1.sol/MarketApproxPtOutLibV1.dbg.json +1 -1
  31. package/build/artifacts/contracts/offchain-helpers/router-static/base/StorageLayout.sol/StorageLayout.dbg.json +1 -1
  32. package/build/artifacts/contracts/router/ActionStorageV4.sol/ActionStorageV4.dbg.json +1 -1
  33. package/build/artifacts/contracts/router/PendleRouterV4.sol/PendleRouterV4.dbg.json +1 -1
  34. package/build/artifacts/contracts/router/Reflector.sol/Reflector.dbg.json +1 -1
  35. package/build/artifacts/contracts/router/base/ActionBase.sol/ActionBase.dbg.json +1 -1
  36. package/build/artifacts/contracts/router/base/ActionDelegateBase.sol/ActionDelegateBase.dbg.json +1 -1
  37. package/build/artifacts/contracts/router/math/ApproxStateLib.sol/ApproxStateLib.dbg.json +1 -1
  38. package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtInLibOnchain.dbg.json +1 -1
  39. package/build/artifacts/contracts/router/math/MarketApproxLibOnchain.sol/MarketApproxPtOutLibOnchain.dbg.json +1 -1
  40. package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtInLibV2.dbg.json +1 -1
  41. package/build/artifacts/contracts/router/math/MarketApproxLibV2.sol/MarketApproxPtOutLibV2.dbg.json +1 -1
  42. package/build/artifacts/contracts/router/swap-aggregator/IPSwapAggregator.sol/IPSwapAggregator.dbg.json +1 -1
  43. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IKyberScalingHelper.dbg.json +1 -1
  44. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/IOdosRouterV2.dbg.json +1 -1
  45. package/build/artifacts/contracts/router/swap-aggregator/PendleSwap.sol/PendleSwap.dbg.json +1 -1
  46. package/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol +117 -0
  47. package/contracts/interfaces/IPMultiTokenMerkleDistributor.sol +27 -0
  48. package/deployments/1-core.json +1 -0
  49. package/deployments/10-core.json +1 -0
  50. package/deployments/42161-core.json +1 -0
  51. package/deployments/5000-core.json +1 -0
  52. package/deployments/56-core.json +1 -0
  53. package/deployments/8453-core.json +1 -0
  54. package/package.json +1 -1
  55. package/typechain-types/IPMultiTokenMerkleDistributor.ts +275 -0
  56. package/typechain-types/PendleMultiTokenMerkleDistributor.ts +677 -0
  57. package/typechain-types/factories/IPMultiTokenMerkleDistributor__factory.ts +209 -0
  58. package/typechain-types/factories/PendleMultiTokenMerkleDistributor__factory.ts +523 -0
  59. package/typechain-types/hardhat.d.ts +18 -0
  60. package/typechain-types/index.ts +4 -0
@@ -0,0 +1,190 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "IPMultiTokenMerkleDistributor",
4
+ "sourceName": "contracts/interfaces/IPMultiTokenMerkleDistributor.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [],
8
+ "name": "InvalidMerkleProof",
9
+ "type": "error"
10
+ },
11
+ {
12
+ "anonymous": false,
13
+ "inputs": [
14
+ {
15
+ "indexed": true,
16
+ "internalType": "address",
17
+ "name": "token",
18
+ "type": "address"
19
+ },
20
+ {
21
+ "indexed": true,
22
+ "internalType": "address",
23
+ "name": "user",
24
+ "type": "address"
25
+ },
26
+ {
27
+ "indexed": true,
28
+ "internalType": "address",
29
+ "name": "receiver",
30
+ "type": "address"
31
+ },
32
+ {
33
+ "indexed": false,
34
+ "internalType": "uint256",
35
+ "name": "amount",
36
+ "type": "uint256"
37
+ }
38
+ ],
39
+ "name": "Claimed",
40
+ "type": "event"
41
+ },
42
+ {
43
+ "anonymous": false,
44
+ "inputs": [
45
+ {
46
+ "indexed": false,
47
+ "internalType": "address[]",
48
+ "name": "defaultTokenList",
49
+ "type": "address[]"
50
+ }
51
+ ],
52
+ "name": "SetDefaultTokenList",
53
+ "type": "event"
54
+ },
55
+ {
56
+ "anonymous": false,
57
+ "inputs": [
58
+ {
59
+ "indexed": true,
60
+ "internalType": "bytes32",
61
+ "name": "merkleRoot",
62
+ "type": "bytes32"
63
+ }
64
+ ],
65
+ "name": "SetMerkleRoot",
66
+ "type": "event"
67
+ },
68
+ {
69
+ "anonymous": false,
70
+ "inputs": [
71
+ {
72
+ "indexed": true,
73
+ "internalType": "address",
74
+ "name": "token",
75
+ "type": "address"
76
+ },
77
+ {
78
+ "indexed": true,
79
+ "internalType": "address",
80
+ "name": "user",
81
+ "type": "address"
82
+ },
83
+ {
84
+ "indexed": false,
85
+ "internalType": "uint256",
86
+ "name": "amountClaimable",
87
+ "type": "uint256"
88
+ }
89
+ ],
90
+ "name": "Verified",
91
+ "type": "event"
92
+ },
93
+ {
94
+ "inputs": [
95
+ {
96
+ "internalType": "address",
97
+ "name": "receiver",
98
+ "type": "address"
99
+ },
100
+ {
101
+ "internalType": "address[]",
102
+ "name": "tokens",
103
+ "type": "address[]"
104
+ },
105
+ {
106
+ "internalType": "uint256[]",
107
+ "name": "totalAccrueds",
108
+ "type": "uint256[]"
109
+ },
110
+ {
111
+ "internalType": "bytes32[][]",
112
+ "name": "proofs",
113
+ "type": "bytes32[][]"
114
+ }
115
+ ],
116
+ "name": "claim",
117
+ "outputs": [
118
+ {
119
+ "internalType": "uint256[]",
120
+ "name": "amountOuts",
121
+ "type": "uint256[]"
122
+ }
123
+ ],
124
+ "stateMutability": "nonpayable",
125
+ "type": "function"
126
+ },
127
+ {
128
+ "inputs": [
129
+ {
130
+ "internalType": "address",
131
+ "name": "receiver",
132
+ "type": "address"
133
+ },
134
+ {
135
+ "internalType": "address[]",
136
+ "name": "tokens",
137
+ "type": "address[]"
138
+ }
139
+ ],
140
+ "name": "claimVerified",
141
+ "outputs": [
142
+ {
143
+ "internalType": "uint256[]",
144
+ "name": "amountOuts",
145
+ "type": "uint256[]"
146
+ }
147
+ ],
148
+ "stateMutability": "nonpayable",
149
+ "type": "function"
150
+ },
151
+ {
152
+ "inputs": [
153
+ {
154
+ "internalType": "address",
155
+ "name": "user",
156
+ "type": "address"
157
+ },
158
+ {
159
+ "internalType": "address[]",
160
+ "name": "tokens",
161
+ "type": "address[]"
162
+ },
163
+ {
164
+ "internalType": "uint256[]",
165
+ "name": "totalAccrueds",
166
+ "type": "uint256[]"
167
+ },
168
+ {
169
+ "internalType": "bytes32[][]",
170
+ "name": "proofs",
171
+ "type": "bytes32[][]"
172
+ }
173
+ ],
174
+ "name": "verify",
175
+ "outputs": [
176
+ {
177
+ "internalType": "uint256[]",
178
+ "name": "amountClaimable",
179
+ "type": "uint256[]"
180
+ }
181
+ ],
182
+ "stateMutability": "nonpayable",
183
+ "type": "function"
184
+ }
185
+ ],
186
+ "bytecode": "0x",
187
+ "deployedBytecode": "0x",
188
+ "linkReferences": {},
189
+ "deployedLinkReferences": {}
190
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../build-info/be15d6fd3edbce74a89dc32e36c32178.json"
3
+ "buildInfo": "../../../../build-info/f3456968fbf18b477661658955d3543f.json"
4
4
  }
@@ -0,0 +1,117 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.17;
3
+
4
+ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
5
+ import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
6
+ import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
7
+ import "../core/libraries/BoringOwnableUpgradeable.sol";
8
+ import "../core/libraries/TokenHelper.sol";
9
+ import "../core/libraries/Errors.sol";
10
+ import "../interfaces/IPMultiTokenMerkleDistributor.sol";
11
+
12
+ contract PendleMultiTokenMerkleDistributor is
13
+ IPMultiTokenMerkleDistributor,
14
+ UUPSUpgradeable,
15
+ BoringOwnableUpgradeable,
16
+ TokenHelper
17
+ {
18
+ bytes32 public merkleRoot;
19
+
20
+ /// (token, user) => amount
21
+ mapping(address => mapping(address => uint256)) public claimed;
22
+ mapping(address => mapping(address => uint256)) public verified;
23
+
24
+ constructor() {
25
+ _disableInitializers();
26
+ }
27
+
28
+ receive() external payable {}
29
+
30
+ function initialize() external initializer {
31
+ __BoringOwnable_init();
32
+ }
33
+
34
+ function claim(
35
+ address receiver,
36
+ address[] memory tokens,
37
+ uint256[] memory totalAccrueds,
38
+ bytes32[][] memory proofs
39
+ ) external returns (uint256[] memory amountOuts) {
40
+ if (tokens.length != totalAccrueds.length || tokens.length != proofs.length) {
41
+ revert Errors.ArrayLengthMismatch();
42
+ }
43
+
44
+ address user = msg.sender;
45
+ uint256 nToken = tokens.length;
46
+ amountOuts = new uint256[](nToken);
47
+
48
+ for (uint256 i = 0; i < nToken; ++i) {
49
+ (address token, uint256 totalAccrued, bytes32[] memory proof) = (tokens[i], totalAccrueds[i], proofs[i]);
50
+ if (!_verifyMerkleData(token, user, totalAccrued, proof)) revert InvalidMerkleProof();
51
+
52
+ amountOuts[i] = totalAccrued - claimed[token][user];
53
+ claimed[token][user] = totalAccrued;
54
+
55
+ _transferOut(token, receiver, amountOuts[i]);
56
+ emit Claimed(token, user, receiver, amountOuts[i]);
57
+ }
58
+ }
59
+
60
+ function claimVerified(address receiver, address[] memory tokens) external returns (uint256[] memory amountOuts) {
61
+ address user = msg.sender;
62
+ uint256 nToken = tokens.length;
63
+ amountOuts = new uint256[](nToken);
64
+
65
+ for (uint256 i = 0; i < nToken; ++i) {
66
+ address token = tokens[i];
67
+ uint256 amountVerified = verified[token][user];
68
+ uint256 amountClaimed = claimed[token][user];
69
+
70
+ if (amountVerified > amountClaimed) {
71
+ amountOuts[i] = amountVerified - amountClaimed;
72
+ claimed[token][user] = amountVerified;
73
+ _transferOut(token, receiver, amountOuts[i]);
74
+ emit Claimed(token, user, receiver, amountOuts[i]);
75
+ }
76
+ }
77
+ }
78
+
79
+ function verify(
80
+ address user,
81
+ address[] memory tokens,
82
+ uint256[] memory totalAccrueds,
83
+ bytes32[][] memory proofs
84
+ ) external returns (uint256[] memory amountClaimable) {
85
+ uint256 nToken = tokens.length;
86
+ amountClaimable = new uint256[](nToken);
87
+
88
+ for (uint256 i = 0; i < nToken; ++i) {
89
+ (address token, uint256 totalAccrued, bytes32[] memory proof) = (tokens[i], totalAccrueds[i], proofs[i]);
90
+ if (!_verifyMerkleData(token, user, totalAccrued, proof)) revert InvalidMerkleProof();
91
+ amountClaimable[i] = totalAccrued - claimed[token][user];
92
+ verified[token][user] = totalAccrued;
93
+ emit Verified(token, user, amountClaimable[i]);
94
+ }
95
+ }
96
+
97
+ function _verifyMerkleData(
98
+ address token,
99
+ address user,
100
+ uint256 amount,
101
+ bytes32[] memory proof
102
+ ) internal view returns (bool) {
103
+ bytes32 leaf = keccak256(abi.encodePacked(token, user, amount));
104
+ return MerkleProof.verify(proof, merkleRoot, leaf);
105
+ }
106
+
107
+ // ----------------- owner logic -----------------
108
+
109
+ function setMerkleRoot(bytes32 newMerkleRoot) external payable onlyOwner {
110
+ merkleRoot = newMerkleRoot;
111
+ emit SetMerkleRoot(merkleRoot);
112
+ }
113
+
114
+ // ----------------- upgrade-related -----------------
115
+
116
+ function _authorizeUpgrade(address) internal override onlyOwner {}
117
+ }
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: GPL-3.0-or-later
2
+ pragma solidity ^0.8.0;
3
+
4
+ interface IPMultiTokenMerkleDistributor {
5
+ event Claimed(address indexed token, address indexed user, address indexed receiver, uint256 amount);
6
+ event Verified(address indexed token, address indexed user, uint256 amountClaimable);
7
+ event SetMerkleRoot(bytes32 indexed merkleRoot);
8
+ event SetDefaultTokenList(address[] defaultTokenList);
9
+
10
+ error InvalidMerkleProof();
11
+
12
+ function claim(
13
+ address receiver,
14
+ address[] memory tokens,
15
+ uint256[] memory totalAccrueds,
16
+ bytes32[][] memory proofs
17
+ ) external returns (uint256[] memory amountOuts);
18
+
19
+ function claimVerified(address receiver, address[] memory tokens) external returns (uint256[] memory amountOuts);
20
+
21
+ function verify(
22
+ address user,
23
+ address[] memory tokens,
24
+ uint256[] memory totalAccrueds,
25
+ bytes32[][] memory proofs
26
+ ) external returns (uint256[] memory amountClaimable);
27
+ }
@@ -49,6 +49,7 @@
49
49
  "gaugeController": "0x47D74516B33eD5D70ddE7119A40839f6Fcc24e57",
50
50
  "feeDistributor": "0xd7b34a6fDCb2A7ceD2115FF7f5fdD72aa6aA4dE2",
51
51
  "feeDistributorV2": "0x8C237520a8E14D658170A633D96F8e80764433b9",
52
+ "multiTokenDistributor": "0x3942F7B55094250644cFfDa7160226Caa349A38E",
52
53
  "sparkLinearDiscountOracleFactory": "0xA9A924A4BB95509F77868E086154C25e934F6171",
53
54
  "beta": {
54
55
  "PendleChainlinkOracleFactory": "0x2A73e899389cABa2a2f648BaBA35e67f5C00EFee"
@@ -46,6 +46,7 @@
46
46
  "vePendle": "0xd5C47D2383Fddc19596489280C0A33AC42b2bB18",
47
47
  "gaugeController": "0x6875e4A945E498FE1B90BbB13CFbAF0b68658C9C",
48
48
  "sparkLinearDiscountOracleFactory": "0xA9A924A4BB95509F77868E086154C25e934F6171",
49
+ "multiTokenDistributor": "0x3942F7B55094250644cFfDa7160226Caa349A38E",
49
50
  "beta": {
50
51
  "PendleChainlinkOracleFactory": "0x2A73e899389cABa2a2f648BaBA35e67f5C00EFee"
51
52
  }
@@ -48,6 +48,7 @@
48
48
  "arbMerkleDistribution": "0x23a102e78D1FF1645a3666691495174764a5FCAF",
49
49
  "linearDistributor": "0x83d85AEDD308261d847C3eb8d7146457bD8F38E8",
50
50
  "sparkLinearDiscountOracleFactory": "0xA9A924A4BB95509F77868E086154C25e934F6171",
51
+ "multiTokenDistributor": "0x3942F7B55094250644cFfDa7160226Caa349A38E",
51
52
  "beta": {
52
53
  "PendleChainlinkOracleFactory": "0x2A73e899389cABa2a2f648BaBA35e67f5C00EFee"
53
54
  }
@@ -44,6 +44,7 @@
44
44
  "vePendle": "0x30c6d4e892871220B5Ab66c10db577da96Fb974b",
45
45
  "gaugeController": "0x428f2f93afAc3F96B0DE59854038c585e06165C8",
46
46
  "sparkLinearDiscountOracleFactory": "0xA9A924A4BB95509F77868E086154C25e934F6171",
47
+ "multiTokenDistributor": "0x3942F7B55094250644cFfDa7160226Caa349A38E",
47
48
  "beta": {
48
49
  "PendleChainlinkOracleFactory": "0x2A73e899389cABa2a2f648BaBA35e67f5C00EFee"
49
50
  }
@@ -46,6 +46,7 @@
46
46
  "vePendle": "0x8A09574b0401A856d89d1b583eE22E8cb0C5530B",
47
47
  "gaugeController": "0x704478Dd72FD7F9B83d1F1e0fc18C14B54F034d0",
48
48
  "sparkLinearDiscountOracleFactory": "0xA9A924A4BB95509F77868E086154C25e934F6171",
49
+ "multiTokenDistributor": "0x3942F7B55094250644cFfDa7160226Caa349A38E",
49
50
  "beta": {
50
51
  "PendleChainlinkOracleFactory": "0x2A73e899389cABa2a2f648BaBA35e67f5C00EFee"
51
52
  }
@@ -39,6 +39,7 @@
39
39
  "vePendle": "0x051dcd6a80f11fE68F77Fb0EBdE03853FA96B1fD",
40
40
  "gaugeController": "0x17F100fB4bE2707675c6439468d38249DD993d58",
41
41
  "sparkLinearDiscountOracleFactory": "0xA9A924A4BB95509F77868E086154C25e934F6171",
42
+ "multiTokenDistributor": "0x3942F7B55094250644cFfDa7160226Caa349A38E",
42
43
  "beta": {
43
44
  "PendleChainlinkOracleFactory": "0x2A73e899389cABa2a2f648BaBA35e67f5C00EFee"
44
45
  }
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": "5.4.2",
5
+ "version": "5.4.3",
6
6
  "homepage": "https://pendle.finance",
7
7
  "keywords": [
8
8
  "pendle",