UNPKG

cu8-lucky-draw-pool-engine

Version:
38 lines (32 loc) 675 B
# Installation ``` npm i cu8-lucky-draw-pool-engine ``` # Usage ```js 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); ```