|
@@ -2,6 +2,7 @@ const SimpleWeb3 = require('./simple-web3')
|
|
|
const Config = require('../../config/config')
|
|
const Config = require('../../config/config')
|
|
|
const BinanceSpot = require('../binance/binance-spot')
|
|
const BinanceSpot = require('../binance/binance-spot')
|
|
|
const BinanceKit = require('../binance/binance-kit')
|
|
const BinanceKit = require('../binance/binance-kit')
|
|
|
|
|
+const Token = require('../token')
|
|
|
|
|
|
|
|
class IERC20 {}
|
|
class IERC20 {}
|
|
|
|
|
|
|
@@ -23,12 +24,13 @@ IERC20.initTokenByHash = async function (tokenHash, lotSizeFilterMap) {
|
|
|
IERC20.contractMap[tokenHash] = new SimpleWeb3.web3.eth.Contract(Config.BASE_ABI, tokenHash)
|
|
IERC20.contractMap[tokenHash] = new SimpleWeb3.web3.eth.Contract(Config.BASE_ABI, tokenHash)
|
|
|
|
|
|
|
|
// 代币初始化
|
|
// 代币初始化
|
|
|
- const tokenDecimals = await IERC20.getDecimals(tokenHash)
|
|
|
|
|
|
|
+ const ierc20Decimals = await IERC20.getDecimals(tokenHash)
|
|
|
const exchangeSymbol = Config.tokenMap[tokenHash]
|
|
const exchangeSymbol = Config.tokenMap[tokenHash]
|
|
|
const exchangePair = `${exchangeSymbol}${Config.baseToken.symbol}`
|
|
const exchangePair = `${exchangeSymbol}${Config.baseToken.symbol}`
|
|
|
- const lotSize = lotSizeFilterMap[exchangePair]
|
|
|
|
|
|
|
+ const exchangeLotSize = lotSizeFilterMap[exchangePair]
|
|
|
|
|
|
|
|
- IERC20.tokenMap[tokenHash] = { decimals: tokenDecimals, symbol: exchangeSymbol, pair: exchangePair, lotSize: lotSize }
|
|
|
|
|
|
|
+ // TODO 将tokenMap放到上下文中
|
|
|
|
|
+ IERC20.tokenMap[tokenHash] = new Token(exchangeSymbol, exchangeLotSize, exchangePair, ierc20Decimals)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
IERC20.getTokenName = async function (tokenHash) {
|
|
IERC20.getTokenName = async function (tokenHash) {
|