-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add refund utilities for tinlake.js tests, add helper for tx success * Use refund mechanism in all tests * Add claim rad functionality to tinlake.js * Use actual gas price for refunding ETH after tinlake.js tests * Update claim RAD ABI * Fix yield data fetching * Implement reward claims UI * Rename claim RAD contract name * Fix buggy permission check * Add Centrifuge Chain wallet, add functionality to set Centrifuge Chain address link on Ethereum * Fix validation * Improve flow Signed-off-by: Philip Stanislaus <6912756+philipstanislaus@users.noreply.github.com> * Fix compilation errors * Update field names * Add display of claimed rewards on Centrifuge Chain * Add fetching of rad rewards tree from GCP * Refactor user rewards to make them simpler * Add reward collection on Centrifuge Chain * Improve flow and copy for demo of RAD rewards claim * Fix spacing and other bugs * Fix claims * Add explanation if collected/uncollected is higher than earned * Add rad reward claim proofs * Fix hash calculation * Remove system rewards * Update reward claim design * Fix reward collection * Simplify state * Add user current investments and daily rewards * Add system rewards * Fix rewards collected display * Add RAD icon to collect stripe * Remove console.logs * Update copy * Show data for non-investors * Update copy * Update copy * More copy updates * Add hook to detect installed/injected polkadot browser extension * Fix bug caused by checksum casing of Ethereum address * Add rewards to dashboard * Fix loading indicators * Design and copy changes * Remove Total Financed to Date * Small layout fixes * Add reload page after polkadot wallet extension install * Automatically connect polkadot wallet * Add title to rewards page * Replace orange with white RAD rewards box on dashboard * Rename "address" with "account" on rewards UI * Change data types for rewards from strings to BNs/Decimals * Add start investing step for investors without earned rewards before link account step * Add success message to account linking and poll status * Change cent chain link address selection to dropdown * Copy changes * Redesign system rewards * Fix bug that led to wrong allocation of claimed rewards * Fix bug if nonZeroBalanceSince is null * Fix padding * Improve pool title visuals * Copy and layout changes * Remove unused router * Add claim rewards entry to wallet * Copy changes * Fix compilation error * Fix bug that caused linked accounts without investments not showing up in rewards page * Add extrinsic hash to claim UI * Fix decimal issues * Add thousands separators to RAD reward claims * Rename tinlake get cent chain account functions * Improve missing env variable errors Co-authored-by: Jeroen Offerijns <jeroen@offerijns.com> Co-authored-by: Jeroen Offerijns <jeroen@offerijns.com>
- Loading branch information
1 parent
a6e90d8
commit 543bbf8
Showing
63 changed files
with
2,802 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { baseToDisplay } from '@centrifuge/tinlake-js' | ||
import { Box, Button } from 'grommet' | ||
import { useRouter } from 'next/router' | ||
import React from 'react' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import styled from 'styled-components' | ||
import { load, UserRewardsState } from '../../ducks/userRewards' | ||
import { addThousandsSeparators } from '../../utils/addThousandsSeparators' | ||
import { toDynamicPrecision } from '../../utils/toDynamicPrecision' | ||
|
||
export const WalletRewards = ({ address }: { address: string }) => { | ||
const dispatch = useDispatch() | ||
const userRewards = useSelector<any, UserRewardsState>((state: any) => state.userRewards) | ||
React.useEffect(() => { | ||
if (address) { | ||
dispatch(load(address)) | ||
} | ||
}, [address]) | ||
|
||
const router = useRouter() | ||
|
||
if (!userRewards.data) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Cont direction="row" pad={{ vertical: '10px', horizontal: '16px' }}> | ||
<TokenLogo src="/static/rad-black.svg" /> | ||
<Box> | ||
<Label>Your rewards</Label> | ||
<Number> | ||
{addThousandsSeparators(toDynamicPrecision(baseToDisplay(userRewards.data?.totalEarnedRewards || '0', 18)))}{' '} | ||
RAD | ||
</Number> | ||
</Box> | ||
<Button secondary onClick={() => router.push('/rewards')} label="Claim RAD" margin={{ left: 'auto' }} /> | ||
</Cont> | ||
) | ||
} | ||
|
||
const Cont = styled(Box)` | ||
background: #fcba59; | ||
border-radius: 0 0 8px 8px; | ||
` | ||
|
||
const TokenLogo = styled.img` | ||
margin: 0 14px 0 0; | ||
width: 24px; | ||
height: 24px; | ||
position: relative; | ||
top: 12px; | ||
` | ||
|
||
const Label = styled.div` | ||
font-size: 10px; | ||
font-weight: 500; | ||
height: 14px; | ||
line-height: 14px; | ||
` | ||
|
||
const Number = styled.div` | ||
font-size: 20px; | ||
font-weight: 500; | ||
height: 32px; | ||
line-height: 32px; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.