Named Wallet

Code

Wallet Factory Contract

A Factory contract for deploying Named Wallets, providing an efficient and scalable solution for creating wallets with unique identities.

Address (Factory)

  • Mainnet: 0x5F53CD20ecE6605c62a3525E1031b1d87Be05D80

  • Sepolia: 0x507cBAFFaf2DbD1f872089E9aF8087F120C96710

Functions

deployWallet

deployWallet is used to deploy a new wallet contract, initializing it with the specified properties and returning the address of the newly deployed wallet contract.

function deployWallet(
    address virtualAddress,
    WalletInfo memory walletInfo,
    string[] calldata keys,
    string[] calldata values
) external returns (address)

Parameters:

Name

Type

Description

virtualAddress

address

The address associated with the virtual or designated environment where the wallet will be linked. (ex, 0x1234567890abcdef1234567890abcdef12345678)

walletInfo

A structured data type (WalletInfo) containing essential wallet details.

keys

string[]

An array of strings representing the property keys of the wallet. It is mandatory that the array includes a key labeled category

values

string[]

An array of strings representing the corresponding values for each key in the keys array. These values define the actual data or settings for the wallet's properties.

Return Values

Type

Description

address

The address of the newly deployed wallet.

computeAddress

This function computes the address of a contract that will be deployed using the CREATE2 opcode, based on the provided signer and virtual address. It returns the future address of the contract, which can be predicted before deployment.

Parameters:

Name

Type

Description

signer

address

The address of the signer, used to generate a unique salt for contract address computation.

virtualAddress

address

The address associated with the virtual environment or contract, used in combination with the signer to create a unique salt.

Return Values

Type

Description

address

The predicted address of the contract that would be deployed using the CREATE2 opcode.

getDataHash

This function computes a hash of the data that will be signed by the signer when activating a wallet.

Parameters:

Name

Type

Description

virtualAddress

address

The address associated with the virtual environment or contract, used to identify the wallet in the context of the activation process.

owner

address

The address of the person who will take over the ownership of the wallet.

Return Values

Type

Description

bytes32

The hash of the data that the signer will sign to activate the wallet.

activateWallet

This function allows the transfer of ownership of a wallet contract, deployed via deployWallet, from the signer to the owner. The wallet contract address is computed using the computeAddress function, and the ownership transfer is verified through the signature provided by the signer.

Parameters:

Name

Type

Description

signer

address

The address of the current wallet owner. This address signs the data to confirm the ownership transfer to the new owner.

virtualAddress

address

The address associated with the virtual environment or contract to which the wallet is linked.

owner

address

The address of the new wallet owner, who will receive ownership of the wallet.

signature

bytes32

The signature corresponding to the hash of the data that is generated by the getDataHash function.

Named Wallet Contract

Data Structures

Struct WalletInfo

  • The properties name, image, and description are stored in the NameTagMetadata struct (link) of OpenNameTag.

  • rate: Tax rate paid to the signer when assets are transferred from the wallet.

Functions

Asset Transfer Functions

These functions allow the contract owner to transfer assets, either native tokens (ETH) or specific tokens, to other addresses.

transferTo

  • Description: Transfers a specified amount of native cryptocurrency (ETH) to the given address. This function is restricted to the owner, ensuring that only the contract owner can transfer funds from the contract's balance.

transferTokenTo

  • Description: Transfers a specified amount of a particular ERC20 token from the contract to the given address. The contract owner is the only one authorized to initiate token transfers, ensuring control over the assets.

Configuration Functions

These functions are used to modify and update various configurations or properties of the contract. They are generally restricted to specific roles, such as the signer or factory, to ensure proper authorization before making changes.

changeTaxRate

  • Description: Changes the tax rate of the system. Only the signer is allowed to modify the tax rate to ensure that only authorized parties can make financial adjustments.

changeInfo

  • Description: Updates the basic information of the contract, such as the name, image, and description. This function is restricted to the signer to prevent unauthorized changes to the contract's identity or metadata.

addPropertyBatch

  • Description: Adds multiple properties (key-value pairs) to the contract in batch. This function can be called by either the signer or the factory, allowing for efficient property management by authorized roles.

removeProperty

  • Description: Removes a specific property identified by its key. Only the signer can remove properties, ensuring that property changes are made with proper authorization.

Last updated

Was this helpful?