-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
CLA Assistant Lite All Contributors have signed the CLA. |
|
I'll document the explanation of what's happening in this issue. Without code changes just adding a few debugging entries, we get to this: The first part is logging stuff from https://github.com/gnosis/cowswap/blob/d42aabe6f0/src/custom/state/claim/hooks/index.ts#L970-L975 This is where the total max investment amount in investment currency is calculated. The second part is logging stuff from cowswap/src/custom/state/claim/hooks/utils.ts Line 181 in d42aabe
This is where the source for the missing atom is coming, causing amounts to be 99.99% claimed, but not quite 100% |
Why is the amount not precise in the first place? (the weird Without diving deep into how JSBI/BigNumber and etc handle the amounts, my assumption would be something funny with its math. From the contract, we get that 1 vCOW = 150000 atoms of USDC == 0.15 USDC Which is not a precise price, but that's how we represent it in the UI and also how we work with internally Also, let's take a look at the amounts. The raw claim data for this case we get is Applying the price to it, we get the weird representation of 25000000000000050000000000000/1000000000000000000 == 25000000000 atoms of USDC == 25000 USDC |
Requires to invert it in the UI and to calculate the total vCOW amount
const amount = CurrencyAmount.fromRawAmount(investCurrency, investedAmount) | ||
return { vCowAmount: price.invert().quote(amount), investmentCost: amount } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but what is the difference between inverting above and now here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the math found in the method used on line975
fixing this? if so, damn, that's sketchy af for us to be using this math lib...
@@ -62,7 +62,7 @@ import useIsMounted from 'hooks/useIsMounted' | |||
import { ChainId } from '@uniswap/sdk' | |||
import { ClaimInfo } from 'state/claim/reducer' | |||
|
|||
const CLAIMS_REPO_BRANCH = 'gip-13' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
careful here about the package (just note)
@alfetopito let me know if we close this one or u want it open |
I was supposed to do a post-morten after finishing with the uni-merge. |
Summary
<<if there's an issue>>Fixes #issueNumber
High-level description of what your changes are accomplishing
Add screenshots if applicable. Images are nice :)
To Test
about
Background
Optional: Give background information for changes you've made, that might be difficult to explain via comments