Skip to content

Native Vault

The NativeVault extends the IKarakBaseVault standard, which enables easy deployment of the vault handling native restaking. The architecture for native restaking comprises a NativeVault which is a specialized ERC4626 vault with overridden functions to handle shares based on a virtual asset instead of an ERC20 token. Due to this requirement the NativeVault had to be made separate from the default ERC20 vault. A NativeVault itself acts as a Beacon for a NativeNode with a createNode function which deploys a new NativeNode for the caller.

Implementing IKarakBaseVault

Accepting extra data

Since NativeVault requires more data than just what the base interface defines we use the _extraData bytes to pass that data to the NativeVault. Here's how we get that data:

(address manager, address slashStore, address nodeImplementation) =
    abi.decode(_extraData, (address, address, address));

The manager, slashStore and nodeImplementation are required by the NativeVault according to the native restaking design.

Handling a virtual asset

Since NativeVault does not accept a real asset, such as an ERC20 token, this becomes specialized case for extending the base vault interface. Hence the asset function returns an address(0) as follows:

function asset() public pure override returns (address) {
    return address(0);
}

The totalAssets in this vault are tracked simply by a uint256 state variable hence the function looks like this:

function totalAssets() public view override returns (uint256) {
    return _self().totalAssets;
}

Due to this special requirement, the _depositToken in the initialize function is not used by the NativeVault and it should be passed as a 0xDEADBEEF address in the initialize function.