(tokenAddress: Address)
| 253 | } |
| 254 | |
| 255 | export function fetchTokenDecimals(tokenAddress: Address): BigInt { |
| 256 | let staticToken = StaticToken.fromAddress(tokenAddress); |
| 257 | if (staticToken != null) { |
| 258 | return (staticToken as StaticToken).decimals; |
| 259 | } |
| 260 | let contract = ERC20.bind(tokenAddress); |
| 261 | // try types uint8 for decimals |
| 262 | let decimalValue = null; |
| 263 | let decimalResult = contract.try_decimals(); |
| 264 | if (!decimalResult.reverted) { |
| 265 | decimalValue = decimalResult.value; |
| 266 | } |
| 267 | return BigInt.fromI32(decimalValue as i32); |
| 268 | } |
| 269 | |
| 270 | function isNullEthValue(value: string): boolean { |
| 271 | return value == ZERO_ADDRESS; |
no test coverage detected