Continuando con la construcción del bytecode básico

Clase 14 de 32Curso de Manejo de la Ethereum Virtual Machine

Resumen

Código del ejercicio:

// Load CALLDATA to memory
CALLDATASIZE
PUSH1 0x00
CALLDATASIZE
PUSH1 0x20
SUB
CALLDATACOPY

// Define JUMPDEST and push to stack
JUMPDEST
PUSH1 0x03
PC
SUB

// Load memory to stack
PUSH1 0x00
MLOAD

// Substract 1 and save to memory
PUSH1 0x01
SWAP1
SUB
DUP1
PUSH1 0x00
MSTORE

// Save to memory and JUMP back if value is not 0
PUSH1 0x0
LT
SWAP1
JUMPI