Skip to content

Vaults

Karak uses Vaults to handle restaked assets. Each Vault is attached to an Operator and is automatically considered delegated to that Operator. Once a user deposits assets to a particular vault they are implicitly delegating to the Operator who owns that Vault. The Vault is subject to both slashing and rewards depending upon on the DSS that the Operator is registered to. Although Karak brings in its default tokenized Vault built on the ERC4626 standard, there might be cases where developers would want to build their own Custom Vault implementations to handle certain assets. Karak Native Restaking was one such case where we developed a different Vault implementation called the NativeVault and manage it with Core. Take a look at the examples section to better understand how Karak compatible vaults can be built. Following is an overview of the steps that need to be followed to implement your own custom vault and deploy it with Karak Restaking Core: Deploy Custom Vault

  1. Create a Vault based on the IKarakBaseVault interface which enables the vault to be deployable and manageable by Karak Core.
  2. Reach out to the Karak team to get the asset of your vault allow listed in Core to be able to deploy the vault.
  3. If your vault implementation is custom and not using the existing Karak 4626 Vault then you will have to get the Vault Implementation allow listed in Core as well. Reach out to the Karak team for the same.
  4. Prepare the VaultConfig for your vault to prepare payload for the deploy function:
struct Config {
    // Address of the vault asset
    address asset;
    // Decimal precision
    uint8 decimals;
    // Operator the vault will be delegated to
    address operator;
    // Name of the Vault
    string name;
    // Symbol for the Vault
    string symbol;
    // Any extra data that you would like to send to your vault
    bytes extraData;
}
  1. Call the deployVaults() function in Core to deploy your vault:
function deployVaults(
    // List of Vault Configs prepared in step 4.
    VaultLib.Config[] calldata vaultConfigs,
    // Address of the Vault Implementation,
    // can be address(0) to use the default karak ERC-4626 vault implementation
    address implementation
) external returns (IKarakBaseVault[] memory vaults);