wallet 增加批量confirm的方法
This commit is contained in:
parent
349485dc58
commit
9a3300c468
@ -126,12 +126,9 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
|||||||
/**
|
/**
|
||||||
* @dev Returns whether an operation is pending or not.
|
* @dev Returns whether an operation is pending or not.
|
||||||
*/
|
*/
|
||||||
function isOperationPending(bytes32 id)
|
function isOperationPending(
|
||||||
public
|
bytes32 id
|
||||||
view
|
) public view virtual returns (bool pending) {
|
||||||
virtual
|
|
||||||
returns (bool pending)
|
|
||||||
{
|
|
||||||
return getTimestamp(id) > _DONE_TIMESTAMP;
|
return getTimestamp(id) > _DONE_TIMESTAMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,12 +144,9 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
|||||||
/**
|
/**
|
||||||
* @dev Returns whether an operation is ready or not.
|
* @dev Returns whether an operation is ready or not.
|
||||||
*/
|
*/
|
||||||
function isOperationReady(bytes32 id)
|
function isOperationReady(
|
||||||
public
|
bytes32 id
|
||||||
view
|
) public view virtual returns (bool ready) {
|
||||||
virtual
|
|
||||||
returns (bool ready)
|
|
||||||
{
|
|
||||||
uint256 timestamp = getTimestamp(id);
|
uint256 timestamp = getTimestamp(id);
|
||||||
return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp;
|
return timestamp > _DONE_TIMESTAMP && timestamp <= block.timestamp;
|
||||||
}
|
}
|
||||||
@ -168,12 +162,9 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
|||||||
* @dev Returns the timestamp at with an operation becomes ready (0 for
|
* @dev Returns the timestamp at with an operation becomes ready (0 for
|
||||||
* unset operations, 1 for done operations).
|
* unset operations, 1 for done operations).
|
||||||
*/
|
*/
|
||||||
function getTimestamp(bytes32 id)
|
function getTimestamp(
|
||||||
public
|
bytes32 id
|
||||||
view
|
) public view virtual returns (uint256 timestamp) {
|
||||||
virtual
|
|
||||||
returns (uint256 timestamp)
|
|
||||||
{
|
|
||||||
return _timestamps[id];
|
return _timestamps[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,10 +290,9 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
|||||||
* Requirements
|
* Requirements
|
||||||
* - the caller must have the 'executor' role.
|
* - the caller must have the 'executor' role.
|
||||||
*/
|
*/
|
||||||
function confirmTransaction(bytes32 id)
|
function confirmTransaction(
|
||||||
public
|
bytes32 id
|
||||||
onlyRoleOrOpenRole(EXECUTOR_ROLE)
|
) public onlyRoleOrOpenRole(EXECUTOR_ROLE) {
|
||||||
{
|
|
||||||
require(
|
require(
|
||||||
isOperationPending(id),
|
isOperationPending(id),
|
||||||
"BEMultiSigWallet: operation not exist or finished"
|
"BEMultiSigWallet: operation not exist or finished"
|
||||||
@ -311,15 +301,25 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
|||||||
emit Confirmation(msg.sender, id);
|
emit Confirmation(msg.sender, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Allows an executor to confirm multiple transactions.
|
||||||
|
*/
|
||||||
|
function confirmTransactionBatch(
|
||||||
|
bytes32[] calldata ids
|
||||||
|
) public onlyRoleOrOpenRole(EXECUTOR_ROLE) {
|
||||||
|
for (uint256 i = 0; i < ids.length; ++i) {
|
||||||
|
confirmTransaction(ids[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Allows an executor to revoke a confirmation for a transaction.
|
* @dev Allows an executor to revoke a confirmation for a transaction.
|
||||||
* Requirements
|
* Requirements
|
||||||
* - the caller must have the 'executor' role.
|
* - the caller must have the 'executor' role.
|
||||||
*/
|
*/
|
||||||
function revokeConfirmation(bytes32 id)
|
function revokeConfirmation(
|
||||||
public
|
bytes32 id
|
||||||
onlyRoleOrOpenRole(EXECUTOR_ROLE)
|
) public onlyRoleOrOpenRole(EXECUTOR_ROLE) {
|
||||||
{
|
|
||||||
require(
|
require(
|
||||||
isOperationPending(id),
|
isOperationPending(id),
|
||||||
"BEMultiSigWallet: operation not exist or finished"
|
"BEMultiSigWallet: operation not exist or finished"
|
||||||
@ -328,6 +328,17 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
|||||||
emit Revocation(msg.sender, id);
|
emit Revocation(msg.sender, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Allows an executor to revoke multiple confirmations for a transaction.
|
||||||
|
*/
|
||||||
|
function revokeConfirmationBatch(
|
||||||
|
bytes32[] calldata ids
|
||||||
|
) public onlyRoleOrOpenRole(EXECUTOR_ROLE) {
|
||||||
|
for (uint256 i = 0; i < ids.length; ++i) {
|
||||||
|
revokeConfirmation(ids[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Execute an (ready) operation containing a single transaction.
|
* @dev Execute an (ready) operation containing a single transaction.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user