Skip to content

Commit

Permalink
fix: add mainnet address and fix max amount (#101)
Browse files Browse the repository at this point in the history
* add mainnet address and fix max amount

* fix: change name to liquidateAll
  • Loading branch information
damarnez authored Feb 24, 2021
1 parent 53ee066 commit ca709b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/tx-builder/config/v2/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const commonContractAddressBetweenMarketsV2: CommonConfigType = {
FAUCET: '',
SWAP_COLLATERAL_ADAPTER: '0x63a3f444e97d14e671e7ee323c4234c8095e3516',
REPAY_WITH_COLLATERAL_ADAPTER: '0x498c5431eb517101582988fbb36431ddaac8f4b1',
FLASHLIQUIDATION: '',
FLASHLIQUIDATION: '0xE377fB98512D7b04827e56BC84e1838804a8019D',
},
};

Expand Down
9 changes: 5 additions & 4 deletions src/tx-builder/services/v2/LendingPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
API_ETH_MOCK_ADDRESS,
commonContractAddressBetweenMarketsV2,
DEFAULT_APPROVE_AMOUNT,
MAX_UINT_AMOUNT,
distinctContractAddressBetweenMarketsV2,
SURPLUS,
} from '../../config';
Expand Down Expand Up @@ -451,6 +452,7 @@ export default class LendingPool
collateralReserve,
purchaseAmount,
getAToken,
liquidateAll,
}: LPLiquidationCall
): Promise<EthereumTransactionTypeExtended[]> {
const txs: EthereumTransactionTypeExtended[] = [];
Expand Down Expand Up @@ -484,10 +486,9 @@ export default class LendingPool

const reserveDecimals: number = debtReserveInfo.decimals;

const convertedAmount: tStringDecimalUnits = parseNumber(
purchaseAmount,
reserveDecimals
);
const convertedAmount: tStringDecimalUnits = liquidateAll
? MAX_UINT_AMOUNT
: parseNumber(purchaseAmount, reserveDecimals);

const lendingPoolContract = this.getContractInstance(
this.lendingPoolAddress
Expand Down
1 change: 1 addition & 0 deletions src/tx-builder/types/LendingPoolMethodTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type LPLiquidationCall = {
collateralReserve: tEthereumAddress;
purchaseAmount: tStringCurrencyUnits;
getAToken?: boolean;
liquidateAll?: boolean;
};

export type LPSwapCollateral = {
Expand Down

0 comments on commit ca709b3

Please sign in to comment.