MetavaultsContract Functions

MetaVaultsRegistryV2

The registry stores configuration for each MetaVault Safe on its chain. A reader looks up a known key with the getter for its value type. For example, the core.wrapper address identifies the share token and the contract that handles deposit and redemption requests. Registry addresses

Read a value

Every getter below takes the same two arguments. vault is the address of the vault Safe on this chain. key is a bytes32 hash of the exact UTF-8 key name, including punctuation and case.

bytes32 key = keccak256(bytes("core.wrapper"));
bool configured = registry.isKeySet(vaultSafe, key);
address wrapper = registry.getAddress(vaultSafe, key);
FunctionReturn typeMeaning
getAddress(address vault, bytes32 key)addressAccount or contract named by the key. For example, core.vault identifies the infrastructure vault and core.wrapper identifies its wrapper.
getString(address vault, bytes32 key)stringText such as the display name under metadata.name.
getUint256(address vault, bytes32 key)uint256Unsigned quantity in the unit defined for the key. For example, settlement.minInterval is in seconds.
getBytes(address vault, bytes32 key)bytesStored bytes. Interpret the payload according to the key's schema.
getBool(address vault, bytes32 key)boolBoolean flag.
isKeySet(address vault, bytes32 key)boolWhether the stored bytes have nonzero length. A stored numeric zero or false counts as set. An empty raw bytes value counts as unset.
isKeyLocked(address vault, bytes32 key)boolWhether the vault itself is prevented from writing the key.
authority()addressThe access manager that authorizes administrative calls to this registry.

An unset key returns the getter's zero value. Use the getter matching the stored type. A getter for a different type may return a misleading value or revert during decoding. To discover keys for a Safe, index the registry's typed write events for that Safe.

Write configuration

The vault Safe can set an unlocked key in its own namespace. A caller authorized by the registry's access manager can also write, including to a locked key. Each scalar setter takes vault, key and the new typed value, returns no value, and emits the event corresponding to the overload.

Setter signatureEvent
set(address,bytes32,string)StringSet(vault,key,value)
set(address,bytes32,address)AddressSet(vault,key,value)
set(address,bytes32,uint256)Uint256Set(vault,key,value)
set(address,bytes32,bytes)BytesSet(vault,key,value)
set(address,bytes32,bool)BoolSet(vault,key,value)

For several keys in one transaction, call set(address vault, RegistryEntry[] entries). Entries are applied in order. A failure reverts the entire batch.

struct RegistryEntry {
    bytes32 key;
    bytes value;
    uint8 valueType;
    bool lock;
}
FieldTypeMeaning
keybytes32Hash of the key name in this vault's namespace.
valuebytesRaw payload for a bytes entry. For the other four types, supply abi.encode(typedValue).
valueTypeuint80 string, 1 address, 2 uint256, 3 bytes, 4 bool. Selects the typed event.
lockboolIf true, lock this key after setting it and emit KeyLocked when newly locked. False preserves its current lock state.

A self-write to a locked key reverts with KeyIsLocked(key). An unauthorized write to another vault’s namespace reverts. An authorized administrative write to a locked key also emits ForceSetEntry(vault,key,valueType).

Manage a lock

The access manager controls lockKey(address vault, bytes32 key) and unlockKey(address vault, bytes32 key). They take the same vault and key as the getters, return no value and emit KeyLocked(vault,key) or KeyUnlocked(vault,key). Unauthorized calls revert.

On this page