Skip to main content
Version: v3.x

Minimal Anti Collusion Infrastructure (MACI) / ContractStorage

Class: ContractStorage

Defined in: 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: 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: contracts/build/tasks/helpers/ContractStorage.d.ts:106

Clean json file for selected network

Parameters​

network​

string

selected network

Returns​

void


getAddress()​

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

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

Get contract address by name from the json file

Type Parameters​

ID​

ID extends string = EContracts

Parameters​

id​

ID

contract name

network​

string

selected network

key?​

string

Returns​

string | undefined

contract address


getAddresses()​

getAddresses<ID>(ids, network, keys?): (string | undefined)[]

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

Get contract addresses by names from the json file

Type Parameters​

ID​

ID extends string = EContracts

Parameters​

ids​

ID[]

contract names

network​

string

selected network

keys?​

string[]

Returns​

(string | undefined)[]

contract address


getContractArgs()​

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

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

Get deployment arguments from the json file

Type Parameters​

ID​

ID extends string = EContracts

Parameters​

id​

ID

contract name

network​

string

selected network

key?​

string

contract key

Returns​

string[] | undefined

deployment arguments


getDeploymentTxHash()​

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

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

Get Contract Deployment Transaction Hash

Type Parameters​

ID​

ID extends string = EContracts

Parameters​

id​

ID

network​

string

address​

string

Returns​

string | undefined


getInstances()​

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

Defined in: 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: 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: contracts/build/tasks/helpers/ContractStorage.d.ts:88

Get contract address by name from the json file

Type Parameters​

ID​

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: contracts/build/tasks/helpers/ContractStorage.d.ts:100

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: contracts/build/tasks/helpers/ContractStorage.d.ts:31

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

Type Parameters​

ID​

ID = EContracts

Parameters​

args​

IRegisterContract<ID>

register arguments

Returns​

Promise<void>


getInstance()​

static getInstance(storagePath?): ContractStorage

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

Get singleton object

Parameters​

storagePath?​

string

path to the storage file

Returns​

ContractStorage

singleton object