-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
Not yet in use, will be useful later
|
return [] | ||
} | ||
|
||
return results.reduce<UserClaims>((acc, result, index) => { |
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.
i think this would be simpler as a filter
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 then I have to filter and map, while on reduce it's a single operation, no?
Of course, it has negligible performance impact. Will refactor.
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.
Actually, if I filter then map I'll lose the reference of the index.
If I map then filter I'll have to build another temporary data structure which is very similar to the current one.
I'd like to keep it as is if you don't mind
* | ||
* @param account | ||
*/ | ||
export function useUserHasAvailableClaim(account: Account): boolean { |
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.
better name is probably useUserCanClaim
- this name is too long and too similar imo
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 that's the point, keep compatibility with existing hook
return CurrencyAmount.fromRawAmount(vCow, JSBI.BigInt(0)) | ||
} | ||
const totalAmount = claims.reduce((acc, claim) => { | ||
return JSBI.add(acc, JSBI.BigInt(claim.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.
nice
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.
That was already there, @anxolin did it =P
Summary
Added a couple of hooks and related stuff.
Right now it uses mocked data for the address
0x82850293A348107E798E5D366c10D1b566145Cd5
which has 2 hardcoded claims.The address is also hardcoded for now, so you'll see the claims for it.
Also:
Added vCOW and GNO Token objects
Reverted
useUserHasAvailableClaim
anduseUserUnclaimedAmount
hooks to original versions on mod file and commented them outAdded their modded versions to the index file
Checking claims against the contract (Rinkeby only for now)
New hook
useUserAvailableClaims
that returns claims still availableAdded utils fns
hasPaidClaim
andhasFreeClaim
To Test
7850
as claimableNote: Actual claiming does not yet work
Background
Optional: Give background information for changes you've made, that might be difficult to explain via comments