danhper / eclair

A Solidity interpreter
https://eclair.so
MIT License
55 stars 1 forks source link

Add a `mul` function to multiply two numbers taking into account decimal scale #4

Closed chase-manning closed 5 months ago

chase-manning commented 5 months ago

E.g. vault.totalSupply().mul(vault.exchangeRate()) with the output value still in 18 decimals. So would output the same as vault.totalSupply() * vault.exchangeRate() / 1e18

danhper commented 5 months ago

Added mul and div. They both accept a decimal multiplier as a second argument (optional, defaults to 18)