mirror of
https://github.com/tornadocash/tornado-relayer
synced 2024-02-02 15:04:06 +01:00
add logs
This commit is contained in:
parent
b5609c30c5
commit
db6a47f4fb
@ -8,7 +8,6 @@ const { web3, fetcher } = require('./instances')
|
||||
|
||||
async function relay (req, resp) {
|
||||
const { proof, args, contract } = req.body
|
||||
console.log(proof, args, contract)
|
||||
const gasPrices = fetcher.gasPrices
|
||||
let { valid , reason } = isValidProof(proof)
|
||||
if (!valid) {
|
||||
@ -37,7 +36,7 @@ async function relay (req, resp) {
|
||||
toBN(args[4]),
|
||||
toBN(args[5])
|
||||
]
|
||||
console.log('root, nullifierHash, recipient, relayer, fee, refund', fee.toString(), refund)
|
||||
console.log('fee, refund', fee.toString(), refund.toString())
|
||||
if (currency === 'eth' && !refund.isZero()) {
|
||||
return resp.status(400).json({ error: 'Cannot send refund for eth currency.' })
|
||||
}
|
||||
|
@ -65,11 +65,14 @@ function isEnoughFee({ gas, gasPrices, currency, refund, ethPrices, fee }) {
|
||||
break
|
||||
}
|
||||
case 'dai': {
|
||||
desiredFee = expense.add(refund).mul(toBN(ethPrices.dai)).div(toBN(10 ** 18))
|
||||
desiredFee =
|
||||
expense.add(refund)
|
||||
.mul(toBN(10 ** 18))
|
||||
.div(toBN(ethPrices.dai))
|
||||
break
|
||||
}
|
||||
}
|
||||
console.log('desired fee', desiredFee)
|
||||
console.log('desired fee', desiredFee.toString())
|
||||
if (fee.lt(desiredFee)) {
|
||||
return { isEnough: false, reason: 'Not enough fee' }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user