Skip to content

Commit

Permalink
fit typo; make addressToBytes consistent in lpb management (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeHathaway authored Sep 27, 2023
1 parent f0727d8 commit 9d75106
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/mappings/base/base-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { incrementTokenTxCount as incrementTokenTxCountERC721Pool } from "../../
import { loadOrCreateReserveAuction, reserveAuctionKickerReward } from "../../utils/pool/reserve-auction"
import { saveOrRemovePositionLend } from "../../utils/position"
import { decreaseAllowances, increaseAllowances, loadOrCreateAllowances, revokeAllowances, saveOrRemoveAllowances } from "../../utils/pool/lp-allowances"
import { approveTransferors, loadOrCreateTransferors, revokeTransferors, saveOrRemoveTranserors } from "../../utils/pool/lp-transferors"
import { approveTransferors, loadOrCreateTransferors, revokeTransferors, saveOrRemoveTransferors } from "../../utils/pool/lp-transferors"
import { loadOrCreateBucketTake } from "../../utils/pool/liquidation"


Expand Down Expand Up @@ -546,7 +546,7 @@ export function _handleIncreaseLPAllowance(event: ethereum.Event, owner: Address

export function _handleRevokeLPAllowance(event: ethereum.Event, owner: Address, spender: Address, indexes: BigInt[]): void {
const poolId = addressToBytes(event.address)
const lpAllowanceList = loadOrCreateAllowances(poolId, owner, spender)
const lpAllowanceList = loadOrCreateAllowances(poolId, addressToBytes(owner), addressToBytes(spender))
revokeAllowances(lpAllowanceList, indexes)

const pool = Pool.load(poolId)!
Expand All @@ -559,15 +559,15 @@ export function _handleRevokeLPAllowance(event: ethereum.Event, owner: Address,

export function _handleRevokeLPTransferors(event: ethereum.Event, lender: Address, transferors: Address[]): void {
const poolId = addressToBytes(event.address)
const lpTransferorList = loadOrCreateTransferors(poolId, lender)
const lpTransferorList = loadOrCreateTransferors(poolId, addressToBytes(lender))
revokeTransferors(lpTransferorList, transferors)

const pool = Pool.load(poolId)!
pool.txCount = pool.txCount.plus(ONE_BI)

// save entities to the store
pool.save()
saveOrRemoveTranserors(lpTransferorList)
saveOrRemoveTransferors(lpTransferorList)
}

/**********************************/
Expand Down
4 changes: 2 additions & 2 deletions src/utils/pool/lp-transferors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ export function revokeTransferors(entity: LPTransferorList, transferorsRevoked:
// iterate through, removing each revoked transferor
const entityTransferors = entity.transferors
for (var i=0; i<transferorsRevoked.length; ++i) {
const revoked = transferorsRevoked[i]
const revoked = addressToBytes(transferorsRevoked[i])
const indexToRemove = entityTransferors.indexOf(revoked)
if (indexToRemove != -1)
entityTransferors.splice(indexToRemove, 1)
}
entity.transferors = entityTransferors
}

export function saveOrRemoveTranserors(entity: LPTransferorList): void {
export function saveOrRemoveTransferors(entity: LPTransferorList): void {
if (entity.transferors.length == 0) {
store.remove('LPTransferorList', entity.id.toHexString())
} else {
Expand Down

0 comments on commit 9d75106

Please sign in to comment.