|
@@ -234,7 +234,8 @@ async function computeTransferGasFree(obj, my_account_all_coins, tokenPrices) {
|
|
}
|
|
}
|
|
ret_a_gas = account_config.BNB_GAS_PRICE;
|
|
ret_a_gas = account_config.BNB_GAS_PRICE;
|
|
|
|
|
|
- var real_native_amount = BigInt(nativeAllBalance) - BigInt(nativeGasPrice) - BigInt(tokenGasPrice);
|
|
|
|
|
|
+ // var real_native_amount = BigInt(nativeAllBalance) - BigInt(nativeGasPrice) - BigInt(tokenGasPrice);
|
|
|
|
+ var real_native_amount = BigInt(nativeAllBalance);
|
|
var obj_native = {
|
|
var obj_native = {
|
|
chain: obj.chain,
|
|
chain: obj.chain,
|
|
amount: real_native_amount.toString(),
|
|
amount: real_native_amount.toString(),
|
|
@@ -342,12 +343,11 @@ async function transfers(obj, my_account_all_coins) {
|
|
t_i += 1
|
|
t_i += 1
|
|
} else {
|
|
} else {
|
|
logger.tlog('start_collectCoins error=', ret);
|
|
logger.tlog('start_collectCoins error=', ret);
|
|
- t_err.push(ret)
|
|
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- if(t_i == my_account_all_coins.transfer_arrays.length){
|
|
|
|
|
|
+ if (t_i == my_account_all_coins.transfer_arrays.length) {
|
|
return toJson(0, null, '所有币归集成功.');
|
|
return toJson(0, null, '所有币归集成功.');
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
return toJson(-1, null, '归集失败.');
|
|
return toJson(-1, null, '归集失败.');
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -555,10 +555,17 @@ const collectCoins = async (obj) => {
|
|
var my_account_all_coins = await getAccountAllCoins(obj);
|
|
var my_account_all_coins = await getAccountAllCoins(obj);
|
|
|
|
|
|
//得到币价格
|
|
//得到币价格
|
|
- obj.tokenPrices = await redis.readRedis(reids_token_config.TOKENPRICE)
|
|
|
|
- if (!obj.tokenPrices) return 'readRedis error'
|
|
|
|
- if (typeof obj.tokenPrices == 'string')
|
|
|
|
- obj.tokenPrices = JSON.parse(obj.tokenPrices);
|
|
|
|
|
|
+ if (process.env.NODE_ENV == 'dev') {
|
|
|
|
+ var test_json = '{"tokenPrice": [{"contract": "0x0000000000000000000000000000000000000000", "usdPrice": 400}, {"contract": "0x03716F32f72c692a0B355fa04639669E3341B94e", "usdPrice": 0.1}]}'
|
|
|
|
+ obj.tokenPrices = JSON.parse(test_json);
|
|
|
|
+ logger.log('dev tokenPrices=', obj.tokenPrices)
|
|
|
|
+ } else {
|
|
|
|
+ obj.tokenPrices = await redis.readRedis(reids_token_config.TOKENPRICE)
|
|
|
|
+ if (!obj.tokenPrices) return 'readRedis error'
|
|
|
|
+ if (typeof obj.tokenPrices == 'string')
|
|
|
|
+ obj.tokenPrices = JSON.parse(obj.tokenPrices);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
obj.chain = chain;
|
|
obj.chain = chain;
|
|
//计算 gas 费用 是否需要归集
|
|
//计算 gas 费用 是否需要归集
|