|
@@ -32,42 +32,45 @@ async function getTransfers(ctx) {
|
|
|
obj.chain = 'bsc_mainnet'
|
|
|
|
|
|
var temp_obj = { ...obj }
|
|
|
-
|
|
|
- await moralis.getTokenTransfers(obj).then((result) => {
|
|
|
- logger.log('getTransfers response', result)
|
|
|
- ctx.body = result;
|
|
|
- if (result) {
|
|
|
- //提交归集任务 native 能获取到 gas 、token 无法获取到 gas 费
|
|
|
- try {
|
|
|
- if (temp_obj.address && moralis.isTransferSucceed(result)) {
|
|
|
- var log_obj = { ...obj }
|
|
|
- log_obj.results = result
|
|
|
- log_obj.type = report.REPORT_TYPE.transfer_record
|
|
|
- //埋点日志上报-入金检查
|
|
|
- report.logReport(log_obj)
|
|
|
-
|
|
|
- var json_obj = JSON.parse(result);
|
|
|
- //缓存当前交易的 gas 费用
|
|
|
- var tr = moralis.getTransferRecordGasFree('native', json_obj, temp_obj.address)
|
|
|
- logger.log('getTransferRecordGasFree:', tr, temp_obj.address)
|
|
|
- if (tr && tr.totalGasFree > 0) {
|
|
|
- logger.log('getTransferRecordGasFree redis_set LAST_TOTAL_BNB_FREE:', tr.totalGasFree.toString())
|
|
|
- logger.log('getTransferRecordGasFree redis_set LAST_TOTAL_TOKEN_FREE:', (parseInt(tr.totalGasFree) * parseInt(account_config.TOKEN_GAS_LIMIT)).toString())
|
|
|
- redis.redis_set(reids_token_config.LAST_TOTAL_BNB_FREE, tr.totalGasFree.toString());
|
|
|
- redis.redis_set(reids_token_config.LAST_TOTAL_TOKEN_FREE, (parseInt(tr.gas_price) * parseInt(account_config.TOKEN_GAS_LIMIT)).toString());
|
|
|
- }
|
|
|
-
|
|
|
- //提交归集任务
|
|
|
- if (temp_obj.address) {
|
|
|
- logger.log('pushCollectConisObj>>>', temp_obj.address)
|
|
|
- moralis.pushCollectConisObj(temp_obj)
|
|
|
+ // for (let index = 0; index < 20; index++) {
|
|
|
+ await moralis.getTokenTransfers(obj).then((result) => {
|
|
|
+ logger.log('getTransfers response','index='+index, result)
|
|
|
+ ctx.body = result;
|
|
|
+ if (result) {
|
|
|
+ //提交归集任务 native 能获取到 gas 、token 无法获取到 gas 费
|
|
|
+ try {
|
|
|
+ if (temp_obj.address && moralis.isTransferSucceed(result)) {
|
|
|
+ var log_obj = { ...obj }
|
|
|
+ log_obj.results = result
|
|
|
+ log_obj.type = report.REPORT_TYPE.transfer_record
|
|
|
+ //埋点日志上报-入金检查
|
|
|
+ report.logReport(log_obj)
|
|
|
+
|
|
|
+ var json_obj = JSON.parse(result);
|
|
|
+ //缓存当前交易的 gas 费用
|
|
|
+ var tr = moralis.getTransferRecordGasFree('native', json_obj, temp_obj.address)
|
|
|
+ logger.log('getTransferRecordGasFree:', tr, temp_obj.address)
|
|
|
+ if (tr && tr.totalGasFree > 0) {
|
|
|
+ logger.log('getTransferRecordGasFree redis_set LAST_TOTAL_BNB_FREE:', tr.totalGasFree.toString())
|
|
|
+ logger.log('getTransferRecordGasFree redis_set LAST_TOTAL_TOKEN_FREE:', (parseInt(tr.totalGasFree) * parseInt(account_config.TOKEN_GAS_LIMIT)).toString())
|
|
|
+ redis.redis_set(reids_token_config.LAST_TOTAL_BNB_FREE, tr.totalGasFree.toString());
|
|
|
+ redis.redis_set(reids_token_config.LAST_TOTAL_TOKEN_FREE, (parseInt(tr.gas_price) * parseInt(account_config.TOKEN_GAS_LIMIT)).toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ //提交归集任务
|
|
|
+ if (temp_obj.address) {
|
|
|
+ logger.log('pushCollectConisObj>>>', temp_obj.address)
|
|
|
+ moralis.pushCollectConisObj(temp_obj)
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (error) {
|
|
|
+ console.error('pushCollectConisObj error=', error)
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.error('pushCollectConisObj error=', error)
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|