InverterBeacon_v1.sol
Inherits: IInverterBeacon_v1, ERC165, Ownable2Step
Author: Inverter Network
Manages upgrades and versioning for smart contract implementations, allowing contract administrators to dynamically change contract logic while maintaining the state. Supports emergency shutdown mechanisms to halt operations if needed.
Extends {ERC165} for interface detection and implements both {IInverterBeacon_v1} and {IBeacon}. Uses modifiers to enforce constraints on implementation upgrades. Unique features include emergency mode control and strict version handling with major, minor and patch version concepts.
State Variables
_reverterAddress
The address of the contract that will revert all transactions. Can only be set via the constructor()
function.
_implementationAddress
The InverterBeacon_v1's implementation address. Can only be changed via the _setImplementation()
function.
_implementationPointer
The {InverterBeacon_v1}'s current implementation pointer. In case of emergency can be set to _reverterAddress
to pause functionality.
_emergencyMode
Is the {InverterBeacon_v1} shut down / in emergency mode.
majorVersion
The major version of the implementation.
minorVersion
The minor version of the implementation.
patchVersion
The patch version of the implementation.
Functions
supportsInterface
See {IERC165-supportsInterface}.
validImplementation
Modifier to ensure the implementation is valid.
validNewMinorOrPatchVersion
Modifier to ensure the new minor or patch version is valid.
constructor
implementation
Must return an address that can be used as a delegate call target. {UpgradeableBeacon} will check that this address is a contract.
getReverterAddress
Returns the {InverterReverter_v1} of the {InverterBeacon_v1}.
Returns
Name | Type | Description |
---|---|---|
|
| ReverterAddress The address of the reverter contract. |
getImplementationAddress
Returns the implementation address of the {InverterBeacon_v1}.
Returns
Name | Type | Description |
---|---|---|
|
| ImplementationAddress The address of the implementation. |
emergencyModeActive
Returns wether the {InverterBeacon_v1} is in emergency mode or not.
Returns
Name | Type | Description |
---|---|---|
|
| emergencyModeActive Is the beacon in emergency mode. |
version
Returns the version of the linked implementation.
Returns
Name | Type | Description |
---|---|---|
|
| Major version. |
|
| Minor version. |
|
| Patch version. |
upgradeTo
Upgrades the {InverterBeacon_v1} to a new implementation address.
Only callable by owner.
Parameters
Name | Type | Description |
---|---|---|
|
| The new implementation address. |
|
| The new minor version of the implementation contract. |
|
| The new patch version of the implementation contract. |
|
| Flag to enable upgradeTo function to override the shutdown. |
shutDownImplementation
Shuts down the {InverterBeacon_v1} and stops the system.
Only callable by owner.
restartImplementation
Restarts the {InverterBeacon_v1} and the system.
Only callable by owner.
_upgradeTo
Internal function to upgrade the implementation.
Parameters
Name | Type | Description |
---|---|---|
|
| The new implementation address. |
|
| The new minor version. |
|
| The new patch version. |
|
| If the upgrade process should override the shutdown. |
_setImplementation
Internal function to set the implementation.
Parameters
Name | Type | Description |
---|---|---|
|
| The new implementation address. |
|
| If the upgrade process should override the shutdown. |
Last updated