@lavarage/sdk 6.7.6 → 6.8.2
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 +25 -250
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -249
- package/dist/index.mjs.map +1 -1
- package/evm.ts +43 -0
- package/package.json +1 -1
- package/playground.ts +28 -0
|
@@ -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 getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
2840
2856
|
declare function getPositionAccountPDA(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, offer: ProgramAccount, seed: PublicKey): PublicKey;
|
|
@@ -3037,4 +3053,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3037
3053
|
collateralType: PublicKey;
|
|
3038
3054
|
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
3039
3055
|
|
|
3040
|
-
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, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
|
3056
|
+
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, 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 getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
|
2840
2856
|
declare function getPositionAccountPDA(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, offer: ProgramAccount, seed: PublicKey): PublicKey;
|
|
@@ -3037,4 +3053,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3037
3053
|
collateralType: PublicKey;
|
|
3038
3054
|
}>, quoteToken: PublicKey) => Promise<VersionedTransaction>;
|
|
3039
3055
|
|
|
3040
|
-
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, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2 };
|
|
3056
|
+
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, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.js
CHANGED
|
@@ -104,7 +104,8 @@ __export(index_exports, {
|
|
|
104
104
|
partialRepayV1: () => partialRepayV1,
|
|
105
105
|
partialRepayV2: () => partialRepayV2,
|
|
106
106
|
removeTpDelegate: () => removeTpDelegate,
|
|
107
|
-
splitPositionV2: () => splitPositionV2
|
|
107
|
+
splitPositionV2: () => splitPositionV2,
|
|
108
|
+
updateMaxLendPerTokenBatchEvm: () => updateMaxLendPerTokenBatchEvm
|
|
108
109
|
});
|
|
109
110
|
module.exports = __toCommonJS(index_exports);
|
|
110
111
|
var import_anchor = require("@coral-xyz/anchor");
|
|
@@ -2747,254 +2748,7 @@ var IDL2 = {
|
|
|
2747
2748
|
var import_ethers = require("ethers");
|
|
2748
2749
|
|
|
2749
2750
|
// abi/borrowerOperations.ts
|
|
2750
|
-
var borrowerOperationsAbi = [
|
|
2751
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
2752
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
2753
|
-
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
2754
|
-
{
|
|
2755
|
-
anonymous: false,
|
|
2756
|
-
inputs: [
|
|
2757
|
-
{
|
|
2758
|
-
indexed: true,
|
|
2759
|
-
internalType: "address",
|
|
2760
|
-
name: "buyer",
|
|
2761
|
-
type: "address"
|
|
2762
|
-
},
|
|
2763
|
-
{
|
|
2764
|
-
indexed: true,
|
|
2765
|
-
internalType: "address",
|
|
2766
|
-
name: "tokenCollateral",
|
|
2767
|
-
type: "address"
|
|
2768
|
-
},
|
|
2769
|
-
{
|
|
2770
|
-
indexed: true,
|
|
2771
|
-
internalType: "uint256",
|
|
2772
|
-
name: "loanId",
|
|
2773
|
-
type: "uint256"
|
|
2774
|
-
},
|
|
2775
|
-
{
|
|
2776
|
-
indexed: false,
|
|
2777
|
-
internalType: "uint256",
|
|
2778
|
-
name: "openingPositionSize",
|
|
2779
|
-
type: "uint256"
|
|
2780
|
-
},
|
|
2781
|
-
{
|
|
2782
|
-
indexed: false,
|
|
2783
|
-
internalType: "uint256",
|
|
2784
|
-
name: "collateralAmount",
|
|
2785
|
-
type: "uint256"
|
|
2786
|
-
},
|
|
2787
|
-
{
|
|
2788
|
-
indexed: false,
|
|
2789
|
-
internalType: "uint256",
|
|
2790
|
-
name: "initialMargin",
|
|
2791
|
-
type: "uint256"
|
|
2792
|
-
}
|
|
2793
|
-
],
|
|
2794
|
-
name: "Buy",
|
|
2795
|
-
type: "event"
|
|
2796
|
-
},
|
|
2797
|
-
{
|
|
2798
|
-
anonymous: false,
|
|
2799
|
-
inputs: [
|
|
2800
|
-
{
|
|
2801
|
-
indexed: false,
|
|
2802
|
-
internalType: "uint64",
|
|
2803
|
-
name: "version",
|
|
2804
|
-
type: "uint64"
|
|
2805
|
-
}
|
|
2806
|
-
],
|
|
2807
|
-
name: "Initialized",
|
|
2808
|
-
type: "event"
|
|
2809
|
-
},
|
|
2810
|
-
{
|
|
2811
|
-
anonymous: false,
|
|
2812
|
-
inputs: [
|
|
2813
|
-
{
|
|
2814
|
-
indexed: true,
|
|
2815
|
-
internalType: "address",
|
|
2816
|
-
name: "borrower",
|
|
2817
|
-
type: "address"
|
|
2818
|
-
},
|
|
2819
|
-
{
|
|
2820
|
-
indexed: true,
|
|
2821
|
-
internalType: "address",
|
|
2822
|
-
name: "tokenCollateral",
|
|
2823
|
-
type: "address"
|
|
2824
|
-
},
|
|
2825
|
-
{
|
|
2826
|
-
indexed: true,
|
|
2827
|
-
internalType: "uint256",
|
|
2828
|
-
name: "loanId",
|
|
2829
|
-
type: "uint256"
|
|
2830
|
-
},
|
|
2831
|
-
{
|
|
2832
|
-
indexed: false,
|
|
2833
|
-
internalType: "uint256",
|
|
2834
|
-
name: "closingPositionSize",
|
|
2835
|
-
type: "uint256"
|
|
2836
|
-
},
|
|
2837
|
-
{
|
|
2838
|
-
indexed: false,
|
|
2839
|
-
internalType: "uint256",
|
|
2840
|
-
name: "liquidatorRepaidAmount",
|
|
2841
|
-
type: "uint256"
|
|
2842
|
-
}
|
|
2843
|
-
],
|
|
2844
|
-
name: "Liquidation",
|
|
2845
|
-
type: "event"
|
|
2846
|
-
},
|
|
2847
|
-
{
|
|
2848
|
-
anonymous: false,
|
|
2849
|
-
inputs: [
|
|
2850
|
-
{
|
|
2851
|
-
indexed: true,
|
|
2852
|
-
internalType: "address",
|
|
2853
|
-
name: "buyer",
|
|
2854
|
-
type: "address"
|
|
2855
|
-
},
|
|
2856
|
-
{
|
|
2857
|
-
indexed: true,
|
|
2858
|
-
internalType: "address",
|
|
2859
|
-
name: "tokenCollateral",
|
|
2860
|
-
type: "address"
|
|
2861
|
-
},
|
|
2862
|
-
{
|
|
2863
|
-
indexed: true,
|
|
2864
|
-
internalType: "uint256",
|
|
2865
|
-
name: "loanId",
|
|
2866
|
-
type: "uint256"
|
|
2867
|
-
},
|
|
2868
|
-
{
|
|
2869
|
-
indexed: false,
|
|
2870
|
-
internalType: "uint256",
|
|
2871
|
-
name: "closingPositionSize",
|
|
2872
|
-
type: "uint256"
|
|
2873
|
-
},
|
|
2874
|
-
{
|
|
2875
|
-
indexed: false,
|
|
2876
|
-
internalType: "uint256",
|
|
2877
|
-
name: "profit",
|
|
2878
|
-
type: "uint256"
|
|
2879
|
-
}
|
|
2880
|
-
],
|
|
2881
|
-
name: "Sell",
|
|
2882
|
-
type: "event"
|
|
2883
|
-
},
|
|
2884
|
-
{
|
|
2885
|
-
inputs: [],
|
|
2886
|
-
name: "admin",
|
|
2887
|
-
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
2888
|
-
stateMutability: "view",
|
|
2889
|
-
type: "function"
|
|
2890
|
-
},
|
|
2891
|
-
{
|
|
2892
|
-
inputs: [
|
|
2893
|
-
{ internalType: "bytes", name: "buyingCode", type: "bytes" },
|
|
2894
|
-
{
|
|
2895
|
-
internalType: "contract IERC20",
|
|
2896
|
-
name: "tokenCollateral",
|
|
2897
|
-
type: "address"
|
|
2898
|
-
},
|
|
2899
|
-
{ internalType: "uint256", name: "borrowAmount", type: "uint256" },
|
|
2900
|
-
{
|
|
2901
|
-
internalType: "contract TokenHolder",
|
|
2902
|
-
name: "tokenHolder",
|
|
2903
|
-
type: "address"
|
|
2904
|
-
},
|
|
2905
|
-
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
2906
|
-
{
|
|
2907
|
-
internalType: "address",
|
|
2908
|
-
name: "integratorFeeAddress",
|
|
2909
|
-
type: "address"
|
|
2910
|
-
}
|
|
2911
|
-
],
|
|
2912
|
-
name: "buy",
|
|
2913
|
-
outputs: [],
|
|
2914
|
-
stateMutability: "payable",
|
|
2915
|
-
type: "function"
|
|
2916
|
-
},
|
|
2917
|
-
{
|
|
2918
|
-
inputs: [
|
|
2919
|
-
{ internalType: "contract IERC20", name: "_weth", type: "address" }
|
|
2920
|
-
],
|
|
2921
|
-
name: "initialize",
|
|
2922
|
-
outputs: [],
|
|
2923
|
-
stateMutability: "nonpayable",
|
|
2924
|
-
type: "function"
|
|
2925
|
-
},
|
|
2926
|
-
{
|
|
2927
|
-
inputs: [
|
|
2928
|
-
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
2929
|
-
{
|
|
2930
|
-
internalType: "contract TokenHolder",
|
|
2931
|
-
name: "tokenHolder",
|
|
2932
|
-
type: "address"
|
|
2933
|
-
},
|
|
2934
|
-
{ internalType: "uint256", name: "closingPositionSize", type: "uint256" }
|
|
2935
|
-
],
|
|
2936
|
-
name: "liquidate",
|
|
2937
|
-
outputs: [],
|
|
2938
|
-
stateMutability: "nonpayable",
|
|
2939
|
-
type: "function"
|
|
2940
|
-
},
|
|
2941
|
-
{
|
|
2942
|
-
inputs: [],
|
|
2943
|
-
name: "openingFee",
|
|
2944
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2945
|
-
stateMutability: "view",
|
|
2946
|
-
type: "function"
|
|
2947
|
-
},
|
|
2948
|
-
{
|
|
2949
|
-
inputs: [],
|
|
2950
|
-
name: "profitFee",
|
|
2951
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2952
|
-
stateMutability: "view",
|
|
2953
|
-
type: "function"
|
|
2954
|
-
},
|
|
2955
|
-
{
|
|
2956
|
-
inputs: [
|
|
2957
|
-
{ internalType: "uint256", name: "loanId", type: "uint256" },
|
|
2958
|
-
{ internalType: "bytes", name: "sellingCode", type: "bytes" },
|
|
2959
|
-
{
|
|
2960
|
-
internalType: "contract TokenHolder",
|
|
2961
|
-
name: "tokenHolder",
|
|
2962
|
-
type: "address"
|
|
2963
|
-
},
|
|
2964
|
-
{ internalType: "address", name: "inchRouter", type: "address" },
|
|
2965
|
-
{
|
|
2966
|
-
internalType: "address",
|
|
2967
|
-
name: "integratorFeeAddress",
|
|
2968
|
-
type: "address"
|
|
2969
|
-
}
|
|
2970
|
-
],
|
|
2971
|
-
name: "sell",
|
|
2972
|
-
outputs: [],
|
|
2973
|
-
stateMutability: "payable",
|
|
2974
|
-
type: "function"
|
|
2975
|
-
},
|
|
2976
|
-
{
|
|
2977
|
-
inputs: [{ internalType: "address", name: "_admin", type: "address" }],
|
|
2978
|
-
name: "setAdmin",
|
|
2979
|
-
outputs: [],
|
|
2980
|
-
stateMutability: "nonpayable",
|
|
2981
|
-
type: "function"
|
|
2982
|
-
},
|
|
2983
|
-
{
|
|
2984
|
-
inputs: [{ internalType: "uint256", name: "_openingFee", type: "uint256" }],
|
|
2985
|
-
name: "setOpeningFee",
|
|
2986
|
-
outputs: [],
|
|
2987
|
-
stateMutability: "nonpayable",
|
|
2988
|
-
type: "function"
|
|
2989
|
-
},
|
|
2990
|
-
{
|
|
2991
|
-
inputs: [{ internalType: "uint256", name: "_profitFee", type: "uint256" }],
|
|
2992
|
-
name: "setProfitFee",
|
|
2993
|
-
outputs: [],
|
|
2994
|
-
stateMutability: "nonpayable",
|
|
2995
|
-
type: "function"
|
|
2996
|
-
}
|
|
2997
|
-
];
|
|
2751
|
+
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": [] }];
|
|
2998
2752
|
|
|
2999
2753
|
// abi/tokenHolderAbi.ts
|
|
3000
2754
|
var tokenHolderAbi = [
|
|
@@ -3953,6 +3707,26 @@ function getAvailableExposureEvm(provider, tokenHolderContractAddress, collatera
|
|
|
3953
3707
|
return contract.getAvailableExposure(collateralAddress);
|
|
3954
3708
|
});
|
|
3955
3709
|
}
|
|
3710
|
+
var updateMaxLendPerTokenBatchEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, tokenHolderContractAddress, {
|
|
3711
|
+
collateralAddresses,
|
|
3712
|
+
newMaxLendPerTokens,
|
|
3713
|
+
gasLimit,
|
|
3714
|
+
gasPrice
|
|
3715
|
+
}) {
|
|
3716
|
+
const contract = new import_ethers.Contract(
|
|
3717
|
+
tokenHolderContractAddress,
|
|
3718
|
+
tokenHolderAbi,
|
|
3719
|
+
provider
|
|
3720
|
+
);
|
|
3721
|
+
const txOptions = {};
|
|
3722
|
+
if (gasLimit) txOptions.gasLimit = gasLimit;
|
|
3723
|
+
if (gasPrice) txOptions.gasPrice = gasPrice;
|
|
3724
|
+
return contract.updateMaxLendPerTokenBulk.populateTransaction(
|
|
3725
|
+
collateralAddresses,
|
|
3726
|
+
newMaxLendPerTokens,
|
|
3727
|
+
Object.keys(txOptions).length > 0 ? txOptions : {}
|
|
3728
|
+
);
|
|
3729
|
+
});
|
|
3956
3730
|
|
|
3957
3731
|
// index.ts
|
|
3958
3732
|
function getPda(seed, programId) {
|
|
@@ -5130,6 +4904,7 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken)
|
|
|
5130
4904
|
partialRepayV1,
|
|
5131
4905
|
partialRepayV2,
|
|
5132
4906
|
removeTpDelegate,
|
|
5133
|
-
splitPositionV2
|
|
4907
|
+
splitPositionV2,
|
|
4908
|
+
updateMaxLendPerTokenBatchEvm
|
|
5134
4909
|
});
|
|
5135
4910
|
//# sourceMappingURL=index.js.map
|