tokenbridge/oracle/scripts/utils/utils.js
Przemyslaw Rzad d656025378
Update the token-bridge sub-repo (#19)
* 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>
2019-05-07 16:52:44 +02:00

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
}