🔒Account Lock

The Account Lock contract is used to provide the account guardians with essential functions to perform account locking operations on the smart wallet accounts they may be guarding.

Only a single instance of the Account Lock contract is deployed.

You can refer to the Guardian smart wallet architecture to understand the high-level inter-dependencies between various contracts.

Usage

On the client side:

Use the AccountGuardian contract address directly on the client side to interact with the deployed contract.

In smart-contract projects:

import {AccountLock} from "@guardian-wallet/contracts/utils/AccountLock.sol"

Functions

function createLockRequest(address account) -> bytes32

Triggered by a guardian to create a lock request for an account they may be guarding.

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Params:

account address of the smart wallet account to be locked.

Returns:

bytes32 the account lock request hash.


function createUnLockRequest(address account) -> bytes32

Triggered by a guardian to create an unlock request for a locked account.

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Params:

account address of the locked smart wallet account to be unlocked.

Returns:

bytes32 the account's unlock request hash.


function recordSignatureOnLockRequest(bytes32 lockRequest, bytes calldata signature)

Records guardian's signature on the lock request of an account, it may be guarding. It updates the lockRequestToGuardianToSignature mapping.

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Params:

lockRequest Active lock request of an account.

signature Guardian's signature on the lock request


function recordSignatureOnUnLockRequest(bytes32 unLockRequest, bytes calldata signature)

Records the guardian's signature on the unlock request of a locked account. It updates the unLockRequestToGuardianToSignature mapping.

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Params:

unLockRequest Active lock request of an account.

signature Guardian's signature on the lock request


function accountRequestConcensusEvaluation(address account) -> bool

This function is used to evaluate if consensus was achieved on an active lock/unlock request of an account. This will return true if the majority of the account guardians sign the lock/unlock request for the account.

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Params:

account An account whose lock request consensus is being evaluated.

Returns:

bool Returns a boolean flag representing the result of the lock request consensus.


function activeLockRequestExists(address account) -> bool

Returns a boolean indicating if a lock request for the account already exists.

Params:

account Account for which active lock request is being checked

Returns:

bool Returns a boolean indicating whether there is an active lock request for the account or not.


function activeUnLockRequestExists(address account) -> bool

Returns a boolean indicating if an unlock request for the account already exists.

Params:

account Account for which active unlock request is being checked.

Returns:

bool Returns a boolean indicating whether there is an active unlock request for the account or not.


function getLockRequests() -> bytes32[] memory

Returns all the lock requests of the sender (guardian).

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Returns:

bytes32[] Array of all active lock requests of all accounts the guardian is guarding.


function getUnLockRequests() -> bytes32[] memory

Returns all the unlock requests of the sender (guardian).

Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.

Returns:

bytes32[] Array of all active unlock requests of all accounts the guardian is guarding.


Last updated