1.0.0 • Published 1 year ago

@hysteaks-js/reward-helpers v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Reward Helpers

This package contains helper functions for calculating reward distributions off chain.

Installation

npm install @hysteaks-js/reward-helpers

Usage

import { even } from '@hysteaks-js/reward-helpers';

const amount = 100n;
const recipientCount = 5;
const result = even(amount, recipientCount);

console.log(result);
// [20n, 20n, 20n, 20n, 20n]
import { weightedAmount } from '@hysteaks-js/reward-helpers';

const amount = 100n;
const weights = [1n, 2n, 3n, 4n];
const result = weightedAmount(amount, weights);
console.log(result);
// [10n, 20n, 30n, 40n]
1.0.0

1 year ago