Versioned

Git Source

Version getter for contracts. Doesn't use any storage slots, meaning it will never cause any troubles with the upgradeable contracts. For instance, this contract can be added or removed from the inheritance chain without shifting the storage layout.

State Variables

_length

Length of the "version string"

uint256 private immutable _length;

_data

Bytes representation of the "version string". Strings with length over 32 are not supported!

bytes32 private immutable _data;

Functions

constructor

constructor(string memory version_);

version

function version() external view returns (string memory versionString);

Structs

_ShortString

Struct that is mimicking the storage layout of a string with 32 bytes or less. Length is limited by 32, so the whole string payload takes two memory words:

struct _ShortString {
    uint256 length;
    bytes32 data;
}