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
<none>
address
ReverterAddress The address of the reverter contract.
getImplementationAddress
Returns the implementation address of the {InverterBeacon_v1}.
Returns
<none>
address
ImplementationAddress The address of the implementation.
emergencyModeActive
Returns wether the {InverterBeacon_v1} is in emergency mode or not.
Returns
<none>
bool
emergencyModeActive Is the beacon in emergency mode.
version
Returns the version of the linked implementation.
Returns
<none>
uint256
Major version.
<none>
uint256
Minor version.
<none>
uint256
Patch version.
upgradeTo
Upgrades the {InverterBeacon_v1} to a new implementation address.
Only callable by owner.
Parameters
newImplementation
address
The new implementation address.
newMinorVersion
uint256
The new minor version of the implementation contract.
newPatchVersion
uint256
The new patch version of the implementation contract.
overrideShutdown
bool
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
newImplementation
address
The new implementation address.
newMinorVersion
uint256
The new minor version.
newPatchVersion
uint256
The new patch version.
overrideShutdown
bool
If the upgrade process should override the shutdown.
_setImplementation
Internal function to set the implementation.
Parameters
newImplementation
address
The new implementation address.
overrideShutdown
bool
If the upgrade process should override the shutdown.
Last updated