> For the complete documentation index, see [llms.txt](https://0xshiven.gitbook.io/guardian-smart-wallet-contracts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xshiven.gitbook.io/guardian-smart-wallet-contracts/guides/account-lock.md).

# 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.

{% hint style="info" %}
Only a single instance of the Account Lock contract is deployed.
{% endhint %}

{% hint style="info" %}
You can refer to the [Guardian smart wallet architecture ](/guardian-smart-wallet-contracts/overview/architecture.md)to understand the high-level inter-dependencies between various contracts.
{% endhint %}

### **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:

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

### **Functions**

```jsx
function createLockRequest(address account) -> bytes32
```

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

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**Params:**

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

**Returns:**

`bytes32` the account lock request hash.

***

```solidity
function createUnLockRequest(address account) -> bytes32
```

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

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**Params:**

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

**Returns:**

`bytes32` the account's unlock request hash.

***

```solidity
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.&#x20;

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**Params:**

`lockRequest` Active lock request of an account.&#x20;

`signature` Guardian's signature on the lock request

***

```solidity
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.&#x20;

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**Params:**

`unLockRequest` Active lock request of an account.&#x20;

`signature` Guardian's signature on the lock request

***

```solidity
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.

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**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.

***

```solidity
function activeLockRequestExists(address account) -> bool
```

Returns a boolean indicating if a lock request for the account already exists.&#x20;

**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.

***

```solidity
function activeUnLockRequestExists(address account) -> bool
```

Returns a boolean indicating if an unlock request for the account already exists.&#x20;

**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.

***

```solidity
function getLockRequests() -> bytes32[] memory
```

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

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**Returns:**

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

***

```solidity
function getUnLockRequests() -> bytes32[] memory
```

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

{% hint style="warning" %}
Can only be called by a verified account guardian, allotted by the smart wallet owner as a guardian.
{% endhint %}

**Returns:**

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

***
