getTokenDecimal function

int getTokenDecimal(
  1. TokenName token
)

getTokenDecimal returns the number decimals supported by the token

Implementation

int getTokenDecimal(TokenName token) {
  int tokenDecimals = 0;
  switch (token) {
    case TokenName.WMAS:
      tokenDecimals = 9;
      break;
    case TokenName.USDC:
      tokenDecimals = 6;
      break;
    case TokenName.WETH:
      tokenDecimals = 18;
      break;
    default:
      throw Exception("Unknown token name: ${token.name}");
  }
  return tokenDecimals;
}