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

Remove coin machine & whitelist extensions #3663

Merged
merged 6 commits into from
Aug 1, 2022

Conversation

danbr
Copy link
Contributor

@danbr danbr commented Jul 21, 2022

Description

This PR removes coin machine & whitelist extensions from the Dapp (combining #3531 & #3532).

Extensions authorised to be used within the Dapp are defined here:
https://github.com/JoinColony/colonyDapp/blob/refactor/3532-remove-whitelist-coinmachine/src/modules/dashboard/components/Extensions/index.ts#L7

export const dappExtensions = [
  Extension.OneTxPayment,
  Extension.VotingReputation,
];

I have removed the following for both coin machine & whitelist extensions :

  • Remove the ability to install either extension
  • Only 'approved' extensions displayed to be considered for installation
  • Remove the route and menu items
  • Remove queries
  • Remove resolvers
  • Remove sagas
  • Remove hooks
  • Remove components
  • Remove types
  • Remove language data
  • Verified Recipient functionality (remains untouched)

There are many changes in this PR, many areas were touched. I have tested many paths through the app without discovering any issues or anomalies.

Resolves #3531 & #3532

@danbr danbr self-assigned this Jul 21, 2022
@danbr danbr requested a review from a team July 21, 2022 13:00
@danbr danbr marked this pull request as ready for review July 21, 2022 13:00
Copy link
Contributor

@ArmandoGraterol ArmandoGraterol left a comment

Choose a reason for hiding this comment

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

Nice work! There are still some places that need to be updated:

  1. In the actionTypes file there are some WHITELIST_UPDATE types that correspond to the whitelist extension.
  2. The WhitelistAddresses and WhitelistMembersListExtraContent components were only used by the whitelist extension.
  3. src/types/extensions.ts only contains a type that was used by the coin machine, so that file can be deleted.
  4. These dependencies can now be uninstalled: @synaps-io/verify.js, react-confetti, react-textfit, and react-twitter-widgets

@danbr
Copy link
Contributor Author

danbr commented Jul 25, 2022

Nice work! There are still some places that need to be updated:

  1. In the actionTypes file there are some WHITELIST_UPDATE types that correspond to the whitelist extension.
  2. The WhitelistAddresses and WhitelistMembersListExtraContent components were only used by the whitelist extension.
  3. src/types/extensions.ts only contains a type that was used by the coin machine, so that file can be deleted.
  4. These dependencies can now be uninstalled: @synaps-io/verify.js, react-confetti, react-textfit, and react-twitter-widgets

Thanks for your comments, they're very helpful. In fact i was planning on adding a comment on WHITELIST_UPDATE in the PR. I wasnt sure if it was being used..... Originally i removed it, and it caused a silly amount of errors.
I'll implement your suggestions.

@danbr danbr requested a review from ArmandoGraterol July 25, 2022 06:47
Copy link
Collaborator

@willm30 willm30 left a comment

Choose a reason for hiding this comment

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

When hitting /extensions/CoinMachine and /extensions/Whitelist in the URL, the app crashes with the following errors instead of redirecting:

Coin Machine
coinmac

Whitelist
whitelist

Copy link
Contributor

@ArmandoGraterol ArmandoGraterol left a comment

Choose a reason for hiding this comment

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

Looking great! A lot of deleted code, kind of satisfying :)

@ArmandoGraterol
Copy link
Contributor

When hitting /extensions/CoinMachine and /extensions/Whitelist in the URL, the app crashes with the following errors instead of redirecting:

Coin Machine coinmac

Whitelist whitelist

@willm30 That's what happens if you hit that URL with any extension that doesn't exist. It's not okay that it's happening but it's not something introduced by this PR.

It's something that could be dealt with in this PR if Dan wants to, but it can perfectly be its own Maintenance issue.

@willm30
Copy link
Collaborator

willm30 commented Jul 25, 2022

