axelar-gmp-sdk-solidity

Solidity API

Upgradable

This contract provides an interface for upgradable smart contracts and includes the functionality to perform upgrades.

_IMPLEMENTATION_SLOT

bytes32 _IMPLEMENTATION_SLOT

constructor

constructor() internal

Constructor sets the implementation address to the address of the contract itself

This is used in the onlyProxy modifier to prevent certain functions from being called directly on the implementation contract itself. The owner is initially set as address(1) because the actual owner is set within the proxy. It is not set as the zero address because Ownable is designed to throw an error for ownership transfers to the zero address.

implementation

function implementation() public view returns (address implementation_)

Returns the address of the current implementation

Return Values

Name Type Description
implementation_ address Address of the current implementation

upgrade

function upgrade(address newImplementation, bytes32 newImplementationCodeHash, bytes params) external

Upgrades the contract to a new implementation

This function is only callable by the owner.

Parameters

Name Type Description
newImplementation address The address of the new implementation contract
newImplementationCodeHash bytes32 The codehash of the new implementation contract
params bytes Optional setup parameters for the new implementation contract

setup

function setup(bytes data) external

Sets up the contract with initial data

This function is only callable by the proxy contract.

Parameters

Name Type Description
data bytes Initialization data for the contract

_setup

function _setup(bytes data) internal virtual

Internal function to set up the contract with initial data

This function should be implemented in derived contracts.

Parameters

Name Type Description
data bytes Initialization data for the contract