Instance Registry

A simple contract to keep track of instances created from a particular type.

Functions

_register

Registers an instance by adding it to the instance set. Access control limited to only child contracts. Inheriting child contract should call this method from an access controlled function. Typically, such a function would use a modifier like onlyAdmin or onlyOwner.

Params:

Name

Type

Description

instance

address

Address of the instance

instanceAt

Fetches the instance at the given index.

Params:

Name

Type

Description

index

uint256

Index into the instance set

Returns:

Name

Type

Description

instance

address

Address of the instance

instanceCount

Returns the number of instances created of a type.

Returns:

Name

Type

Description

count

uint256

Number of instances of this type

isInstance

Checks if the passed address is an instance.

Params:

Name

Type

Description

instance

address

Address of the instance

Returns:

Name

Type

Description

validity

bool

True if the passed address is an instance, false otherwise