Skip to content

set

Assign a value to a variable for use later in the script.

set <variable> <value>
Name Type Description
variable variable Variable name
value any Value to assign
# Set a simple value
set $amount 1e18
# Set a string
set $greeting "hello world"
# Set from a helper result
set $dai @token(DAI)
# Destructuring assignment
set [$a $b] ["hello" "world"]
# Skip values with _
set [_ $second] ["skip" "keep"]
# Nested destructuring
set [$a [_ $b]] ["x" ["skip" "y"]]
  • @get — read contract state into a variable
  • def — define reusable commands/helpers