InverterBeaconProxy_v1.sol

Git Source

Inherits: Proxy

Author: Inverter Network

Acts as a proxy for Inverter Network's smart contracts, allowing for upgrades to contract implementations without affecting the existing state or contract addresses, thereby achieving upgradeable contracts.

Implements the Proxy pattern by referencing the {InverterBeacon_v1}, which holds the address of the current implementation to which calls are delegated.

State Variables

_beacon

{InverterBeacon_v1} instance that points to the implementation.

IInverterBeacon_v1 private immutable _beacon;

Functions

constructor

Constructs the InverterBeaconProxy_v1.

Sets the {InverterBeacon_v1} instance that contains the implementation address.

constructor(IInverterBeacon_v1 beacon);

Parameters

Name
Type
Description

beacon

IInverterBeacon_v1

version

Returns the version of the linked implementation.

This overrides the possible use of a "version" function in the modules that are called via the Proxy Beacon structure.

function version() external view returns (uint, uint, uint);

Returns

Name
Type
Description

<none>

uint256

Major version.

<none>

uint256

Minor version.

<none>

uint256

Patch version.

receive

Fallback function to delegate calls to the implementation contract even if the call data is empty but msg.value > 0.

receive() external payable virtual;

_implementation

This is a virtual function that should be overridden so it returns the address to which the fallback function and {_fallback} should delegate.

function _implementation() internal view override returns (address);

Events

BeaconUpgraded

Proxy upgraded to new {InverterBeacon_v1} instance.

event BeaconUpgraded(IInverterBeacon_v1 indexed beacon);

Parameters

Name
Type
Description

beacon

IInverterBeacon_v1

Last updated