add failed status
fix withdraw parameters
This commit is contained in:
parent
22a170f809
commit
838da6eab3
@ -43,6 +43,7 @@ const status = Object.freeze({
|
|||||||
SENT: 'SENT',
|
SENT: 'SENT',
|
||||||
MINED: 'MINED',
|
MINED: 'MINED',
|
||||||
CONFIRMED: 'CONFIRMED',
|
CONFIRMED: 'CONFIRMED',
|
||||||
|
FAILED: 'FAILED'
|
||||||
})
|
})
|
||||||
|
|
||||||
async function fetchTree() {
|
async function fetchTree() {
|
||||||
@ -164,14 +165,14 @@ async function checkMiningFee({ args }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTxObject({ data }) {
|
function getTxObject({ data }) {
|
||||||
let [ABI, contractAddress, value] =
|
let [ABI, contractAddress, value, args] =
|
||||||
data.type === jobType.TORNADO_WITHDRAW
|
data.type === jobType.TORNADO_WITHDRAW
|
||||||
? [tornadoABI, data.contract, data.args[5]]
|
? [tornadoABI, data.contract, data.args[5], data.args]
|
||||||
: [miningABI, minerAddress, 0]
|
: [miningABI, minerAddress, 0, [data.args]]
|
||||||
const method = data.type !== jobType.MINING_REWARD ? 'withdraw' : 'reward'
|
const method = data.type !== jobType.MINING_REWARD ? 'withdraw' : 'reward'
|
||||||
|
|
||||||
const contract = new web3.eth.Contract(ABI, contractAddress)
|
const contract = new web3.eth.Contract(ABI, contractAddress)
|
||||||
const calldata = contract.methods[method](data.proof, data.args).encodeABI()
|
const calldata = contract.methods[method](data.proof, ...args).encodeABI()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
value,
|
value,
|
||||||
@ -215,6 +216,7 @@ async function process(job) {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
await updateStatus(status.FAILED)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user