1.0.1 • Published 10 months ago

cu8-lucky-draw-pool-engine v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Installation

npm i cu8-lucky-draw-pool-engine

Usage

import { init } from 'cu8-lucky-draw-pool-engine';

const engine = await init({
  mongoUrl: 'mongodb://0.0.0.0:27017/lucky-draw-pool-engine',
  debug: true,
  cleanUpPools: true,
});

await engine.createPool({
  poolKey: 'example',
  name: 'Example',
  initialAmount: 10,
  startTime: dayjs().toDate(),
  endTime: dayjs().add(10, 'd').toDate(),
  config: {
    minRate: 0,
    maxRate: 100,
    controlPoints: [
      [0, 0],
      [1, 1],
    ],
  },
});
const pools = await engine.listPools();
console.log(pools);
const reward = await engine.draw({ poolKeys: ['example'] });
console.log(reward);
1.0.1

10 months ago

1.0.0

10 months ago