This repo contains the set of smart contracts that provide the foundations for the Hero marketplace.
Contracts are currently only available on the Kovan testnet. The latest addresses are available here:
http://blockchain-definitions.s3-website-eu-west-1.amazonaws.com/v4/contracts.json
The Kovan migration script will also deploy fake DAI and HERO tokens to support testing.
The contracts support the following use cases:
- Creating loan requests and pricing them via a dutch auction process ->
contracts/LoanContractDispatcher.sol
andcontracts/LoanContract.sol
- Tracking Hero membership eligibility ->
contracts/Authorization.sol
- Allowing the Hero loan contracts to interact with DAI ->
contracts/DAIProxy.sol
- Hero members referring others in exchange for token rewards ->
contracts/ReferralTracker.sol
As per the original whitepaper, lenders need to deposit 200 HERO tokens in order to be able to invest on the marketplace.
These deposits are held in the DepositRegistry
contract and will be withdrawable at any time provided members have verified their accounts on the Hero platform. This will be chaned in the future to allow a more flexible scheme should user fail to complete the verification process.
Withdrawing membership deposits will effectively waive the lender's right to operate on the platform; no new investments will be possible although open positions still settle normally.
The interactions between each contract are depicted here:
https://drive.google.com/open?id=1eW3AXcncLX0K-LFvi_fq9fbtviTMEdF5
Even through each loan will execute autonomously once created, the following actions still happen via a centrally controlled account:
- Authorizing a new lender on the marketplace by adding it to the
KYCRegistry
- Establishing minimum and maximum amounts and interest rates for new loan requests
- Setting up the duration for a loan dutch auction
- Pausing the Hero referral program and adding funds to it
First migrate contracts in your local blockchain:
npx truffle migrate --network ganache
or npx truffle migrate
while npx truffle dev
is open
Once migrated run the script via truffle, by default creates 10 loans, you can set the number of loans with NUMBER_LOANS
env variable:
NUMBER_LOANS=200 npx truffle exec scripts/loan-generator/main.js --network ganache
Follow the next guide in HeroHQ Notion: https://www.notion.so/herohq/Build-and-Deployment-4a34f11e65504a8babde16e484fcaa4a
- Ownership of defaulted loans isn't transferred to debt collection agents
- tests and coverage need to be added to CI