import { formatUnits } from '@ethersproject/units' ; import { multicall } from '../../utils' ; export const author = 'dave4506' ; export const version = '0.1.0' ; const abi = [ { inputs : [ { internalType : 'address' , name : 'owner' , type : 'address' } , { internalType : 'uint256' , name : 'id' , type : 'uint256' } ] , name : 'balanceOf' , outputs : [ { internalType : 'uint256' , name : '' , type : 'uint256' } ] , stateMutability : 'view' , type : 'function' } ] ; export async function strategy ( space , network , provider , addresses , options , snapshot ) { const blockTag = typeof snapshot === 'number' ? snapshot : 'latest' ; const response = await multicall ( network , provider , abi , addresses . map ( ( address ) => [ options . address , 'balanceOf' , [ address , options . tokenId ] ] ) , { blockTag } ) ; return Object . fromEntries ( response . map ( ( value , i ) => [ addresses [ i ] , parseFloat ( formatUnits ( value . toString ( ) , options . decimals ) ) ] ) ) ; }