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

Add snapshot creation logic #1216

Merged
merged 12 commits into from
Jun 11, 2021
Merged

Add snapshot creation logic #1216

merged 12 commits into from
Jun 11, 2021

Conversation

fstar1129
Copy link
Contributor

Description

Create a Snapshot Proposal flow, like a thread on CW, but gets pushed to IPFS in the proper way for a Snapshot community to fetch the Proposal. (PR7)
Also: Merge in Master (Node v14 upgrade and ETH Adapter changes)

Motivation and Context

How has this been tested?

Have proper tags been added (for bug, enhancement, breaking change)?

  • yes

Does this PR affect any server routes?

  • yes, and they are tested: [enter the % coverage here]
  • yes, and they are not tested: [enter the % coverage here]
  • yes, but I did not run tests
  • no

@zakhap zakhap changed the title Hector.create snapshot proposal Add snapshot creation logic Jun 3, 2021
Copy link
Collaborator

@zakhap zakhap left a comment

Choose a reason for hiding this comment

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

All of the new code looks good.

One thing we have to change is how we're adding new chains in this branch. Rather than adding chains in a manual migration (and having plain boilerplate api/adapter for each), across commonwealth we're using token communities to represent basic ERC20 communities. So in the cases we need to enable snapshot communities, we should be able to turn that on via the admin panel for the token/chain community. This will probably be a form of some kind that sets the snapshot property on the chain model. In this case, we can identify what controller to import in app.ts by looking for n.chain.type === 'token' && n.chain.snapshot.

@fstar1129
Copy link
Contributor Author

Got it

@fstar1129 fstar1129 requested a review from zakhap June 9, 2021 07:03
Copy link
Collaborator

@zakhap zakhap left a comment

Choose a reason for hiding this comment

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

Great progress was made here on this PR. I'm going to merge it in and add a bunch of refactoring/deleting notes to the Notion doc for a later PR that involves a more "generalized" snapshot upgrade/approach to our standard "token communities". Really useful though to have all this stuff you've added (migrations in particular) for testing, so all in all really good work.

@zakhap zakhap merged commit c78d7b6 into snapshot Jun 11, 2021
@zakhap zakhap deleted the hector.create-snapshot-proposal branch June 11, 2021 22:48
dillchen pushed a commit that referenced this pull request Jul 14, 2021
* update snapshot proposal page

* create snpashot proposal workflow

* update UI

* utilize snapshot js

* add snapshot create proposal

* add sushi token for testing purpose

* correct wrong code

* complete creating snapshot proposal

