Skip to content

Commit

Permalink
Merge pull request #961 from rainlanguage/2024-10-24-negative-output
Browse files Browse the repository at this point in the history
Fix negative output in trades table
  • Loading branch information
hardyjosh authored Oct 30, 2024
2 parents 36391b6 + 4b566b6 commit 3a66e6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</TableBodyCell>
<TableBodyCell tdClass="break-all py-2">
{formatUnits(
BigInt(item.outputVaultBalanceChange.amount),
BigInt(item.outputVaultBalanceChange.amount) * BigInt(-1),
Number(item.outputVaultBalanceChange.vault.token.decimals ?? 0),
)}
{item.outputVaultBalanceChange.vault.token.symbol}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const mockTradeOrdersList: Trade[] = [
},
},
outputVaultBalanceChange: {
amount: '100',
amount: '-100',
vault: {
id: 'id',
vault_id: 'vault-id',
Expand Down Expand Up @@ -118,7 +118,7 @@ const mockTradeOrdersList: Trade[] = [
},
},
outputVaultBalanceChange: {
amount: '100',
amount: '-100',
vault: {
id: 'id',
vault_id: 'vault-id',
Expand Down Expand Up @@ -207,8 +207,8 @@ test('renders table with correct data', async () => {
BigInt(mockTradeOrdersList[i].outputVaultBalanceChange.amount),
Number(mockTradeOrdersList[i].outputVaultBalanceChange.vault.token.decimals),
);
const ioRatio = Number(inputDisplay) / Number(outputDisplay);
const oiRatio = Number(outputDisplay) / Number(inputDisplay);
const ioRatio = Number(inputDisplay) / (Number(outputDisplay) * -1);
const oiRatio = (Number(outputDisplay) * -1) / Number(inputDisplay);
expect(rows[i]).toHaveTextContent(ioRatio.toString());
expect(rows[i]).toHaveTextContent(oiRatio.toString());
}
Expand Down

0 comments on commit 3a66e6a

Please sign in to comment.