Skip to content

Commit

Permalink
ON-509: updateERC1155Balance returns Nft
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Oct 27, 2023
1 parent db6c15f commit 03c8059
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/entities/nft/erc-1155.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export function upsertERC1155Nft(tokenAddress: string, tokenId: BigInt, amount:
nft.type = NftType.ERC1155.toString()
}

updateERC1155Balance(findOrCreateAccount(from), findOrCreateAccount(to), nft, amount)

return nft
return updateERC1155Balance(findOrCreateAccount(from), findOrCreateAccount(to), nft, amount)
}

export function findOrCreateERC1155Nft(tokenAddress: string, tokenId: BigInt, to: Account): Nft {
Expand All @@ -40,7 +38,7 @@ export function findOrCreateERC1155Nft(tokenAddress: string, tokenId: BigInt, to
return nft
}

export function updateERC1155Balance(from: Account, to: Account, toNft: Nft, amount: BigInt): void {
export function updateERC1155Balance(from: Account, to: Account, toNft: Nft, amount: BigInt): Nft {
if (from.id != Address.zero().toHex()) {
const fromNft = findOrCreateERC1155Nft(toNft.tokenAddress, toNft.tokenId, from)

Expand All @@ -59,4 +57,6 @@ export function updateERC1155Balance(from: Account, to: Account, toNft: Nft, amo
else toNft.amount = toNft.amount!.plus(amount)
toNft.save()
}

return toNft
}

0 comments on commit 03c8059

Please sign in to comment.