From 9d7510694c7336b0ff7ea82349118b7545de8b36 Mon Sep 17 00:00:00 2001 From: Mike Hathaway Date: Wed, 27 Sep 2023 12:00:27 -0400 Subject: [PATCH 1/2] fit typo; make addressToBytes consistent in lpb management (#72) --- src/mappings/base/base-pool.ts | 8 ++++---- src/utils/pool/lp-transferors.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mappings/base/base-pool.ts b/src/mappings/base/base-pool.ts index edcf82b..180deb6 100644 --- a/src/mappings/base/base-pool.ts +++ b/src/mappings/base/base-pool.ts @@ -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" @@ -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)! @@ -559,7 +559,7 @@ 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)! @@ -567,7 +567,7 @@ export function _handleRevokeLPTransferors(event: ethereum.Event, lender: Addres // save entities to the store pool.save() - saveOrRemoveTranserors(lpTransferorList) + saveOrRemoveTransferors(lpTransferorList) } /**********************************/ diff --git a/src/utils/pool/lp-transferors.ts b/src/utils/pool/lp-transferors.ts index f2f9e44..5554496 100644 --- a/src/utils/pool/lp-transferors.ts +++ b/src/utils/pool/lp-transferors.ts @@ -33,7 +33,7 @@ export function revokeTransferors(entity: LPTransferorList, transferorsRevoked: // iterate through, removing each revoked transferor const entityTransferors = entity.transferors for (var i=0; i Date: Thu, 5 Oct 2023 15:34:46 -0400 Subject: [PATCH 2/2] Fix merge collateral (#73) * assign pool in mergeOrRemove entity * remove calldata logging --- src/mappings/erc-721-pool.ts | 1 + tests/erc-721-pool.test.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/mappings/erc-721-pool.ts b/src/mappings/erc-721-pool.ts index ab2ec73..c595f9b 100644 --- a/src/mappings/erc-721-pool.ts +++ b/src/mappings/erc-721-pool.ts @@ -405,6 +405,7 @@ export function handleMergeOrRemoveCollateralNFT( pool.bucketTokenIds = findAndRemoveTokenIds(tokenIdsToRemove, pool.bucketTokenIds) } + mergeOrRemove.pool = pool.id updateAccountPools(account, pool) // save entities to store diff --git a/tests/erc-721-pool.test.ts b/tests/erc-721-pool.test.ts index 786fcdf..fb9559e 100644 --- a/tests/erc-721-pool.test.ts +++ b/tests/erc-721-pool.test.ts @@ -1634,6 +1634,7 @@ describe("Describe entity assertions", () => { }) // TODO: finish implementing once a mergeOrRemoveCollateralNFT calldata becomes available + // example mergeOrRemoveCollateral event.transaction.input: 0x47f6fe64000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000b7500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000b750000000000000000000000000000000000000000000000000000000000000b740000000000000000000000000000000000000000000000000000000000000b730000000000000000000000000000000000000000000000000000000000000b72, test("MergeOrRemoveCollateralNFT", () => { // check entity is unavailable prior to storage assert.entityCount("MergeOrRemoveCollateralNFT", 0)