morkeltry / GAP-microfinance

GAP microfinance frontend and Solidity prototype
0 stars 1 forks source link

Loan decision endpoint #5

Open morkeltry opened 6 years ago

morkeltry commented 6 years ago

I suggest name the endpoint /offers

Accepts as params the fields from Apply page form #14, plus borrower eth address,

Compare these to lender's settings from db. Choose a lender (based on preferences?)

EDIT: If borrower has a loan offer in db already, use that. /EDIT

If borrower meets criteria for a loan and does not already have anything outstanding on a loan store details as an 'offer' in db and respond with an object containing tx: a smart contract transaction object with as many mandatory fields filled as poss, AND a unique nonce. See transaction structure and comment. data field is a todo for later #21.

Liase with @jignasheth407 #14

Set an environment variable CONTRACT_ADDR in .env and use this in tx as to:

morkeltry commented 6 years ago
var tx = {
  from: borrowerEthAddr,
  to: contractAddr,  // use env2 to set this as app constant - '0x12345' is fine
  gasPrice: "9000000000",
  gas: "85000",
  data: ""
};