Language Basics
EVMcrispr uses a custom DSL (domain-specific language) designed for writing EVM transaction scripts. This guide covers the core syntax.
Comments
Section titled “Comments”Lines starting with # are comments:
# This is a commentset $x 42 # Inline comments work tooCommands
Section titled “Commands”Commands are the primary building blocks. They produce transactions or control program flow. Each command starts with its name followed by arguments:
exec 0xAbC... "transfer(address,uint256)" @me 100e18set $greeting "hello"print "The value is" $xCommands from non-default modules use a prefix:
load aragonosaragonos:connect my-dao.aragonid.eth ( aragonos:grant @me voting CREATE_VOTES_ROLE)Helpers
Section titled “Helpers”Helpers are expressions that produce values. They are prefixed with @:
@me # No arguments@token(DAI) # Single argument@get(0xAbC... "balanceOf(address)(uint256)" @me) # Multiple argumentsHelpers can be nested and used as arguments to commands:
exec @token(DAI) "transfer(address,uint256)" @me @token.amount(DAI 100)Variables
Section titled “Variables”Use set to assign values and $name to reference them:
set $recipient 0x1234...set $amount @token.amount(DAI 1000)exec @token(DAI) "transfer(address,uint256)" $recipient $amountThe DSL supports these value types:
| Type | Example | Description |
|---|---|---|
address | 0xAbCd...1234 | 20-byte Ethereum address |
number | 42, 100e18, 1.5e6 | Integer or scientific notation |
string | "hello" | Quoted string |
bool | true, false | Boolean |
bytes | 0xdeadbeef | Hex-encoded bytes |
bytes32 | 0x00...001 | 32-byte value |
array | [1 2 3] | Ordered collection |
Numbers support scientific notation with e: 100e18 means 100 * 10^18.
This is useful for token amounts with 18 decimals.
Blocks
Section titled “Blocks”Some commands accept a block of sub-commands in parentheses:
batch ( exec 0xA... "foo()" exec 0xB... "bar()")
for $i in @range(0 5) ( print $i)
if @bool($x > 0) ( print "positive") else ( print "non-positive")ABI Signatures
Section titled “ABI Signatures”Contract function signatures follow Solidity syntax:
# Write functions (for exec)"transfer(address,uint256)""approve(address,uint256)"
# Read functions (for @get) — include (returnType) after inputs"balanceOf(address)(uint256)""name()(string)""getReserves()(uint112,uint112,uint32)"Modules
Section titled “Modules”The std module is loaded by default. Load additional modules with:
load aragonosload simload ensload httpAfter loading, use their commands and helpers with the module prefix:
load simsim:fork 1 ( sim:set-balance @me 100e18 exec 0xAbC... "foo()")Options
Section titled “Options”Some commands accept options with --name value:
exec 0xAbC... "foo()" --value 1e18exec 0xAbC... "foo()" --from 0x1234...
load aragonos --as daoEvent Captures
Section titled “Event Captures”The exec command can capture events emitted by the transaction:
exec 0xAbC... "createPool(address,uint24)" @token(DAI) 3000 -> Transfer [_ $pool]Arithmetic & Boolean Expressions
Section titled “Arithmetic & Boolean Expressions”Use @num() for arithmetic and @bool() for boolean logic:
set $total @num($a + $b * 2)set $isValid @bool($x > 0 and $y < 100)Control Flow
Section titled “Control Flow”# Conditionalif @bool($balance > 0) ( print "Has balance")
# Loop over arrayfor $item in @range(0 10) ( print $item)
# While loopset $i 0while @bool($i < 5) ( print $i set $i @num($i + 1))User-Defined Commands and Helpers
Section titled “User-Defined Commands and Helpers”Use def to define reusable commands and helpers:
# Define a helperdef @double "$x: number -> number" ( @num($x * 2))
# Define a commanddef transfer($token $to $amount) ( exec @token($token) "transfer(address,uint256)" $to @token.amount($token $amount))
# Use themset $result @double(21)transfer DAI 0x1234... 100