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.
Name | Type | Description |
---|---|---|
domain | bytes4 | - Unique identifier for the delegate |
getDomain
function getDomain() public view returns (bytes4)
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4 - 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)
Name | Type | Description |
---|---|---|
[0] | bool | bool - Deployable status of the delegate. |
isValidData
function isValidData() external view returns (bool)
Name | Type | Description |
---|---|---|
[0] | bool | bool - If the current stack has set Spanning Info correctly |
currentSenderAddress
function currentSenderAddress() external view returns (bytes32)
Name | Type | Description |
---|---|---|
[0] | bytes32 | bytes32 - Address of the entity that contacted the delegate. |
currentTxnSenderAddress
function currentTxnSenderAddress() external view returns (bytes32)
Name | Type | Description |
---|---|---|
[0] | bytes32 | bytes32 - 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_
Name | Type | Description |
---|---|---|
programAddress | bytes32 | - Address to be called |
msgSenderAddress | bytes32 | - Address of who requested the call |
txnSenderAddress | bytes32 | - Address of the originator of the call |
payload | bytes | - 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._
Name | Type | Description |
---|---|---|
programAddress | bytes32 | - Address to be called |
payload | bytes | - 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
Name | Type | Description |
---|---|---|
_returnData | bytes | - return data from call |
executeSpanningCall
function executeSpanningCall(bytes32 programAddress, bytes32 msgSenderAddress, bytes32 txnSenderAddress, bytes payload) internal
Helper function to execute a local transaction
Name | Type | Description |
---|---|---|
programAddress | bytes32 | - Address to be called |
msgSenderAddress | bytes32 | - Address of who requested the call |
txnSenderAddress | bytes32 | - Address of the originator of the transaction |
payload | bytes | - ABI-encoding of the desired function call |