Skip to main content
Version: v2.x

Minimal Anti Collusion Infrastructure (MACI) / ContractStorage

Class: ContractStorage

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:6

Notice

Contract storage keeps all deployed contracts with addresses, arguments in the json file. This class is using for incremental deployment and verification.

Properties

setVerified()

setVerified: (address, network, verified) => void

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:54

Set contract verification in the json file

Parameters

address

string

contract address

network

string

selected network

verified

boolean

verified or not

Returns

void

Methods

cleanup()

cleanup(network): void

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:98

Clean json file for selected network

Parameters

network

string

selected network

Returns

void


getAddress()

getAddress<ID>(id, network, key?): undefined | string

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:71

Get contract address by name from the json file

Type Parameters

ID extends string = EContracts

Parameters

id

ID

contract name

network

string

selected network

key?

string

Returns

undefined | string

contract address


getContractArgs()

getContractArgs<ID>(id, network, key?): undefined | string[]

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:63

Get deployment arguments from the json file

Type Parameters

ID extends string = EContracts

Parameters

id

ID

contract name

network

string

selected network

key?

string

contract key

Returns

undefined | string[]

deployment arguments


getDeploymentTxHash()

getDeploymentTxHash<ID>(id, network, address): undefined | string

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:84

Get Contract Deployment Transaction Hash

Type Parameters

ID extends string = EContracts

Parameters

id

ID

network

string

address

string

Returns

undefined | string


getInstances()

getInstances(network): [string, IStorageInstanceEntry][]

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:38

Get contract instances from the json file

Parameters

network

string

selected network

Returns

[string, IStorageInstanceEntry][]

storage instance entries


getVerified()

getVerified(address, network): boolean

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:46

Check if contract is verified or not locally

Parameters

address

string

contract address

network

string

selected network

Returns

boolean

contract verified or not


mustGetAddress()

mustGetAddress<ID>(id, network, key?): string

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:80

Get contract address by name from the json file

Type Parameters

ID extends string = EContracts

Parameters

id

ID

contract name

network

string

selected network

key?

string

Returns

string

contract address

Throws

if there is no address the error will be thrown


printContracts()

printContracts(deployer, network): [Map<string, string>, number, number]

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:92

Get contract from the json file with sizes and multi count

Parameters

deployer

string

deployer address

network

string

selected network

Returns

[Map<string, string>, number, number]


register()

register<ID>(args): Promise<void>

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:31

Register contract and save contract address, constructor args in the json file

Type Parameters

ID = EContracts

Parameters

args

IRegisterContract<ID>

register arguments

Returns

Promise<void>


getInstance()

static getInstance(storagePath?): ContractStorage

Defined in: packages/contracts/build/tasks/helpers/ContractStorage.d.ts:25

Get singleton object

Parameters

storagePath?

string

path to the storage file

Returns

ContractStorage

singleton object