getPercentOfTotalSupply static method

String getPercentOfTotalSupply(
  1. BigInt amount
)

Return percentage of total supploy @param amount 10020243004141 @return 0.0000001%

Implementation

static String getPercentOfTotalSupply(BigInt amount) {
  Decimal totalSupply =
      Decimal.parse('133248290000000000000000000000000000000');
  Decimal amountRaw = Decimal.parse(amount.toString());
  return ((amountRaw / totalSupply) * Decimal.fromInt(100))
      .toStringAsFixed(4);
}