Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsign Tx and Delete PendingTx after Completion #30

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Added unsignTx & removed pendingTx after send
JavierMNieto committed Mar 3, 2022
commit f9b5ae6ddab995d72b04864a95168699bde18a3d
13 changes: 11 additions & 2 deletions src/Multisig.sol
Original file line number Diff line number Diff line change
@@ -185,15 +185,24 @@ contract Multisig {
if (pending[pendingHash].nSigned >= nNeeded) {
sendTx(pendingHash);
emit SignTx(pendingHash, msg.sender);
delete pending[pendingHash];
}
}

/// @notice Removes existing signature from a PendingTx
/// @dev Check if they're signature exists to properly update nSigned
/// @param pendingHash Hash that maps to the PendingTx to unsign
function unsignTx(bytes32 pendingHash) public onlyOwner {
// remove signature from tx
// log event
PendingTx storage pendingTx = pending[pendingHash];
require(pendingTx.nSigned > 0, "Transaction does not exist!");
if (pendingTx.signers[msg.sender]) {
pendingTx.signers[msg.sender] = false;
pendingTx.nSigned -= 1;
}
emit UnsignTx(pendingHash, msg.sender);
if (pendingTx.nSigned == 0) {
delete pending[pendingHash];
}
}

/// @notice Wrapper to send transaction once approved