cu8-lucky-draw-pool-engine
v1.0.1
Published
Lucky draw pool engine for luck based games
Downloads
5
Readme
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);