VaultFactory
Methods
blacklist
function blacklist(uint64 version) external nonpayable
Blacklist a version of entities.
The given version will still be deployable.
Parameters
| Name | Type | Description |
|---|---|---|
| version | uint64 | version to blacklist |
blacklisted
function blacklisted(uint64 version) external view returns (bool value)
Get if a version is blacklisted (e.g., in case of invalid implementation).
The given version is still deployable.
Parameters
| Name | Type | Description |
|---|---|---|
| version | uint64 | version to check |
Returns
| Name | Type | Description |
|---|---|---|
| bool | whether the version is blacklisted |
create
function create(uint64 version, address owner, bytes data) external nonpayable returns (address entity)
Create a new entity at the factory.
CREATE2 salt is constructed from the given parameters.
Parameters
| Name | Type | Description |
|---|---|---|
| version | uint64 | entity’s version to use |
| owner | address | initial owner of the entity |
| data | bytes | initial data for the entity creation |
Returns
| Name | Type | Description |
|---|---|---|
| entity | address | address of the entity |
entity
function entity(uint256 index) external view returns (address)
Get an entity given its index.
Parameters
| Name | Type | Description |
|---|---|---|
| index | uint256 | index of the entity to get |
Returns
| Name | Type | Description |
|---|---|---|
| address | address of the entity |
implementation
function implementation(uint64 version) external view returns (address)
Get the implementation for a given version.
Reverts when an invalid version.
Parameters
| Name | Type | Description |
|---|---|---|
| version | uint64 | version to get the implementation for |
Returns
| Name | Type | Description |
|---|---|---|
| address | address of the implementation |
isEntity
function isEntity(address entity) external view returns (bool)
Get if a given address is an entity.
Parameters
| Name | Type | Description |
|---|---|---|
| entity | address | address to check |
Returns
| Name | Type | Description |
|---|---|---|
| bool | if the given address is an entity |
lastVersion
function lastVersion() external view returns (uint64)
Get the last available version.
If zero, no implementations are whitelisted.
Returns
| Name | Type | Description |
|---|---|---|
| uint64 | version of the last implementation |
migrate
function migrate(address entity, uint64 newVersion, bytes data) external nonpayable
Migrate a given entity to a given newer version.
Only the entity’s owner can call this function.
Parameters
| Name | Type | Description |
|---|---|---|
| entity | address | address of the entity to migrate |
| newVersion | uint64 | new version to migrate to |
| data | bytes | some data to reinitialize the contract with |
owner
function owner() external view returns (address)
Returns the address of the current owner.
Returns
| Name | Type | Description |
|---|---|---|
| address |
renounceOwnership
function renounceOwnership() external nonpayable
Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.
totalEntities
function totalEntities() external view returns (uint256)
Get a total number of entities.
Returns
| Name | Type | Description |
|---|---|---|
| uint256 | total number of entities added |
transferOwnership
function transferOwnership(address newOwner) external nonpayable
Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.
Parameters
| Name | Type | Description |
|---|---|---|
| newOwner | address |
whitelist
function whitelist(address implementation) external nonpayable
Whitelist a new implementation for entities.
Parameters
| Name | Type | Description |
|---|---|---|
| implementation | address | address of the new implementation |
Events
AddEntity
event AddEntity(address indexed entity)
Emitted when an entity is added.
Parameters
| Name | Type | Description |
|---|---|---|
entity indexed | address | address of the added entity |
Blacklist
event Blacklist(uint64 indexed version)
Emitted when a version is blacklisted (e.g., in case of invalid implementation).
The given version is still deployable.
Parameters
| Name | Type | Description |
|---|---|---|
version indexed | uint64 | version that was blacklisted |
Migrate
event Migrate(address indexed entity, uint64 newVersion)
Emitted when an entity is migrated to a new version.
Parameters
| Name | Type | Description |
|---|---|---|
entity indexed | address | address of the entity |
| newVersion | uint64 | new version of the entity |
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Parameters
| Name | Type | Description |
|---|---|---|
previousOwner indexed | address | |
newOwner indexed | address |
Whitelist
event Whitelist(address indexed implementation)
Emitted when a new implementation is whitelisted.
Parameters
| Name | Type | Description |
|---|---|---|
implementation indexed | address | address of the new implementation |