tokenbridge/oracle/scripts/utils/utils.js

19 lines
451 B
JavaScript
Raw Normal View History

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
}