Skip to content

Commit

Permalink
Add balance opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelBilbao committed Apr 10, 2024
1 parent f45e50c commit c515c76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions system-contracts/contracts/EvmInterpreter.yul
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,17 @@ object "EVMInterpreter" {

evmGasLeft := chargeGas(evmGasLeft, 2)
}
case 0x31 { // OP_BALANCE
printHex(balance(address()))
let addr

addr, sp := popStackItem(sp)

sp := pushStackItem(sp, balance(addr))

// TODO: Handle cold/warm slots and updates, etc for gas costs.
evmGasLeft := chargeGas(evmGasLeft, 100)
}
// NOTE: We don't currently do full jumpdest validation
// (i.e. validating a jumpdest isn't in PUSH data)
case 0x56 { // OP_JUMP
Expand Down

0 comments on commit c515c76

Please sign in to comment.