Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fit typo; make addressToBytes consistent in lpb management #72

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading