From 346908775a1e4cb7b9bde657c0effd07b794ad9f Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Wed, 8 May 2019 16:06:02 +0200 Subject: [PATCH] Annotate op handlers with type --- lib/evm/opFns.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/evm/opFns.ts b/lib/evm/opFns.ts index 40fb3ad712..faca3d16e9 100644 --- a/lib/evm/opFns.ts +++ b/lib/evm/opFns.ts @@ -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 +} + +export type OpHandler = SyncOpHandler | AsyncOpHandler + // the opcode functions -module.exports = { +export const handlers: {[k: string]: OpHandler} = { STOP: function (runState: RunState) { runState.stopped = true },