From 3ef8c6139dc167c223f76dd3b89e7fcc6be44fb8 Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Mon, 7 Aug 2023 12:00:30 -0400 Subject: [PATCH 1/6] changes --- liquidator/src/libs/refreshObligation.ts | 4 ++- liquidator/src/libs/utils.ts | 31 +++++++++++++++++++++++- liquidator/src/liquidate.ts | 11 +++------ 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/liquidator/src/libs/refreshObligation.ts b/liquidator/src/libs/refreshObligation.ts index 664fec36..5e78ab49 100644 --- a/liquidator/src/libs/refreshObligation.ts +++ b/liquidator/src/libs/refreshObligation.ts @@ -84,6 +84,7 @@ export function calculateRefreshedObligation( mintAddress, marketValue, symbol, + addedBorrowWeightBPS: reserve.config.addedBorrowWeightBPS }); }); @@ -132,12 +133,13 @@ function getBorrrowedAmountWadsWithInterest( } } -type Borrow = { +export type Borrow = { borrowReserve: PublicKey; borrowAmountWads: BN; marketValue: BigNumber; mintAddress: string, symbol: string; + addedBorrowWeightBPS: BN; }; type Deposit = { diff --git a/liquidator/src/libs/utils.ts b/liquidator/src/libs/utils.ts index e2fcbb7b..65441aff 100644 --- a/liquidator/src/libs/utils.ts +++ b/liquidator/src/libs/utils.ts @@ -11,6 +11,7 @@ import { } from 'global'; import { findWhere } from 'underscore'; import { TokenOracleData } from './pyth'; +import { Borrow } from './refreshObligation'; export const WAD = new BigNumber(`1${''.padEnd(18, '0')}`); export const U64_MAX = '18446744073709551615'; @@ -78,7 +79,7 @@ export function getTokenInfo(market: MarketConfig, symbol: string) { } export function getTokenInfoFromMarket(market: MarketConfig, symbol: string) { - const liquidityToken: LiquidityToken = findWhere(market.reserves.map((reserve) => reserve.liquidityToken), { symbol }); + const liquidityToken: LiquidityToken = findWhere(market.reserves.map((reserve) => reserve.liquidityToken), { symbol })!; if (!liquidityToken) { throw new Error(`Could not find ${symbol} in config.assets`); } @@ -287,3 +288,31 @@ export const getLoanToValueRate = (reserve: Reserve): BigNumber => new BigNumber export const getLiquidationThresholdRate = (reserve: Reserve): BigNumber => new BigNumber( reserve.config.liquidationThreshold / 100, ); + +export const sortBorrows = (borrows: Borrow[]): Borrow[] => { + return borrows.sort((a, b) => { + if (a.addedBorrowWeightBPS.eq(b.addedBorrowWeightBPS)) { + return comparePubkeys(b.borrowReserve, a.borrowReserve); + } else { + // Otherwise, sort by addedBorrowWeightBPS in descending order + return b.addedBorrowWeightBPS.cmp(a.addedBorrowWeightBPS); + } + }); +}; + +// use the bytes representation to compare two addresses +export const comparePubkeys = (a: PublicKey, b: PublicKey): number => { + const a_bytes = a.toBytes(); + const b_bytes = b.toBytes(); + + for (let i = 0; i < 32; i++) { + if (a_bytes[i] < b_bytes[i]) { + return -1; + } + if (a_bytes[i] > b_bytes[i]) { + return 1; + } + } + + return 0; +}; diff --git a/liquidator/src/liquidate.ts b/liquidator/src/liquidate.ts index 01e38df5..22b70197 100644 --- a/liquidator/src/liquidate.ts +++ b/liquidator/src/liquidate.ts @@ -8,10 +8,10 @@ import { } from '@solana/web3.js'; import dotenv from 'dotenv'; import { - getObligations, getReserves, getWalletBalances, getWalletDistTarget, getWalletTokenData, wait, + getObligations, getReserves, getWalletBalances, getWalletDistTarget, getWalletTokenData, sortBorrows, wait, } from 'libs/utils'; import { getTokensOracleData } from 'libs/pyth'; -import { calculateRefreshedObligation } from 'libs/refreshObligation'; +import { Borrow, calculateRefreshedObligation } from 'libs/refreshObligation'; import { readSecret } from 'libs/secret'; import { liquidateAndRedeem } from 'libs/actions/liquidateAndRedeem'; import { rebalanceWallet } from 'libs/rebalanceWallet'; @@ -75,12 +75,7 @@ async function runLiquidator() { } // select repay token that has the highest market value - let selectedBorrow; - borrows.forEach((borrow) => { - if (!selectedBorrow || borrow.marketValue.gt(selectedBorrow.marketValue)) { - selectedBorrow = borrow; - } - }); + let selectedBorrow: Borrow | undefined = sortBorrows(borrows)[0]; // select the withdrawal collateral token with the highest market value let selectedDeposit; From bf94e5a8fa7f4eb0977d5090ea2778c3ed9341c1 Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Mon, 7 Aug 2023 12:06:13 -0400 Subject: [PATCH 2/6] camelcase --- liquidator/src/libs/utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/liquidator/src/libs/utils.ts b/liquidator/src/libs/utils.ts index 65441aff..54f11a71 100644 --- a/liquidator/src/libs/utils.ts +++ b/liquidator/src/libs/utils.ts @@ -302,14 +302,14 @@ export const sortBorrows = (borrows: Borrow[]): Borrow[] => { // use the bytes representation to compare two addresses export const comparePubkeys = (a: PublicKey, b: PublicKey): number => { - const a_bytes = a.toBytes(); - const b_bytes = b.toBytes(); + const aBytes = a.toBytes(); + const bBytes = b.toBytes(); for (let i = 0; i < 32; i++) { - if (a_bytes[i] < b_bytes[i]) { + if (aBytes[i] < bBytes[i]) { return -1; } - if (a_bytes[i] > b_bytes[i]) { + if (aBytes[i] > bBytes[i]) { return 1; } } From 0e41b4e6c8518cb9bdc11d2783cc1fb9faffb772 Mon Sep 17 00:00:00 2001 From: legocactus <0xcactus@solend.fi> Date: Mon, 7 Aug 2023 10:05:43 -0700 Subject: [PATCH 3/6] fix build errors --- liquidator/.eslintrc.js | 2 +- liquidator/package.json | 13 +- liquidator/src/libs/rebalanceWallet.ts | 4 +- liquidator/src/libs/refreshObligation.ts | 2 +- liquidator/src/libs/unwrap/nazare/ggoldca.ts | 164 +++++++++---------- liquidator/src/liquidate.ts | 2 +- 6 files changed, 94 insertions(+), 93 deletions(-) diff --git a/liquidator/.eslintrc.js b/liquidator/.eslintrc.js index 508f4991..f27de97d 100644 --- a/liquidator/.eslintrc.js +++ b/liquidator/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = { root: true, parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], + plugins: ['@typescript-eslint', 'react', 'import'], extends: [ 'eslint:recommended', 'airbnb-typescript', diff --git a/liquidator/package.json b/liquidator/package.json index 5a0e1297..f8465b96 100644 --- a/liquidator/package.json +++ b/liquidator/package.json @@ -39,6 +39,7 @@ "bs58": "^4.0.1", "buffer-layout": "^1.2.1", "dotenv": "^10.0.0", + "eslint-config-airbnb": "^19.0.4", "ggoldca-sdk": "^0.0.17", "got": "^9.6.0", "hot-shots": "^8.5.0", @@ -53,12 +54,12 @@ "devDependencies": { "@types/jest": "^24.9.1", "@types/node": "^14.0.14", - "@typescript-eslint/eslint-plugin": "^3.10.1", - "@typescript-eslint/parser": "^3.10.1", - "eslint": "^5.16.0", + "@typescript-eslint/eslint-plugin": "^6.2.1", + "@typescript-eslint/parser": "^6.2.1", + "eslint": "^8.46.0", "eslint-config-airbnb-base": "^13.2.0", - "eslint-config-airbnb-typescript": "^8.0.2", - "eslint-plugin-import": "^2.18.2", + "eslint-config-airbnb-typescript": "^17.1.0", + "eslint-plugin-import": "^2.28.0", "eslint-plugin-jest": "^22.21.0", "eslint-plugin-jsx-a11y": "^6.3.1", "eslint-plugin-react": "^7.20.0", @@ -68,6 +69,6 @@ "nodemon": "^1.19.4", "supertest": "^4.0.2", "ts-jest": "^26.3.0", - "typescript": "^4.4.4" + "typescript": "^5.1.6" } } diff --git a/liquidator/src/libs/rebalanceWallet.ts b/liquidator/src/libs/rebalanceWallet.ts index d231ea0c..3dac6bbe 100644 --- a/liquidator/src/libs/rebalanceWallet.ts +++ b/liquidator/src/libs/rebalanceWallet.ts @@ -67,7 +67,7 @@ export async function rebalanceWallet(connection, payer, jupiter, tokensOracle, function aggregateInfo(tokensOracle, walletBalances, connection, wallet, target) { const info: any = []; target.forEach(async (tokenDistribution: TokenCount) => { - const { symbol, target } = tokenDistribution; + const { symbol, target: tokenTarget } = tokenDistribution; const tokenOracle = findWhere(tokensOracle, { symbol }); const walletBalance = findWhere(walletBalances, { symbol }); @@ -90,7 +90,7 @@ function aggregateInfo(tokensOracle, walletBalances, connection, wallet, target) const usdValue = new BigNumber(walletBalance.balance).multipliedBy(tokenOracle.price); info.push({ symbol, - target, + target: tokenTarget, mintAddress: tokenOracle.mintAddress, ata: walletBalance.ata?.toString(), balance: walletBalance.balance, diff --git a/liquidator/src/libs/refreshObligation.ts b/liquidator/src/libs/refreshObligation.ts index 5e78ab49..cb31837f 100644 --- a/liquidator/src/libs/refreshObligation.ts +++ b/liquidator/src/libs/refreshObligation.ts @@ -84,7 +84,7 @@ export function calculateRefreshedObligation( mintAddress, marketValue, symbol, - addedBorrowWeightBPS: reserve.config.addedBorrowWeightBPS + addedBorrowWeightBPS: reserve.config.addedBorrowWeightBPS, }); }); diff --git a/liquidator/src/libs/unwrap/nazare/ggoldca.ts b/liquidator/src/libs/unwrap/nazare/ggoldca.ts index 9137e18e..28b81a2c 100644 --- a/liquidator/src/libs/unwrap/nazare/ggoldca.ts +++ b/liquidator/src/libs/unwrap/nazare/ggoldca.ts @@ -64,7 +64,7 @@ export type Ggoldca = { 'name': 'rent', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { @@ -78,7 +78,7 @@ export type Ggoldca = { { 'name': 'minSlotsForReinvest', 'type': 'u64' - } + }, ] }, { @@ -93,13 +93,13 @@ export type Ggoldca = { 'name': 'vaultAccount', 'isMut': true, 'isSigner': false - } + }, ], 'args': [ { 'name': 'isPaused', 'type': 'bool' - } + }, ] }, { @@ -114,13 +114,13 @@ export type Ggoldca = { 'name': 'vaultAccount', 'isMut': true, 'isSigner': false - } + }, ], 'args': [ { 'name': 'isActive', 'type': 'bool' - } + }, ] }, { @@ -180,7 +180,7 @@ export type Ggoldca = { 'name': 'associatedTokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { @@ -194,7 +194,7 @@ export type Ggoldca = { { 'name': 'tickUpperIndex', 'type': 'i32' - } + }, ] }, { @@ -234,7 +234,7 @@ export type Ggoldca = { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [] }, @@ -265,7 +265,7 @@ export type Ggoldca = { 'name': 'destinationTokenAccount', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { @@ -273,7 +273,7 @@ export type Ggoldca = { 'type': { 'defined': 'MarketRewardsInfoInput' } - } + }, ] }, { @@ -288,13 +288,13 @@ export type Ggoldca = { 'name': 'vaultAccount', 'isMut': true, 'isSigner': false - } + }, ], 'args': [ { 'name': 'fee', 'type': 'u64' - } + }, ] }, { @@ -309,13 +309,13 @@ export type Ggoldca = { 'name': 'vaultAccount', 'isMut': true, 'isSigner': false - } + }, ], 'args': [ { 'name': 'minSlots', 'type': 'u64' - } + }, ] }, { @@ -383,7 +383,7 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { @@ -413,14 +413,14 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [] }, @@ -499,7 +499,7 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { @@ -516,7 +516,7 @@ export type Ggoldca = { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { @@ -530,7 +530,7 @@ export type Ggoldca = { { 'name': 'maxAmountB', 'type': 'u64' - } + }, ] }, { @@ -608,7 +608,7 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { @@ -625,7 +625,7 @@ export type Ggoldca = { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { @@ -639,7 +639,7 @@ export type Ggoldca = { { 'name': 'minAmountB', 'type': 'u64' - } + }, ] }, { @@ -712,14 +712,14 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [] }, @@ -778,20 +778,20 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { 'name': 'rewardIndex', 'type': 'u8' - } + }, ] }, { @@ -821,7 +821,7 @@ export type Ggoldca = { 'name': 'swapProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [] }, @@ -847,7 +847,7 @@ export type Ggoldca = { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [] }, @@ -916,7 +916,7 @@ export type Ggoldca = { 'name': 'tickArrayUpper', 'isMut': true, 'isSigner': false - } + }, ] }, { @@ -943,7 +943,7 @@ export type Ggoldca = { 'name': 'tokenProgram', 'isMut': false, 'isSigner': false - } + }, ], 'args': [] }, @@ -994,7 +994,7 @@ export type Ggoldca = { 'name': 'rent', 'isMut': false, 'isSigner': false - } + }, ], 'args': [ { @@ -1012,15 +1012,15 @@ export type Ggoldca = { { 'name': 'firstTime', 'type': 'bool' - } + }, ] - } + }, ], 'accounts': [ { 'name': 'vaultAccount', 'docs': [ - 'Strategy vault account' + 'Strategy vault account', ], 'type': { 'kind': 'struct', @@ -1028,35 +1028,35 @@ export type Ggoldca = { { 'name': 'version', 'docs': [ - 'Vault version' + 'Vault version', ], 'type': 'u8' }, { 'name': 'isActiveFromUi', 'docs': [ - 'The vault is active from the UI' + 'The vault is active from the UI', ], 'type': 'bool' }, { 'name': 'isPaused', 'docs': [ - 'The smart contract is paused for this vault' + 'The smart contract is paused for this vault', ], 'type': 'bool' }, { 'name': 'id', 'docs': [ - 'Vault number for a given whirlpool' + 'Vault number for a given whirlpool', ], 'type': 'u8' }, { 'name': 'bumps', 'docs': [ - 'PDA bump seeds' + 'PDA bump seeds', ], 'type': { 'defined': 'Bumps' @@ -1065,56 +1065,56 @@ export type Ggoldca = { { 'name': 'whirlpoolId', 'docs': [ - 'Whirlpool pubkey' + 'Whirlpool pubkey', ], 'type': 'publicKey' }, { 'name': 'inputTokenAMintPubkey', 'docs': [ - 'Pool input token_a mint address' + 'Pool input token_a mint address', ], 'type': 'publicKey' }, { 'name': 'inputTokenBMintPubkey', 'docs': [ - 'Pool input token_b mint address' + 'Pool input token_b mint address', ], 'type': 'publicKey' }, { 'name': 'fee', 'docs': [ - 'Fee percentage using FEE_SCALE. Fee applied on earnings' + 'Fee percentage using FEE_SCALE. Fee applied on earnings', ], 'type': 'u64' }, { 'name': 'minSlotsForReinvest', 'docs': [ - 'Minimum number of elapsed slots required for reinvesting' + 'Minimum number of elapsed slots required for reinvesting', ], 'type': 'u64' }, { 'name': 'lastReinvestmentSlot', 'docs': [ - 'Last reinvestment slot' + 'Last reinvestment slot', ], 'type': 'u64' }, { 'name': 'lastLiquidityIncrease', 'docs': [ - 'Last reinvestment liquidity increase' + 'Last reinvestment liquidity increase', ], 'type': 'u128' }, { 'name': 'earnedRewardsTokenA', 'docs': [ - 'Total rewards earned by the vault' + 'Total rewards earned by the vault', ], 'type': 'u64' }, @@ -1125,21 +1125,21 @@ export type Ggoldca = { { 'name': 'marketRewards', 'docs': [ - 'The market where to sell the rewards' + 'The market where to sell the rewards', ], 'type': { 'array': [ { 'defined': 'MarketRewardsInfo' }, - 3 + 3, ] } }, { 'name': 'positions', 'docs': [ - 'Information about the opened positions (max = MAX_POSITIONS)' + 'Information about the opened positions (max = MAX_POSITIONS)', ], 'type': { 'vec': { @@ -1150,18 +1150,18 @@ export type Ggoldca = { { 'name': 'padding', 'docs': [ - 'Additional padding' + 'Additional padding', ], 'type': { 'array': [ 'u64', - 10 + 10, ] } - } + }, ] } - } + }, ], 'types': [ { @@ -1172,7 +1172,7 @@ export type Ggoldca = { { 'name': 'id', 'docs': [ - 'Id of market associated' + 'Id of market associated', ], 'type': { 'defined': 'MarketRewards' @@ -1181,17 +1181,17 @@ export type Ggoldca = { { 'name': 'minAmountOut', 'docs': [ - 'Minimum number of lamports to receive during swap' + 'Minimum number of lamports to receive during swap', ], 'type': 'u64' - } + }, ] } }, { 'name': 'Bumps', 'docs': [ - 'PDA bump seeds' + 'PDA bump seeds', ], 'type': { 'kind': 'struct', @@ -1203,14 +1203,14 @@ export type Ggoldca = { { 'name': 'lpTokenMint', 'type': 'u8' - } + }, ] } }, { 'name': 'PositionInfo', 'docs': [ - 'Position information' + 'Position information', ], 'type': { 'kind': 'struct', @@ -1218,24 +1218,24 @@ export type Ggoldca = { { 'name': 'pubkey', 'docs': [ - 'Position pubkey' + 'Position pubkey', ], 'type': 'publicKey' }, { 'name': 'lowerTick', 'docs': [ - 'Position lower tick' + 'Position lower tick', ], 'type': 'i32' }, { 'name': 'upperTick', 'docs': [ - 'Position upper tick' + 'Position upper tick', ], 'type': 'i32' - } + }, ] } }, @@ -1247,7 +1247,7 @@ export type Ggoldca = { { 'name': 'id', 'docs': [ - 'Id of market associated' + 'Id of market associated', ], 'type': { 'defined': 'MarketRewards' @@ -1256,24 +1256,24 @@ export type Ggoldca = { { 'name': 'rewardsMint', 'docs': [ - 'Pubkey of the rewards token mint' + 'Pubkey of the rewards token mint', ], 'type': 'publicKey' }, { 'name': 'destinationTokenAccount', 'docs': [ - 'Destination account' + 'Destination account', ], 'type': 'publicKey' }, { 'name': 'minAmountOut', 'docs': [ - 'Minimum number of lamports to receive during swap' + 'Minimum number of lamports to receive during swap', ], 'type': 'u64' - } + }, ] } }, @@ -1293,10 +1293,10 @@ export type Ggoldca = { }, { 'name': 'Whirlpool' - } + }, ] } - } + }, ], 'events': [ { @@ -1326,7 +1326,7 @@ export type Ggoldca = { 'name': 'treasuryFeeTokenB', 'type': 'u64', 'index': false - } + }, ] }, { @@ -1346,7 +1346,7 @@ export type Ggoldca = { 'name': 'treasuryFee', 'type': 'u64', 'index': false - } + }, ] }, { @@ -1371,7 +1371,7 @@ export type Ggoldca = { 'name': 'liquidity', 'type': 'u128', 'index': false - } + }, ] }, { @@ -1391,7 +1391,7 @@ export type Ggoldca = { 'name': 'newLiquidity', 'type': 'u128', 'index': false - } + }, ] }, { @@ -1421,7 +1421,7 @@ export type Ggoldca = { 'name': 'elapsedSlots', 'type': 'u64', 'index': false - } + }, ] }, { @@ -1451,9 +1451,9 @@ export type Ggoldca = { 'name': 'amountOut', 'type': 'u64', 'index': false - } + }, ] - } + }, ], 'errors': [ { @@ -1610,7 +1610,7 @@ export type Ggoldca = { 'code': 6030, 'name': 'WhirlpoolLiquidityToDeltasOverflow', 'msg': 'whirlpool_cpi: Overflow while computing liquidity to token deltas' - } + }, ] }; diff --git a/liquidator/src/liquidate.ts b/liquidator/src/liquidate.ts index 22b70197..41c6722d 100644 --- a/liquidator/src/liquidate.ts +++ b/liquidator/src/liquidate.ts @@ -75,7 +75,7 @@ async function runLiquidator() { } // select repay token that has the highest market value - let selectedBorrow: Borrow | undefined = sortBorrows(borrows)[0]; + const selectedBorrow: Borrow | undefined = sortBorrows(borrows)[0]; // select the withdrawal collateral token with the highest market value let selectedDeposit; From d1ea0cf090bdb9550bba5c2a58226300a6d7b00a Mon Sep 17 00:00:00 2001 From: legocactus <0xcactus@solend.fi> Date: Mon, 7 Aug 2023 10:29:48 -0700 Subject: [PATCH 4/6] fix lint error --- liquidator/src/config.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/liquidator/src/config.ts b/liquidator/src/config.ts index 1cdf4ef4..dc445742 100644 --- a/liquidator/src/config.ts +++ b/liquidator/src/config.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-loop-func */ import got from 'got'; import { MarketConfig } from 'global'; import dotenv from 'dotenv'; @@ -35,10 +34,13 @@ export async function getMarkets(): Promise { const maxAttempt = 10; const marketUrl = getMarketsUrl(); - do { + // Function to wait for a certain amount of time + const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + + while (attemptCount < maxAttempt) { try { if (attemptCount > 0) { - await new Promise((resolve) => setTimeout(resolve, backoffFactor * 10)); + await wait(backoffFactor * 10); backoffFactor *= 2; } attemptCount += 1; @@ -48,7 +50,7 @@ export async function getMarkets(): Promise { } catch (error) { console.error('error fetching /v1/markets/configs ', error); } - } while (attemptCount < maxAttempt); + } throw new Error('failed to fetch /v1/markets/configs'); } From 95cb36440ab4394362fb789e538bb9a82d9d6d6f Mon Sep 17 00:00:00 2001 From: legocactus <0xcactus@solend.fi> Date: Mon, 7 Aug 2023 10:54:37 -0700 Subject: [PATCH 5/6] pin hubble deps --- liquidator/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/liquidator/package.json b/liquidator/package.json index f8465b96..a90d79e9 100644 --- a/liquidator/package.json +++ b/liquidator/package.json @@ -18,8 +18,8 @@ ], "license": "ISC", "dependencies": { - "@hubbleprotocol/hubble-config": "^1.0.127", - "@hubbleprotocol/kamino-sdk": "^1.0.131", + "@hubbleprotocol/hubble-config": "=1.0.127", + "@hubbleprotocol/kamino-sdk": "=1.0.131", "@jup-ag/core": "=1.0.0-beta.22", "@project-serum/anchor": "^0.25.0", "@project-serum/sol-wallet-adapter": "^0.2.0", From 976b6396fe4462356f4171e0865c4604f9dc36b4 Mon Sep 17 00:00:00 2001 From: 0xripleys <0xripleys@solend.fi> Date: Tue, 8 Aug 2023 01:38:24 -0400 Subject: [PATCH 6/6] mark lending market mutable --- .../LiquidateObligationAndRedeemReserveCollateral.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquidator/src/models/instructions/LiquidateObligationAndRedeemReserveCollateral.ts b/liquidator/src/models/instructions/LiquidateObligationAndRedeemReserveCollateral.ts index eee3d3b3..1d019ee0 100644 --- a/liquidator/src/models/instructions/LiquidateObligationAndRedeemReserveCollateral.ts +++ b/liquidator/src/models/instructions/LiquidateObligationAndRedeemReserveCollateral.ts @@ -76,7 +76,7 @@ export const LiquidateObligationAndRedeemReserveCollateral = ( { pubkey: withdrawReserveLiquiditySupply, isSigner: false, isWritable: true }, { pubkey: withdrawReserveFeeReceiver, isSigner: false, isWritable: true }, { pubkey: obligation, isSigner: false, isWritable: true }, - { pubkey: lendingMarket, isSigner: false, isWritable: false }, + { pubkey: lendingMarket, isSigner: false, isWritable: true }, { pubkey: lendingMarketAuthority, isSigner: false, isWritable: false }, { pubkey: transferAuthority, isSigner: true, isWritable: false }, { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },