@lavarage/sdk 6.8.0 → 6.8.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.
- package/abi/borrowerOperations.ts +1 -248
- package/dist/index.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +26 -251
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -250
- package/dist/index.mjs.map +1 -1
- package/evm.ts +43 -0
- package/lending.ts +2 -2
- package/package.json +1 -1
|
@@ -1,248 +1 @@
|
|
|
1
|
-
export const borrowerOperationsAbi = [
|
|
2
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
3
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
4
|
-
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
5
|
-
{
|
|
6
|
-
anonymous: false,
|
|
7
|
-
inputs: [
|
|
8
|
-
{
|
|
9
|
-
indexed: true,
|
|
10
|
-
internalType: "address",
|
|
11
|
-
name: "buyer",
|
|
12
|
-
type: "address",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
indexed: true,
|
|
16
|
-
internalType: "address",
|
|
17
|
-
name: "tokenCollateral",
|
|
18
|
-
type: "address",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
indexed: true,
|
|
22
|
-
internalType: "uint256",
|
|
23
|
-
name: "loanId",
|
|
24
|
-
type: "uint256",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
indexed: false,
|
|
28
|
-
internalType: "uint256",
|
|
29
|
-
name: "openingPositionSize",
|
|
30
|
-
type: "uint256",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
indexed: false,
|
|
34
|
-
internalType: "uint256",
|
|
35
|
-
name: "collateralAmount",
|
|
36
|
-
type: "uint256",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
indexed: false,
|
|
40
|
-
internalType: "uint256",
|
|
41
|
-
name: "initialMargin",
|
|
42
|
-
type: "uint256",
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
name: "Buy",
|
|
46
|
-
type: "event",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
anonymous: false,
|
|
50
|
-
inputs: [
|
|
51
|
-
{
|
|
52
|
-
indexed: false,
|
|
53
|
-
internalType: "uint64",
|
|
54
|
-
name: "version",
|
|
55
|
-
type: "uint64",
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
name: "Initialized",
|
|
59
|
-
type: "event",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
anonymous: false,
|
|
63
|
-
inputs: [
|
|
64
|
-
{
|
|
65
|
-
indexed: true,
|
|
66
|
-
internalType: "address",
|
|
67
|
-
name: "borrower",
|
|
68
|
-
type: "address",
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
indexed: true,
|
|
72
|
-
internalType: "address",
|
|
73
|
-
name: "tokenCollateral",
|
|
74
|
-
type: "address",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
indexed: true,
|
|
78
|
-
internalType: "uint256",
|
|
79
|
-
name: "loanId",
|
|
80
|
-
type: "uint256",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
indexed: false,
|
|
84
|
-
internalType: "uint256",
|
|
85
|
-
name: "closingPositionSize",
|
|
86
|
-
type: "uint256",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
indexed: false,
|
|
90
|
-
internalType: "uint256",
|
|
91
|
-
name: "liquidatorRepaidAmount",
|
|
92
|
-
type: "uint256",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
name: "Liquidation",
|
|
96
|
-
type: "event",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
anonymous: false,
|
|
100
|
-
inputs: [
|
|
101
|
-
{
|
|
102
|
-
indexed: true,
|
|
103
|
-
internalType: "address",
|
|
104
|
-
name: "buyer",
|
|
105
|
-
type: "address",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
indexed: true,
|
|
109
|
-
internalType: "address",
|
|
110
|
-
name: "tokenCollateral",
|
|
111
|
-
type: "address",
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
indexed: true,
|
|
115
|
-
internalType: "uint256",
|
|
116
|
-
name: "loanId",
|
|
117
|
-
type: "uint256",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
indexed: false,
|
|
121
|
-
internalType: "uint256",
|
|
122
|
-
name: "closingPositionSize",
|
|
123
|
-
type: "uint256",
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
indexed: false,
|
|
127
|
-
internalType: "uint256",
|
|
128
|
-
name: "profit",
|
|
129
|
-
type: "uint256",
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
name: "Sell",
|
|
133
|
-
type: "event",
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
inputs: [],
|
|
137
|
-
name: "admin",
|
|
138
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
139
|
-
stateMutability: "view",
|
|
140
|
-
type: "function",
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
inputs: [
|
|
144
|
-
{ internalType: "bytes", name: "buyingCode", type: "bytes" },
|
|
145
|
-
{
|
|
146
|
-
internalType: "contract IERC20",
|
|
147
|
-
name: "tokenCollateral",
|
|
148
|
-
type: "address",
|
|
149
|
-
},
|
|
150
|
-
{ internalType: "uint256", name: "borrowAmount", type: "uint256" },
|
|
151
|
-
{
|
|
152
|
-
internalType: "contract TokenHolder",
|
|
153
|
-
name: "tokenHolder",
|
|
154
|
-
type: "address",
|
|
155
|
-
},
|
|
156
|
-
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
157
|
-
{
|
|
158
|
-
internalType: "address",
|
|
159
|
-
name: "integratorFeeAddress",
|
|
160
|
-
type: "address",
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
name: "buy",
|
|
164
|
-
outputs: [],
|
|
165
|
-
stateMutability: "payable",
|
|
166
|
-
type: "function",
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
inputs: [
|
|
170
|
-
{ internalType: "contract IERC20", name: "_weth", type: "address" },
|
|
171
|
-
],
|
|
172
|
-
name: "initialize",
|
|
173
|
-
outputs: [],
|
|
174
|
-
stateMutability: "nonpayable",
|
|
175
|
-
type: "function",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
inputs: [
|
|
179
|
-
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
180
|
-
{
|
|
181
|
-
internalType: "contract TokenHolder",
|
|
182
|
-
name: "tokenHolder",
|
|
183
|
-
type: "address",
|
|
184
|
-
},
|
|
185
|
-
{ internalType: "uint256", name: "closingPositionSize", type: "uint256" },
|
|
186
|
-
],
|
|
187
|
-
name: "liquidate",
|
|
188
|
-
outputs: [],
|
|
189
|
-
stateMutability: "nonpayable",
|
|
190
|
-
type: "function",
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
inputs: [],
|
|
194
|
-
name: "openingFee",
|
|
195
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
196
|
-
stateMutability: "view",
|
|
197
|
-
type: "function",
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
inputs: [],
|
|
201
|
-
name: "profitFee",
|
|
202
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
203
|
-
stateMutability: "view",
|
|
204
|
-
type: "function",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
inputs: [
|
|
208
|
-
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
209
|
-
{ internalType: "bytes", name: "sellingCode", type: "bytes" },
|
|
210
|
-
{
|
|
211
|
-
internalType: "contract TokenHolder",
|
|
212
|
-
name: "tokenHolder",
|
|
213
|
-
type: "address",
|
|
214
|
-
},
|
|
215
|
-
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
216
|
-
{
|
|
217
|
-
internalType: "address",
|
|
218
|
-
name: "integratorFeeAddress",
|
|
219
|
-
type: "address",
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
name: "sell",
|
|
223
|
-
outputs: [],
|
|
224
|
-
stateMutability: "payable",
|
|
225
|
-
type: "function",
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
inputs: [{ internalType: "address", name: "_admin", type: "address" }],
|
|
229
|
-
name: "setAdmin",
|
|
230
|
-
outputs: [],
|
|
231
|
-
stateMutability: "nonpayable",
|
|
232
|
-
type: "function",
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
inputs: [{ internalType: "uint256", name: "_openingFee", type: "uint256" }],
|
|
236
|
-
name: "setOpeningFee",
|
|
237
|
-
outputs: [],
|
|
238
|
-
stateMutability: "nonpayable",
|
|
239
|
-
type: "function",
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
inputs: [{ internalType: "uint256", name: "_profitFee", type: "uint256" }],
|
|
243
|
-
name: "setProfitFee",
|
|
244
|
-
outputs: [],
|
|
245
|
-
stateMutability: "nonpayable",
|
|
246
|
-
type: "function",
|
|
247
|
-
},
|
|
248
|
-
];
|
|
1
|
+
export const borrowerOperationsAbi = [{"type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"buy","inputs":[{"name":"buyingCode","type":"bytes","internalType":"bytes"},{"name":"tokenCollateral","type":"address","internalType":"contract IERC20"},{"name":"borrowAmount","type":"uint256","internalType":"uint256"},{"name":"tokenHolder","type":"address","internalType":"contract TokenHolder"},{"name":"inchRouter","type":"address","internalType":"address"},{"name":"integratorFeeAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"initialize","inputs":[{"name":"_weth","type":"address","internalType":"contract IERC20"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"liquidate","inputs":[{"name":"loanId","type":"uint256","internalType":"uint256"},{"name":"tokenHolder","type":"address","internalType":"contract TokenHolder"},{"name":"closingPositionSize","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"loanRecords","inputs":[{"name":"","type":"address","internalType":"address"},{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"id","type":"uint256","internalType":"uint256"},{"name":"tokenHolder","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"openingFee","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"profitFee","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"sell","inputs":[{"name":"loanId","type":"uint256","internalType":"uint256"},{"name":"sellingCode","type":"bytes","internalType":"bytes"},{"name":"tokenHolder","type":"address","internalType":"contract TokenHolder"},{"name":"inchRouter","type":"address","internalType":"address"},{"name":"integratorFeeAddress","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"payable"},{"type":"function","name":"setAdmin","inputs":[{"name":"_admin","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setOpeningFee","inputs":[{"name":"_openingFee","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setProfitFee","inputs":[{"name":"_profitFee","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"event","name":"Buy","inputs":[{"name":"buyer","type":"address","indexed":true,"internalType":"address"},{"name":"tokenHolder","type":"address","indexed":true,"internalType":"address"},{"name":"tokenCollateral","type":"address","indexed":true,"internalType":"address"},{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"openingPositionSize","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"collateralAmount","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"initialMargin","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"name":"version","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"type":"event","name":"Liquidation","inputs":[{"name":"borrower","type":"address","indexed":true,"internalType":"address"},{"name":"tokenHolder","type":"address","indexed":true,"internalType":"address"},{"name":"tokenCollateral","type":"address","indexed":true,"internalType":"address"},{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"closingPositionSize","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"liquidatorRepaidAmount","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"Sell","inputs":[{"name":"buyer","type":"address","indexed":true,"internalType":"address"},{"name":"tokenHolder","type":"address","indexed":true,"internalType":"address"},{"name":"tokenCollateral","type":"address","indexed":true,"internalType":"address"},{"name":"loanId","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"closingPositionSize","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"profit","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"ReentrancyGuardReentrantCall","inputs":[]}]
|
package/dist/index.d.mts
CHANGED
|
@@ -2835,6 +2835,22 @@ declare function getCollateralExposureEvm(provider: Provider, tokenHolderContrac
|
|
|
2835
2835
|
* @returns Available exposure as a BigNumber
|
|
2836
2836
|
*/
|
|
2837
2837
|
declare function getAvailableExposureEvm(provider: Provider, tokenHolderContractAddress: string, collateralAddress: string): Promise<bigint>;
|
|
2838
|
+
/**
|
|
2839
|
+
* Update max lend per token for multiple collaterals in batch
|
|
2840
|
+
* @param provider - Ethers provider
|
|
2841
|
+
* @param tokenHolderContractAddress - Address of the TokenHolder contract
|
|
2842
|
+
* @param collateralAddresses - Array of collateral token addresses
|
|
2843
|
+
* @param newMaxLendPerTokens - Array of new max lend per token values
|
|
2844
|
+
* @param gasLimit - Optional gas limit
|
|
2845
|
+
* @param gasPrice - Optional gas price
|
|
2846
|
+
* @returns Unsigned transaction object
|
|
2847
|
+
*/
|
|
2848
|
+
declare const updateMaxLendPerTokenBatchEvm: (provider: Provider, tokenHolderContractAddress: string, { collateralAddresses, newMaxLendPerTokens, gasLimit, gasPrice, }: {
|
|
2849
|
+
collateralAddresses: string[];
|
|
2850
|
+
newMaxLendPerTokens: BigNumberish[];
|
|
2851
|
+
gasLimit?: string | number;
|
|
2852
|
+
gasPrice?: string | number;
|
|
2853
|
+
}) => Promise<ContractTransaction>;
|
|
2838
2854
|
|
|
2839
2855
|
declare function getNodeWalletPDA(operatorPublicKey: PublicKey, mintPublicKey: PublicKey, programId: PublicKey): PublicKey;
|
|
2840
2856
|
declare function getTradingPoolPDA(poolOwnerPublicKey: PublicKey, tokenPublicKey: PublicKey, programId: PublicKey): PublicKey;
|
|
@@ -3109,4 +3125,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3109
3125
|
collateralType: PublicKey;
|
|
3110
3126
|
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
3111
3127
|
|
|
3112
|
-
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getActiveLoanCountEvm, getActiveLoansBatchEvm, getAllPositions, getAvailableExposureEvm, getClosedPositions, getClosedPositionsEvm, getCollateralExposureEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getLoansByBorrowerEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, lending, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
|
3128
|
+
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getActiveLoanCountEvm, getActiveLoansBatchEvm, getAllPositions, getAvailableExposureEvm, getClosedPositions, getClosedPositionsEvm, getCollateralExposureEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getLoansByBorrowerEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, lending, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.d.ts
CHANGED
|
@@ -2835,6 +2835,22 @@ declare function getCollateralExposureEvm(provider: Provider, tokenHolderContrac
|
|
|
2835
2835
|
* @returns Available exposure as a BigNumber
|
|
2836
2836
|
*/
|
|
2837
2837
|
declare function getAvailableExposureEvm(provider: Provider, tokenHolderContractAddress: string, collateralAddress: string): Promise<bigint>;
|
|
2838
|
+
/**
|
|
2839
|
+
* Update max lend per token for multiple collaterals in batch
|
|
2840
|
+
* @param provider - Ethers provider
|
|
2841
|
+
* @param tokenHolderContractAddress - Address of the TokenHolder contract
|
|
2842
|
+
* @param collateralAddresses - Array of collateral token addresses
|
|
2843
|
+
* @param newMaxLendPerTokens - Array of new max lend per token values
|
|
2844
|
+
* @param gasLimit - Optional gas limit
|
|
2845
|
+
* @param gasPrice - Optional gas price
|
|
2846
|
+
* @returns Unsigned transaction object
|
|
2847
|
+
*/
|
|
2848
|
+
declare const updateMaxLendPerTokenBatchEvm: (provider: Provider, tokenHolderContractAddress: string, { collateralAddresses, newMaxLendPerTokens, gasLimit, gasPrice, }: {
|
|
2849
|
+
collateralAddresses: string[];
|
|
2850
|
+
newMaxLendPerTokens: BigNumberish[];
|
|
2851
|
+
gasLimit?: string | number;
|
|
2852
|
+
gasPrice?: string | number;
|
|
2853
|
+
}) => Promise<ContractTransaction>;
|
|
2838
2854
|
|
|
2839
2855
|
declare function getNodeWalletPDA(operatorPublicKey: PublicKey, mintPublicKey: PublicKey, programId: PublicKey): PublicKey;
|
|
2840
2856
|
declare function getTradingPoolPDA(poolOwnerPublicKey: PublicKey, tokenPublicKey: PublicKey, programId: PublicKey): PublicKey;
|
|
@@ -3109,4 +3125,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3109
3125
|
collateralType: PublicKey;
|
|
3110
3126
|
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
3111
3127
|
|
|
3112
|
-
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getActiveLoanCountEvm, getActiveLoansBatchEvm, getAllPositions, getAvailableExposureEvm, getClosedPositions, getClosedPositionsEvm, getCollateralExposureEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getLoansByBorrowerEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, lending, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
|
3128
|
+
export { IDL$1 as IDL, lavaragev2 as IDLV2, type Lavarage$1 as Lavarage, closePositionEvm, closeTradeV1, closeTradeV2, createTpDelegate, getActiveLoanCountEvm, getActiveLoansBatchEvm, getAllPositions, getAvailableExposureEvm, getClosedPositions, getClosedPositionsEvm, getCollateralExposureEvm, getCollateralInfoEvm, getDelegateAccounts, getLiquidatedPositions, getLiquidatedPositionsEvm, getLoanEvm, getLoansByBorrowerEvm, getOffers, getOffersEvm, getOpenPositions, getOpeningFeeEvm, getPda, getPositionAccountPDA, getPositionsEvm, getProfitFeeEvm, getTokenBalanceEvm, getUserLoansEvm, lending, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.js
CHANGED
|
@@ -105,7 +105,8 @@ __export(index_exports, {
|
|
|
105
105
|
partialRepayV1: () => partialRepayV1,
|
|
106
106
|
partialRepayV2: () => partialRepayV2,
|
|
107
107
|
removeTpDelegate: () => removeTpDelegate,
|
|
108
|
-
splitPositionV2: () => splitPositionV2
|
|
108
|
+
splitPositionV2: () => splitPositionV2,
|
|
109
|
+
updateMaxLendPerTokenBatchEvm: () => updateMaxLendPerTokenBatchEvm
|
|
109
110
|
});
|
|
110
111
|
module.exports = __toCommonJS(index_exports);
|
|
111
112
|
var import_anchor2 = require("@coral-xyz/anchor");
|
|
@@ -117,254 +118,7 @@ var import_spl_token2 = require("@solana/spl-token");
|
|
|
117
118
|
var import_ethers = require("ethers");
|
|
118
119
|
|
|
119
120
|
// abi/borrowerOperations.ts
|
|
120
|
-
var borrowerOperationsAbi = [
|
|
121
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
122
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
123
|
-
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
124
|
-
{
|
|
125
|
-
anonymous: false,
|
|
126
|
-
inputs: [
|
|
127
|
-
{
|
|
128
|
-
indexed: true,
|
|
129
|
-
internalType: "address",
|
|
130
|
-
name: "buyer",
|
|
131
|
-
type: "address"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
indexed: true,
|
|
135
|
-
internalType: "address",
|
|
136
|
-
name: "tokenCollateral",
|
|
137
|
-
type: "address"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
indexed: true,
|
|
141
|
-
internalType: "uint256",
|
|
142
|
-
name: "loanId",
|
|
143
|
-
type: "uint256"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
indexed: false,
|
|
147
|
-
internalType: "uint256",
|
|
148
|
-
name: "openingPositionSize",
|
|
149
|
-
type: "uint256"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
indexed: false,
|
|
153
|
-
internalType: "uint256",
|
|
154
|
-
name: "collateralAmount",
|
|
155
|
-
type: "uint256"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
indexed: false,
|
|
159
|
-
internalType: "uint256",
|
|
160
|
-
name: "initialMargin",
|
|
161
|
-
type: "uint256"
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
name: "Buy",
|
|
165
|
-
type: "event"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
anonymous: false,
|
|
169
|
-
inputs: [
|
|
170
|
-
{
|
|
171
|
-
indexed: false,
|
|
172
|
-
internalType: "uint64",
|
|
173
|
-
name: "version",
|
|
174
|
-
type: "uint64"
|
|
175
|
-
}
|
|
176
|
-
],
|
|
177
|
-
name: "Initialized",
|
|
178
|
-
type: "event"
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
anonymous: false,
|
|
182
|
-
inputs: [
|
|
183
|
-
{
|
|
184
|
-
indexed: true,
|
|
185
|
-
internalType: "address",
|
|
186
|
-
name: "borrower",
|
|
187
|
-
type: "address"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
indexed: true,
|
|
191
|
-
internalType: "address",
|
|
192
|
-
name: "tokenCollateral",
|
|
193
|
-
type: "address"
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
indexed: true,
|
|
197
|
-
internalType: "uint256",
|
|
198
|
-
name: "loanId",
|
|
199
|
-
type: "uint256"
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
indexed: false,
|
|
203
|
-
internalType: "uint256",
|
|
204
|
-
name: "closingPositionSize",
|
|
205
|
-
type: "uint256"
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
indexed: false,
|
|
209
|
-
internalType: "uint256",
|
|
210
|
-
name: "liquidatorRepaidAmount",
|
|
211
|
-
type: "uint256"
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
name: "Liquidation",
|
|
215
|
-
type: "event"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
anonymous: false,
|
|
219
|
-
inputs: [
|
|
220
|
-
{
|
|
221
|
-
indexed: true,
|
|
222
|
-
internalType: "address",
|
|
223
|
-
name: "buyer",
|
|
224
|
-
type: "address"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
indexed: true,
|
|
228
|
-
internalType: "address",
|
|
229
|
-
name: "tokenCollateral",
|
|
230
|
-
type: "address"
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
indexed: true,
|
|
234
|
-
internalType: "uint256",
|
|
235
|
-
name: "loanId",
|
|
236
|
-
type: "uint256"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
indexed: false,
|
|
240
|
-
internalType: "uint256",
|
|
241
|
-
name: "closingPositionSize",
|
|
242
|
-
type: "uint256"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
indexed: false,
|
|
246
|
-
internalType: "uint256",
|
|
247
|
-
name: "profit",
|
|
248
|
-
type: "uint256"
|
|
249
|
-
}
|
|
250
|
-
],
|
|
251
|
-
name: "Sell",
|
|
252
|
-
type: "event"
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
inputs: [],
|
|
256
|
-
name: "admin",
|
|
257
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
258
|
-
stateMutability: "view",
|
|
259
|
-
type: "function"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
inputs: [
|
|
263
|
-
{ internalType: "bytes", name: "buyingCode", type: "bytes" },
|
|
264
|
-
{
|
|
265
|
-
internalType: "contract IERC20",
|
|
266
|
-
name: "tokenCollateral",
|
|
267
|
-
type: "address"
|
|
268
|
-
},
|
|
269
|
-
{ internalType: "uint256", name: "borrowAmount", type: "uint256" },
|
|
270
|
-
{
|
|
271
|
-
internalType: "contract TokenHolder",
|
|
272
|
-
name: "tokenHolder",
|
|
273
|
-
type: "address"
|
|
274
|
-
},
|
|
275
|
-
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
276
|
-
{
|
|
277
|
-
internalType: "address",
|
|
278
|
-
name: "integratorFeeAddress",
|
|
279
|
-
type: "address"
|
|
280
|
-
}
|
|
281
|
-
],
|
|
282
|
-
name: "buy",
|
|
283
|
-
outputs: [],
|
|
284
|
-
stateMutability: "payable",
|
|
285
|
-
type: "function"
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
inputs: [
|
|
289
|
-
{ internalType: "contract IERC20", name: "_weth", type: "address" }
|
|
290
|
-
],
|
|
291
|
-
name: "initialize",
|
|
292
|
-
outputs: [],
|
|
293
|
-
stateMutability: "nonpayable",
|
|
294
|
-
type: "function"
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
inputs: [
|
|
298
|
-
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
299
|
-
{
|
|
300
|
-
internalType: "contract TokenHolder",
|
|
301
|
-
name: "tokenHolder",
|
|
302
|
-
type: "address"
|
|
303
|
-
},
|
|
304
|
-
{ internalType: "uint256", name: "closingPositionSize", type: "uint256" }
|
|
305
|
-
],
|
|
306
|
-
name: "liquidate",
|
|
307
|
-
outputs: [],
|
|
308
|
-
stateMutability: "nonpayable",
|
|
309
|
-
type: "function"
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
inputs: [],
|
|
313
|
-
name: "openingFee",
|
|
314
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
315
|
-
stateMutability: "view",
|
|
316
|
-
type: "function"
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
inputs: [],
|
|
320
|
-
name: "profitFee",
|
|
321
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
322
|
-
stateMutability: "view",
|
|
323
|
-
type: "function"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
inputs: [
|
|
327
|
-
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
328
|
-
{ internalType: "bytes", name: "sellingCode", type: "bytes" },
|
|
329
|
-
{
|
|
330
|
-
internalType: "contract TokenHolder",
|
|
331
|
-
name: "tokenHolder",
|
|
332
|
-
type: "address"
|
|
333
|
-
},
|
|
334
|
-
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
335
|
-
{
|
|
336
|
-
internalType: "address",
|
|
337
|
-
name: "integratorFeeAddress",
|
|
338
|
-
type: "address"
|
|
339
|
-
}
|
|
340
|
-
],
|
|
341
|
-
name: "sell",
|
|
342
|
-
outputs: [],
|
|
343
|
-
stateMutability: "payable",
|
|
344
|
-
type: "function"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
inputs: [{ internalType: "address", name: "_admin", type: "address" }],
|
|
348
|
-
name: "setAdmin",
|
|
349
|
-
outputs: [],
|
|
350
|
-
stateMutability: "nonpayable",
|
|
351
|
-
type: "function"
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
inputs: [{ internalType: "uint256", name: "_openingFee", type: "uint256" }],
|
|
355
|
-
name: "setOpeningFee",
|
|
356
|
-
outputs: [],
|
|
357
|
-
stateMutability: "nonpayable",
|
|
358
|
-
type: "function"
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
inputs: [{ internalType: "uint256", name: "_profitFee", type: "uint256" }],
|
|
362
|
-
name: "setProfitFee",
|
|
363
|
-
outputs: [],
|
|
364
|
-
stateMutability: "nonpayable",
|
|
365
|
-
type: "function"
|
|
366
|
-
}
|
|
367
|
-
];
|
|
121
|
+
var borrowerOperationsAbi = [{ "type": "function", "name": "admin", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "buy", "inputs": [{ "name": "buyingCode", "type": "bytes", "internalType": "bytes" }, { "name": "tokenCollateral", "type": "address", "internalType": "contract IERC20" }, { "name": "borrowAmount", "type": "uint256", "internalType": "uint256" }, { "name": "tokenHolder", "type": "address", "internalType": "contract TokenHolder" }, { "name": "inchRouter", "type": "address", "internalType": "address" }, { "name": "integratorFeeAddress", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "initialize", "inputs": [{ "name": "_weth", "type": "address", "internalType": "contract IERC20" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "liquidate", "inputs": [{ "name": "loanId", "type": "uint256", "internalType": "uint256" }, { "name": "tokenHolder", "type": "address", "internalType": "contract TokenHolder" }, { "name": "closingPositionSize", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "loanRecords", "inputs": [{ "name": "", "type": "address", "internalType": "address" }, { "name": "", "type": "uint256", "internalType": "uint256" }], "outputs": [{ "name": "id", "type": "uint256", "internalType": "uint256" }, { "name": "tokenHolder", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", "name": "openingFee", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "profitFee", "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", "name": "sell", "inputs": [{ "name": "loanId", "type": "uint256", "internalType": "uint256" }, { "name": "sellingCode", "type": "bytes", "internalType": "bytes" }, { "name": "tokenHolder", "type": "address", "internalType": "contract TokenHolder" }, { "name": "inchRouter", "type": "address", "internalType": "address" }, { "name": "integratorFeeAddress", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "payable" }, { "type": "function", "name": "setAdmin", "inputs": [{ "name": "_admin", "type": "address", "internalType": "address" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setOpeningFee", "inputs": [{ "name": "_openingFee", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "function", "name": "setProfitFee", "inputs": [{ "name": "_profitFee", "type": "uint256", "internalType": "uint256" }], "outputs": [], "stateMutability": "nonpayable" }, { "type": "event", "name": "Buy", "inputs": [{ "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenHolder", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenCollateral", "type": "address", "indexed": true, "internalType": "address" }, { "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "openingPositionSize", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "collateralAmount", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "initialMargin", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Initialized", "inputs": [{ "name": "version", "type": "uint64", "indexed": false, "internalType": "uint64" }], "anonymous": false }, { "type": "event", "name": "Liquidation", "inputs": [{ "name": "borrower", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenHolder", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenCollateral", "type": "address", "indexed": true, "internalType": "address" }, { "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "closingPositionSize", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "liquidatorRepaidAmount", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "event", "name": "Sell", "inputs": [{ "name": "buyer", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenHolder", "type": "address", "indexed": true, "internalType": "address" }, { "name": "tokenCollateral", "type": "address", "indexed": true, "internalType": "address" }, { "name": "loanId", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "closingPositionSize", "type": "uint256", "indexed": false, "internalType": "uint256" }, { "name": "profit", "type": "uint256", "indexed": false, "internalType": "uint256" }], "anonymous": false }, { "type": "error", "name": "InvalidInitialization", "inputs": [] }, { "type": "error", "name": "NotInitializing", "inputs": [] }, { "type": "error", "name": "ReentrancyGuardReentrantCall", "inputs": [] }];
|
|
368
122
|
|
|
369
123
|
// abi/tokenHolderAbi.ts
|
|
370
124
|
var tokenHolderAbi = [
|
|
@@ -1323,6 +1077,26 @@ function getAvailableExposureEvm(provider, tokenHolderContractAddress, collatera
|
|
|
1323
1077
|
return contract.getAvailableExposure(collateralAddress);
|
|
1324
1078
|
});
|
|
1325
1079
|
}
|
|
1080
|
+
var updateMaxLendPerTokenBatchEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, tokenHolderContractAddress, {
|
|
1081
|
+
collateralAddresses,
|
|
1082
|
+
newMaxLendPerTokens,
|
|
1083
|
+
gasLimit,
|
|
1084
|
+
gasPrice
|
|
1085
|
+
}) {
|
|
1086
|
+
const contract = new import_ethers.Contract(
|
|
1087
|
+
tokenHolderContractAddress,
|
|
1088
|
+
tokenHolderAbi,
|
|
1089
|
+
provider
|
|
1090
|
+
);
|
|
1091
|
+
const txOptions = {};
|
|
1092
|
+
if (gasLimit) txOptions.gasLimit = gasLimit;
|
|
1093
|
+
if (gasPrice) txOptions.gasPrice = gasPrice;
|
|
1094
|
+
return contract.updateMaxLendPerTokenBulk.populateTransaction(
|
|
1095
|
+
collateralAddresses,
|
|
1096
|
+
newMaxLendPerTokens,
|
|
1097
|
+
Object.keys(txOptions).length > 0 ? txOptions : {}
|
|
1098
|
+
);
|
|
1099
|
+
});
|
|
1326
1100
|
|
|
1327
1101
|
// lending.ts
|
|
1328
1102
|
var lending_exports = {};
|
|
@@ -1368,7 +1142,7 @@ function createNodeWallet(lavarageProgram, params) {
|
|
|
1368
1142
|
return __async(this, null, function* () {
|
|
1369
1143
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1370
1144
|
let instruction, nodeWallet;
|
|
1371
|
-
if (params.
|
|
1145
|
+
if (params.mint !== void 0) {
|
|
1372
1146
|
nodeWallet = getNodeWalletPDA(
|
|
1373
1147
|
new import_web3.PublicKey(params.operator),
|
|
1374
1148
|
new import_web3.PublicKey(params.mint),
|
|
@@ -5400,6 +5174,7 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken)
|
|
|
5400
5174
|
partialRepayV1,
|
|
5401
5175
|
partialRepayV2,
|
|
5402
5176
|
removeTpDelegate,
|
|
5403
|
-
splitPositionV2
|
|
5177
|
+
splitPositionV2,
|
|
5178
|
+
updateMaxLendPerTokenBatchEvm
|
|
5404
5179
|
});
|
|
5405
5180
|
//# sourceMappingURL=index.js.map
|