Skip to content

Solidity API

SpanningDelegate

domain_

bytes4 domain_

delegateAddress_

address delegateAddress_

deployable_

bool deployable_

isValidData_

bool isValidData_

_Spanning-generated transaction information.

Currently, this includes:

  • msgSenderAddress: Address of the entity that contacted the delegate
  • txnSenderAddress: Address of the originator of the transaction
  • TODO(ENG-133): functionId: ABI-encoded function header
  • TODO(ENG-133): txnValue: Value of the transaction

This information is determined directly by the protocol, so it is subject to different trust assumptions than program payloads._

currentMsgSenderAddress_

bytes32 currentMsgSenderAddress_

currentTxnSenderAddress_

bytes32 currentTxnSenderAddress_

constructor

constructor(bytes4 domain) public

Initializes a Spanning Delegate.

NameTypeDescription
domainbytes4- Unique identifier for the delegate

getDomain

function getDomain() public view returns (bytes4)
NameTypeDescription
[0]bytes4bytes4 - Domain of the delegate.

makeDeployable

function makeDeployable() external

Sets the deployable status to true.

revokeDeployable

function revokeDeployable() external

Sets the deployable status to false.

isDeployable

function isDeployable() public view returns (bool)
NameTypeDescription
[0]boolbool - Deployable status of the delegate.

isValidData

function isValidData() external view returns (bool)
NameTypeDescription
[0]boolbool - If the current stack has set Spanning Info correctly

currentSenderAddress

function currentSenderAddress() external view returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Address of the entity that contacted the delegate.

currentTxnSenderAddress

function currentTxnSenderAddress() external view returns (bytes32)
NameTypeDescription
[0]bytes32bytes32 - Address of the originator of the transaction.

spanningCall

function spanningCall(bytes32 programAddress, bytes32 msgSenderAddress, bytes32 txnSenderAddress, bytes payload) external

_Used by authorized middleware to run a transaction on this domain.

Note: We currently we assume the contract owner == authorized address_

NameTypeDescription
programAddressbytes32- Address to be called
msgSenderAddressbytes32- Address of who requested the call
txnSenderAddressbytes32- Address of the originator of the call
payloadbytes- ABI-encoding of the desired function call

makeRequest

function makeRequest(bytes32 programAddress, bytes payload) external

_Allows a user to request a call over authorized middleware nodes.

Note: This can result in either a local or cross-domain transaction. Note: Dispatch uses EVM Events as a signal to our middleware._

NameTypeDescription
programAddressbytes32- Address to be called
payloadbytes- ABI-encoding of the desired function call TODO(ENG-133): Support "rolled up" method to dispatch transactions

receive

receive() external payable

Fallback function for receiving payment

packSpanningInformation

function packSpanningInformation(bytes32 msgSenderAddress, bytes32 txnSenderAddress) internal

_Pack Spanning transaction information

Note: Keep this function in sync with resetSpanningInformation()_

resetSpanningInformation

function resetSpanningInformation() internal

_Reset cached Spanning transaction information

Note: Keep this function in sync with packSpanningInformation()_

_getRevertMsg

function _getRevertMsg(bytes _returnData) internal view returns (string)

Helper function to parse revert message from https://ethereum.stackexchange.com/questions/83528

NameTypeDescription
_returnDatabytes- return data from call

executeSpanningCall

function executeSpanningCall(bytes32 programAddress, bytes32 msgSenderAddress, bytes32 txnSenderAddress, bytes payload) internal

Helper function to execute a local transaction

NameTypeDescription
programAddressbytes32- Address to be called
msgSenderAddressbytes32- Address of who requested the call
txnSenderAddressbytes32- Address of the originator of the transaction
payloadbytes- ABI-encoding of the desired function call