Units and Natural Units
Here, we cover how unit amounts are defined and calculated in WandX tokens. In the ERC20 standard, each token has a base unit that is defined by its
decimals property. For example, a WandX token’s
decimals is 18, meaning its base unit is
10 ** -18 of one WandX. Intuitively, it makes sense to tie a certain amount of a component‘s base unit to one WandX token to calculate the component allocation of the WandX. However, this becomes problematic when a component token has a significantly lower
decimals value than a WandX. Take for example Airswap (AST), which uses only 4 decimal places, this makes their token far less divisible. As a consequence, say we want to issue
10 ** 13 of a WandX that contains AST, there‘s a chance that the issuance would require transferring partial amounts of an AST base unit, which is not possible, and thus would leave the WandX token undercollateralized.
To combat this problem, instead of tying component base unit amounts to one WandX Token, we can tie the component base unit amounts to some quantity of WandX token base units. This is what the natural unit of a WandX is for: it defines the amount of WandX token base units to tie component token amounts to. In order to make this work there is a lower bound on what the natural unit can be, which is
10 ** (18 - minimumDecimal) where minimumDecimal is the lowest decimal value of the component tokens comprising the WandX. Furthermore in order to avoid rounding errors in issuance and redemption, all issue and redeem quantities must be multiples of the natural unit. For a more thorough treatment, including an example, see section 5.2.1 of our White Paper.