Skip to content

Commit

Permalink
eliminated grace period from _prepareAuctionStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
EdNoepel committed Jan 9, 2024
1 parent 18d6457 commit 29b944c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/classes/Liquidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ export class Liquidation {
const kickTime = new Date(kickTimestampNumber * 1000);
const elapsedTime = currentTimestamp - kickTimestampNumber;

const isGracePeriod = elapsedTime < HOUR_TO_SECONDS;
const zero = constants.Zero;
const isTakeable = !isGracePeriod && collateral.gt(zero);
const isTakeable = collateral.gt(zero);
const isSettleable =
kickTimestampNumber > 0 && (elapsedTime >= HOUR_TO_SECONDS * 72 || collateral.eq(0));

Expand Down
5 changes: 2 additions & 3 deletions src/tests/erc20-pool-liquidations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ describe('ERC20 Liquidations', () => {
await submitAndVerifyTransaction(tx);
const liquidation = pool.getLiquidation(signerBorrower2.address);
let auctionStatus = await liquidation.getStatus();
expect(auctionStatus.isTakeable).toBeFalsy(); // in grace period

// wait 8 hours
const jumpTimeSeconds = 8 * 60 * 60; // 8 hours
Expand Down Expand Up @@ -298,7 +297,7 @@ describe('ERC20 Liquidations', () => {
let auctionStatus = await liquidation.getStatus();
let blockTime = await getBlockTime(signerLender);
expect(auctionStatus.kickTime.valueOf() / 1000).toBeLessThanOrEqual(blockTime);
expect(auctionStatus.isTakeable).toBe(false);
expect(auctionStatus.isTakeable).toBe(true);
expect(auctionStatus.isCollateralized).toBe(false);
expect(auctionStatus.isSettleable).toBe(false);

Expand Down Expand Up @@ -356,7 +355,7 @@ describe('ERC20 Liquidations', () => {
let auctionStatus = await liquidation.getStatus();
const blockTime = await getBlockTime(signerLender);
expect(auctionStatus.kickTime.valueOf() / 1000).toBeLessThanOrEqual(blockTime);
expect(auctionStatus.isTakeable).toBe(false);
expect(auctionStatus.isTakeable).toBe(true);
expect(auctionStatus.isCollateralized).toBe(false);
expect(auctionStatus.isSettleable).toBe(false);

Expand Down
6 changes: 2 additions & 4 deletions src/tests/erc721-pool-liquidations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ describe('ERC721 Liquidations', () => {
await submitAndVerifyTransaction(tx);
const liquidation = poolDuckDai.getLiquidation(signerBorrower2.address);
let auctionStatus = await liquidation.getStatus();
expect(auctionStatus.isTakeable).toBeFalsy(); // in grace period

// check auction status after kicking and before bucketTake
expect(auctionStatus.debtToCover.gt(toWad('3.5'))).toBeTruthy();
Expand Down Expand Up @@ -294,7 +293,6 @@ describe('ERC721 Liquidations', () => {
await submitAndVerifyTransaction(tx);
const liquidation = poolDuckDai.getLiquidation(signerBorrower2.address);
let auctionStatus = await liquidation.getStatus();
expect(auctionStatus.isTakeable).toBeFalsy(); // in grace period

// check auction status after kicking and before bucketTake
expect(auctionStatus.debtToCover.gt(toWad('3.5'))).toBeTruthy();
Expand Down Expand Up @@ -395,7 +393,7 @@ describe('ERC721 Liquidations', () => {
let auctionStatus = await liquidation.getStatus();
let blockTime = await getBlockTime(signerLender);
expect(auctionStatus.kickTime.valueOf() / 1000).toBeLessThanOrEqual(blockTime);
expect(auctionStatus.isTakeable).toBe(false);
expect(auctionStatus.isTakeable).toBe(true);
expect(auctionStatus.isCollateralized).toBe(false);
expect(auctionStatus.isSettleable).toBe(false);

Expand Down Expand Up @@ -453,7 +451,7 @@ describe('ERC721 Liquidations', () => {
let auctionStatus = await liquidation.getStatus();
const blockTime = await getBlockTime(signerLender);
expect(auctionStatus.kickTime.valueOf() / 1000).toBeLessThanOrEqual(blockTime);
expect(auctionStatus.isTakeable).toBe(false);
expect(auctionStatus.isTakeable).toBe(true);
expect(auctionStatus.isCollateralized).toBe(false);
expect(auctionStatus.isSettleable).toBe(false);

Expand Down
2 changes: 1 addition & 1 deletion src/types/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface AuctionStatus {
collateral: BigNumber;
/** remaining borrower debt to be covered */
debtToCover: BigNumber;
/** true if the grace period has elapsed and the auction has not expired */
/** true if collateral is available to be taken */
isTakeable: boolean;
/** helps determine if the liquidation may be settled */
isCollateralized: boolean;
Expand Down

0 comments on commit 29b944c

Please sign in to comment.