Skip to content

0xreviews/curve-stablecoin-simulator

Repository files navigation

Curve Stable Coin Simulator

npm (tag) Tests (tag) Snyk Security Check (tag)

curve-stablecoin js implementation.

🖥️ Graphic Live Demo

Install

npm i curve-stablecoin-simulator

Getting Started

import { LLAMMA, Controller } from "curve-stablecoin-simulator";

const amm = new LLAMMA(100, 0.00, 0, 0.05, 0.02, 10 ** 6, 1000);
const controller = new Controller(0.02, 0.05, amm);

// deposit 10 ETH borrow 1000 crvUSD with 10 bands range
controller.create_loan("user1", 10, 1000, 10);

// swap in 100 crvUSD out ETH, min received 0.8ETH
// will return acctually out amount.
const out_amount = amm.exchange(0, 1, 1000, 0.8);

Test

cd curve-stablecoin-simulator
npm install
npm test

# output
> curve-stablecoin-simulator@0.1.14 test
> mocha

 11  -_-_-_-_-_-__,------,
 0   -_-_-_-_-_-__|  /\_/\ 
 0   -_-_-_-_-_-_~|_( ^ .^) 
     -_-_-_-_-_-_ ""  "" 

  11 passing (275ms)

TODO

  • PegKeeper
  • mpoliceis
    • AggMonetaryPolicy
    • ConstantMonetaryPolicy