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

Claim RAD UI #93

Merged
merged 76 commits into from
Jan 19, 2021
Merged

Claim RAD UI #93

merged 76 commits into from
Jan 19, 2021

Conversation

philipstanislaus
Copy link
Contributor

No description provided.

@philipstanislaus philipstanislaus changed the title Claim rad Claim RAD UI Jan 4, 2021
Copy link
Contributor

@hieronx hieronx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great Philip!

tinlake-ui/components/LoadingValue/index.tsx Show resolved Hide resolved
height?: number
maxWidth?: number
alignRight?: boolean
render: () => React.ReactNode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this. children is the standard way to pass "inner contents" of an element. Why do you need this render prop, rather than just using the children prop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a function allows conditional evaluation of the arguments to that function. I added it here so we can actually use values we check in the done property, without needing to check for undefined/null/loading in the arguments again.

Created a small codesandbox for you to play around with – feel free to ping me on Slack to show you what I mean: https://codesandbox.io/s/dreamy-wright-4g97l?file=/src/App.js

tinlake-ui/components/WalletRewards/index.tsx Show resolved Hide resolved
tinlake-ui/components/WithTinlake/index.tsx Show resolved Hide resolved
tinlake-ui/config.ts Show resolved Hide resolved
tinlake-ui/ducks/centChainWallet.ts Show resolved Hide resolved
claims: null | RewardClaim[]
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like how you organised all the ducks and properly documented this inline!

tinlake-ui/services/apollo/index.ts Show resolved Hide resolved
} from './radRewardProofs'
const BN = require('bn.js')

describe('Proofs', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

* Returns a number rounded to 4 decimals if the value is smaller than 10, and to 0 decimlas otherwise.
* @param num amount with a decimal dot, not in base units
*/
export const toDynamicPrecision = (num: string) => toPrecision(num, dynamicPrecision(num))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this can be really useful in other places as well.

@philipstanislaus
Copy link
Contributor Author

Thanks for your feedback @offerijns , merging this now and will address all your points in another PR.

@philipstanislaus philipstanislaus merged commit 7434f2d into main Jan 19, 2021
@philipstanislaus philipstanislaus deleted the claim-rad branch January 19, 2021 15:31
philipstanislaus added a commit that referenced this pull request Jan 19, 2021
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants