tokenbridge/monitor/utils/ercUtils.js

19 lines
396 B
JavaScript
Raw Normal View History

2019-07-12 15:49:46 +03:00
const { ERC_TYPES } = require('../../commons')
2019-05-08 16:12:02 +03:00
const getTokenType = async (contract, bridgeAddress) => {
try {
const bridgeContract = await contract.methods.bridgeContract().call()
if (bridgeContract === bridgeAddress) {
return ERC_TYPES.ERC677
} else {
return ERC_TYPES.ERC20
}
} catch (e) {
return ERC_TYPES.ERC20
}
}
module.exports = {
getTokenType
}