Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mis math on setting value for activity and transactions for eth add l… #10592

Merged
merged 2 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/augur-simplified/src/modules/common/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ const TransactionRow = ({ transaction }: TransactionProps) => {
<li>
<ReceiptLink hash={transaction.tx_hash} label={transaction.subheader} />
</li>
<li>{formatDai(transaction.value).full}</li>
<li>{formatDai(transaction.cashValueUsd).full}</li>
<li>{transaction.tokenAmount}</li>
<li>{transaction.shareAmount}</li>
<li>
Expand Down
1 change: 0 additions & 1 deletion packages/augur-simplified/src/modules/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const MILLION = THOUSAND.times(THOUSAND);
export const BILLION = MILLION.times(THOUSAND);
export const TRILLION = BILLION.times(THOUSAND);
export const SEC_IN_YEAR = createBigNumber(86400).times(createBigNumber(365));
export const NUM_TICKS_Y_N = 1000;

// # Asset Types
export const ETH = 'ETH';
Expand Down
32 changes: 16 additions & 16 deletions packages/augur-simplified/src/utils/process-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ const shapeEnterTransactions = (
sender: e.sender?.id,
subheader,
...properties,
cashValueUsd: String(cashValueUsd),
value: cashValueUsd
};
});
Expand All @@ -451,6 +452,7 @@ const shapeExitTransactions = (
subheader,
...properties,
value: cashValueUsd,
cashValueUsd: String(cashValueUsd)
};
});
};
Expand All @@ -464,17 +466,13 @@ const shapeAddLiquidityTransactions = (
const subheader = `Add ${cash.name} Liquidity`;
// TODO: cashValue seems to be off on graph data, work around is to add up yes/no share cashValues
const totalCashValue = new BN(e.noShareCashValue).plus(e.yesShareCashValue);
// const cashValue = String(
// convertOnChainCashAmountToDisplayCashAmount(
// e.cashValue,
// new BN(cash.decimals)
// )
// );
const cashValueUsd = String(
const cashValue =
convertOnChainSharesToDisplayShareAmount(
totalCashValue,
new BN(cash.decimals)
).times(cash.usdPrice)
);
const cashValueUsd = String(
cashValue.times(cash.usdPrice)
);
const lpTokens = String(
convertOnChainSharesToDisplayShareAmount(
Expand All @@ -491,7 +489,7 @@ const shapeAddLiquidityTransactions = (
...properties,
price: null,
cashValueUsd,
value: cashValueUsd,
value: String(cashValue),
lpTokens,
netShares: e.netShares
};
Expand All @@ -505,11 +503,12 @@ const shapeRemoveLiquidityTransactions = (
return transactions.map((e) => {
const properties = formatTransaction(e, cash);
const subheader = `Remove ${cash.name} Liquidity`;
const cashValue = String(
convertOnChainSharesToDisplayShareAmount(
new BN(e.cashValue),
new BN(cash.decimals)
)
const cashValue = convertOnChainSharesToDisplayShareAmount(
new BN(e.cashValue),
new BN(cash.decimals)
)
const cashValueUsd = String(
cashValue.times(cash.usdPrice)
);
const shares = new BN(e.noShares).plus(new BN(e.yesShares));
const shareAmount = String(formatShares(
Expand All @@ -531,8 +530,9 @@ const shapeRemoveLiquidityTransactions = (
subheader,
...properties,
price: null,
cashValue,
value: cashValue,
cashValue: String(cashValue),
cashValueUsd,
value: String(cashValue),
tokenAmount,
shareAmount
};
Expand Down