mirror of openzeppelin-contracts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
module.exports = {
|
|
|
|
// sum of integer / bignumber
|
|
|
|
sum: (...args) => args.reduce((acc, n) => acc + n, 0),
|
|
|
|
bigintSum: (...args) => args.reduce((acc, n) => acc + n, 0n),
|
|
|
|
BNsum: (...args) => args.reduce((acc, n) => acc.add(n), web3.utils.toBN(0)),
|
|
|
|
// min of integer / bignumber
|
|
|
|
min: (...args) => args.slice(1).reduce((x, y) => (x < y ? x : y), args[0]),
|
|
|
|
BNmin: (...args) => args.slice(1).reduce((x, y) => (x.lt(y) ? x : y), args[0]),
|
|
|
|
// max of integer / bignumber
|
|
|
|
max: (...args) => args.slice(1).reduce((x, y) => (x > y ? x : y), args[0]),
|
|
|
|
BNmax: (...args) => args.slice(1).reduce((x, y) => (x.gt(y) ? x : y), args[0]),
|
|
|
|
};
|