|
|
@@ -5,30 +5,32 @@ module.exports = class Token {
|
|
|
exchange = {}
|
|
|
ierc20 = {}
|
|
|
|
|
|
- constructor(exchangeSymbol, exchangePriceTick, exchangePair, ierc20Decimals) {
|
|
|
+ constructor(exchangeSymbol, exchangePriceTick, exchangeLotSize, exchangePair, ierc20Decimals) {
|
|
|
this.exchange.symbol = exchangeSymbol
|
|
|
this.exchange.priceTick = exchangePriceTick
|
|
|
+ this.exchange.lotSize = exchangeLotSize
|
|
|
this.exchange.pair = exchangePair
|
|
|
|
|
|
this.ierc20.decimals = ierc20Decimals
|
|
|
}
|
|
|
|
|
|
- static async init(context, tokenHash, priceTickFilterMap) {
|
|
|
+ static async init(context, tokenHash, priceTickFilterMap, lotSizeFilterMap) {
|
|
|
// token初始化
|
|
|
const ierc20Decimals = parseInt(await IERC20.getDecimals(tokenHash))
|
|
|
const exchangeSymbol = Config.tokenMapping[tokenHash]
|
|
|
const exchangePair = `${exchangeSymbol}${Config.baseIerc20Token.symbol}`
|
|
|
const exchangePriceTick = priceTickFilterMap[exchangePair]
|
|
|
+ const exchangeLotSize = lotSizeFilterMap[exchangePair]
|
|
|
|
|
|
- context.tokenMap[tokenHash] = new Token(exchangeSymbol, exchangePriceTick, exchangePair, ierc20Decimals)
|
|
|
+ context.tokenMap[tokenHash] = new Token(exchangeSymbol, exchangePriceTick, exchangeLotSize, exchangePair, ierc20Decimals)
|
|
|
}
|
|
|
|
|
|
- static async batchInit(context, ierc20TokenAddressList, priceTickFilterMap) {
|
|
|
+ static async batchInit(context, ierc20TokenAddressList, priceTickFilterMap, lotSizeFilterMap) {
|
|
|
context.tokenMap = {}
|
|
|
|
|
|
for (const tokenHash of ierc20TokenAddressList) {
|
|
|
// 初始化token
|
|
|
- await Token.init(context, tokenHash, priceTickFilterMap)
|
|
|
+ await Token.init(context, tokenHash, priceTickFilterMap, lotSizeFilterMap)
|
|
|
}
|
|
|
}
|
|
|
}
|