Returns if any token in a given ERC721 is held by a given address
Parameters
address
(address as hex string, default: 0x60f18213040f38645156fb99a5c23f81c7f295e1)- address for which we want to check holding status.
chain_id
(uint64, default: 1)token_address
(address as hex string, default: 0x45ebb5fe718f40052fb2dc2463c13717b7b72768)- The contract for which we want to check if any token is owned.
block_number
(uint64, default: 0)- Optional. Can be used to view holding status at a particular block. If unset, defaults to
0
and returns latest.
- Optional. Can be used to view holding status at a particular block. If unset, defaults to
Returns
isHolderOfContract
(bool)
Query
SELECT lower($address) IN(
SELECT b.owner
FROM @sim.erc721_owner_changes_block b
WHERE b.token_address = lower($token_address)
AND b.chain_id = $chain_id
AND b.block_number IN (
SELECT MAX(block_number) AS latest_block_number
FROM @sim.erc721_owner_changes_block
WHERE token_address = lower($token_address)
AND chain_id = $chain_id
AND (
block_number <= $block_number
OR $block_number = 0
)
GROUP BY token_id
)
)