curve-stablecoin-simulator
v0.1.16
Published
Curve Stable Coin JS implementation.
Downloads
1
Readme
Curve Stable Coin Simulator
curve-stablecoin js implementation.
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
> [email protected] test
> mocha
11 -_-_-_-_-_-__,------,
0 -_-_-_-_-_-__| /\_/\
0 -_-_-_-_-_-_~|_( ^ .^)
-_-_-_-_-_-_ "" ""
11 passing (275ms)
TODO
- PegKeeper
- mpoliceis
- AggMonetaryPolicy
- ConstantMonetaryPolicy