import Maker from '@makerdao/dai';
import { ETH, BAT, DAI } from '@makerdao/dai-plugin-mcd';
const maker = await Maker.create(...);
const mgr = maker.service('mcd:cdpManager');
// lock BAT into a new vault and draw Dai
const vault = await mgr.openLockAndDraw(
// These are all identical:
// each method has a default type
// you can pass in a currency unit instance
// currency units have convenient converter methods
cdp.lockEth(ETH.wei(250000000000000000));
eth.toString() == '5.00 ETH';
const price = USD_ETH(500);
price.toString() == '500.00 USD/ETH';
// multiplication handles units
const usd = eth.times(price);
usd.toString() == '2500.00 USD';
const eth2 = usd.div(eth);