๐Ÿ‘ฎโ€โ™‚๏ธ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.

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

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 Guardian contract address directly on the client side to interact with the deployed guardian contract.

In smart-contract projects:

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

Functions

function addVerifiedGuardian()

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


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

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

Params:

isVerified the address to be checked for a verified guardian.

Returns:

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


function removeVerifiedGuardian()

Removes the sender as a verified guardian.


function linkAccountToAccountGuardian(address account, address accountGuardian)

Used to maintain a record of each account and it's guardian contract instance(accountGuardian)

Params

account Address of the account that got initialized

accountGuardian Address of the guardian contract of the account


function addGuardianToAccount(address guardian, address account)

Creates a mapping of smart wallet accounts to their respective guardians

Params

guardian Guardian to be added to account

account An account whose guardian list is to be updated.


function getVerifiedGuardians() -> address[] memory

Returns:

address[] Array of verified guardian addresses

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

Can only be called by the dApp owner.


function getAccountGuardian(address account) -> address

Returns the accountGuardian contract address of a smart wallet account.

Params:

account The account whoโ€™s Account Guardian contract instance address is required.

Returns:

address address of the Account Guardian contact instance


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

Returns the list of accounts a guardian is guarding.

Params

guardian Guardian whose account list has to be returned.

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


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


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

A checker function to check if an address is a guardian for the account.

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


Last updated