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.
|
||||
*/
|
||||
function isOperationPending(bytes32 id)
|
||||
public
|
||||
view
|
||||
virtual
|
||||
returns (bool pending)
|
||||
{
|
||||
function isOperationPending(
|
||||
bytes32 id
|
||||
) public view virtual returns (bool pending) {
|
||||
return getTimestamp(id) > _DONE_TIMESTAMP;
|
||||
}
|
||||
|
||||
@ -147,12 +144,9 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
||||
/**
|
||||
* @dev Returns whether an operation is ready or not.
|
||||
*/
|
||||
function isOperationReady(bytes32 id)
|
||||
public
|
||||
view
|
||||
virtual
|
||||
returns (bool ready)
|
||||
{
|
||||
function isOperationReady(
|
||||
bytes32 id
|
||||
) public view virtual returns (bool ready) {
|
||||
uint256 timestamp = getTimestamp(id);
|
||||
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
|
||||
* unset operations, 1 for done operations).
|
||||
*/
|
||||
function getTimestamp(bytes32 id)
|
||||
public
|
||||
view
|
||||
virtual
|
||||
returns (uint256 timestamp)
|
||||
{
|
||||
function getTimestamp(
|
||||
bytes32 id
|
||||
) public view virtual returns (uint256 timestamp) {
|
||||
return _timestamps[id];
|
||||
}
|
||||
|
||||
@ -299,10 +290,9 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
||||
* Requirements
|
||||
* - the caller must have the 'executor' role.
|
||||
*/
|
||||
function confirmTransaction(bytes32 id)
|
||||
public
|
||||
onlyRoleOrOpenRole(EXECUTOR_ROLE)
|
||||
{
|
||||
function confirmTransaction(
|
||||
bytes32 id
|
||||
) public onlyRoleOrOpenRole(EXECUTOR_ROLE) {
|
||||
require(
|
||||
isOperationPending(id),
|
||||
"BEMultiSigWallet: operation not exist or finished"
|
||||
@ -311,15 +301,25 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
||||
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.
|
||||
* Requirements
|
||||
* - the caller must have the 'executor' role.
|
||||
*/
|
||||
function revokeConfirmation(bytes32 id)
|
||||
public
|
||||
onlyRoleOrOpenRole(EXECUTOR_ROLE)
|
||||
{
|
||||
function revokeConfirmation(
|
||||
bytes32 id
|
||||
) public onlyRoleOrOpenRole(EXECUTOR_ROLE) {
|
||||
require(
|
||||
isOperationPending(id),
|
||||
"BEMultiSigWallet: operation not exist or finished"
|
||||
@ -328,6 +328,17 @@ contract BEMultiSigWallet is AccessControlEnumerable {
|
||||
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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user