import { Arithmetic, Comparison, Frame, Host, Memory, Stack, Storage } from '@tevm/voltaire/evm';
const frame = Frame({
bytecode: new Uint8Array([0x5f, 0x60, 0x2a, 0x01]), // PUSH0, PUSH1 0x2a, ADD
gas: 100_000n,
});
const host = Host.createMemoryHost();
// Execute PUSH0 -> PUSH1 0x2a -> ADD
Stack.handler_0x5f_PUSH0(frame);
Stack.handler_0x60_PUSH1(frame);
Arithmetic.add(frame);
// Store top of stack into memory offset 0, then load back
Frame.pushStack(frame, 0n);
Memory.mstore(frame);
// Persist slot 0 = 42n via host
Frame.pushStack(frame, 42n);
Frame.pushStack(frame, 0n);
Storage.sstore(frame, host);
// Compare 42n == 42n
Frame.pushStack(frame, 42n);
Frame.pushStack(frame, 42n);
Comparison.EQ(frame);
console.log(Frame.popStack(frame).value); // 1n