Skip to content

Commit

Permalink
moar logging
Browse files Browse the repository at this point in the history
  • Loading branch information
EdNoepel committed Sep 11, 2023
1 parent 0b52a4f commit 3054adc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/mappings/base/base-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,10 @@ export function _handleBucketBankruptcy(event: ethereum.Event, index: BigInt, lp
}

// iterate through all bucket positionLends and set positionLend.lpb to zero
log.info("_handleBucketBankruptcy bucket has {} positionLends", [bucket.positionLends.length.toString()])
for (let i = 0; i < bucket.positionLends.length; i++) {
const positionLendId = bucket.positionLends[i]
log.info("_handleBucketBankruptcy loading positionLend {}", [positionLendId.toHexString()])
const positionLend = PositionLend.load(positionLendId)!
positionLend.lpb = ZERO_BD
log.info("_handleBucketBankruptcy calling saveOrRemovePositionLend for token {}", [positionLend.tokenId.toString()])
Expand Down
3 changes: 1 addition & 2 deletions src/utils/pool/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ export function updateBucket(bucket: Bucket, bucketInfo: BucketInfo): void {
}

export function updateBucketLends(bucket: Bucket, lend: Lend): void {
const lends = bucket.lends
// get current index of lend in bucket's list of lends
const index = lends.indexOf(lend.id)
const index = bucket.lends.indexOf(lend.id)
if (lend.lpb != ZERO_BD && index == -1) {
bucket.lends = bucket.lends.concat([lend.id])
} else if (lend.lpb == ZERO_BD && index != -1) {
Expand Down

0 comments on commit 3054adc

Please sign in to comment.