Home

Awesome

<h1 align="center"> Dai.js Examples </h1>

other examples

See the Maker governance dashboard repo for an example of a production application that uses dai.js. The WIP MCD CDP Portal also uses dai.js. The examples in this repo are simple examples that use dai.js, but note that these examples are not updated very often.

accounts

Demo of multiple account support. See README.

leverage

Lock ETH -> Draw DAI -> Exchange Dai for ETH -> repeat

Example usage

export PRIVATE_KEY=0xabc... # your key goes here
export NETWORK='kovan' # choose your network here
export DEBUG=leverage.* #turn on console logging
cd leverage
babel-node . 1 400 0.1

react-example

Interact with Dai.js in the browser.

To set your private key:

TopUp

Prevent your Vault from getting liquidated (automated risk management) -- "top it up" with collateral to stay above a target collateralization ratio.

Example usage

Run yarn install or npm install

NB: One way to get your pivate key is to do it trough Metamask. Click on Details button and then on the Export Private Key button in your wallet account.

export PRIVATE_KEY=0xabc... # your key goes here
export NETWORK='kovan' # choose your network here
cd topup
node . 1234 -t 2.5 -v

wyre

Use Dai.js along with the Wyre SDK for an easy fiat on or off ramp in your application. Uses version 1.0.5 of the Wyre API, which may need an upgrade soon.

mcd-dai

Use the dai-mcd-plugin to interact with the Multi Collateral Dai smart contracts

Example Usage See the project's README for detailed instructions