enabledao / enable Goto Github PK
View Code? Open in Web Editor NEWStablecoin loans for borderless peer-to-peer credit
Home Page: https://www.enable.credit
License: MIT License
Stablecoin loans for borderless peer-to-peer credit
Home Page: https://www.enable.credit
License: MIT License
Mailchimp campaign w/ newsletter?
Mifos Demo:
demo.fiter.io
User: mifos
Pass: password
See annotated screenshots below
Bear in mind that this amortization table is at a 3% per month interest (i.e. 36% per year), which wreaks havoc on the numbers (you'll see that a $60k loan eventually earns the bank 3 times that amount in interest!) This is the reality facing emerging markets
I used Apache Fineract below, and then go to the following URL
demo.fiter.io
User: mifos
Pass: password
https://demo.fiter.io/#/viewloanaccount/126
Parameters
Principal: US$60,000
Interest: 6% per annum (i.e. 0.5% monthly)
Grace period on Principal: 24 months
Loan Tenor: 144 months (12 years including 2 years of study)
Results
Grace period installment (1st 2 years): $295-305
Monthly installment post-graduation: $700
Final repayment tranche: 20 Sept 2030
Here's a link to a draw.io architecture diagram (can open in draw.io and make changes I believe)
https://drive.google.com/file/d/1U54sHhv3xVk7-CZ5dnR1l-UjgkhmGyRO/view?usp=sharing
I'm happy to recreate it in a more collab-friendly software if anyone has suggestions.
The parties with power to change the system are the Core Devs and a DAO of stakeholders for each loan.
The Core Devs power is intended for rapid response in contract emergencies. To that end, they can pause any contracts in the system.
However, the DAO holders have to vote on any changes they propose, and can unpause the system. They can also ban the devs from pausing if they abuse their power.
What changes are possible:
We're skipping renegotiations of terms for now - it's messy even in "real life".
The simplest approaches are web3 subscriptions in front end, and TheGraph.
I imagine we'll eventually want a service that handles making queries to data sources for each of our integrations.
Simple web3 subscription in front-end and filtered events should be fine here
However, the Bloom attestation events don't use indexed parameters 😬
They do have good event coverage, TheGraph would work
We can design it to have good event coverage.
Payment values derived 'on demand' vs Payments Table
It's about gas cost, complexity on users, and if one enables more w/ tradable debt tokens
Withdrawal vs Direct Transfer
I'm a fan of withdrawal pattern rather than dealing with the loops and sending money directly. It removes the potential looping pitfalls and gives the lenders more control becuase they can choose when and where to send their funds.
I'm going to just take a crack at high-level specs and user story, which we can refine over the next few days.
Step 1: Borrower deploys Loan Request
Borrower should be able to deploy a Loan Contract
, which defaults to the initial state of "New Request". The borrower will specify loan request params, which are the following:
Step 2: Loan Request produces deterministic amortization schedule
Loan Proposal should have a call
function that, based on proposed loan parameters, generates an amortization schedule (i.e. proposed repayment schedule). This removes the possibility for ambiguity (e.g. different rates)
Step 2B: Social Attestation
Once Loan Request is created, others can "attest" for the loan through Bloom ID or 3Box linked accounts
Step 3: Lenders can view Loan Request and amortization schedule
Once Loan Contract (at the stage of 'new request') has been deployed, lenders should be able to view the loan request on a frontend app. The frontend app should show the loan parameters that the borrower requested. The frontend app should also show the amortization schedule (i.e. repayment table). The frontend app might also show some graphs to show the declining outstanding balance.
Step 4: Lenders can fund the loan request
[Needs more thought] Lender should be able to either:
For simplicity, Lender should use a stablecoin (e.g. Dai). However, given that Dai is currently trading at 0.95, we might explore fiat-collateralized stablecoins (e.g. Paxos, USDC) as an interim measure.
Step 5: Loan Contract needs to determine what to do as funding period ends
[Needs more thought] Mechanics associated with ending funding period:
Step 6: If fully funded, Borrower needs to confirm the loan and disburse principal to wallet
Once the loan funding amount is reached, borrower can "confirm" the loan, with the total amount being .send
to their pre-specified wallet address. For safety we might have a method to allow him/her to withdraw a variable amount (e.g. 1 Dai) to make sure the wallet address is correct.
Step 7 (loop): Borrower makes a repayment to the loan contract each month
Each month, Borrower calls a MakeRepayment contract and pays a stablecoin (e.g. Dai, USDC etc).
Needs thought What happens if borrower just sends money into smart contract, without calling MakeRepayment? (i.e. confusion or mistake made)
Step 8: Loan Contract assesses each repayment and updates Amortization table
Loan Contract will track repaid amount and update the Amortization table. If Repayment is late, repayment amount will go into settling the payment streams in order (i.e. Penalties, Fees, Principal, Interest).
Step 9: Amortization table should deterministically update outstanding loan amount and calculate additional interest if borrower defaults
If borrower defaults on multiple repayments, Loan Contract should have a call
method that takes into account the additional interest (or late fees) so it can deterministically calculate additional interest / late fees.
Random ideas
Twitter poll posted at:
https://twitter.com/onggunhao/status/1132978090420916224
If we do need a table, I envision us passing it in on contract creation and having it be static.
This is a plus for the bounty judgers, to have a live site with an email opt-in.
Surya for graphing out contract dependencies
https://github.com/ConsenSys/surya
Developer environment
https://medium.com/edgefund/testing-and-code-coverage-of-solidity-smart-contracts-660cb6291701
https://blog.coinfabrik.com/test-solidity-smart-contracts-using-travis-ci/
As discussed.
I should be able to make it such that debt orders submitted to kernel revert if the "rightful lender" doesn't send it.
Dai might be too volatile and high stability fees might result in very high interest rates (currently 14.5%). For 150% collateralized loans on Dharma, the interest rate is 11%.
Dai currently only trades at ~0.98 : 1 USD. The exchange rate still fluctuating and there is a chance that it changes in the future, leaving Ines susceptible to forex risk.
Fiat-based stablecoins might have significantly lower interest rates.
bloom-starter-react
Heroku docsSet up Heroku app for staging
Set up Heroku app for prod
Set up Heroku pipeline
Add collabs
Document deployment process to README.md
(KIV due to time? Also Heroku's review apps are pretty nice)
Where?
User staking is very simple - users can just stake for another user in this contract and an event is emitted. The indexing service collects these and they are used as part of the calculation to determine the creditworthiness of an individual.
To prove business case of 2-sided loan marketplace, we need funders willing to lend money.
Daniel to use wireframes and talk to people in industry, w intent to validate and rapidly iterate prototype / business case:
Come up with first cut wireframes of frontend to drive product discussion + requirements
Enable is a P2P marketplace. We've validated demand for one side (i.e. demand for loans). I don't think we've validated demand for the other side (i.e. supply of loans). It's critical to validate this for the following reasons:
Ines needs to have some idea of whether she needs to find alternatives
The time cost of building even a MVP is high, and there is opportunity cost on our part
This is especially for the design / front-end eng part, which is time consuming
I learned a few hard lessons from previous startups:
Always do a demand experiment before sinking in time / resources (i.e. Tim Feriss)
Do riskiest assumption tests, instead of building MVPs: i.e. test core value prop before getting stuck in product / eng
I'll use 2hrs to do up a simple one page site at www.ines.fund. This one page site will articulate the lender value proposition. It'll include the interest rate, repayment schedule, our backstory at the hackathon
This data is important for us to figure out whether this project looks more like a GoFundMe, Kiva, or LendingClub.
I'll put this out on Crypto Twitter and Reddit etc, and we'll ask the community to help us forward it around. Hopefully Consensys will help us spread the survey.
I see this as a low-risk experiment which helps us learn quickly and fail fast.
If the results come back negative, I still think I'll work on the project but really focus on the Solidity stuff instead of trying to fill the gaps on design/UX and "bizdev".
Step 1: Borrower deploys Loan Request
Borrower should be able to deploy a Loan Contract, which defaults to the initial state of "New Request". The borrower will specify loan request params, which are the following:
Step 2: Loan Request produces deterministic amortization schedule
Loan Proposal should have a call function that, based on proposed loan parameters, generates an amortization schedule (i.e. proposed repayment schedule). This removes the possibility for ambiguity (e.g. different rates)
Step 3: Lenders can view Loan Request and amortization schedule
Once Loan Contract (at the stage of 'new request') has been deployed, lenders should be able to view the loan request on a frontend app. The frontend app should show the loan parameters that the borrower requested. The frontend app should also show the amortization schedule (i.e. repayment table). The frontend app might also show some graphs to show the declining outstanding balance.
Step 4: Lenders can fund the loan request
[Needs more thought] Lender should be able to either:
For simplicity, Lender should use a stablecoin (e.g. Dai). However, given that Dai is currently trading at 0.95, we might explore fiat-collateralized stablecoins (e.g. Paxos, USDC) as an interim measure.
The MVP live demo imo is a lender signing on, checking out the homepage / loan / user profile, and requesting data from the user.
I'm using Ines (Borrower) and Daniel (Lender) as the sample users here.
Any more steps we can add to the UI are good:
More important than any by far is a well researched business case imo
Large text (user public profile, loan description): We can just mock it up in the front-end, or store on IPFS if there is time.
User photo: Likewise.
Why
Todos
Originally, Ines requested for the ability to do "early settlement" for the loan request (e.g. after 5 years) as the cost of interest is very high
Early settlement by paying off the entire loan (i.e. clearing out all future loan tranches) is very easy. Just sum over all outstanding loan tranches and pay it off
Early settlement by waiving additional interest (i.e. paying on the principal on future loan tranches) requires us to have a PMT function to break down future loan tranches into principal, interest payments - and only pay off the outstanding principal amounts
(early repayment by paying all outstanding loan tranches) at the 5 year mark in April 2026: Ines will pay total of $85,774
(early repayment by waiving additional interest): Ines will only pay 5 years worth of interest (I'd estimate around $72,000)
Dharma
It will add unnecessary complexity for the loan process and will still require custom code for the crowdfunding aspect. We can certainly take architectural inspiration.
Compound
I have some questions/concerns regarding the loan:
Can we use existing tools (e.g. 3Box or uPort) to verify social media profiles of borrowers and attestors?
If we do it from scratch, can we use the LinkedIn OAuth flow to get users' token and verify ownership of LinkedIn account?
Loan Contract needs method to allow another wallet (hopefully w/ 3Box or uPort) to attest
Is there a better name for social attestation? Gah
Some previous discussion:
Reddit discussion on Dai crowdsale contract:
https://www.reddit.com/r/ethdev/comments/8iith6/what_would_a_crowdsale_raise_in_dai_look_like/
BlankDAO evidently did a crowdsale using Dai:
https://github.com/BlankDAO/smart-contracts/blob/master/contracts/BlankCrowdsale.sol
The loan contract is essentially an extension of openzeppelin crowdsale contracts that takes in a loan token rather than either.
Next work:
A lot of this is business-related, and Ines will be driving this
Paxos
Paxos' redemption process
TrueUSD
TrueUSD Redemption Process
https://www.colendi.com/
Colendi is doing sovereign ID + Credit scoring mechanism as their core product.
Conclusion: Core business is possible partner, looking to build competing product in the future
Ultimate vision: “In Colendi ecosystem, users can create their Colendi ID and get Colendi Score and can join Colendi network to access microcredits, P2P financing and installment shopping by simply using Colendi app.”
Interesting project for ethereum loans. Talks about support for unsecured loans in the future, they have users earn 'credit tokens' on successful repayments that they can stake as 'reputational collateral' in future loans.
Conclusion: Good source of inspiration
Online P2P loan marketplace. No blockchain, just people! Interesting case study in p2p unsecured lending.
https://www.reddit.com/r/borrow/
Step 2B: Others can "attest" for the loan (i.e. use Bloom or 3Box-linked Ethereum accounts to support the loan)
Once Loan Request is created, others can "attest" for the loan through Bloom ID or 3Box linked accounts
Wireframes for social attestation @onggunhao
Set up Bloom ID attestation
@onggunhao Watch Bloom Workshop to understand starter kit
We need a Decentralized ID provider for the Borrower and Social Attestor's identity and links to their socially verified profiles.
There is also a read-only 3Box API:
Read-only 3Box Build API
// Read profile data
const profile = await Box.getProfile(<ethereum-address>)
console.log(profile)
// Output:
// {
// name: 'mollie the narwhal',
// emoji: 😋
// }
const name = await box.public.get('name')
console.log(name)
// Output:
// 'mollie the narwhal'
const email = await box.private.get('email')
console.log(email)
// Output:
// 'mollyí[email protected]'
// SET
// Update public profile data
await box.public.set('name', 'Molly the Narwhal')
// Update encrypted profile data
await box.private.set('email', '[email protected]')
"Global Namespace"
dApp-specific Space
// Read space data
const spaceData = await Box.getSpace(<eth-address>, 'myApp')
// SET
// Open space for writing
const myAppSpace = await box.openSpace('myApp')
// Update public space data
await myAppSpace.public.set('favorite-nft', 'Space Narwhal')
// Update encrypted space data
await myAppSpace.private.set('last used', 'id-of-last-used-item')
box.private
a global namespace for the user? (i.e. if I create a new key called loans
, another app could possibly remove it?).box.space.public
a thing? For a specific use case - I want people to know that this person has an open loan, but nobody except my dApp can change the valuesbox.logout
- will this continue to work, even if the user logs out of Metamask? (are you caching the jwt in localstorage?Box.isLoggedIn
check for? Does this refer to whether the user is logged in via Metamask, or whether they've authorized us to open a box?Box.getVerifiedAccounts
?box.verified
- what does this do?box.linkAccount
- how is linking
different from verifying
?box.isAccountLinked
- same as aboveverified.DID()
- what does this return? The Ethereum address?@tspoff
I am starting to implement the Mockups from @onggunhao in #13 .
Is there a particular preference for rebass
https://rebassjs.org/getting-started,
We will need something with more components.
I am thinking we could use this to test https://rimble.consensys.design/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.