* update manage community form
jnaviask added a commit that referenced this pull request Aug 13, 2021
* Add Test Community Migrations and Modify Chain Model (#1150)

* add yearn and fei as chains
* modify chain model
* add migration
* add icons

* add snapshot to chainInfo class (#1155)

* Add yearn and fei migrations and controllers (#1156)

I'm going to merge this in so your most recent PR can be merged in post-review. But the controllers will be removed when the ETH-Token Forum PR gets merged into master upstream. We can sync over this later.

* Add boilerplate for snapshot proposal page and controller (#1167)

* fetch all proposals using snapshot (#1169)

* fetch all proposals using snapshot

* add date time fixes

Co-authored-by: dillchen <dillon@commonwealth.im>

* Add View snapshot proposal (#1178)

* add view snapshot proposal

* add viewVote component

* Add Snapshot Creation (#1216)

* update snapshot proposal page

* create snpashot proposal workflow

* update UI

* utilize snapshot js

* add snapshot create proposal

* add sushi token for testing purpose

* correct wrong code

* complete creating snapshot proposal

* update manage community form

* Hector.vote snapshot proposal (#1226)

* update snapshot proposal page

* create snpashot proposal workflow

* update UI

* utilize snapshot js

* add snapshot create proposal

* add sushi token for testing purpose

* correct wrong code

* complete creating snapshot proposal

* Handle proposals missing Passed and Executed events

* Add debug trace when Substrate proposals fail to load

* Show missing PROP/MOTs

* Reduce data passed in bulkEntities

* Include chain entities on getThread

* Remove extra sanitize pass

* Ensure treasury proposals are always created

* Add missing data tag for tres proposals

* Adjust mobile header

* Enforce DISTINCT when query for collaborators and chain entities with ARRAY_AGG

* Minor copy

* Integrate github actions. (#1219)

* Migrate CI to github actions.

* Add NO_CLIENT env for test suite.

* Map postgres port to localhost.

* Offchain Community Creation (site-admin only) (#1204)

* create an offchain community(site admin only)

* Remove commented code

* Route to the newly created community

Co-authored-by: zakhap <zhs2104@columbia.edu>

* update manage community form

* Fixed README.md to properly display instructions (#1215)

* fixed README.md to properly display instructions

* fixed connect address instructions using substrate cmd line

* Remove token balance requirement for creating threads (#1220)

* remove token balance requirement

* allow commenting as well

* Fix createReaction and remove dead code.

Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>
Co-authored-by: Jake Naviasky <jake@commonwealth.im>

* Skip token holder test cases.

* add confirm vote modal

* Fix hydradx spec and disable bounties page.

* add snapshot util functions for voting

* Fix completion hack in referendum.

* Invite Flow Fixes, Stage 1 (#1212)

* Add invite count pip

* Reinit app on private community invite acceptance

* Remove logs, remove svg work

* Conditionally close modal if no remaining invites

* Refactor Community Options Popover (#1214)

* Small Invite Flow Bug Fixes (#1213)

* small bugs for invite flow

* Get Invite Link Section updated

* button label update

* add strategies from snapshot.js to fix ts errors

* remove warnings

* Add underline to Quill Editor links

* Fix Comma/Semicolon Bug (#1224)

* Serve Substrate specs from DB. (#1223)

* Store substrate specs in db.

* Add spec_settings page.

* Remove plasm switch in substrate controller.

* Attempt CSS.

* style update

* Permit community admin to edit spec and QA.

Co-authored-by: James Truong <jamestruong.consult@gmail.com>

* complete voting

* utilize snapshotjs npm package

* fix linting test

* test linting

* fix lint error and update code

* Tips UI (#1221)

* Remove puppeteer.

* Add tip controllers.

* Add tentative view.

* Comment out tx success callbacks.

* tips ui integration first pass

* tips ui done

* changed tip value from sum to median

* changed tip value display style to match design

* Bump CW version and fix migrations.

* fix responsive design issue, show contribute only for council members and tip reason in listing page

* minor styling change

* Fix tip view page error.

Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: zakhap <zhs2104@columbia.edu>

* Added Google Tag Manager Script (#1233)

* Offchain Polls v2 (#1240)

* motions wip

* sidebar wip

* sidebar modules

* hierarchical sidebar

* move poll, style revs

* Add offchain voting options json blob to backend

* offchain vote options

* Add form, update JSON field names, revs on poll creation flow

* Bug fixes and styling

* More bugs and style fixes

* Hide motions for now

* Minor fixes: Update copy for offchain communities, update styling

* Minor fixes: topic selector dropdown arrow

* Fix allowNull requirement for threads

* Update user address styling

* Adjust discussion row tag styling

* Fix responsive new thread form, mobile header glitch

* Fix notifications menu overflow text

* Use formatter on notification rows

* Reset app.chain when chain initialization was aborted, to prevent infinite spinner race condition

* Manage community modal styling

* Tips "Reason" fix (#1242)

* tips reason fix: commonwealth links open in the same tab

* changes based on Zak's review

* update getVotes from snapshot.js

* Optimization: Load bulkOffchain in parallel with proposal comments and chain entities (#1243)

* Bump typescript dependency version.

* fix ajv issue

* Remove global and cleanup lint and add redraw.

* Lint fixes.

* Add another demo community

* Add new snapshot space id to fei

* Add voting buffer style

* Fix voter addresses to be User objects and the snapshot author to be User object with link

* Fix header spacing issues

* Unlink the Created and Updated at metadata, date calculation still wrong

* Add spinner while proposals load from snapshot api

* Make the proposal form look nicer, oddly thin?, removed the weird date-pickers.

* Remove evidence of DatePicker from form

* Add spinner for when callout is loading on new proposal form

* Add margin to the bottom of voting actions so they don't touch the bottom

* Add comment on VotingAction buttons where they're hardcoded to always be clickable.

* Comment out SnapshotProposalStagesBar because it has no logic to do anything and the proposal rows do not have attributes for filtering yet.

* Add fei.eth back to migration

* Fix ending/ended ago bug

* Add 'in' to timestamp interpretation

* resetServer.ts demos community, broken

* Add generic snapshot adapter and use it for all snapshot communities

* Add demo community to migration and ChainNetwork, probably wrong contract address on chainnode"

* Add demo to down migration and add TEST token contract to node

* Make hub.snapshot default, add demo community.

* Default apollo to hub.snapshot as well

* Add demo to address model

* The changes to run the demo, not generalized

* Make snapshot pages mobile friendly

* add snapshot filtering

* Clean up proposal listing UI

* UI tweaks for snapshot proposal pages

* Catch voting errors

* Switch off oninit lifecycle; move submit proposal button to new proposal button

Co-authored-by: Raymond Zhong <raykyri@gmail.com>
Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: rakeshup <parthiban.rakesh95@gmail.com>
Co-authored-by: zakhap <zhs2104@columbia.edu>
Co-authored-by: Timothee Legros <62490329+timolegros@users.noreply.github.com>
Co-authored-by: maxwellfoley3 <maxwellsfoley@gmail.com>
Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>
Co-authored-by: gdjohnson <graham@commonwealth.im>
Co-authored-by: true-eye <jamestruong.consult@gmail.com>
Co-authored-by: Raymond Zhong <raykyri@users.noreply.github.com>

* Clean up copy in review

* add option to autofill snapshot proposal from existing thread (#1250)

* add option to autofill snapshot proposal from existing thread

* remove code accidentally added in merge

Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>

* Add Test Community Migrations and Modify Chain Model (#1150)

* add yearn and fei as chains
* modify chain model
* add migration
* add icons

* add snapshot to chainInfo class (#1155)

* Add yearn and fei migrations and controllers (#1156)

I'm going to merge this in so your most recent PR can be merged in post-review. But the controllers will be removed when the ETH-Token Forum PR gets merged into master upstream. We can sync over this later.

* Add boilerplate for snapshot proposal page and controller (#1167)

* fetch all proposals using snapshot (#1169)

* fetch all proposals using snapshot

* add date time fixes

Co-authored-by: dillchen <dillon@commonwealth.im>

* Add View snapshot proposal (#1178)

* add view snapshot proposal

* add viewVote component

* Add Snapshot Creation (#1216)

* update snapshot proposal page

* create snpashot proposal workflow

* update UI

* utilize snapshot js

* add snapshot create proposal

* add sushi token for testing purpose

* correct wrong code

* complete creating snapshot proposal

* update manage community form

* Hector.vote snapshot proposal (#1226)

* update snapshot proposal page

* create snpashot proposal workflow

* update UI

* utilize snapshot js

* add snapshot create proposal

* add sushi token for testing purpose

* correct wrong code

* complete creating snapshot proposal

* Handle proposals missing Passed and Executed events

* Add debug trace when Substrate proposals fail to load

* Show missing PROP/MOTs

* Reduce data passed in bulkEntities

* Include chain entities on getThread

* Remove extra sanitize pass

* Ensure treasury proposals are always created

* Add missing data tag for tres proposals

* Adjust mobile header

* Enforce DISTINCT when query for collaborators and chain entities with ARRAY_AGG

* Minor copy

* Integrate github actions. (#1219)

* Migrate CI to github actions.

* Add NO_CLIENT env for test suite.

* Map postgres port to localhost.

* Offchain Community Creation (site-admin only) (#1204)

* create an offchain community(site admin only)

* Remove commented code

* Route to the newly created community

Co-authored-by: zakhap <zhs2104@columbia.edu>

* update manage community form

* Fixed README.md to properly display instructions (#1215)

* fixed README.md to properly display instructions

* fixed connect address instructions using substrate cmd line

* Remove token balance requirement for creating threads (#1220)

* remove token balance requirement

* allow commenting as well

* Fix createReaction and remove dead code.

Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>
Co-authored-by: Jake Naviasky <jake@commonwealth.im>

* Skip token holder test cases.

* add confirm vote modal

* Fix hydradx spec and disable bounties page.

* add snapshot util functions for voting

* Fix completion hack in referendum.

* Invite Flow Fixes, Stage 1 (#1212)

* Add invite count pip

* Reinit app on private community invite acceptance

* Remove logs, remove svg work

* Conditionally close modal if no remaining invites

* Refactor Community Options Popover (#1214)

* Small Invite Flow Bug Fixes (#1213)

* small bugs for invite flow

* Get Invite Link Section updated

* button label update

* add strategies from snapshot.js to fix ts errors

* remove warnings

* Add underline to Quill Editor links

* Fix Comma/Semicolon Bug (#1224)

* Serve Substrate specs from DB. (#1223)

* Store substrate specs in db.

* Add spec_settings page.

* Remove plasm switch in substrate controller.

* Attempt CSS.

* style update

* Permit community admin to edit spec and QA.

Co-authored-by: James Truong <jamestruong.consult@gmail.com>

* complete voting

* utilize snapshotjs npm package

* fix linting test

* test linting

* fix lint error and update code

* Tips UI (#1221)

* Remove puppeteer.

* Add tip controllers.

* Add tentative view.

* Comment out tx success callbacks.

* tips ui integration first pass

* tips ui done

* changed tip value from sum to median

* changed tip value display style to match design

* Bump CW version and fix migrations.

* fix responsive design issue, show contribute only for council members and tip reason in listing page

* minor styling change

* Fix tip view page error.

Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: zakhap <zhs2104@columbia.edu>

* Added Google Tag Manager Script (#1233)

* Offchain Polls v2 (#1240)

* motions wip

* sidebar wip

* sidebar modules

* hierarchical sidebar

* move poll, style revs

* Add offchain voting options json blob to backend

* offchain vote options

* Add form, update JSON field names, revs on poll creation flow

* Bug fixes and styling

* More bugs and style fixes

* Hide motions for now

* Minor fixes: Update copy for offchain communities, update styling

* Minor fixes: topic selector dropdown arrow

* Fix allowNull requirement for threads

* Update user address styling

* Adjust discussion row tag styling

* Fix responsive new thread form, mobile header glitch

* Fix notifications menu overflow text

* Use formatter on notification rows

* Reset app.chain when chain initialization was aborted, to prevent infinite spinner race condition

* Manage community modal styling

* Tips "Reason" fix (#1242)

* tips reason fix: commonwealth links open in the same tab

* changes based on Zak's review

* update getVotes from snapshot.js

* Optimization: Load bulkOffchain in parallel with proposal comments and chain entities (#1243)

* Bump typescript dependency version.

* fix ajv issue

* Remove global and cleanup lint and add redraw.

* Lint fixes.

* Add another demo community

* Add new snapshot space id to fei

* Add voting buffer style

* Fix voter addresses to be User objects and the snapshot author to be User object with link

* Fix header spacing issues

* Unlink the Created and Updated at metadata, date calculation still wrong

* Add spinner while proposals load from snapshot api

* Make the proposal form look nicer, oddly thin?, removed the weird date-pickers.

* Remove evidence of DatePicker from form

* Add spinner for when callout is loading on new proposal form

* Add margin to the bottom of voting actions so they don't touch the bottom

* Add comment on VotingAction buttons where they're hardcoded to always be clickable.

* Comment out SnapshotProposalStagesBar because it has no logic to do anything and the proposal rows do not have attributes for filtering yet.

* Add fei.eth back to migration

* Fix ending/ended ago bug

* Add 'in' to timestamp interpretation

* resetServer.ts demos community, broken

* Add generic snapshot adapter and use it for all snapshot communities

* Add demo community to migration and ChainNetwork, probably wrong contract address on chainnode"

* Add demo to down migration and add TEST token contract to node

* Make hub.snapshot default, add demo community.

* Default apollo to hub.snapshot as well

* Add demo to address model

* The changes to run the demo, not generalized

* Make snapshot pages mobile friendly

* add snapshot filtering

* Clean up proposal listing UI

* UI tweaks for snapshot proposal pages

* Catch voting errors

* Switch off oninit lifecycle; move submit proposal button to new proposal button

Co-authored-by: Raymond Zhong <raykyri@gmail.com>
Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: rakeshup <parthiban.rakesh95@gmail.com>
Co-authored-by: zakhap <zhs2104@columbia.edu>
Co-authored-by: Timothee Legros <62490329+timolegros@users.noreply.github.com>
Co-authored-by: maxwellfoley3 <maxwellsfoley@gmail.com>
Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>
Co-authored-by: gdjohnson <graham@commonwealth.im>
Co-authored-by: true-eye <jamestruong.consult@gmail.com>
Co-authored-by: Raymond Zhong <raykyri@users.noreply.github.com>

* Clean up copy in review

* add option to autofill snapshot proposal from existing thread (#1250)

* add option to autofill snapshot proposal from existing thread

* remove code accidentally added in merge

Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>

* merge master

* Removing fei/sushi/yearn adapters, unnecessary with token/snapshot adapters

* Show admin snapshot (ETH only) and validate inputs (#1257)

* show snapshot field only on tokens, and check input

* delete unnecessary page

* do extra input checking on back end for snapshot info

* formatting

Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>

* Add create proposal button back with cherry-pick from private repo

* Fix snapshot update check in updateChain route

* Change fei et al to type token

* Remove old adapter stuff, unnecessary for snapshot

* Fix issue #1 from Max's QA list

* Assorted bug fixes for snapshot (#1258)

* Assorted bug fixes for snapshot

- voting modal now properly loads
- 'Load more' on list of voters
- Ended and active proposals is now accurate
- Voting buttons only display on active proposals
- 'Last edited' changed to 'Ended'

* remove console log

* fix name change

Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>

* New Snapshot DatePicker

* Core Community pending

* use existing webwalletcontroller to sign the snapshot proposal message

* Fix imports and finish implementing webwallet over window.ethereum

* Remove sushi migration and add loading spinners.

* remove simplepicker and add radio buttons (#1271)

* Add simplepicker.

* prompt enable wallet if disabled

* format snapshot form properly for API

* assorted minor bug fixes

* Fix sidebar conditionals and remove unused migration.

* Proposal queries now via apollo.

* Controllers refactor.

* Small style changes.

* Reenable callout warning.

* get rid of spinner state on new proposal creation snapshot page

* fix voting

* minor display fixes

* Fix snapshot proposal page loading.

* Cleanup getPower init.

* Fix proposal creation redirect and add walletconnect.

Co-authored-by: fstar1129 <41280117+fstar1129@users.noreply.github.com>
Co-authored-by: fstar1129 <hector1990112950@hotmail.com>
Co-authored-by: zakhap <zhs2104@columbia.edu>
Co-authored-by: Raymond Zhong <raykyri@gmail.com>
Co-authored-by: Jake Naviasky <jake@commonwealth.im>
Co-authored-by: rakeshup <parthiban.rakesh95@gmail.com>
Co-authored-by: Timothee Legros <62490329+timolegros@users.noreply.github.com>
Co-authored-by: maxwellfoley3 <maxwellsfoley@gmail.com>
Co-authored-by: Maxwell Foley <maxwell.foley@certik.org>
Co-authored-by: gdjohnson <graham@commonwealth.im>
Co-authored-by: true-eye <jamestruong.consult@gmail.com>
Co-authored-by: Raymond Zhong <raykyri@users.noreply.github.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