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

Refactor UI to Utilize useChainState Hook for Contract Address Retrieval #49

Closed
6 tasks done
bayological opened this issue Jan 29, 2024 · 0 comments · Fixed by #50
Closed
6 tasks done

Refactor UI to Utilize useChainState Hook for Contract Address Retrieval #49

bayological opened this issue Jan 29, 2024 · 0 comments · Fixed by #50
Assignees

Comments

@bayological
Copy link
Member

bayological commented Jan 29, 2024

Description

We now have a deployment of the governance contracts on testnets, which are now available in the SDK. We need to update the UI code to make use of these addresses instead of hardcoding contract addresses here.

To achieve this we should do the following:

  • Update the chain helper to include the contracts and addresses that are needed in the UI
  • Use the latest version of the SDK and set the correct addresses for the chains defined in the chain helper
  • Update the chain state data to include an object to store the addresses of the mento contracts, then ensure they are populated.
  • Remove any hard coded contract addresses and refactor to make use of the useChainState hook

Acceptance Criteria

  • The chain helper (app/helpers/chains.ts) includes the required contracts and addresses.
  • The correct addresses for the chains defined in the chain helper are pulled from the latest SDK version
  • The chain state data (app/providers/chainState.provider.tsx) includes an object to store mento contract addresses.
  • The mento contract addresses are populated in the chain state data.
  • The UI interacts with the useChainState hook (app/providers/chainState.provider.tsx) to retrieve and use contract addresses.
  • All UI features requiring contract interaction function correctly with the new addresses.
bayological pushed a commit that referenced this issue Feb 2, 2024
### Description

It improves the chain state helper definition and loading and exposes a `useContracts` hook used throughout the app.
The problem with this PR right now is that the addresses in the SDK are not the ones that are indexed in `The Graph` that is a separate deployment. I will migrate the indexers to this deployment as well.

After I do that, however, we will have no test proposals because the ones that I created are on the other deployment.
We need a small script to seed the deployment with some test proposals that have votes. 

### Other changes

- None

### Tested

- Verified correct contract addresses were being used with logs on chain switch :)

### Related issues

-  Fixes #49
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 a pull request may close this issue.

2 participants