Ethereum smart contract

### Hierarchy

- EvmContract

## Index

### Constructors

- constructor

### Properties

- abiJson
- addresses
- bytecode
- methodAbi
- name
- transactions
- viewMethods

### Methods

- addNewInstance
- decodeCallResult
- encodeCallData
- encodeDeployData
- getMethodAbi
- getMethodFragment
- serialize
- computeAddress
- deserialize

## Constructors

### constructor

- new EvmContract(name: string, bytecode?: Buffer, abiJson: string, addresses?: Buffer[]): EvmContract

- - Defined in src/bevm/bevm-instance.ts:112

  Create a new EVM contract

  #### Parameters

  - ##### name: string

    Contract name

  - ##### Default value bytecode: Buffer = Buffer.from("")

    Contract bytecode; pass `undefined` if the contract does not need deploying

  - ##### abiJson: string

    Contract ABI (JSON-encoded)

  - ##### Default value addresses: Buffer[] = []

    Array of existing (already deployed) contract instances; if not provided, the contract will need to deploy instances before exeuting transactions or view method calls

  #### Returns EvmContract

## Properties

### Private abiJson

abiJson: string

- Defined in src/bevm/bevm-instance.ts:128

Contract ABI (JSON-encoded)

### addresses

addresses: Buffer[]

- Defined in src/bevm/bevm-instance.ts:129

Array of existing (already deployed) contract instances; if not provided, the contract will need to deploy instances before exeuting transactions or view method calls

### Private bytecode

bytecode: Buffer

- Defined in src/bevm/bevm-instance.ts:127

Contract bytecode; pass `undefined` if the contract does not need deploying

### Private methodAbi

methodAbi: Map<string, any>

- Defined in src/bevm/bevm-instance.ts:112

### name

name: string

- Defined in src/bevm/bevm-instance.ts:126

Contract name

### transactions

transactions: string[]

- Defined in src/bevm/bevm-instance.ts:110

### viewMethods

viewMethods: string[]

- Defined in src/bevm/bevm-instance.ts:111

## Methods

### addNewInstance

- addNewInstance(account: EvmAccount): void

- - Defined in src/bevm/bevm-instance.ts:202

  Add a new instance to this conctract, with the address determine by the provided account.

  #### Parameters

  - ##### account: EvmAccount

    Account that spawned the instance

  #### Returns void

### decodeCallResult

- decodeCallResult(method: string, result: Buffer): Result

- - Defined in src/bevm/bevm-instance.ts:188

  #### Parameters

  - ##### method: string

  - ##### result: Buffer

  #### Returns Result

### encodeCallData

- encodeCallData(method: string, ...args: any[]): Buffer

- - Defined in src/bevm/bevm-instance.ts:179

  #### Parameters

  - ##### method: string

  - ##### Rest ...args: any[]

  #### Returns Buffer

### encodeDeployData

- encodeDeployData(...args: any[]): Buffer

- - Defined in src/bevm/bevm-instance.ts:166

  #### Parameters

  - ##### Rest ...args: any[]

  #### Returns Buffer

### getMethodAbi

- getMethodAbi(method: string): any

- - Defined in src/bevm/bevm-instance.ts:157

  #### Parameters

  - ##### method: string

  #### Returns any

### Private getMethodFragment

- getMethodFragment(method: string): string

- - Defined in src/bevm/bevm-instance.ts:216

  #### Parameters

  - ##### method: string

  #### Returns string

### serialize

- serialize(): object

- - Defined in src/bevm/bevm-instance.ts:207

  #### Returns object

### Static Private computeAddress

- computeAddress(data: Buffer, nonce: number): Buffer

- - Defined in src/bevm/bevm-instance.ts:98

  #### Parameters

  - ##### data: Buffer

  - ##### nonce: number

  #### Returns Buffer

### Static deserialize

- deserialize(obj: any): EvmContract

- - Defined in src/bevm/bevm-instance.ts:89

  #### Parameters

  - ##### obj: any

  #### Returns EvmContract

Generated using TypeDoc