
In the simple casper contract, we use the as_wei_value() helper function. I was confused about ether being used as a param because it looks like a variable. So I started searching for instances of this variable, just to realize that you can use gwei or ether etc as a denomination unit.
I propose we take those as strings to make it clear that they're not declared variables within the contract. (i.e. "ether", "gwei" instead of ether, gwei)
(Spoke with @vbuterin and @DavidKnott about this, who seem to agree)
100% on using strings instead of keywords.
My suggestion in general for labels is to use strings, e.g. num("ether")
I think the "types are classes" solution could implement this quite easily:
type wei = num("wei")
type Kwei = 1e3 * wei
type Mwei = 1e3 * Kwei # = 1e6 * wei
...
type ether = 1e3 * finney # = 1e6 * szabo = ...
Which you could use in contracts like so:
fee: Gwei
price: ether
@payable
def buy():
# Implicit to '("wei") > (1e18 * "wei") + (1e9 * "wei")' behind the scenes
assert msg.value >= price + fee
# NOTE perhaps types >wei allow decimals up to X precision (based on their multiplier)?
...
Please note this is not current syntax, just an example of something we are discussing.
As_we_value Now takes a string, closing.
Most helpful comment
As_we_valueNow takes a string, closing.