Merge pull request #594 from hermeznetwork/fix/post-tx-no-usd Avoid SQL error when checking value of token without usd on tx insert
Eduard S eduard@iden3.io
Mon, 01 Mar 2021 10:34:35 +0100
1 files changed,
1 insertions(+),
1 deletions(-)
jump to
M
db/l2db/apiqueries.go
→
db/l2db/apiqueries.go
@@ -50,7 +50,7 @@ }
defer l2db.apiConnCon.Release() row := l2db.dbRead.QueryRow(`SELECT - ($1::NUMERIC * token.usd * fee_percentage($2::NUMERIC)) / + ($1::NUMERIC * COALESCE(token.usd, 0) * fee_percentage($2::NUMERIC)) / (10.0 ^ token.decimals::NUMERIC) FROM token WHERE token.token_id = $3;`, tx.AmountFloat, tx.Fee, tx.TokenID)