@pendle/core-v2 5.12.2-cross-chain-pt → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.dbg.json +1 -1
  2. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgReceiveEndpointUpg.sol/PendleMsgReceiveEndpointUpg.json +2 -2
  3. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.dbg.json +1 -1
  4. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/PendleMsgSendEndpointUpg.sol/PendleMsgSendEndpointUpg.json +2 -2
  5. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.dbg.json +1 -1
  6. package/build/artifacts/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol/LayerZeroHelper.json +2 -2
  7. package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PTExpiry.dbg.json +1 -1
  8. package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PendleSparkLinearDiscountOracle.dbg.json +1 -1
  9. package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol/PendleSparkLinearDiscountOracle.json +2 -2
  10. package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracleFactory.sol/PendleSparkLinearDiscountOracleFactory.dbg.json +1 -1
  11. package/build/artifacts/contracts/oracles/internal/PendleSparkLinearDiscountOracleFactory.sol/PendleSparkLinearDiscountOracleFactory.json +2 -2
  12. package/contracts/LiquidityMining/CrossChainMsg/libraries/LayerZeroHelper.sol +4 -0
  13. package/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol +1 -3
  14. package/deployments/1-core.json +1 -2
  15. package/deployments/999-core.json +52 -0
  16. package/deployments/999-offchain-helper.json +7 -0
  17. package/package.json +6 -6
  18. package/typechain-types/factories/PendleMsgReceiveEndpointUpg__factory.ts +1 -1
  19. package/typechain-types/factories/PendleMsgSendEndpointUpg__factory.ts +1 -1
  20. package/typechain-types/factories/PendleSparkLinearDiscountOracleFactory__factory.ts +1 -1
  21. package/typechain-types/factories/PendleSparkLinearDiscountOracle__factory.ts +1 -1
  22. package/typechain-types/hardhat.d.ts +0 -108
  23. package/typechain-types/index.ts +0 -24
  24. package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.dbg.json +0 -4
  25. package/build/artifacts/contracts/cross-chain/FixedPricePTAMM.sol/FixedPricePTAMM.json +0 -466
  26. package/build/artifacts/contracts/cross-chain/factory/hub/PendlePTOFTAdapterFactory.sol/PendlePTOFTAdapterFactory.dbg.json +0 -4
  27. package/build/artifacts/contracts/cross-chain/factory/hub/PendlePTOFTAdapterFactory.sol/PendlePTOFTAdapterFactory.json +0 -191
  28. package/build/artifacts/contracts/cross-chain/oftImpl/hub/OFTAdapterImpl.sol/OFTAdapterImpl.dbg.json +0 -4
  29. package/build/artifacts/contracts/cross-chain/oftImpl/hub/OFTAdapterImpl.sol/OFTAdapterImpl.json +0 -1265
  30. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/BasePendleBridgedPrincipalToken.dbg.json +0 -4
  31. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/BasePendleBridgedPrincipalToken.json +0 -1527
  32. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken_18Decimals.dbg.json +0 -4
  33. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken_18Decimals.json +0 -1558
  34. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken_6Decimals.dbg.json +0 -4
  35. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken_6Decimals.json +0 -1558
  36. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken_8Decimals.dbg.json +0 -4
  37. package/build/artifacts/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol/PendleBridgedPrincipalToken_8Decimals.json +0 -1558
  38. package/build/artifacts/contracts/interfaces/IPBridgedPrincipalToken.sol/IPBridgedPrincipalToken.dbg.json +0 -4
  39. package/build/artifacts/contracts/interfaces/IPBridgedPrincipalToken.sol/IPBridgedPrincipalToken.json +0 -928
  40. package/build/artifacts/contracts/interfaces/IPChainlinkOracleEssential.sol/IPChainlinkOracleEssential.dbg.json +0 -4
  41. package/build/artifacts/contracts/interfaces/IPChainlinkOracleEssential.sol/IPChainlinkOracleEssential.json +0 -57
  42. package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMM.dbg.json +0 -4
  43. package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMM.json +0 -302
  44. package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMMSwapCallback.dbg.json +0 -4
  45. package/build/artifacts/contracts/interfaces/IPFixedPricePTAMM.sol/IPFixedPricePTAMMSwapCallback.json +0 -34
  46. package/build/artifacts/contracts/interfaces/IPPTOFTAdapterFactory.sol/IPPTOFTAdapterFactory.dbg.json +0 -4
  47. package/build/artifacts/contracts/interfaces/IPPTOFTAdapterFactory.sol/IPPTOFTAdapterFactory.json +0 -81
  48. package/contracts/cross-chain/FixedPricePTAMM.sol +0 -121
  49. package/contracts/cross-chain/factory/hub/PendlePTOFTAdapterFactory.sol +0 -33
  50. package/contracts/cross-chain/oftImpl/hub/OFTAdapterImpl.sol +0 -12
  51. package/contracts/cross-chain/oftImpl/spoke/PendleBridgedPrincipalToken.sol +0 -61
  52. package/contracts/interfaces/IPBridgedPrincipalToken.sol +0 -11
  53. package/contracts/interfaces/IPChainlinkOracleEssential.sol +0 -11
  54. package/contracts/interfaces/IPFixedPricePTAMM.sol +0 -54
  55. package/contracts/interfaces/IPPTOFTAdapterFactory.sol +0 -12
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a09e1424a3c0ce161221b9e93e0af448.json"
4
- }
@@ -1,57 +0,0 @@
1
- {
2
- "_format": "hh-sol-artifact-1",
3
- "contractName": "IPChainlinkOracleEssential",
4
- "sourceName": "contracts/interfaces/IPChainlinkOracleEssential.sol",
5
- "abi": [
6
- {
7
- "inputs": [],
8
- "name": "decimals",
9
- "outputs": [
10
- {
11
- "internalType": "uint8",
12
- "name": "",
13
- "type": "uint8"
14
- }
15
- ],
16
- "stateMutability": "view",
17
- "type": "function"
18
- },
19
- {
20
- "inputs": [],
21
- "name": "latestRoundData",
22
- "outputs": [
23
- {
24
- "internalType": "uint80",
25
- "name": "roundId",
26
- "type": "uint80"
27
- },
28
- {
29
- "internalType": "int256",
30
- "name": "answer",
31
- "type": "int256"
32
- },
33
- {
34
- "internalType": "uint256",
35
- "name": "startedAt",
36
- "type": "uint256"
37
- },
38
- {
39
- "internalType": "uint256",
40
- "name": "updatedAt",
41
- "type": "uint256"
42
- },
43
- {
44
- "internalType": "uint80",
45
- "name": "answeredInRound",
46
- "type": "uint80"
47
- }
48
- ],
49
- "stateMutability": "view",
50
- "type": "function"
51
- }
52
- ],
53
- "bytecode": "0x",
54
- "deployedBytecode": "0x",
55
- "linkReferences": {},
56
- "deployedLinkReferences": {}
57
- }
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a09e1424a3c0ce161221b9e93e0af448.json"
4
- }
@@ -1,302 +0,0 @@
1
- {
2
- "_format": "hh-sol-artifact-1",
3
- "contractName": "IPFixedPricePTAMM",
4
- "sourceName": "contracts/interfaces/IPFixedPricePTAMM.sol",
5
- "abi": [
6
- {
7
- "anonymous": false,
8
- "inputs": [
9
- {
10
- "indexed": true,
11
- "internalType": "address",
12
- "name": "PT",
13
- "type": "address"
14
- },
15
- {
16
- "indexed": true,
17
- "internalType": "address",
18
- "name": "token",
19
- "type": "address"
20
- },
21
- {
22
- "indexed": true,
23
- "internalType": "address",
24
- "name": "priceOracle",
25
- "type": "address"
26
- }
27
- ],
28
- "name": "PriceOracleUpdated",
29
- "type": "event"
30
- },
31
- {
32
- "anonymous": false,
33
- "inputs": [
34
- {
35
- "indexed": true,
36
- "internalType": "address",
37
- "name": "token",
38
- "type": "address"
39
- },
40
- {
41
- "indexed": false,
42
- "internalType": "uint256",
43
- "name": "amount",
44
- "type": "uint256"
45
- }
46
- ],
47
- "name": "Seeded",
48
- "type": "event"
49
- },
50
- {
51
- "anonymous": false,
52
- "inputs": [
53
- {
54
- "indexed": true,
55
- "internalType": "address",
56
- "name": "caller",
57
- "type": "address"
58
- },
59
- {
60
- "indexed": true,
61
- "internalType": "address",
62
- "name": "receiver",
63
- "type": "address"
64
- },
65
- {
66
- "indexed": false,
67
- "internalType": "address",
68
- "name": "PT",
69
- "type": "address"
70
- },
71
- {
72
- "indexed": false,
73
- "internalType": "uint256",
74
- "name": "netPtIn",
75
- "type": "uint256"
76
- },
77
- {
78
- "indexed": false,
79
- "internalType": "address",
80
- "name": "token",
81
- "type": "address"
82
- },
83
- {
84
- "indexed": false,
85
- "internalType": "uint256",
86
- "name": "netTokenOut",
87
- "type": "uint256"
88
- }
89
- ],
90
- "name": "Swap",
91
- "type": "event"
92
- },
93
- {
94
- "anonymous": false,
95
- "inputs": [
96
- {
97
- "indexed": true,
98
- "internalType": "address",
99
- "name": "token",
100
- "type": "address"
101
- },
102
- {
103
- "indexed": false,
104
- "internalType": "uint256",
105
- "name": "amount",
106
- "type": "uint256"
107
- }
108
- ],
109
- "name": "Unseeded",
110
- "type": "event"
111
- },
112
- {
113
- "inputs": [
114
- {
115
- "internalType": "address",
116
- "name": "token",
117
- "type": "address"
118
- },
119
- {
120
- "internalType": "uint256",
121
- "name": "amount",
122
- "type": "uint256"
123
- }
124
- ],
125
- "name": "addFund",
126
- "outputs": [],
127
- "stateMutability": "payable",
128
- "type": "function"
129
- },
130
- {
131
- "inputs": [
132
- {
133
- "internalType": "address",
134
- "name": "PT",
135
- "type": "address"
136
- },
137
- {
138
- "internalType": "address",
139
- "name": "token",
140
- "type": "address"
141
- }
142
- ],
143
- "name": "getPtToTokenPrice",
144
- "outputs": [
145
- {
146
- "internalType": "uint256",
147
- "name": "",
148
- "type": "uint256"
149
- }
150
- ],
151
- "stateMutability": "view",
152
- "type": "function"
153
- },
154
- {
155
- "inputs": [
156
- {
157
- "internalType": "address",
158
- "name": "PT",
159
- "type": "address"
160
- },
161
- {
162
- "internalType": "address",
163
- "name": "token",
164
- "type": "address"
165
- }
166
- ],
167
- "name": "priceOracle",
168
- "outputs": [
169
- {
170
- "internalType": "contract IPChainlinkOracleEssential",
171
- "name": "",
172
- "type": "address"
173
- }
174
- ],
175
- "stateMutability": "view",
176
- "type": "function"
177
- },
178
- {
179
- "inputs": [
180
- {
181
- "internalType": "address",
182
- "name": "token",
183
- "type": "address"
184
- },
185
- {
186
- "internalType": "uint256",
187
- "name": "amount",
188
- "type": "uint256"
189
- }
190
- ],
191
- "name": "removeFund",
192
- "outputs": [],
193
- "stateMutability": "nonpayable",
194
- "type": "function"
195
- },
196
- {
197
- "inputs": [
198
- {
199
- "internalType": "address",
200
- "name": "PT",
201
- "type": "address"
202
- },
203
- {
204
- "internalType": "address",
205
- "name": "token",
206
- "type": "address"
207
- },
208
- {
209
- "internalType": "address",
210
- "name": "priceOracle",
211
- "type": "address"
212
- }
213
- ],
214
- "name": "setPriceOracle",
215
- "outputs": [],
216
- "stateMutability": "nonpayable",
217
- "type": "function"
218
- },
219
- {
220
- "inputs": [
221
- {
222
- "internalType": "address",
223
- "name": "receiver",
224
- "type": "address"
225
- },
226
- {
227
- "internalType": "address",
228
- "name": "PT",
229
- "type": "address"
230
- },
231
- {
232
- "internalType": "uint256",
233
- "name": "exactPtIn",
234
- "type": "uint256"
235
- },
236
- {
237
- "internalType": "address",
238
- "name": "token",
239
- "type": "address"
240
- },
241
- {
242
- "internalType": "bytes",
243
- "name": "data",
244
- "type": "bytes"
245
- }
246
- ],
247
- "name": "swapExactPtForToken",
248
- "outputs": [
249
- {
250
- "internalType": "uint256",
251
- "name": "netTokenOut",
252
- "type": "uint256"
253
- }
254
- ],
255
- "stateMutability": "payable",
256
- "type": "function"
257
- },
258
- {
259
- "inputs": [
260
- {
261
- "internalType": "address",
262
- "name": "receiver",
263
- "type": "address"
264
- },
265
- {
266
- "internalType": "address",
267
- "name": "PT",
268
- "type": "address"
269
- },
270
- {
271
- "internalType": "address",
272
- "name": "token",
273
- "type": "address"
274
- },
275
- {
276
- "internalType": "uint256",
277
- "name": "exactTokenOut",
278
- "type": "uint256"
279
- },
280
- {
281
- "internalType": "bytes",
282
- "name": "data",
283
- "type": "bytes"
284
- }
285
- ],
286
- "name": "swapPtForExactToken",
287
- "outputs": [
288
- {
289
- "internalType": "uint256",
290
- "name": "netPtIn",
291
- "type": "uint256"
292
- }
293
- ],
294
- "stateMutability": "payable",
295
- "type": "function"
296
- }
297
- ],
298
- "bytecode": "0x",
299
- "deployedBytecode": "0x",
300
- "linkReferences": {},
301
- "deployedLinkReferences": {}
302
- }
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a09e1424a3c0ce161221b9e93e0af448.json"
4
- }
@@ -1,34 +0,0 @@
1
- {
2
- "_format": "hh-sol-artifact-1",
3
- "contractName": "IPFixedPricePTAMMSwapCallback",
4
- "sourceName": "contracts/interfaces/IPFixedPricePTAMM.sol",
5
- "abi": [
6
- {
7
- "inputs": [
8
- {
9
- "internalType": "uint256",
10
- "name": "exactTokenOut",
11
- "type": "uint256"
12
- },
13
- {
14
- "internalType": "uint256",
15
- "name": "netPtIn",
16
- "type": "uint256"
17
- },
18
- {
19
- "internalType": "bytes",
20
- "name": "data",
21
- "type": "bytes"
22
- }
23
- ],
24
- "name": "swapCallback",
25
- "outputs": [],
26
- "stateMutability": "nonpayable",
27
- "type": "function"
28
- }
29
- ],
30
- "bytecode": "0x",
31
- "deployedBytecode": "0x",
32
- "linkReferences": {},
33
- "deployedLinkReferences": {}
34
- }
@@ -1,4 +0,0 @@
1
- {
2
- "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/a09e1424a3c0ce161221b9e93e0af448.json"
4
- }
@@ -1,81 +0,0 @@
1
- {
2
- "_format": "hh-sol-artifact-1",
3
- "contractName": "IPPTOFTAdapterFactory",
4
- "sourceName": "contracts/interfaces/IPPTOFTAdapterFactory.sol",
5
- "abi": [
6
- {
7
- "anonymous": false,
8
- "inputs": [
9
- {
10
- "indexed": true,
11
- "internalType": "address",
12
- "name": "pt",
13
- "type": "address"
14
- },
15
- {
16
- "indexed": true,
17
- "internalType": "address",
18
- "name": "adapter",
19
- "type": "address"
20
- }
21
- ],
22
- "name": "PtAdapterCreated",
23
- "type": "event"
24
- },
25
- {
26
- "inputs": [
27
- {
28
- "internalType": "address",
29
- "name": "pt",
30
- "type": "address"
31
- }
32
- ],
33
- "name": "createPtAdapter",
34
- "outputs": [
35
- {
36
- "internalType": "address",
37
- "name": "",
38
- "type": "address"
39
- }
40
- ],
41
- "stateMutability": "nonpayable",
42
- "type": "function"
43
- },
44
- {
45
- "inputs": [
46
- {
47
- "internalType": "address",
48
- "name": "_owner",
49
- "type": "address"
50
- }
51
- ],
52
- "name": "initialize",
53
- "outputs": [],
54
- "stateMutability": "nonpayable",
55
- "type": "function"
56
- },
57
- {
58
- "inputs": [
59
- {
60
- "internalType": "address",
61
- "name": "pt",
62
- "type": "address"
63
- }
64
- ],
65
- "name": "ptAdapter",
66
- "outputs": [
67
- {
68
- "internalType": "address",
69
- "name": "",
70
- "type": "address"
71
- }
72
- ],
73
- "stateMutability": "view",
74
- "type": "function"
75
- }
76
- ],
77
- "bytecode": "0x",
78
- "deployedBytecode": "0x",
79
- "linkReferences": {},
80
- "deployedLinkReferences": {}
81
- }
@@ -1,121 +0,0 @@
1
- // SPDX-License-Identifier: SEE LICENSE IN LICENSE
2
- pragma solidity ^0.8.19;
3
-
4
- import {IPFixedPricePTAMM, IPFixedPricePTAMMSwapCallback} from "../interfaces/IPFixedPricePTAMM.sol";
5
- import {IPChainlinkOracleEssential} from "../interfaces/IPChainlinkOracleEssential.sol";
6
- import {IPBridgedPrincipalToken} from "../interfaces/IPBridgedPrincipalToken.sol";
7
-
8
- import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
9
- import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
10
-
11
- import {PMath} from "../core/libraries/math/PMath.sol";
12
- import {BoringOwnableUpgradeableV2} from "../core/libraries/BoringOwnableUpgradeableV2.sol";
13
- import {TokenHelper} from "../core/libraries/TokenHelper.sol";
14
-
15
- contract FixedPricePTAMM is IPFixedPricePTAMM, BoringOwnableUpgradeableV2, ReentrancyGuardUpgradeable, TokenHelper {
16
- // cast index-erc7201 "pendle.FixedPricePTAMM.storage"
17
- uint256 internal constant STORAGE_SLOT = 0xbbf04d9aae855c6bd76c8f4ba7a918994ad0d002f537323e58c83cbfe5249000;
18
-
19
- error OracleNotSet(address PT, address token);
20
- error InsufficientTokenForTrade(address token, uint256 actualAmount, uint256 requiredAmount);
21
- error InsufficientPtReceived(address PT, uint256 actualAmount, uint256 requiredAmount);
22
-
23
- using PMath for uint256;
24
- using PMath for int256;
25
-
26
- constructor() {
27
- _disableInitializers();
28
- }
29
-
30
- function initialize(address _owner) external initializer {
31
- __BoringOwnableV2_init(_owner);
32
- }
33
-
34
- struct Storage {
35
- mapping(address PT => mapping(address token => address oracle)) priceOracle;
36
- mapping(address token => uint256) totalToken;
37
- }
38
-
39
- function $() internal pure returns (Storage storage res) {
40
- assembly ("memory-safe") {
41
- res.slot := STORAGE_SLOT
42
- }
43
- }
44
-
45
- function priceOracle(address PT, address token) public view returns (IPChainlinkOracleEssential) {
46
- address res = $().priceOracle[PT][token];
47
- if (res == address(0)) revert OracleNotSet(PT, token);
48
- return IPChainlinkOracleEssential(res);
49
- }
50
-
51
- function getPtToTokenPrice(address PT, address token) public view returns (uint256) {
52
- (, int256 ptPrice, , , ) = priceOracle(PT, token).latestRoundData();
53
- return ptPrice.Uint();
54
- }
55
-
56
- function swapPtForExactToken(
57
- address receiver,
58
- address PT,
59
- address token,
60
- uint256 exactTokenOut,
61
- bytes calldata data
62
- ) external payable nonReentrant returns (uint256 netPtIn) {
63
- netPtIn = exactTokenOut.divDown(getPtToTokenPrice(PT, token));
64
- _swap(receiver, PT, netPtIn, token, exactTokenOut, data);
65
- }
66
-
67
- function swapExactPtForToken(
68
- address receiver,
69
- address PT,
70
- uint256 exactPtIn,
71
- address token,
72
- bytes calldata data
73
- ) external payable nonReentrant returns (uint256 netTokenOut) {
74
- netTokenOut = exactPtIn.mulDown(getPtToTokenPrice(PT, token));
75
- _swap(receiver, PT, exactPtIn, token, netTokenOut, data);
76
- }
77
-
78
- function _swap(
79
- address receiver,
80
- address PT,
81
- uint256 exactPtIn,
82
- address token,
83
- uint256 exactTokenOut,
84
- bytes calldata data
85
- ) internal {
86
- if ($().totalToken[token] < exactTokenOut)
87
- revert InsufficientTokenForTrade(token, $().totalToken[token], exactTokenOut);
88
-
89
- _transferOut(token, receiver, exactTokenOut);
90
- $().totalToken[token] -= exactTokenOut;
91
-
92
- if (data.length > 0) {
93
- IPFixedPricePTAMMSwapCallback(msg.sender).swapCallback(exactTokenOut, exactPtIn, data);
94
- }
95
-
96
- $().totalToken[PT] += exactPtIn;
97
- if (_selfBalance(PT) < $().totalToken[PT])
98
- revert InsufficientPtReceived(PT, _selfBalance(PT), $().totalToken[PT]);
99
-
100
- emit Swap(msg.sender, receiver, PT, exactPtIn, token, exactTokenOut);
101
- }
102
-
103
- // Admin functions
104
-
105
- function setPriceOracle(address PT, address token, address _priceOracle) external onlyOwner {
106
- $().priceOracle[PT][token] = _priceOracle;
107
- emit PriceOracleUpdated(PT, token, _priceOracle);
108
- }
109
-
110
- function addFund(address token, uint256 amount) external payable onlyOwner {
111
- _transferIn(token, owner, amount);
112
- $().totalToken[token] += amount;
113
- emit Seeded(token, amount);
114
- }
115
-
116
- function removeFund(address token, uint256 amount) external onlyOwner {
117
- _transferOut(token, owner, amount);
118
- $().totalToken[token] -= amount;
119
- emit Unseeded(token, amount);
120
- }
121
- }
@@ -1,33 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
- pragma solidity ^0.8.0;
3
-
4
- import {IPPTOFTAdapterFactory} from "../../../interfaces/IPPTOFTAdapterFactory.sol";
5
- import {BoringOwnableUpgradeableV2} from "../../../core/libraries/BoringOwnableUpgradeableV2.sol";
6
- import {OFTAdapterImpl} from "../..//oftImpl/hub/OFTAdapterImpl.sol";
7
-
8
- contract PendlePTOFTAdapterFactory is IPPTOFTAdapterFactory, BoringOwnableUpgradeableV2 {
9
- error PTOFTAdapterExisted(address pt);
10
-
11
- address internal immutable _lzEndpoint;
12
-
13
- constructor(address lzEndpoint) {
14
- _disableInitializers();
15
- _lzEndpoint = lzEndpoint;
16
- }
17
-
18
- function initialize(address _owner) external initializer {
19
- __BoringOwnableV2_init(_owner);
20
- }
21
-
22
- mapping(address pt => address) public ptAdapter;
23
-
24
- function createPtAdapter(address pt) external override onlyOwner returns (address) {
25
- if (ptAdapter[pt] != address(0)) revert PTOFTAdapterExisted(pt);
26
-
27
- OFTAdapterImpl adapter = new OFTAdapterImpl(pt, _lzEndpoint, owner);
28
- adapter.transferOwnership(owner);
29
- emit PtAdapterCreated(pt, address(adapter));
30
-
31
- return ptAdapter[pt] = address(adapter);
32
- }
33
- }
@@ -1,12 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-or-later
2
-
3
- pragma solidity ^0.8.0;
4
-
5
- import {OFTAdapter} from "@layerzerolabs/oft-evm/contracts/OFTAdapter.sol";
6
-
7
- // @notice Base OFT contract, without any additional functionality (like RateLimiter).
8
- // @dev This contract inherits Ownable from OpenZeppelin v4.
9
- // @dev Sender is set as the contract owner at deployment.
10
- contract OFTAdapterImpl is OFTAdapter {
11
- constructor(address _token, address _endpoint, address _delegate) OFTAdapter(_token, _endpoint, _delegate) {}
12
- }