Base Registry

Base KAIO Registry.

Overview

The base registry (BaseRegistry.sol) is a contract that implements the core functionality that a registry needs, and thus it is used as a base for most KAIO registries. These then extend the functionality as needed for their specific purpose.

Data Storage

The base registry inherits the functions and date types from the Eternal Registry Storage, but adds restrictions to who can store data in it. This is checked with the following functions:

  • _checkHasAccess() : This function checks that the identifier to store data for is valid, and that the caller has the correct role in order to store data for that identifier. Usually the role required is for admins, but extra access can be given to certain users without roles. For example in the investor registry, dealers have this extra access and can thus add data to storage.

  • _onlyConfigurableKey() : This function checks that the key to store data for is not restricted. Some keys are restricted since they are already being used by the contracts, and should not be modifiable by users, regardless of their role. One such example would be the FUND_ID in the instrument registry, since no one should be able to modify its value once it is set by the contract.

User Registry

An extension of the base registry known as the base user registry (BaseUserRegistry.sol) is used for registries storing user information, such as for investors or dealers. It includes additional functionality for adding and querying wallets for users, with wallets being associated with their Id.

Adding Wallet

  • Function: addWallet(address _wallet, uint256 _expiry, bytes _signature)

  • Purpose: Adds a new wallet to an existing user.

  • Parameters:

    • address _wallet: Address of the wallet.

    • uint256 _expiry: Signature expiry timestamp.

    • bytes _signature: Signature proving ownership of wallet.

  • Validation Checks:

    • Checks the signature is not expired.

    • Ensures the signature is signed by the caller.

    • Verifies the signature is meant for the given contract.

    • Confirms the signature is meant for the given chain.

    • Makes sure the caller has a valid user Id.

    • Checks the wallet is not already owned.

  • Behavior:

    • Adds a new wallet to the caller using their Id.

    • Emits a WalletAdded event, signaling the wallet has been added.

  • Example:

    addWallet(0xWallet, 1714879500, 0xSignature);

Getting Wallets

  • Function: getWallets(bytes32 _userId)

  • Purpose: Returns the list of wallets for a given user.

  • Parameters:

    • bytes32 _userId: Id of the user.

  • Return Values:

    • address[]: List of the addresses for the user's wallets.

  • Example:

Getting Id from Wallet

  • Function: getIdFromWallet(address wallet)

  • Purpose: Returns the Id to which a given wallets belongs to.

  • Parameters:

    • address wallet: Address of the wallet to check.

  • Return Values:

    • bytes32: Id of the user owning the wallet.

  • Example:

Last updated