@lavarage/sdk 7.2.3 → 7.4.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.
- package/abi/borrowerOperations.ts +1 -1
- package/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +30 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/evm.ts +49 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export const borrowerOperationsAbi = [{
|
|
1
|
+
export const borrowerOperationsAbi = [{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"tokenHolder","type":"address"},{"indexed":true,"internalType":"address","name":"tokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","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"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"dex","type":"address"}],"name":"DexAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"dex","type":"address"}],"name":"DexRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":true,"internalType":"address","name":"tokenHolder","type":"address"},{"indexed":true,"internalType":"address","name":"tokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"closingPositionSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidatorRepaidAmount","type":"uint256"}],"name":"Liquidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"MaxApprovalAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"tokenHolder","type":"address"},{"indexed":true,"internalType":"address","name":"tokenCollateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"loanId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"closingPositionSize","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"profit","type":"uint256"}],"name":"Sell","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"TokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"TokenRemoved","type":"event"},{"inputs":[{"internalType":"address","name":"dex","type":"address"}],"name":"addWhitelistedDex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"addWhitelistedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"buyingCode","type":"bytes"},{"internalType":"contract IERC20","name":"tokenCollateral","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"internalType":"contract TokenHolder","name":"tokenHolder","type":"address"},{"internalType":"address","name":"inchRouter","type":"address"},{"internalType":"address","name":"integratorFeeAddress","type":"address"},{"internalType":"address","name":"whitelistedDex","type":"address"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_weth","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dex","type":"address"}],"name":"isWhitelistedDex","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isWhitelistedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"loanId","type":"uint256"},{"internalType":"contract TokenHolder","name":"tokenHolder","type":"address"},{"internalType":"uint256","name":"closingPositionSize","type":"uint256"}],"name":"liquidate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"loanRecords","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"tokenHolder","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxApprovalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openingFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"profitFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dex","type":"address"}],"name":"removeWhitelistedDex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeWhitelistedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"loanId","type":"uint256"},{"internalType":"bytes","name":"sellingCode","type":"bytes"},{"internalType":"contract TokenHolder","name":"tokenHolder","type":"address"},{"internalType":"address","name":"inchRouter","type":"address"},{"internalType":"address","name":"integratorFeeAddress","type":"address"},{"internalType":"address","name":"whitelistedDex","type":"address"}],"name":"sell","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxApprovalAmount","type":"uint256"}],"name":"setMaxApprovalAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_openingFee","type":"uint256"}],"name":"setOpeningFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_profitFee","type":"uint256"}],"name":"setProfitFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedDexes","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
|
package/dist/index.d.mts
CHANGED
|
@@ -3143,7 +3143,7 @@ interface LiquidationEvent {
|
|
|
3143
3143
|
* @param params - Trading parameters
|
|
3144
3144
|
* @returns Unsigned transaction object
|
|
3145
3145
|
*/
|
|
3146
|
-
declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { buyingCode, tokenCollateral, borrowAmount, tokenHolder, inchRouter, integratorFeeAddress, buyerContribution, gasLimit, gasPrice, }: {
|
|
3146
|
+
declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { buyingCode, tokenCollateral, borrowAmount, tokenHolder, inchRouter, integratorFeeAddress, buyerContribution, tokenApproval, gasLimit, gasPrice, }: {
|
|
3147
3147
|
buyingCode: string;
|
|
3148
3148
|
tokenCollateral: string;
|
|
3149
3149
|
borrowAmount: BigNumberish;
|
|
@@ -3151,6 +3151,7 @@ declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress:
|
|
|
3151
3151
|
inchRouter: string;
|
|
3152
3152
|
integratorFeeAddress?: string;
|
|
3153
3153
|
buyerContribution: BigNumberish;
|
|
3154
|
+
tokenApproval: string;
|
|
3154
3155
|
gasLimit?: string | number;
|
|
3155
3156
|
gasPrice?: string | number;
|
|
3156
3157
|
}) => Promise<ContractTransaction>;
|
|
@@ -3161,7 +3162,7 @@ declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress:
|
|
|
3161
3162
|
* @param params - Trading parameters
|
|
3162
3163
|
* @returns Unsigned transaction object
|
|
3163
3164
|
*/
|
|
3164
|
-
declare const closePositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { loanId, sellingCode, tokenHolder, inchRouter, integratorFeeAddress, gasLimit, gasPrice, }: {
|
|
3165
|
+
declare const closePositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { loanId, sellingCode, tokenHolder, inchRouter, integratorFeeAddress, gasLimit, gasPrice, tokenApproval, }: {
|
|
3165
3166
|
loanId: BigNumberish;
|
|
3166
3167
|
sellingCode: string;
|
|
3167
3168
|
tokenHolder: string;
|
|
@@ -3169,6 +3170,7 @@ declare const closePositionEvm: (provider: Provider, borrowerOpsContractAddress:
|
|
|
3169
3170
|
integratorFeeAddress?: string;
|
|
3170
3171
|
gasLimit?: string | number;
|
|
3171
3172
|
gasPrice?: string | number;
|
|
3173
|
+
tokenApproval: string;
|
|
3172
3174
|
}) => Promise<ContractTransaction>;
|
|
3173
3175
|
/**
|
|
3174
3176
|
* Get all positions from active loans
|
|
@@ -3289,6 +3291,20 @@ declare function getCollateralExposureEvm(provider: Provider, tokenHolderContrac
|
|
|
3289
3291
|
* @returns Available exposure as a BigNumber
|
|
3290
3292
|
*/
|
|
3291
3293
|
declare function getAvailableExposureEvm(provider: Provider, tokenHolderContractAddress: string, collateralAddress: string): Promise<bigint>;
|
|
3294
|
+
/**
|
|
3295
|
+
* Creates an unsigned transaction to liquidate a trading position on EVM chain
|
|
3296
|
+
* @param provider - Ethers provider
|
|
3297
|
+
* @param borrowerOpsContractAddress - BorrowerOperations contract address
|
|
3298
|
+
* @param params - Liquidation parameters
|
|
3299
|
+
* @returns Unsigned transaction object
|
|
3300
|
+
*/
|
|
3301
|
+
declare const liquidatePositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { loanId, tokenHolder, closingPositionSize, gasLimit, gasPrice, }: {
|
|
3302
|
+
loanId: BigNumberish;
|
|
3303
|
+
tokenHolder: string;
|
|
3304
|
+
closingPositionSize: BigNumberish;
|
|
3305
|
+
gasLimit?: string | number;
|
|
3306
|
+
gasPrice?: string | number;
|
|
3307
|
+
}) => Promise<ContractTransaction>;
|
|
3292
3308
|
/**
|
|
3293
3309
|
* Update max lend per token for multiple collaterals in batch
|
|
3294
3310
|
* @param provider - Ethers provider
|
|
@@ -3619,4 +3635,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3619
3635
|
collateralType: PublicKey;
|
|
3620
3636
|
}>, quoteToken: PublicKey, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3621
3637
|
|
|
3622
|
-
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 };
|
|
3638
|
+
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, liquidatePositionEvm, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.d.ts
CHANGED
|
@@ -3143,7 +3143,7 @@ interface LiquidationEvent {
|
|
|
3143
3143
|
* @param params - Trading parameters
|
|
3144
3144
|
* @returns Unsigned transaction object
|
|
3145
3145
|
*/
|
|
3146
|
-
declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { buyingCode, tokenCollateral, borrowAmount, tokenHolder, inchRouter, integratorFeeAddress, buyerContribution, gasLimit, gasPrice, }: {
|
|
3146
|
+
declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { buyingCode, tokenCollateral, borrowAmount, tokenHolder, inchRouter, integratorFeeAddress, buyerContribution, tokenApproval, gasLimit, gasPrice, }: {
|
|
3147
3147
|
buyingCode: string;
|
|
3148
3148
|
tokenCollateral: string;
|
|
3149
3149
|
borrowAmount: BigNumberish;
|
|
@@ -3151,6 +3151,7 @@ declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress:
|
|
|
3151
3151
|
inchRouter: string;
|
|
3152
3152
|
integratorFeeAddress?: string;
|
|
3153
3153
|
buyerContribution: BigNumberish;
|
|
3154
|
+
tokenApproval: string;
|
|
3154
3155
|
gasLimit?: string | number;
|
|
3155
3156
|
gasPrice?: string | number;
|
|
3156
3157
|
}) => Promise<ContractTransaction>;
|
|
@@ -3161,7 +3162,7 @@ declare const openPositionEvm: (provider: Provider, borrowerOpsContractAddress:
|
|
|
3161
3162
|
* @param params - Trading parameters
|
|
3162
3163
|
* @returns Unsigned transaction object
|
|
3163
3164
|
*/
|
|
3164
|
-
declare const closePositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { loanId, sellingCode, tokenHolder, inchRouter, integratorFeeAddress, gasLimit, gasPrice, }: {
|
|
3165
|
+
declare const closePositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { loanId, sellingCode, tokenHolder, inchRouter, integratorFeeAddress, gasLimit, gasPrice, tokenApproval, }: {
|
|
3165
3166
|
loanId: BigNumberish;
|
|
3166
3167
|
sellingCode: string;
|
|
3167
3168
|
tokenHolder: string;
|
|
@@ -3169,6 +3170,7 @@ declare const closePositionEvm: (provider: Provider, borrowerOpsContractAddress:
|
|
|
3169
3170
|
integratorFeeAddress?: string;
|
|
3170
3171
|
gasLimit?: string | number;
|
|
3171
3172
|
gasPrice?: string | number;
|
|
3173
|
+
tokenApproval: string;
|
|
3172
3174
|
}) => Promise<ContractTransaction>;
|
|
3173
3175
|
/**
|
|
3174
3176
|
* Get all positions from active loans
|
|
@@ -3289,6 +3291,20 @@ declare function getCollateralExposureEvm(provider: Provider, tokenHolderContrac
|
|
|
3289
3291
|
* @returns Available exposure as a BigNumber
|
|
3290
3292
|
*/
|
|
3291
3293
|
declare function getAvailableExposureEvm(provider: Provider, tokenHolderContractAddress: string, collateralAddress: string): Promise<bigint>;
|
|
3294
|
+
/**
|
|
3295
|
+
* Creates an unsigned transaction to liquidate a trading position on EVM chain
|
|
3296
|
+
* @param provider - Ethers provider
|
|
3297
|
+
* @param borrowerOpsContractAddress - BorrowerOperations contract address
|
|
3298
|
+
* @param params - Liquidation parameters
|
|
3299
|
+
* @returns Unsigned transaction object
|
|
3300
|
+
*/
|
|
3301
|
+
declare const liquidatePositionEvm: (provider: Provider, borrowerOpsContractAddress: string, { loanId, tokenHolder, closingPositionSize, gasLimit, gasPrice, }: {
|
|
3302
|
+
loanId: BigNumberish;
|
|
3303
|
+
tokenHolder: string;
|
|
3304
|
+
closingPositionSize: BigNumberish;
|
|
3305
|
+
gasLimit?: string | number;
|
|
3306
|
+
gasPrice?: string | number;
|
|
3307
|
+
}) => Promise<ContractTransaction>;
|
|
3292
3308
|
/**
|
|
3293
3309
|
* Update max lend per token for multiple collaterals in batch
|
|
3294
3310
|
* @param provider - Ethers provider
|
|
@@ -3619,4 +3635,4 @@ declare const mergePositionV2: (lavarageProgram: Program<Lavarage>, position1: P
|
|
|
3619
3635
|
collateralType: PublicKey;
|
|
3620
3636
|
}>, quoteToken: PublicKey, computeBudgetMicroLamports?: number) => Promise<VersionedTransaction>;
|
|
3621
3637
|
|
|
3622
|
-
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 };
|
|
3638
|
+
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, liquidatePositionEvm, mergePositionV2, modifyTpDelegate, openPositionEvm, openTradeV1, openTradeV2, partialRepayV1, partialRepayV2, removeTpDelegate, splitPositionV2, updateMaxLendPerTokenBatchEvm };
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,7 @@ __export(index_exports, {
|
|
|
97
97
|
getTokenBalanceEvm: () => getTokenBalanceEvm,
|
|
98
98
|
getUserLoansEvm: () => getUserLoansEvm,
|
|
99
99
|
lending: () => lending_exports,
|
|
100
|
+
liquidatePositionEvm: () => liquidatePositionEvm,
|
|
100
101
|
mergePositionV2: () => mergePositionV2,
|
|
101
102
|
modifyTpDelegate: () => modifyTpDelegate,
|
|
102
103
|
openPositionEvm: () => openPositionEvm,
|
|
@@ -118,7 +119,7 @@ var import_spl_token2 = require("@solana/spl-token");
|
|
|
118
119
|
var import_ethers = require("ethers");
|
|
119
120
|
|
|
120
121
|
// abi/borrowerOperations.ts
|
|
121
|
-
var borrowerOperationsAbi = [{ "
|
|
122
|
+
var borrowerOperationsAbi = [{ "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenHolder", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenCollateral", "type": "address" }, { "indexed": false, "internalType": "uint256", "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" }], "name": "Buy", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "dex", "type": "address" }], "name": "DexAdded", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "dex", "type": "address" }], "name": "DexRemoved", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "borrower", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenHolder", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenCollateral", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "loanId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "closingPositionSize", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "liquidatorRepaidAmount", "type": "uint256" }], "name": "Liquidation", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "oldAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "newAmount", "type": "uint256" }], "name": "MaxApprovalAmountUpdated", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenHolder", "type": "address" }, { "indexed": true, "internalType": "address", "name": "tokenCollateral", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "loanId", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "closingPositionSize", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "profit", "type": "uint256" }], "name": "Sell", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "token", "type": "address" }], "name": "TokenAdded", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "token", "type": "address" }], "name": "TokenRemoved", "type": "event" }, { "inputs": [{ "internalType": "address", "name": "dex", "type": "address" }], "name": "addWhitelistedDex", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "token", "type": "address" }], "name": "addWhitelistedToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "admin", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes", "name": "buyingCode", "type": "bytes" }, { "internalType": "contract IERC20", "name": "tokenCollateral", "type": "address" }, { "internalType": "uint256", "name": "borrowAmount", "type": "uint256" }, { "internalType": "contract TokenHolder", "name": "tokenHolder", "type": "address" }, { "internalType": "address", "name": "inchRouter", "type": "address" }, { "internalType": "address", "name": "integratorFeeAddress", "type": "address" }, { "internalType": "address", "name": "whitelistedDex", "type": "address" }], "name": "buy", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "contract IERC20", "name": "_weth", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "dex", "type": "address" }], "name": "isWhitelistedDex", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "token", "type": "address" }], "name": "isWhitelistedToken", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "loanId", "type": "uint256" }, { "internalType": "contract TokenHolder", "name": "tokenHolder", "type": "address" }, { "internalType": "uint256", "name": "closingPositionSize", "type": "uint256" }], "name": "liquidate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint256", "name": "", "type": "uint256" }], "name": "loanRecords", "outputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }, { "internalType": "address", "name": "tokenHolder", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxApprovalAmount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "openingFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "profitFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "dex", "type": "address" }], "name": "removeWhitelistedDex", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "token", "type": "address" }], "name": "removeWhitelistedToken", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "loanId", "type": "uint256" }, { "internalType": "bytes", "name": "sellingCode", "type": "bytes" }, { "internalType": "contract TokenHolder", "name": "tokenHolder", "type": "address" }, { "internalType": "address", "name": "inchRouter", "type": "address" }, { "internalType": "address", "name": "integratorFeeAddress", "type": "address" }, { "internalType": "address", "name": "whitelistedDex", "type": "address" }], "name": "sell", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_admin", "type": "address" }], "name": "setAdmin", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_maxApprovalAmount", "type": "uint256" }], "name": "setMaxApprovalAmount", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_openingFee", "type": "uint256" }], "name": "setOpeningFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "_profitFee", "type": "uint256" }], "name": "setProfitFee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "whitelistedDexes", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "whitelistedTokens", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }];
|
|
122
123
|
|
|
123
124
|
// abi/tokenHolderAbi.ts
|
|
124
125
|
var tokenHolderAbi = [
|
|
@@ -790,6 +791,7 @@ var openPositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (p
|
|
|
790
791
|
inchRouter,
|
|
791
792
|
integratorFeeAddress = import_ethers.ZeroAddress,
|
|
792
793
|
buyerContribution,
|
|
794
|
+
tokenApproval,
|
|
793
795
|
gasLimit,
|
|
794
796
|
gasPrice
|
|
795
797
|
}) {
|
|
@@ -810,6 +812,7 @@ var openPositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (p
|
|
|
810
812
|
tokenHolder,
|
|
811
813
|
inchRouter,
|
|
812
814
|
integratorFeeAddress,
|
|
815
|
+
tokenApproval,
|
|
813
816
|
txOptions
|
|
814
817
|
);
|
|
815
818
|
});
|
|
@@ -820,7 +823,8 @@ var closePositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (
|
|
|
820
823
|
inchRouter,
|
|
821
824
|
integratorFeeAddress = import_ethers.ZeroAddress,
|
|
822
825
|
gasLimit,
|
|
823
|
-
gasPrice
|
|
826
|
+
gasPrice,
|
|
827
|
+
tokenApproval
|
|
824
828
|
}) {
|
|
825
829
|
const contract = new import_ethers.Contract(
|
|
826
830
|
borrowerOpsContractAddress,
|
|
@@ -836,6 +840,7 @@ var closePositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (
|
|
|
836
840
|
tokenHolder,
|
|
837
841
|
inchRouter,
|
|
838
842
|
integratorFeeAddress,
|
|
843
|
+
tokenApproval,
|
|
839
844
|
Object.keys(txOptions).length > 0 ? txOptions : {}
|
|
840
845
|
);
|
|
841
846
|
});
|
|
@@ -1077,6 +1082,28 @@ function getAvailableExposureEvm(provider, tokenHolderContractAddress, collatera
|
|
|
1077
1082
|
return contract.getAvailableExposure(collateralAddress);
|
|
1078
1083
|
});
|
|
1079
1084
|
}
|
|
1085
|
+
var liquidatePositionEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, borrowerOpsContractAddress, {
|
|
1086
|
+
loanId,
|
|
1087
|
+
tokenHolder,
|
|
1088
|
+
closingPositionSize,
|
|
1089
|
+
gasLimit,
|
|
1090
|
+
gasPrice
|
|
1091
|
+
}) {
|
|
1092
|
+
const contract = new import_ethers.Contract(
|
|
1093
|
+
borrowerOpsContractAddress,
|
|
1094
|
+
borrowerOperationsAbi,
|
|
1095
|
+
provider
|
|
1096
|
+
);
|
|
1097
|
+
const txOptions = {};
|
|
1098
|
+
if (gasLimit) txOptions.gasLimit = gasLimit;
|
|
1099
|
+
if (gasPrice) txOptions.gasPrice = gasPrice;
|
|
1100
|
+
return contract.liquidate.populateTransaction(
|
|
1101
|
+
loanId,
|
|
1102
|
+
tokenHolder,
|
|
1103
|
+
closingPositionSize,
|
|
1104
|
+
Object.keys(txOptions).length > 0 ? txOptions : {}
|
|
1105
|
+
);
|
|
1106
|
+
});
|
|
1080
1107
|
var updateMaxLendPerTokenBatchEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (provider, tokenHolderContractAddress, {
|
|
1081
1108
|
collateralAddresses,
|
|
1082
1109
|
newMaxLendPerTokens,
|
|
@@ -5991,6 +6018,7 @@ var mergePositionV2 = (lavarageProgram, position1, position2, offer, quoteToken,
|
|
|
5991
6018
|
getTokenBalanceEvm,
|
|
5992
6019
|
getUserLoansEvm,
|
|
5993
6020
|
lending,
|
|
6021
|
+
liquidatePositionEvm,
|
|
5994
6022
|
mergePositionV2,
|
|
5995
6023
|
modifyTpDelegate,
|
|
5996
6024
|
openPositionEvm,
|