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) {
|
async function relay (req, resp) {
|
||||||
const { proof, args, contract } = req.body
|
const { proof, args, contract } = req.body
|
||||||
console.log(proof, args, contract)
|
|
||||||
const gasPrices = fetcher.gasPrices
|
const gasPrices = fetcher.gasPrices
|
||||||
let { valid , reason } = isValidProof(proof)
|
let { valid , reason } = isValidProof(proof)
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
@ -37,7 +36,7 @@ async function relay (req, resp) {
|
|||||||
toBN(args[4]),
|
toBN(args[4]),
|
||||||
toBN(args[5])
|
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()) {
|
if (currency === 'eth' && !refund.isZero()) {
|
||||||
return resp.status(400).json({ error: 'Cannot send refund for eth currency.' })
|
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
|
break
|
||||||
}
|
}
|
||||||
case 'dai': {
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('desired fee', desiredFee)
|
console.log('desired fee', desiredFee.toString())
|
||||||
if (fee.lt(desiredFee)) {
|
if (fee.lt(desiredFee)) {
|
||||||
return { isEnough: false, reason: 'Not enough fee' }
|
return { isEnough: false, reason: 'Not enough fee' }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user