Created
September 10, 2018 22:33
-
-
Save sfncook/075c4f7ec9b70d793c6eb09a6681745e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const { Dharma, Web3 } = require("@dharmaprotocol/dharma.js"); | |
const { LoanRequest } = Dharma.Types; | |
async function f2() { | |
const host = "http://localhost:8545"; | |
const provider = new Web3.providers.HttpProvider(host); | |
const dharma = new Dharma(provider); | |
const loanRequest = await LoanRequest.create(dharma, { | |
principalAmount: 1, | |
principalToken: "WETH", | |
collateralAmount: 20, | |
collateralToken: "REP", | |
interestRate: 3.5, | |
termDuration: 3, | |
termUnit: "months", | |
expiresInDuration: 1, | |
expiresInUnit: "weeks" | |
}) | |
.catch(err=>{console.log(err)}); | |
} | |
f2(); | |
app.get('/', (req, res) => res.send('Hello World!')) | |
app.listen(3000, () => console.log('Example app listening on port 3000!')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment