|
|
@@ -1,18 +1,22 @@
|
|
|
-const SimpleWeb3 = require('simple-web3')
|
|
|
+const SimpleWeb3 = require('./simple-web3')
|
|
|
const Config = require('../../config/config')
|
|
|
|
|
|
class IERC20 {}
|
|
|
|
|
|
-IERC20.batchInit = async function (ierc20TokenAddressList) {
|
|
|
+IERC20.batchInit = function (ierc20TokenAddressList) {
|
|
|
IERC20.contractMap = {}
|
|
|
|
|
|
- ierc20TokenAddressList.map(function (tokenHash) {
|
|
|
+ ierc20TokenAddressList.forEach(function (tokenHash) {
|
|
|
IERC20.contractMap[tokenHash] = new SimpleWeb3.web3.eth.Contract(Config.BASE_ABI, tokenHash)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
IERC20.getTokenName = async function (tokenHash) {
|
|
|
- return await IERC20.contractMap[tokenHash].methods.getName(tokenHash)
|
|
|
+ return await IERC20.contractMap[tokenHash].methods.name().call()
|
|
|
+}
|
|
|
+
|
|
|
+IERC20.getTokenSymbol = async function (tokenHash) {
|
|
|
+ return await IERC20.contractMap[tokenHash].methods.symbol().call()
|
|
|
}
|
|
|
|
|
|
module.exports = IERC20
|