Skip to content

Commit

Permalink
serialize protocol liquidation fee as deca bps
Browse files Browse the repository at this point in the history
  • Loading branch information
0xodia committed Nov 21, 2023
1 parent 4895a1b commit adeb3a8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ export default function TransactionTakeover() {
setValue={setValue}
onSubmit={() => {
if (publicKey && selectedReserve && selectedPool) {
const useMax = selectedObligation?.borrows
?.find((b) => b.reserveAddress === selectedReserve.address)
?.amount.isGreaterThanOrEqualTo(new BigNumber(value));
const useMax = new BigNumber(value).isGreaterThanOrEqualTo(
repayMax,
);

return repayConfigs.action(
useMax
Expand Down
5 changes: 1 addition & 4 deletions solend-lite/src/stores/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ import { ENVIRONMENT, DEBUG_MODE } from 'common/config';
export const configAtom = atom(async (get) => {
const connection = get(connectionAtom);

const a = await fetchPoolMetadata(connection, ENVIRONMENT, true, DEBUG_MODE);

console.log(a);
return a;
return fetchPoolMetadata(connection, ENVIRONMENT, true, DEBUG_MODE);
});
2 changes: 1 addition & 1 deletion solend-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solendprotocol/solend-sdk",
"version": "0.6.48",
"version": "0.6.50",
"private": true,
"main": "src/index.ts",
"module": "src/index.ts",
Expand Down
17 changes: 10 additions & 7 deletions solend-sdk/src/core/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,25 @@ export async function fetchPoolMetadata(
address: string;
owner: string;
authorityAddress: string;
reserves: Array<{liquidityToken: {
name: string,
logo: string,
mint: string,
}, address: string}>;
reserves: Array<{
liquidityToken: {
name: string;
logo: string;
mint: string;
};
address: string;
}>;
}) => ({
name: titleCase(c.name),
owner: c.owner,
address: c.address,
authorityAddress: c.authorityAddress,
reserves: c.reserves.map(r => ({
reserves: c.reserves.map((r) => ({
name: r.liquidityToken.name,
logo: r.liquidityToken.logo,
mintAddress: r.liquidityToken.mint,
address: r.address,
}))
})),
})
);
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions solend-sdk/src/instructions/updateReserveConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ export const updateReserveConfig = (
minBorrowRate: reserveConfig.minBorrowRate,
optimalBorrowRate: reserveConfig.optimalBorrowRate,
maxBorrowRate: reserveConfig.maxBorrowRate,
superMaxBorrowRate: reserveConfig.superMaxBorrowRate,
borrowFeeWad: reserveConfig.fees.borrowFeeWad,
flashLoanFeeWad: reserveConfig.fees.flashLoanFeeWad,
hostFeePercentage: reserveConfig.fees.hostFeePercentage,
depositLimit: reserveConfig.depositLimit,
borrowLimit: reserveConfig.borrowLimit,
feeReceiver: reserveConfig.feeReceiver,
superMaxBorrowRate: reserveConfig.superMaxBorrowRate,
protocolLiquidationFee: reserveConfig.protocolLiquidationFee,
protocolLiquidationFee: reserveConfig.protocolLiquidationFee * 10,
protocolTakeRate: reserveConfig.protocolTakeRate,
addedBorrowWeightBPS: reserveConfig.addedBorrowWeightBPS,
reserveType: reserveConfig.reserveType,
Expand Down

0 comments on commit adeb3a8

Please sign in to comment.