index | register | description |
---|---|---|
0x00 |
zero |
always zero |
0x01 |
one |
always one |
0x02 |
of |
contains overflow of arithmetic |
0x03 |
pc |
memory address of the current instruction |
0x04 |
ssp |
memory address of the stack start |
0x05 |
sp |
memory address of the current stack index |
0x06 |
fp |
memory address of the current call frame |
0x07 |
hp |
memory address of the end of the heap |
0x08 |
err |
error codes |
0x09 |
ggas |
gas avaiable globally |
0x0a |
cgas |
gas available in the context |
0x0b |
bal |
received balance for the context |
0x0c |
is |
start of the currently-executing code |
0x0d |
ret |
return value or pointer |
0x0e |
retl |
return value length,in bytes |
0x0f |
flag |
flags register |
syntax | behavior | notes |
---|---|---|
add c,a,b |
c = a + b |
|
addi c,a,imm |
c = a + imm |
|
sub c,a,b |
c = a - b |
|
subi c,a,imm |
c = a - imm |
|
mul c,a,b |
c = a * b |
|
muli c,a,imm |
c = a * imm |
|
div c,a,b |
c = a / b |
|
divi c,a,imm |
c = a / imm |
|
mod c,a,b |
c = a % b |
|
modi c,a,imm |
c = a % imm |
|
exp c,a,b |
c = a ** b |
|
exp c,a,imm |
c = a ** imm |
|
mroo c,a,b |
c = math.floor(math.root(a,b)) |
|
mlog c,a,b |
c = math.floor(math.log(a,b)) |
|
move a,b |
a = b |
|
movi a,imm |
a = imm |
syntax | behavior | notes |
---|---|---|
eq c,a,b |
c = a == b |
|
gt c,a,b |
c = a > b |
|
lt c,a,b |
c = a < b |
|
and c,a,b |
c = a & b |
|
andi c,a,imm |
c = a & imm |
|
noop |
no operation | |
not b,a |
b = ~a |
|
or c,a,b |
c = a | b |
|
ori c,a,imm |
c = a | imm |
|
sll c,a,b |
c = a << b |
|
slli c,a,imm |
c = a << imm |
|
srl c,a,b |
c = a >> b |
|
srli c,a,imm |
c = a >> imm |
|
xor c,a,b |
c = a ^ b |
|
xori c,a,imm |
c = a ^ imm |
syntax | behavior | notes |
---|---|---|
jmp a |
pc = is+a |
jumps to a |
ji imm |
pc = is+imm*4 |
jumps to constant |
jne a b c |
pc = a != b ? is+c*4 : pc+4 |
jump to c if a != b |
jnei a b imm |
pc = a != b ? is+imm*4 : pc+4 |
jump to imm if a != b |
jnzi a imm |
pc = a != 0 ? is+imm*4 : pc+4 |
jump to imm if a != 0 |
ret a |
return a |
return from context with a |
syntax | behavior | notes |
---|---|---|
alloc a |
hp -= a |
allocate a bytes from heap |
cfei imm |
sp += imm |
extend call frame by imm |
cfsi imm |
sp -= imm |
shrink call frame by imm |
lb a,b,imm |
a = mem[b+imm,1] |
load byte from memory at b + imm |
lw a,b,imm |
a = mem[b+(imm*8),8] |
load word from memory at b + imm |
mcl a,b |
mem[a,b] = 0 |
clears b bytes of memory at offset a |
mcli a,imm |
mem[a,imm] = 0 |
clear imm bytes of memory at offset a |
mcp a,b,c |
mem[a,c] = mem[b,c] |
copy c bytes of memory from b to a |
mcpi a,b,imm |
mem[a,imm] = mem[b,imm] |
copy imm bytes of memory from b to a |
meq a,b,c,d |
a = mem[b,d] == mem[c,d] |
true if d bytes of memory at b and c match |
sb a,b,imm |
mem[a+imm,1] = b[7,1] |
stores rightmost byte of b at a + imm |
sw a,b,imm |
mem[a+(imm*8),8] = b |
stores word, b , at a + imm |
syntax | behavior | notes |
---|---|---|
bal a,b,c |
a = bal(mem[b,32],mem[c,32]) |
get balance of account c given asset id b |
bhei a |
a = blockheight |
get fuel block height |
bhsh a b |
mem[a,32] = blockhash(b) |
store in memory at a the hash of block b |
burn a |
burn(a) |
burn a amount of the contract's asset ID |
call a,b,c,d |
call(a,b,c,d) |
call w data at a , b amount of c asset and d gas |
cb a |
mem[a,32] = coinbase |
store coinbase account in memory at a |
cpp a,b,c,d |
mem[a,d] = code(b,c,d) |
copy d bytes of contract b at c to a |
croo a,b |
mem[a,32] = coderoot(mem[b,32]) |
copy code merkle root of contract at b |
csiz a,b |
a = codesize(mem[b,32]) |
get code size of contract at b |
ldc a,b,c |
mem[ssp,c] = code(a,b,c) |
copy c bytes from contract b at a to execute |
log a,b,c,d |
log(a,b,c,d) |
log event with topics a , b , c , and d |
logd a,b,c,d |
logd(a,b,c,d) |
log event with topics a and b with d bytes at c |
mint a |
mint(a) |
mint a amount of the contract's asset ID |
retd |
returndata(a,b) |
return b bytes from a to the context's caller |
rvrt a |
revert(a) |
halt execution, revert state changes, return a |
smo a,b,c,d |
msg(mem[fp,32],mem[a,32],mem[a+32,b],d,c) |
send msg to recipient address |
scwq a,b,c |
state[mem[a,32],32*c] = None |
clear c slots of storage from a |
srw a,b,c |
a = state[mem[c,32]][0,8] |
read from state at c into a |
srwq a,b,c,d |
mem[a,32*d] = state[mem[c,32*d]] |
read d slots of state into a |
sww a,b,c |
state[mem[a,32]] = (rc,0) |
write c to slot at a |
swwq a,b,c,d |
state[mem[a,32],32*d] = mem[c,32*d] |
write d slots from c to a |
time a,b |
a = time(b) |
get timestamp of block b |
tr a,b,c |
transfer(mem[a,32],b,mem[c,32]) |
transfer b amount of asset c to a |
tro a,b,c,d |
transferout(mem[a,32],b,c,mem[d,32]) |
transfer c amount of d to address a w output b |
syntax | behavior | notes |
---|---|---|
ecr a,b,c |
mem[a,32] = ecrecover(mem[b,64],mem[c,32]) |
ec recover from b , b+1 , c |
k256 a,b,c |
mem[a,32] = keccak256(mem[b,c]) |
hash c bytes from b into a |
s256 a,b,c |
mem[a,32] = sha256(mem[b,c]) |
hash c bytes from b into a |
syntax | behavior | notes |
---|---|---|
flag a |
flag = a |
set flag |
gm a,imm |
get metadata from memory | |
gtf a,b,imm |
get fields from the transaction |
├── contract_a
│ ├── key : value
│ ├── key : value
│ └── key : value
│
└── contract_b
├── key : value
└── key : value