d656025378
* Moved audit to root directory. * Moved code of conduct, contributing and licence files. * Removed travis config and badge. * Updated repository links in CONTRIBUTING. * Moved Gitter badge to main readme. Updated links to contributing and licence. * Updated main readme. * Moved references to main readme. * Renamed token-bridge to oracle. * Update README.md Co-Authored-By: rzadp <rzadp@student.mini.pw.edu.pl>
19 lines
451 B
JavaScript
19 lines
451 B
JavaScript
const Web3Utils = require('web3-utils')
|
|
|
|
async function getMinPerTxLimit(bridge) {
|
|
const minPerTx = await bridge.methods.minPerTx().call()
|
|
return Web3Utils.fromWei(minPerTx)
|
|
}
|
|
|
|
async function isValidAmount(amount, bridge) {
|
|
const minLimit = await getMinPerTxLimit(bridge)
|
|
if (amount < minLimit) {
|
|
throw new Error(`The amount per Tx ${amount} should be at least ${minLimit}`)
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getMinPerTxLimit,
|
|
isValidAmount
|
|
}
|