getTokenAddress function
getTokenAddress returns the token address
Implementation
String getTokenAddress(TokenName token, bool isBuildnet) {
String tokenAddress = '';
switch (token) {
case TokenName.WMAS:
tokenAddress = isBuildnet ? BuildnetConstants.wmasAddress : MainnetConstants.wmasAddress;
break;
case TokenName.USDC:
tokenAddress = isBuildnet ? BuildnetConstants.usdcAddress : MainnetConstants.usdcAddress;
break;
case TokenName.WETH:
tokenAddress = isBuildnet ? BuildnetConstants.wethAddress : MainnetConstants.wethAddress;
break;
default:
throw Exception("Unknown token name: ${token.name}");
}
return tokenAddress;
}