Skip to content

Solidity API

SpanningUpgradeable

_This module provides a number of utility functions and modifiers for interacting with the Spanning Network.

It includes:

  • Functions abstracting delegate state and methods
  • Functions for multi-domain ownership

Note: This module is meant to be used through inheritance._

delegateLegacyAddress

address delegateLegacyAddress

delegate_

contract ISpanningDelegate delegate_

rootOwner

bytes32 rootOwner

__Spanning_init

function __Spanning_init(address delegate) internal

_Initializes a Spanning base module.

Note: The initial rootOwner is set to whomever deployed the contract._

NameTypeDescription
delegateaddress- Legacy (local) address of our Spanning Delegate

__Spanning_init_unchained

function __Spanning_init_unchained(address delegate) internal

isSpanning

function isSpanning() external pure returns (bool)
NameTypeDescription
[0]boolbool - true if the contract is a Spanning contract

onlySpanning

modifier onlySpanning()

Reverts if the function is executed by anyone but the Delegate.

isSpanningCall

function isSpanningCall() public view returns (bool)
NameTypeDescription
[0]boolbool - true if a sender is a Spanning Delegate

getDomain

function getDomain() internal view returns (bytes4)
NameTypeDescription
[0]bytes4bytes4 - Domain identifier

delegateAddress

function delegateAddress() internal view returns (address)
NameTypeDescription
[0]addressaddress - Local (legacy) address of the Delegate

updateDelegate

function updateDelegate(address newDelegateLegacyAddress) external

Updates Delegate's legacy (local) address.

NameTypeDescription
newDelegateLegacyAddressaddress- Desired address for Spanning Delegate

makeRequest

function makeRequest(bytes32 programAddress, bytes payload) internal virtual

_Creates a function request for a delegate to execute.

Note: This can result in either a local or cross-domain transaction._

NameTypeDescription
programAddressbytes32- Address to be called
payloadbytes- ABI-encoding of the desired function call

getLegacyFromAddress

function getLegacyFromAddress(bytes32 inputAddress) internal view returns (address)

_Gets a Legacy Address from an Address, if in the same domain.

Note: This function can be used to create backwards-compatible events._

NameTypeDescription
inputAddressbytes32- Address to convert to a Legacy Address
NameTypeDescription
[0]addressaddress - Legacy Address if in the same domain, otherwise 0x0

getDomainFromAddress

function getDomainFromAddress(bytes32 inputAddress) internal pure returns (bytes4)

Gets a Domain from an Address

NameTypeDescription
inputAddressbytes32- Address to convert to a domain
NameTypeDescription
[0]bytes4domain - Domain ID

getAddressFromLegacy

function getAddressFromLegacy(address legacyAddress) internal view returns (bytes32)

Creates an Address from a Legacy Address, using the local domain.

NameTypeDescription
legacyAddressaddress- Legacy (local) address to convert
NameTypeDescription
[0]bytes32bytes32 - Packed Address

spanningMsgSender

function spanningMsgSender() internal view returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Multi-domain msg.sender, defaulting to local sender.

spanningTxnSender

function spanningTxnSender() internal view returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Multi-domain tx.origin, defaulting to local origin.

isValidSpanningInfo

function isValidSpanningInfo() internal view returns (bool)
NameTypeDescription
[0]boolbool - True if the current call stack has valid Spanning Info

spanningMsgSenderUnchecked

function spanningMsgSenderUnchecked() internal view returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Multi-domain msg.sender, defaulting to local sender.

spanningTxnSenderUnchecked

function spanningTxnSenderUnchecked() internal view returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Multi-domain tx.origin.

onlyOwner

modifier onlyOwner()

Reverts if the function is executed by anyone but the owner.

owner

function owner() public view virtual returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Address of current owner

renounceOwnership

function renounceOwnership() public virtual

_Sets the owner to null, effectively removing contract ownership.

Note: It will not be possible to call onlyOwner functions anymore Note: Can only be called by the current owner_

transferOwnership

function transferOwnership(bytes32 newOwnerAddress) public virtual

_Assigns new owner for the contract.

Note: Can only be called by the current owner_

NameTypeDescription
newOwnerAddressbytes32- Address for desired owner

_transferOwnership

function _transferOwnership(bytes32 newOwnerAddress) internal virtual

Transfers ownership of the contract to a new Address.

NameTypeDescription
newOwnerAddressbytes32- Address for desired owner

__gap

uint256[46] __gap

This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps We use a standard of 50 storage slots. The amount referenced below is based on: 50 - numberOfClassMemberVariables.