|
@@ -306,16 +306,31 @@ async function withdraw_task() {
|
|
last_time = utils.getTimestamp()
|
|
last_time = utils.getTimestamp()
|
|
logger.log('withdraw_task withdraw_ =', result, last_time)
|
|
logger.log('withdraw_task withdraw_ =', result, last_time)
|
|
if (result && moralis.getTransferCode(result) == 0) {
|
|
if (result && moralis.getTransferCode(result) == 0) {
|
|
- var obj = JSON.parse(result)
|
|
|
|
|
|
+ var obj;
|
|
|
|
+ var curGasPrice = 0;
|
|
|
|
+ var curGasLimit = 0;
|
|
|
|
+ if (typeof result === 'string') {
|
|
|
|
+ obj = JSON.parse(result)
|
|
|
|
+ }
|
|
var nonce = obj.data.nonce
|
|
var nonce = obj.data.nonce
|
|
- var curGasPrice = BigNumber(obj.data.gasPrice.hex).toNumber()
|
|
|
|
- var curGasLimit = BigNumber(obj.data.gasLimit.hex).toNumber()
|
|
|
|
|
|
+ try {
|
|
|
|
+ curGasPrice = BigNumber(obj.data.gasPrice.hex).toNumber()
|
|
|
|
+ curGasLimit = BigNumber(obj.data.gasLimit.hex).toNumber()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ logger.error('BigNumber toNumber error')
|
|
|
|
+ }
|
|
|
|
+
|
|
var value = 0
|
|
var value = 0
|
|
- if (obj.data.chainId == 97) {
|
|
|
|
- value = BigNumber(obj.data.value.hex).toNumber()
|
|
|
|
- } else {
|
|
|
|
- value = obj.data.value.number
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (obj.data.chainId == 97) {
|
|
|
|
+ value = BigNumber(obj.data.value.hex).toNumber()
|
|
|
|
+ } else {
|
|
|
|
+ value = obj.data.value.number
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ logger.error('BigNumber value toNumber error')
|
|
}
|
|
}
|
|
|
|
+
|
|
var hash = obj.data.hash
|
|
var hash = obj.data.hash
|
|
last_hash = hash
|
|
last_hash = hash
|
|
last_chain = temp_obj.chain
|
|
last_chain = temp_obj.chain
|
|
@@ -325,7 +340,11 @@ async function withdraw_task() {
|
|
update_obj.nonce = nonce
|
|
update_obj.nonce = nonce
|
|
update_obj.gas_price = curGasPrice.toString()
|
|
update_obj.gas_price = curGasPrice.toString()
|
|
update_obj.gas_limit = curGasLimit.toString()
|
|
update_obj.gas_limit = curGasLimit.toString()
|
|
- update_obj.value = utils.scientificNotationToString(value).toString()
|
|
|
|
|
|
+ try {
|
|
|
|
+ update_obj.value = utils.scientificNotationToString(value).toString()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ logger.error('scientificNotationToString error')
|
|
|
|
+ }
|
|
update_obj.errorMsg = ''
|
|
update_obj.errorMsg = ''
|
|
await withdraw_db.update_withdraw_task(exec_obj.withdraw_id, update_obj)
|
|
await withdraw_db.update_withdraw_task(exec_obj.withdraw_id, update_obj)
|
|
break
|
|
break
|
|
@@ -676,3 +695,5 @@ if (process.env.NODE_ENV == 'dev' || process.env.NODE_ENV == 'test') {
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = router
|
|
module.exports = router
|
|
|
|
+
|
|
|
|
+
|