import { BigNumberish } from '@ethersproject/bignumber' ; import { formatUnits } from '@ethersproject/units' ; import { Multicaller } from '../../utils' ; export const author = 'krotos-arch' ; export const version = '0.0.1' ; const abi = [ 'function balanceOfDToken(address _token, address _account) public returns (uint256 _balance)' ] ; export async function strategy ( space , network , provider , addresses , options , snapshot ) { const blockTag = typeof snapshot === 'number' ? snapshot : 'latest' ; const multi = new Multicaller ( network , provider , abi , { blockTag } ) ; addresses . forEach ( ( address ) => multi . call ( address , options . balanceOfAdds , 'balanceOfDToken' , [ options . token , address ] ) ) ; const result = await multi . execute ( ) ; return Object . fromEntries ( Object . entries ( result ) . map ( ( [ address , balance ] ) => [ address , parseFloat ( formatUnits ( balance , options . decimals ) ) ] ) ) ; }