-
Notifications
You must be signed in to change notification settings - Fork 50
DebtRegistry Specification
The DebtRegistry contract serves as the canonical registry of all debt agreements issued via Dharma protocol. We intentionally heavily restrict the mutability of the registry such that only an extremely limited set of mutations on the registry can be executed by a well-defined set of parties. Moreover, we design the registry in a manner that is future-proof, modular, and upgradeable. First, we define some terminology:
-
Creditor - the address of an entity who "owns" a given debt and expects to receive repayments from it.
-
TermsContract - the address of a smart contract adhering to the Terms Contract Interface -- this contract defines the expected terms of repayment and can be used to deterministically determine whether or not a given debt has been defaulted on.
-
TermsContractParameters - a string of text ingested by a given terms contract that contains parameters defining repayment terms in a given TermsContract. As an example, a TermsContract could define a generic, simple interest rate repayment scheme, and its associated TermsContractParameters string would contain the interest rate parameter. The schema of the TermsContractParameters is not enforced by the DebtRegistry, but, rather, can vary based on the TermsContract it is associated with.
-
Agents - addresses that have permission to execute a certain type of mutation on the registry (not to be confused with "agents" as defined in the Dharma white paper)
-
Owner - the address of the contract's owner. Can be an entity's address or a multisig wallet.
-
Version - a string specifying the version of the TermsContractInterface which any given entry's TermsContract adheres to. Version string adheres to semantic versioning schema.
-
Underwriter - refer to the the Dharma whitepaper.
-
Underwriter Risk Rating - refer to the the Dharma whitepaper.
-
Entry Hash - a hash of the debt issuance commitment associated with any given registry entry.
Each entry stores the following data points in some capacity:
{
version: <Version String>
creditor: <Creditor's Address>,
termsContract: <Terms Contract Address>,
termsContractParameters: <Terms Contract Parameters String>,
underwriter: <Underwriter Address>,
underwriterRiskRating: <Underwriter's Risk Rating>,
entryHash: <Entry Hash>
}
There are two types of mutations agents are allowed to make on the registry:
-
INSERT
- inserting a new entry into the DebtRegistry -
MODIFY_CREDITOR
- changing the address of the creditor in an existing entry
Note that the registry does no validation on data mutations it undergoes -- it assumes agents have properly validated that entries are properly formed.
Each type of mutation is associated with a mutually exclusive set of agents who are authorized to make that mutation, i.e. there is a set of agents that are allowed to make INSERT
operations and a separate set of agents that are allowed to make MODIFY_CREDITOR
operations.
In practice, each set will likely only have the address of one agent in it at a time -- namely, the INSERT
operation's permitted set will include only the DebtKernel
contract address and the MODIFY_CREDITOR
operation's permitted set will include only the DebtToken
contract address. We intentionally heavily restrict the range of permitted functionality in order to minimize the attack surface of the registry.
The reason we allow each operation's permitted set to include multiple agents is for purposes of upgrading the protocol's contract -- if we wish to upgrade, say, the DebtKernel
contract, we can deploy a new DebtKernel
contract, add it to the MODIFY_CREDITOR
operation's permitted set of addresses, and, once a majority of client applications have migrated to using the new DebtKernel
contract, remove the old DebtKernel
from the permitted set.
Dharma is a generic protocol for tokenized debt issuance. We are committed to building permissionless, non-rent seeking infrastructure for the credit markets of tomorrow. Backed by YCombinator, Polychain Capital, Green Visor Capital, and others.