It's something that could be dealt with in this PR if Dan wants to, but it can perfectly be its own Maintenance issue.

Got it. Made the issue for it here: #3678

@willm30 willm30 self-requested a review July 25, 2022 18:38
Copy link
Contributor

@chinins chinins left a comment

Choose a reason for hiding this comment

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

Very comprehensive work - impressive! You probably needed a lot of patience 🙈

I left a couple of comments of small things that can be removed, it's very hard to catch them. I only know because I implemented some of it.

import { DEFAULT_NETWORK_INFO } from '~constants';
import { Address, WhitelistPolicy } from '~types/index';
import { CM_BLOG_POST, CM_GOOGLE_SHEET, CM_DESCRIPTION } from '~externalUrls';
import { Address } from '~types/index';
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't comment directly on the line because it was not changed, so will comment for the file. You can remove ColonyPolicySelector in ExtensionParamType - it's for whitelist as far as I remember and we are not using it anywhere

Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove orderNumber and options from ExtensionInitParams, it was only for coin machine and whitelist respectively.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can also remove disabled from ExtensionInitParams & from params.map in ExtensionSetup. I think it was only used for whitelist policy selector (when whitelist agreement was not an option). But please test

Copy link
Contributor

Choose a reason for hiding this comment

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

I think tokenLabel is not needed in ExtensionInitParams either.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that you can also remove fieldName from ExtensionInitParams & from ExtensionSetup

Copy link
Contributor

Choose a reason for hiding this comment

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

And I think you can remove ExtensionParamType.TokenSelector from both files

Copy link
Contributor

Choose a reason for hiding this comment

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

From ExtensionData I think you can remove:

  • address
  • header
  • descriptionExtended (from ExtensionSetup too)
  • descriptionLinks (from ExtensionSetup too)
  • tokenContractAddress (from ExtensionSetup too)
  • info
  • extraInitParams (from ExtensionSetup too)
  • enabledExtensionBody

@willm30
Copy link
Collaborator

willm30 commented Jul 26, 2022

@danbr As I was working through this issue I noticed references to whitelist in a few places, e.g. the processedColony resolver. I have touched as little as possible in that PR so as to maintain separation of work but did need to tweak a few things so I've used this branch as the base. In the getProcessedColony function for example, I left whitelistActivated in so am bringing to your attention.

I also notice a few search results in VS code when I do a text search for whitelist or WhitelistDialog. You might be aware of these already but also flagging just in case (the 'ManageWhitelistDialog' being the most obvious one).

@danbr
Copy link
Contributor Author

danbr commented Jul 27, 2022

@danbr As I was working through this issue I noticed references to whitelist in a few places, e.g. the processedColony resolver. I have touched as little as possible in that PR so as to maintain separation of work but did need to tweak a few things so I've used this branch as the base. In the getProcessedColony function for example, I left whitelistActivated in so am bringing to your attention.

I also notice a few search results in VS code when I do a text search for whitelist or WhitelistDialog. You might be aware of these already but also flagging just in case (the 'ManageWhitelistDialog' being the most obvious one).

@willm30 Thank you for your notification. There will still be code using whitelist terms but its not associated with the extension .
Previously there was both a whitelist extension and a 'verified recipient' feature that provides an address book and implementation of a whitelist (outside of the extension). Only the whitelist extension was removed.

Copy link
Member

@rdig rdig left a comment

Choose a reason for hiding this comment

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

Very nice! This obviously took a lot of work! 💯

I've left some notes on what can be improved and stuff that was missed and needs to be removed.

Since I can't comment on the file itself, I'll leave this note here:

  • The authenticateKYC method from src/api/auth.ts needs to be also removed since it's not being used anymore

Either way I'm pre-approving this!

Comment on lines 7 to 10
export const dappExtensions = [
Extension.OneTxPayment,
Extension.VotingReputation,
];
Copy link
Member

Choose a reason for hiding this comment

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

