ais a struct)
ais an array)
x < y ? x : y)
i++updates the value of
i). This is something that we want to avoid doing in a specification language.
i++), these are not allowed by Scribble.
old( expression )to get the value of
expressionas it was at the beginning of a transaction.
let <variable> := <expression> in <expression>
unpack()that returns three values: amount, sender and receiver.
balancevariable, and then we use it to compute and bind
halfBalance. Which we end up using to check
halfBalance >= amount.
let-binding variable inside of an
old()expression in the body of the let, as in the contrived example below:
tis bound to is implicitly computed after the original function was called, but we are attempting to use it in a computation that is executed before the original function was called. Since doing this requires time travel, we obviously cannot make it happen. The fix in such a scenario is to wrap the expression that
tis bound to in an
old()expression like so:
<expression> ==> <expression>
A ==> Bdescribes that
Bmust be true if
Ais true. If
Aisn't true, then it doesn't matter whether
Bis true or false. In natural language, you can usually describe an implication as:
If A, then also B.
unchecked_sum()builtin function. You can apply it to both numeric maps and arrays.
sum()to ensure that the sum of balances is equal to the
unchecked_sum()is always either
int256(depending on whether the underlying map/array is signed). While it may seem confusing that
int8, this was done on purpose, to minimize the chance of overflow when working with small integer types.