masaun / tranche-lending-and-borrowing-for-agriculture-market

This is the smart contract that provide fixed-rate borrowing for farmers and lending for investors by utilizing a bond tranche scheme. 👩‍🌾🌽

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tranche lending and borrowing smart contract for agriculture market👩‍🌾🌽 (※ NOTE: This repos is still in progress)

【Overview】

  • There is a problem in agriculture sector (especially, in developing countries) that it's difficult for small farmers to access financial product (such as borrowing money for their business). Even if they can access financial product, they often need to repay extremely high interest rates. (include the case of traditional micro finance).

  • This is a smart contract that:

    • allow farmers (borrowers) to borrow money with lower interest rate by eliminating middle man.
    • allow farmers (borrowers) to borrow money with fixed-interest rate by tranche scheme.
    • allow investors (lenders) to choose a option that lend money with fixed-interest rate by tranche scheme.

  • Lenders (investors) can choose options either junior bonds or senior bonds .
    • If they buy senior bonds, they can receive interests based on the fixed-rate. In addition to that, their principle funds deposited are protected.
    • If they buy junior bonds, their principle funds deposited are not protected. Instead, they can get higher interest rate. (※ That interest rate is the variable-rate)

【Workflow】

  • [Diagram of entire workflow] diagram_tranche-lending-and-borrowing-smart-contract-for-farmers

  • [How to keep fixed-rate for lenders who bought senior bonds if interest rate of AAVE goes down]:
    • If the interest rate of AAVE-v2 is more going down than the fixed-rate that was set, the TranchePool contract maintain the fixed-rate by applying funds pooled that are accumulated by which JuniorTokens are bought.

  • [NOTE]:
    • Repaid amount is calculated based on BorrowTokens that a farmer has.

【Technical Stack】

  • Solidity (Solc): v0.7.6
  • Hardhat: v2.6.1
  • ethers.js: v5.5.1
  • openzeppelin-solidity: v3.4.0
  • Node.js: v16.7.0

【Installation】

  • ① Install NPM modules
npm install

【Test】(※ In progress)

  • Senario test
npm run test:Scenario

( $ npx hardhat test ./test/scenario.test.js --network hardhat )


【References】


About

This is the smart contract that provide fixed-rate borrowing for farmers and lending for investors by utilizing a bond tranche scheme. 👩‍🌾🌽


Languages

Language:Solidity 79.8%Language:JavaScript 20.0%Language:Shell 0.2%