Utils
- synthetix.utils.ether_to_wei(ether_value: float) int
Convert ether value to wei value:
>>> ether_to_wei(1.0) 1000000000000000000
- Parameters:
ether_value (float) – ether value to convert to wei
- Returns:
wei value
- Return type:
int
- synthetix.utils.format_ether(ether_value: float, decimals: int = 18) int
Format ether value with the specified decimals:
>>> format_ether(1.0, 6) 1000000
- Parameters:
ether_value (float) – ether value to convert
decimals (int) – number of decimals
- Returns:
wei value
- Return type:
int
- synthetix.utils.format_wei(wei_value: float, decimals: int = 18) int
Convert wei value with the specified decimals:
>>> format_wei(1000000, 6) 1.0
- Parameters:
wei_value (float) – wei value to convert
decimals (int) – number of decimals
- Returns:
ether value
- Return type:
int
- synthetix.utils.wei_to_ether(wei_value: int) float
Convert wei value to ether value:
>>> wei_to_ether(1000000000000000000) 1.0
- Parameters:
wei_value (int) – wei value to convert to ether
- Returns:
ether value
- Return type:
float