near-ndc / voting-v1 Goto Github PK
View Code? Open in Web Editor NEWVoting smart contracts for NDC v1
License: Other
Voting smart contracts for NDC v1
License: Other
How does the Transparency Commission start? Elected.
GWG serves the role of Election Committee
candidacy process via forum threads + polls
stake-weighted voting for constitution
stake-weighted ranking for elections
Traditionally, the NEAR core / examples smart contract put integration tests in a totally separate crate. For example the NFT reference implementation has integration tests outside of the NFT crate and outside of the main workspace (the integration-tests
are not linked to the root workspace cargo file). Similarly the workspace-rs
example doesn't put integration tests in a tests
subdirectory of the contract crate.
This is not what a Rustacean would expect. Rust integration tests, per documentation are placed in /tests
directory (sibling to the /src
directory).
We tried to follow the Rust structure by moving the tests to the tests
directory with a workspace setup, but unfortunately this doesn't work.
cd elections
cargo test
# wait 5min
# you will see error that crate "elections" is not found
error[E0433]: failed to resolve: use of undeclared crate or module elections
--> elections/tests/iah.rs:7:5
|
7 | use elections::proposal::{HouseType, TokenMetadata, SECOND, VOTE_COST};
| ^^^^^^^^^ use of undeclared crate or module elections
Moreover, any change in the file will cause long run of the tests, due to recompilation of the workspace.
/elections/tests
integration tests don't compile (what's wrong with the setup)./elections/tests
(rather than moving them to a separate workspace directory).Enhance the existing smart-contract to include a new view method that returns detailed voting participation information of all users.
This includes their voting choices (Approve, Reject, Abstain) across all proposals and the number of proposals they have created.
The current smart-contract includes structures for recording individual votes and proposals. However, it lacks a consolidated view of voting participation by each user.
CollectedResults
approves: u16
- Total number of approvals.rejects: u16
- Total number of rejections.abstains: u16
- Total number of abstentions.created: u16
- Number of proposals created by the user.user_collected_results
UnorderedMap<AccountId, CollectedResults>
.user_collected_results
from Existing DataCollectedResults
for each voter and the proposer.user_collected_results
on Each VoteCollectedResults
in user_collected_results
.proposals_created
count for the proposer in user_collected_results
.get_voting_participation
user_collected_results
are efficient, especially for large number of proposals and users.user_collected_results
.The following deployed smart-contracts will be updated with the new features:
congress-hom-v1.ndc-gwg.near
congress-tc-v1.ndc-gwg.near
congress-coa-v1.ndc-gwg.near
The current project repository is available at NEAR NDC Voting V1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.