So I think we can simplify this even further.

  1. Remove this
  2. Remove Unknown from the extensions map inside data/staticData/extensionData.tsx (it was set up as an fallback, but we never ended up using it)
  3. Refactor the extensions map to use Extension.<ExtensionName> enums as keys (instead of them being manually typed)
  4. Use that array as the source for what extensions to surface in the dapp

It actually makes sense since if that mapping doesn't have an entry for the extension, it won't have any data to display when trying to render the extension's card on the extension's page.

So it's only fitting that we use this object to also control the "supported" extensions inside the dapp

(maybe leave a comment about this, that we're using this object to control the extensions display)


const MSG = defineMessages({
removeCSVText: {
id: 'dashboard.Whitelist.CSVUploader.CSVUploaderItem.removeCSVText',
id: 'core.CSVUploader.CSVUploaderItem.removeCSVText',
Copy link
Member

Choose a reason for hiding this comment

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

Good attention to details :)

actionType: 'SUBMIT' | 'ERROR' | 'SUCCESS',
extensionId: string,
) => {
export const getButtonAction = (actionType: 'SUBMIT' | 'ERROR' | 'SUCCESS') => {
Copy link
Member

Choose a reason for hiding this comment

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

Again, nice catch. No reason in keeping it around

Comment on lines 56 to 57
// @NOTE get list of installed extensions that are only allowed to be
// used within the dapp
Copy link
Member

Choose a reason for hiding this comment

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

See my note about using the object from static data for this

Comment on lines 152 to 154
// be careful to use matching data with both
// installedExtensionsData & dappInstalledExtensions
installedExtension={getDappInstalledExtension(idx)}
Copy link
Member

Choose a reason for hiding this comment

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

So extensions can also be installed at the contract level.

Might might want to "enforce" only showing the supported ones, even though the colony has more installed.

Comment on lines -22 to -26
export const CM_LEARN_MORE = `https://colony.gitbook.io/colony/extensions/coin-machine`;
export const CM_GET_WHITELISTED = `https://colony.gitbook.io/colony/get-started/how-to-get-whitelisted-for-the-clny-sale.`;
export const CM_BLOG_POST = `https://blog.colony.io/introducing-coin-machine/`;
export const CM_GOOGLE_SHEET = `https://docs.google.com/spreadsheets/d/1ZCuFcwqI4S6ZK5OwTl1yN7AK8mjv5d_V3g-_kMen01Y/edit#gid=2013814210`;
export const CM_DESCRIPTION = 'https://colony.gitbook.io/colony/';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe ask @arrenv or however is managing our Gitbook, if these links are still relevant to them, otherwise they should remove them on their end as well.

Copy link
Member

@arrenv arrenv Jul 28, 2022

Choose a reason for hiding this comment

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

Good point, there is some content we will still want to use, so, I have temporarily added a note on each of the Coin Machine pages in GitBook until they can be removed.

@@ -260,7 +233,6 @@ export const parseSubgraphEvent = ({
...addressArgumentParser(parsedArguments),
...motionArgumentparser(parsedArguments),
...storageSlotArgumentParser(parsedArguments),
...coinMachineEventsArgumentParser(parsedArguments),
...whitelistEventsArgumentParser(parsedArguments),
Copy link
Member

Choose a reason for hiding this comment

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

This one should be removed as well

Copy link
Contributor

@chinins chinins left a comment

Choose a reason for hiding this comment

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

The updates are all correct, so it's good to merge. I agree with Raul that this is a better approach.

type ExtensionDataPartialMap = Partial<
{
[E in Extension]: ExtensionData;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Very nice type casting!

@danbr danbr force-pushed the refactor/3532-remove-whitelist-coinmachine branch from 2662619 to 94aa383 Compare August 1, 2022 10:38
@danbr danbr merged commit ac3d104 into master Aug 1, 2022
@danbr danbr deleted the refactor/3532-remove-whitelist-coinmachine branch August 1, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the Coin Machine extension
6 participants