Allowing people to lend their digital assets (token) with limited risk and cost is one of the promises of DeFi. People should be given the maximum amount of freedom and security without the pain of complexity. This challenge gave us the chance to develop our skills on all three levels: frontend, backend, and Scrypto. Meanwhile, we also created something that is useful for the community to use. Enjoy!
The core idea is to give users the ability to lend any amount of token for collateral of their choice and a fee (per hour) of their choice. This use case is standard in traditional finance e.g. when private people refinance their house by taking a new credit. We believe this is an important use case as we expect more tokenized assets to come to radix in upcoming years. By using an oracle sending timestamps, we solved the biggest disadvantage radix faced against traditional finance.
Lending offers can be accepted by sending the collateral and a fee. A part of the fee will be returned when the lending assets are returned before the time runs out. Otherwise, the lender has the option to keep the collateral and the fee by calling the
default() method when the maximum borrow time is expired.
The smart contracts were written in Scrypto. A
centralComponent serves as a creator for
lendingOffers, it keep a list of active
lendingOffers and authorizes the oracle to be the only instance to deliver timestamps by using Radix's innovative badge system.
The oracles which is sending the current
unix-time (nb of seconds since 1970) is build with node.js. It is able to communicate with the ledger by building transaction, signing and sending them without human intervention.
We're planning to make it more granular, user friendly and to improve the interface to make this project a part of the Impahla ecosystem. We might add a decentralized oracle and add the ability to lend NFTs as well with slight changes to the core contracts.
Have a look at the readme for more detail about it, and to see how to make it work locally.