Skip to content

Commit

Permalink
Annotate op handlers with type
Browse files Browse the repository at this point in the history
  • Loading branch information
s1na committed May 8, 2019
1 parent 26a8c99 commit 3469087
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/evm/opFns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,18 @@ function addressToBuffer (address: BN) {
return address.and(MASK_160).toArrayLike(Buffer, 'be', 20)
}

export interface SyncOpHandler {
(runState: RunState): void
}

export interface AsyncOpHandler {
(runState: RunState): Promise<void>
}

export type OpHandler = SyncOpHandler | AsyncOpHandler

// the opcode functions
module.exports = {
export const handlers: {[k: string]: OpHandler} = {
STOP: function (runState: RunState) {
runState.stopped = true
},
Expand Down

0 comments on commit 3469087

Please sign in to comment.