Add batchExecuteTransaction
This commit is contained in:
@@ -39,15 +39,46 @@ contract MixinTransactions is
|
||||
// Address of current transaction signer
|
||||
address public currentContextAddress;
|
||||
|
||||
/// @dev Executes an exchange method call in the context of signer.
|
||||
/// @dev Executes an Exchange method call in the context of signer.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param signature Proof of signer transaction by signer.
|
||||
/// @param signature Proof that transaction has been signed by signer.
|
||||
function executeTransaction(
|
||||
ZeroExTransaction memory transaction,
|
||||
bytes memory signature
|
||||
)
|
||||
public
|
||||
returns (bytes memory)
|
||||
{
|
||||
return _executeTransaction(transaction, signature);
|
||||
}
|
||||
|
||||
/// @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).
|
||||
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;
|
||||
}
|
||||
|
||||
/// @dev Executes an Exchange method call in the context of signer.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param signature Proof that transaction has been signed by signer.
|
||||
function _executeTransaction(
|
||||
ZeroExTransaction memory transaction,
|
||||
bytes memory signature
|
||||
)
|
||||
internal
|
||||
returns (bytes memory)
|
||||
{
|
||||
bytes32 transactionHash = getTransactionHash(transaction);
|
||||
|
||||
|
@@ -24,13 +24,23 @@ import "@0x/contracts-exchange-libs/contracts/src/LibZeroExTransaction.sol";
|
||||
|
||||
contract ITransactions {
|
||||
|
||||
/// @dev Executes an exchange method call in the context of signer.
|
||||
/// @dev Executes an Exchange method call in the context of signer.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param signature Proof of signer transaction by signer.
|
||||
/// @param signature Proof that transaction has been signed by signer.
|
||||
function executeTransaction(
|
||||
LibZeroExTransaction.ZeroExTransaction memory transaction,
|
||||
bytes memory signature
|
||||
)
|
||||
public
|
||||
returns (bytes memory);
|
||||
|
||||
/// @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).
|
||||
function batchExecuteTransactions(
|
||||
LibZeroExTransaction.ZeroExTransaction[] memory transactions,
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
returns (bytes[] memory);
|
||||
}
|
||||
|
@@ -19,12 +19,22 @@
|
||||
pragma solidity ^0.5.5;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibZeroExTransaction.sol";
|
||||
import "../interfaces/ITransactions.sol";
|
||||
|
||||
|
||||
contract MTransactions is
|
||||
ITransactions
|
||||
{
|
||||
/// @dev Executes an Exchange method call in the context of signer.
|
||||
/// @param transaction 0x transaction containing salt, signerAddress, and data.
|
||||
/// @param signature Proof that transaction has been signed by signer.
|
||||
function _executeTransaction(
|
||||
LibZeroExTransaction.ZeroExTransaction memory transaction,
|
||||
bytes memory signature
|
||||
)
|
||||
internal
|
||||
returns (bytes memory);
|
||||
|
||||
/// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
|
||||
/// If calling a fill function, this address will represent the taker.
|
||||
|
Reference in New Issue
Block a user