Class Contract

Hierarchy

  • Contract

Constructors

  • Parameters

    • bytecode: string | Uint8Array | ArrayLike<number>

      the bytecode to analyze in hexadecimal format.

    • step: Undef<"ADDMOD" | "MULMOD" | "SIGNEXTEND" | "EQ" | "ISZERO" | "NOT" | "BYTE" | "COINBASE" | "TIMESTAMP" | "NUMBER" | "DIFFICULTY" | "GASLIMIT" | "CALLER" | "CALLDATASIZE" | "ORIGIN" | "GASPRICE" | "ADDRESS" | "CODESIZE" | "RETURNDATASIZE" | "GAS" | "CALLVALUE" | "CALLDATALOAD" | "CALLDATACOPY" | "CODECOPY" | "EXTCODECOPY" | "RETURNDATACOPY" | "SLOAD" | "SSTORE" | "POP" | "PUSH2" | "PUSH1" | "PUSH16" | "PUSH3" | "PUSH8" | "PUSH9" | "PUSH11" | "PUSH20" | "PUSH21" | "PUSH25" | "PUSH26" | "PUSH5" | "PUSH32" | "PUSH4" | "PUSH6" | "PUSH7" | "PUSH10" | "PUSH12" | "PUSH13" | "PUSH14" | "PUSH15" | "PUSH24" | "PUSH17" | "PUSH18" | "PUSH19" | "PUSH22" | "PUSH23" | "PUSH27" | "PUSH28" | "PUSH29" | "PUSH30" | "PUSH31" | "DUP2" | "DUP1" | "DUP16" | "DUP3" | "DUP8" | "DUP9" | "DUP11" | "DUP5" | "DUP4" | "DUP6" | "DUP7" | "DUP10" | "DUP12" | "DUP13" | "DUP14" | "DUP15" | "SWAP2" | "SWAP1" | "SWAP16" | "SWAP3" | "SWAP8" | "SWAP9" | "SWAP11" | "SWAP5" | "SWAP4" | "SWAP6" | "SWAP7" | "SWAP10" | "SWAP12" | "SWAP13" | "SWAP14" | "SWAP15" | "ADD" | "MUL" | "SUB" | "DIV" | "SDIV" | "MOD" | "SMOD" | "EXP" | "LT" | "GT" | "SLT" | "SGT" | "AND" | "OR" | "XOR" | "PC" | "BALANCE" | "EXTCODESIZE" | "EXTCODEHASH" | "BLOCKHASH" | "MLOAD" | "MSTORE" | "MSTORE8" | "MSIZE" | "SHA3" | "STOP" | "CREATE" | "CALL" | "CALLCODE" | "RETURN" | "DELEGATECALL" | "STATICCALL" | "REVERT" | "SELFDESTRUCT" | "INVALID" | "LOG0" | "LOG2" | "LOG1" | "LOG3" | "LOG4" | "JUMPDEST" | "JUMP" | "JUMPI" | "SHL" | "SHR" | "SAR" | "CREATE2" | "CHAINID" | "SELFBALANCE" | "PREVRANDAO" | "BASEFEE" | "PUSH0"> & {
          ADD: ((__namedParameters) => void);
          ADDMOD: ((__namedParameters) => void);
          ADDRESS: ((__namedParameters) => void);
          AND: ((__namedParameters) => void);
          BALANCE: ((__namedParameters) => void);
          BASEFEE: ((__namedParameters) => void);
          BLOCKHASH: ((__namedParameters) => void);
          BYTE: ((__namedParameters) => void);
          CALL: ((__namedParameters) => void);
          CALLCODE: ((__namedParameters) => void);
          CALLDATACOPY: ((state) => void);
          CALLDATALOAD: ((__namedParameters) => void);
          CALLDATASIZE: ((__namedParameters) => void);
          CALLER: ((__namedParameters) => void);
          CALLVALUE: ((__namedParameters) => void);
          CHAINID: ((__namedParameters) => void);
          CODECOPY: ((__namedParameters, _opcode, __namedParameters) => void);
          CODESIZE: ((__namedParameters) => void);
          COINBASE: ((__namedParameters) => void);
          CREATE: ((__namedParameters) => void);
          CREATE2: ((__namedParameters) => void);
          DELEGATECALL: ((__namedParameters) => void);
          DIFFICULTY: ((__namedParameters) => void);
          DIV: ((__namedParameters) => void);
          DUP1: ((state) => void);
          DUP10: ((state) => void);
          DUP11: ((state) => void);
          DUP12: ((state) => void);
          DUP13: ((state) => void);
          DUP14: ((state) => void);
          DUP15: ((state) => void);
          DUP16: ((state) => void);
          DUP2: ((state) => void);
          DUP3: ((state) => void);
          DUP4: ((state) => void);
          DUP5: ((state) => void);
          DUP6: ((state) => void);
          DUP7: ((state) => void);
          DUP8: ((state) => void);
          DUP9: ((state) => void);
          EQ: ((__namedParameters) => void);
          EXP: ((__namedParameters) => void);
          EXTCODECOPY: ((state) => void);
          EXTCODEHASH: ((__namedParameters) => void);
          EXTCODESIZE: ((__namedParameters) => void);
          GAS: ((__namedParameters) => void);
          GASLIMIT: ((__namedParameters) => void);
          GASPRICE: ((__namedParameters) => void);
          GT: ((__namedParameters) => void);
          INVALID: ((state, op) => void);
          ISZERO: ((__namedParameters) => void);
          JUMP: ((state, opcode, __namedParameters) => void);
          JUMPDEST: ((_state) => void);
          JUMPI: ((this, state, opcode, __namedParameters) => void);
          LOG0: ((this, __namedParameters) => void);
          LOG1: ((this, __namedParameters) => void);
          LOG2: ((this, __namedParameters) => void);
          LOG3: ((this, __namedParameters) => void);
          LOG4: ((this, __namedParameters) => void);
          LT: ((__namedParameters) => void);
          MLOAD: ((__namedParameters) => void);
          MOD: ((__namedParameters) => void);
          MSIZE: ((__namedParameters) => void);
          MSTORE: ((__namedParameters) => void);
          MSTORE8: ((__namedParameters) => void);
          MUL: ((__namedParameters) => void);
          MULMOD: ((__namedParameters) => void);
          NOT: ((__namedParameters) => void);
          NUMBER: ((__namedParameters) => void);
          OR: ((__namedParameters) => void);
          ORIGIN: ((__namedParameters) => void);
          PC: ((__namedParameters, op) => void);
          POP: ((__namedParameters) => Expr);
          PREVRANDAO: ((__namedParameters) => void);
          PUSH0: ((state) => void);
          PUSH1: ((state, opcode) => void);
          PUSH10: ((state, opcode) => void);
          PUSH11: ((state, opcode) => void);
          PUSH12: ((state, opcode) => void);
          PUSH13: ((state, opcode) => void);
          PUSH14: ((state, opcode) => void);
          PUSH15: ((state, opcode) => void);
          PUSH16: ((state, opcode) => void);
          PUSH17: ((state, opcode) => void);
          PUSH18: ((state, opcode) => void);
          PUSH19: ((state, opcode) => void);
          PUSH2: ((state, opcode) => void);
          PUSH20: ((state, opcode) => void);
          PUSH21: ((state, opcode) => void);
          PUSH22: ((state, opcode) => void);
          PUSH23: ((state, opcode) => void);
          PUSH24: ((state, opcode) => void);
          PUSH25: ((state, opcode) => void);
          PUSH26: ((state, opcode) => void);
          PUSH27: ((state, opcode) => void);
          PUSH28: ((state, opcode) => void);
          PUSH29: ((state, opcode) => void);
          PUSH3: ((state, opcode) => void);
          PUSH30: ((state, opcode) => void);
          PUSH31: ((state, opcode) => void);
          PUSH32: ((state, opcode) => void);
          PUSH4: ((state, opcode) => void);
          PUSH5: ((state, opcode) => void);
          PUSH6: ((state, opcode) => void);
          PUSH7: ((state, opcode) => void);
          PUSH8: ((state, opcode) => void);
          PUSH9: ((state, opcode) => void);
          RETURN: ((state) => void);
          RETURNDATACOPY: ((state) => void);
          RETURNDATASIZE: ((__namedParameters) => void);
          REVERT: ((this, state) => void);
          SAR: ((__namedParameters) => void);
          SDIV: ((__namedParameters) => void);
          SELFBALANCE: ((__namedParameters) => void);
          SELFDESTRUCT: ((state) => void);
          SGT: ((__namedParameters) => void);
          SHA3: ((state) => void);
          SHL: ((__namedParameters) => void);
          SHR: ((__namedParameters) => void);
          SIGNEXTEND: ((__namedParameters) => void);
          SLOAD: ((this, __namedParameters) => void);
          SLT: ((__namedParameters) => void);
          SMOD: ((__namedParameters) => void);
          SSTORE: ((this, __namedParameters) => void);
          STATICCALL: ((__namedParameters) => void);
          STOP: ((state) => void);
          SUB: ((__namedParameters) => void);
          SWAP1: ((__namedParameters) => void);
          SWAP10: ((__namedParameters) => void);
          SWAP11: ((__namedParameters) => void);
          SWAP12: ((__namedParameters) => void);
          SWAP13: ((__namedParameters) => void);
          SWAP14: ((__namedParameters) => void);
          SWAP15: ((__namedParameters) => void);
          SWAP16: ((__namedParameters) => void);
          SWAP2: ((__namedParameters) => void);
          SWAP3: ((__namedParameters) => void);
          SWAP4: ((__namedParameters) => void);
          SWAP5: ((__namedParameters) => void);
          SWAP6: ((__namedParameters) => void);
          SWAP7: ((__namedParameters) => void);
          SWAP8: ((__namedParameters) => void);
          SWAP9: ((__namedParameters) => void);
          TIMESTAMP: ((__namedParameters) => void);
          XOR: ((__namedParameters) => void);
      } = ...

    Returns Contract

Properties

blocks: Map<number, Block<string>>
bytecode: Uint8Array

The bytecode used to create this Contract.

chunks: (() => {
    content: Uint8Array | Opcode<string>[];
    pcbegin: number;
    pcend: number;
    states?: State<Inst, Expr>[];
}[])

Type declaration

    • (): {
          content: Uint8Array | Opcode<string>[];
          pcbegin: number;
          pcend: number;
          states?: State<Inst, Expr>[];
      }[]
    • Returns {
          content: Uint8Array | Opcode<string>[];
          pcbegin: number;
          pcend: number;
          states?: State<Inst, Expr>[];
      }[]

errors: {
    err: Throw;
    state: State<Inst, Expr>;
}[]

Symbolic execution errors found during interpretation of this.bytecode.

Type declaration

  • err: Throw

    The statement that represents the error triggered during symbolic execution.

  • state: State<Inst, Expr>

    The state in which the error was triggered. Given this states ends up in error, this.last statement will be this.err.

events: IEvents = {}
functionBranches: Map<string, {
    pc: number;
    state: State<Inst, Expr>;
}> = ...

Type declaration

functions: {
    [selector: string]: PublicFunction;
} = {}

Type declaration

main: Stmt[]
mappings: {
    [location: string]: {
        keys: Expr[][];
        name: string | undefined;
        structs: bigint[];
        values: Expr[];
    };
} = {}

Type declaration

  • [location: string]: {
        keys: Expr[][];
        name: string | undefined;
        structs: bigint[];
        values: Expr[];
    }
    • keys: Expr[][]
    • name: string | undefined
    • structs: bigint[]
    • values: Expr[]
metadata: undefined | Metadata

The metadataHash part from the bytecode. That is, if present, the bytecode without its code.

opcodes: (() => Opcode<string>[])

Type declaration

    • (): Opcode<string>[]
    • Returns the opcodes present in the reacheable blocks of this Contract's bytecode.

      Returns Opcode<string>[]

payable: boolean
reverts: IReverts = {}
variables: Map<bigint, Variable> = ...

Methods

  • It looks up in the signature and events database for matching selector or topic hashes.

    When a matching function or event is found, it patches the function or event with the corresponding signature.

    Returns Contract

  • Decompiles the Contract into Solidity-like source code.

    Parameters

    • Rest ...args: [options: {
          contractName?: string;
          license?: null | string;
          pragma?: boolean;
      }]

    Returns string

Generated using TypeDoc v0.25.2