🤝Account Guardian

The Account Guardian contract allows smart wallet account holders to manage their account guardians.

Since the Account Guardian contract handles individual accounts' guardian operations, a new instance of the Account Guardian contract is deployed on every new smart wallet account.

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 {AccountGuardian} from "@guardian-wallet/contracts/utils/AccountGuardian.sol"

Functions

function addGuardian(address guardian)

Add guardians for your smart wallet.

Can only be called by the smart wallet account, AccountLock and AccountRecovery.

Params:

guardian the verified guardian address being added as an account guardian.


function removeGuardian(address guardian)

A user will be able to remove allotted guardian(s) from their smart-wallet guardian list. The address should be a registered guardian for the account.

Can only be called by the smart wallet account, AccountLock and AccountRecovery.

Params:

guardian address of the guardian the user wishes to remove.


function getAllGuardians() -> address[] memory

Returns a list of all added account guardians for the sender’s smart wallet account.

Can only be called by the smart wallet account, AccountLock and AccountRecovery.

Returns

address[] List of account guardians of the sender’s smart wallet.


function isAccountGuardian(address guardian) -> bool

Returns a boolean value indicating if the guardian is the sender’s guardian or not.

Can only be called by the smart wallet account, AccountLock and AccountRecovery.

Params:

guardian guardian to be checked for

Returns:

bool Bool flag indicating if the guardian is guarding the account


function getTotalGuardians() -> uint256

This will return the number of guardians allotted for a smart wallet account. Will be used when creating shards of the account's private key.

Returns:

uint256 No. of allotted account guardians


Last updated