πŸͺΆNotary

Permissioned Interface System

Design Ethos

The Notary is a contract that holds permissions for each critical wallet action. Where-as with a Gnosis Safe that has a group of owners and optional modules, Locksmith uses a progressively granular permission scheme that allows for maximum flexibility while maintaining a single integration pattern.

The Notary is designed to approve actions that operate on a wallet's state, like moving collateral or firing events. To approve any action the notary must determine that the action meets acceptable parameters as outlined by a wallet root key holder.

As of the first version, the Notary includes the following permissions:

  • Collateral Providers: Contract addresses that adhere to the ICollateralProvider interface and are trusted by the wallet's root key-holder to custody funds safely on-chain.

  • Scribes: Contract Addresses that are trusted to move funds on the Ledger between keys in a wallet.

  • Dispatchers: Contract addresses that are trusted to register and fire events within the wallet to the TrustEventLog.

These modules are entrusted by the root key holder to provide and extend the wallet's capacity to store, move, and automate funds. The same contract can hold multiple permissions but are acquired and set separately for composability.

Smart Contract interaction and trust model

Storage

The 'ledger' component in these mappings is the message sender that is querying for notarization. In the current implementation this is the Ledger and the TrustEventLog.

locksmith

The reference to the Locksmith interface. Instead of using a contract registry, each Locksmith contract takes a direct deployment dependency on a contract it requires to operate.

withdrawalAllowances

A key holder will go to the collateral provider to request a withdrawal. For collateral providers to offer a valid withdrawal, it must be fully registered and balanced on the ledger and pass notarization. Since the collateral provider does not explicitly hold the key, a critical part of withdrawal notarization is to ensure the key-holder who is withdrawing has attested to approve that amount, of that asset, from that ledger, for that collateral provider. At later layers this is composed into a single transaction.

actorRegistry

A mapping of contract address of modules that are approved for each trust model, for each role. The roles are defined as simple unsigned integers and are documented below. These are checked during operations to ensure the actors are considered trusted.

actorAliases

Human readable alises for each contract address and role. Because no off-chain infrastructure should be needed to create a feasible UX, we are paying the gas and the storage to provide some sane expectations for clients.

COLLATERAL_PROVIDER

This role describes an actor that is trusted by the root key holder to honor asset deposit and withdrawal requests from key holders, respecting the key-holder balances on the wallet's central Ledger. This enables wallet owners to compose their asset storage and investments with different features and providers directly into their wallet. On-chain Vaults, Staking providers, or exchanges can expose on-chain ICollateralProvider interfaces and honor key-rights. This in effect brings all deployed assets back into a single virtual wallet.

SCRIBE

This role describes an actor that is trusted by the root key holder to move funds between keys. A scribe has the ability to move any funds on the ledger between any set of valid keys within the wallet's trust model. It is up to the root key holder to sufficiently trust the means by which the scribe will move funds. Contracts that restrict access to move funds under different scenarios can be composed.

DISPATCHER

This role describes an actor that is trusted by the root key holder to register and fire events. Events are immutable boolean triggers that can be consumed by collateral providers, scribes, or other applications to compose additional logic and gates into features.

Operations

There are two typese of operations. There are operations that can only be successfully executed by a root key holder, and there are operations that are assumed to be executed by the associated role's ledger.

setTrustedLedgerRole

This method is called by a root key holder to specify to trust or untrust a specific contract address for a given role. It ensures that the root key holder is valid, and then will double check the users action before storing the root key's configuration.

This method can only be successfully called by a root key holder.

setWithdrawalAllowance

All key holders must attest to the notary that collaterael providers are cleared to register withdrawals to the ledger on their behalf. This is because the collateral provider is not required to hold the key when facilitating a withdrawal. But in its place resides the key holder attestation to the notary.

A key holder calls this method, usually right before a withdrawal, to enable the collateral provider to successfully register on the ledger.

This method can only be successfully called by a key holder.

notarizeDeposit

The wallet's central ledger will call this for notarization when a collateral provider attempt to deposit to a wallet's ledger. This will fail if the key is invalid, or if the collateral provider is not trusted by the wallet's root key holder.

Below is also an internal method, requireTrustedActor(), that is used for multiple notarization operations.

notarizeWithdrawal

The wallet's central ledger will call this for notarization when a collateral provider attempt to withdrawal to a wallet's ledger. This will fail if the key is invalid, the withdrawal allowance for that key holder, provider, and asset is insufficient or if the collateral provider is not trusted by the wallet's root key holder.

The notary does not check the ledger for sufficient balance. The ledger will fail to create a valid entry on its own. The notaries role is the ensure everything else is proper.

notarizeDistribution

This method is called by the ledger when a scribe is attempting to re-distribute funds amongst keys. The notarization will fail if the involved scribe or collateral provider isn't trusted, or if the keys do not all belong to the same ring.

notarizeEventRegistration

This method is called by the TrustEventLog to ensure that a dispatcher whom is registering an event is trusted by the specified wallet owner. This prevents spam, attacks, or otherwise random events from popping up in the event stream. In this implementation, two default dispachers are included (KeyOracle and AlarmClock)./**

Last updated