Skip to content

Commit

Permalink
add stop recovery method
Browse files Browse the repository at this point in the history
  • Loading branch information
ququzone committed Nov 2, 2023
1 parent c869550 commit ed29199
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions contracts/accounts/secp256r1/P256Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ contract P256Account is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Init
event EmailGuardianRemoved();
event AccountPendingRecovey(uint256 timestamp, bytes publicKey);
event AccountRecovered(bytes publicKey);
event AccountRecoveryStopped();
event AccountResetted(bytes publicKey);

// solhint-disable-next-line no-empty-blocks
Expand Down Expand Up @@ -197,6 +198,14 @@ contract P256Account is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, Init
emit AccountPendingRecovey(block.timestamp, publicKey);
}

function stopRecovery() external {
require(address(this) == msg.sender, "only owner");
require(pendingPublicKey.timestamp > 0, "no recovery");

pendingPublicKey.timestamp = 0;
emit AccountRecoveryStopped();
}

function recovery() external {
require(
pendingPublicKey.timestamp > 0 && pendingPublicKey.timestamp + 86400 < block.timestamp,
Expand Down

0 comments on commit ed29199

Please sign in to comment.