Skip to content

EternalStorage

Description

This is an implementation of the well-known eternal storage smart contract pattern, described in more detail here and here.

In short, it is a key-value store for variables which are retrieved by a byte string, typically a hash of their name and an index.

The contract is architected this way so that the access pattern is uniform and the memory layout is not dependent on implementation or compilation details. In this way, smart contracts can retain state between updates while minimising the difficulty and expense of migrating this information.

Each type of variable has its own mapping, along with getters and setters. As this entails some replication, this document will express functions and variables generically with the type variable 𝕋, where 𝕋 \in {uint, string, address, bytes, bytes32, bool, int}. This notation is used slightly abusively, standing in for both names and types; in the former case, substitution is in camelCase. More complex types, such as structs and nested mappings, are not supported.

Source: contracts/EternalStorage.sol

Architecture

Inheritance Graph

graph TD EternalStorage[EternalStorage] --> State[State] State[State] --> Owned[Owned]

Constructor

constructor

Source

Initialises the inherited State instance.

Details

Signature

(address _owner, address _associatedContract)

Visibility

public

State Mutability

nonpayable

Views

getAddressValue

Source

Details

Signature

getAddressValue(bytes32 record) returns (address)

Visibility

external

State Mutability

view

getBooleanValue

Source

Details

Signature

getBooleanValue(bytes32 record) returns (bool)

Visibility

external

State Mutability

view

getBytes32Value

Source

Details

Signature

getBytes32Value(bytes32 record) returns (bytes32)

Visibility

external

State Mutability

view

getBytesValue

Source

Details

Signature

getBytesValue(bytes32 record) returns (bytes)

Visibility

external

State Mutability

view

getIntValue

Source

Details

Signature

getIntValue(bytes32 record) returns (int256)

Visibility

external

State Mutability

view

getStringValue

Source

Details

Signature

getStringValue(bytes32 record) returns (string)

Visibility

external

State Mutability

view

getUIntValue

Source

Details

Signature

getUIntValue(bytes32 record) returns (uint256)

Visibility

external

State Mutability

view

Restricted Functions

deleteAddressValue

Source

Details

Signature

deleteAddressValue(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

deleteBooleanValue

Source

Details

Signature

deleteBooleanValue(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

deleteBytes32Value

Source

Details

Signature

deleteBytes32Value(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

deleteBytesValue

Source

Details

Signature

deleteBytesValue(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

deleteIntValue

Source

Details

Signature

deleteIntValue(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

deleteStringValue

Source

Details

Signature

deleteStringValue(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

deleteUIntValue

Source

Details

Signature

deleteUIntValue(bytes32 record)

Visibility

external

State Mutability

nonpayable

Modifiers

setAddressValue

Source

Details

Signature

setAddressValue(bytes32 record, address value)

Visibility

external

State Mutability

nonpayable

Modifiers

setBooleanValue

Source

Details

Signature

setBooleanValue(bytes32 record, bool value)

Visibility

external

State Mutability

nonpayable

Modifiers

setBytes32Value

Source

Details

Signature

setBytes32Value(bytes32 record, bytes32 value)

Visibility

external

State Mutability

nonpayable

Modifiers

setBytesValue

Source

Details

Signature

setBytesValue(bytes32 record, bytes value)

Visibility

external

State Mutability

nonpayable

Modifiers

setIntValue

Source

Details

Signature

setIntValue(bytes32 record, int256 value)

Visibility

external

State Mutability

nonpayable

Modifiers

setStringValue

Source

Details

Signature

setStringValue(bytes32 record, string value)

Visibility

external

State Mutability

nonpayable

Modifiers

setUIntValue

Source

Details

Signature

setUIntValue(bytes32 record, uint256 value)

Visibility

external

State Mutability

nonpayable

Modifiers