You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Exchange contract currently only allows for a single 0x transaction to be executed atomically. This proposal would add the ability to atomically execute a batch of transactions by calling a single function.
Motivation
There are niche use cases for composing custom a custom series of Exchange function calls. One example:
A maker places a buy order on market A
A sell order appears on market B that would satisfy the maker's buy order
The maker would like to atomically fill the sell order and cancel the buy order, rather than executing the transactions asynchronously and risking that only one of the transactions is successful.
Specification
A naive solution is extremely simple to implement and adds no additional attack surface:
/// @dev Executes a batch of Exchange method calls in the context of signer(s).
/// @param transactions Array of 0x transactions containing salt, signerAddress, and data.
/// @param signatures Array of proofs that transactions have been signed by signer(s).
/// @return Array containing ABI encoded return data for each of the underlying Exchange function calls.
function batchExecuteTransactions(
ZeroExTransaction[] memory transactions,
bytes[] memory signatures
)
public
returns (bytes[] memory)
{
uint256 length = transactions.length;
bytes[] memory returnData = new bytes[](length);
for (uint256 i = 0; i != length; i++) {
returnData[i] = _executeTransaction(transactions[i], signatures[i]);
}
return returnData;
}
It would be useful if the return data of each transaction could be passed into and processed by the next transaction, but this would be extremely complex to implement (and is potentially infeasible).
Preamble
Discussion: #36
Summary
The Exchange contract currently only allows for a single 0x transaction to be executed atomically. This proposal would add the ability to atomically execute a batch of transactions by calling a single function.
Motivation
There are niche use cases for composing custom a custom series of Exchange function calls. One example:
Specification
A naive solution is extremely simple to implement and adds no additional attack surface:
It would be useful if the return data of each transaction could be passed into and processed by the next transaction, but this would be extremely complex to implement (and is potentially infeasible).
Copyright
Copyright and related rights waived via CC0.
The text was updated successfully, but these errors were encountered: