github.com/DapperCollectives/CAST/backend@v0.0.0-20230921221157-1350c8be7c96/main/cadence/scripts/get_balance.cdc (about)

     1  // This script reads the balance field of an account's FlowToken Balance
     2  import FungibleToken from "FUNGIBLE_TOKEN_ADDRESS";
     3  pub fun main(path: PublicPath, account: Address): UFix64 {
     4  
     5      let vaultRef = getAccount(account)
     6          .getCapability(path)
     7          .borrow<&{FungibleToken.Balance}>()
     8          ?? panic("Could not borrow Balance reference to the Vault")
     9  
    10      return vaultRef.balance
    11  }
    12