# Guardian Contract

The **Guardian** contract provides the account guardians with essential functions to onboard themselves to the Guardian smart wallet system along with providing guardian-related information to the other contracts to help them carry out their functions related to the "Guardian" stakeholder.

{% hint style="info" %}
&#x20;Since the **Guardian** contract handles a guardian’s system-level operations, only a **single instance** of this contract is deployed.

For account-specific guardian operations, [check out the`AccountGuardian`contract.](https://app.gitbook.com/o/LjYGRkRPnnKrhcijwaQJ/s/kLTZ8B9UcK4qCh4H7J8P/~/changes/15/guides/account-guardian)
{% 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 Guardian contract address directly on the client side to interact with the deployed guardian contract.

#### In smart-contract projects:

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

### **Functions**

```jsx
function addVerifiedGuardian()
```

This function will add the sender as a verified guardian to Guardian Smart Wallet's guardian list.

***

```jsx
function isVerifiedGuardian(address isVerified) -> (bool);
```

Will check if an address is a verified guardian in Guardian Smart Wallet's system.&#x20;

**Params:**

`isVerified` the address to be checked for a verified guardian.&#x20;

**Returns:**

`bool` Boolean value indicates if an address is a verified guardian or not.

***

```jsx
function removeVerifiedGuardian()
```

Removes the sender as a verified guardian.

***

```solidity
function linkAccountToAccountGuardian(address account, address accountGuardian)
```

Used to maintain a record of each account and it's guardian contract instance(`accountGuardian`)&#x20;

**Params**

`account` Address of the account that got initialized&#x20;

`accountGuardian` Address of the guardian contract of the account

***

```solidity
function addGuardianToAccount(address guardian, address account)
```

Creates a mapping of smart wallet accounts to their respective guardians&#x20;

**Params**

`guardian` Guardian to be added to account&#x20;

`account` An account whose guardian list is to be updated.

***

```solidity
function getVerifiedGuardians() -> address[] memory
```

**Returns:**

`address[]` Array of verified guardian addresses

Returns the list of verified guardians in the Guardian Smart Wallet system

{% hint style="info" %}
Can only be called by the dApp owner.
{% endhint %}

***

```solidity
function getAccountGuardian(address account) -> address
```

Returns the `accountGuardian` contract address of a smart wallet account.&#x20;

**Params:**

`account` The account who’s **Account Guardian** contract instance address is required.&#x20;

**Returns:**

`address` address of the **Account Guardian** contact instance

***

```solidity
function getAccountsTheGuardianIsGuarding(address guardian) -> address[] memory
```

Returns the list of accounts a guardian is guarding.&#x20;

**Params**

`guardian` Guardian whose account list has to be returned.

**Returns**\
`address[]` The array of addresses the guardian is guarding.

***

```solidity
function getAccountRecovery(address account) -> address
```

Returns the address of the **Account Recovery** contract of an account. It will be used by guardians to get the *account recovery request* and send the signature back to the **Account Recovery** contract.

**Params:**

`account` The address of the account for which its recovery contract is requested

**Returns:**

`address` The address of the Account Recovery Contract of a smart wallet account

***

```solidity
function isGuardingAccount(address account, address guardian) -> bool
```

A checker function to check if an address is a guardian for the account.&#x20;

**Params:**

`account` Account address for which the guardian is being checked.

`guardian` The guardian address that is being checked for being a guardian of the account.

**Returns:**

`bool` Boolean to indicate if the `guardian` address is guarding the `account`

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://0xshiven.gitbook.io/guardian-smart-wallet-contracts/guides/guardian-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
