Dharma is a protocol for generic tokenized debt issuance and fundraising on blockchains supporting requisite smart contract functionality (i.e. EVM blockchains). For a full description of the protocol's mechanics, a thorough overview can be found in the Dharma Protocol Whitepaper. This repository contains the core contracts that compromise the business logic for issuing and administering debt crypto-assets on-chain.
We use truffle for deployment, testing, and development.
Join us on our chat for any technical or general questions.
Install dependencies:
npm install
Start testrpc
:
npm run testrpc
Run truffle
tests:
npm test
A wrapper library for all business logic associated with crowdfunding, administering, and pricing-via-auction any loans issued under the Dharma Protocol. Loans inherit logic from RedeemableTokenLib
, and, as such, expose standardized logic for redeeming value from loan repayments on a pro-rata basis for debt token holders. Note that this generic logic is exposed in the form of a library, and that no state is stored in the LoanLib.sol
.
2. LoanRegistry.sol
This contract functions as a factory for creating debt assets in Dharma Protocol, and, in turn, as a registry and store for state and metadata associated with said assets. The business logic exposed by these assets is inherited from LoanLib.sol
.
Implements a superset of the ERC20 token standard's functionality that allows for what we call "redeemable tokens". Redeemable tokens are assets where ownership of a token represents a right to pro rata cash flows that are generated by the asset. As an illustrative example, consider a loan as a redeemable token: if an individual holds X%
of the token supply, and a repayment is made to the loan (i.e. the totalValueAccrued
is increased by Y
), that individual will be able to redeem X%
of the totalValueAccrued
. This functionality is inherited by LoanLib.sol
.
A centrally managed on-chain registry of the above contracts' deployed addresses as corresponding to the protocol's release version. For the time being, this is a (centralized) mechanism for upgrading the protocol contracts.
All of the above contracts use SafeMath.sol
as a generic library for safe mathematical operations. The file is part of OpenZeppelin's fantastic libraries.
Boilerplate migration code used by the truffle framework.