This simple voting DAO contract is designed to manage decentralized governance through proposals and voting. It utilizes ERTP (Electronic Rights Transfer Protocol) for handling and verifying digital assets within the smart contract.
- Token Minting: The contract mints its own DAO tokens and Membership NFTs which are used to manage membership and voting rights.
- Proposal Management: Members can create basic governance proposals which are then voted on by token holders.
- Voting System: Uses DAO tokens to cast votes on proposals. Members can vote 'for' or 'against' each proposal.
- Tokens (DAO and Membership) are minted when the contract starts.
- Initial tokens are allocated to the first seat (contract initiator).
Tokens (DAO and Membership) are minted when the contract starts. Initial tokens are allocated to the first seat (contract initiator):
daoTokenMint.mintGains({DaoTokens: {brand: daoTokenBrand, value: initialDaoTokens}});
createProposal(title, details)
: Creates a new proposal and returns a unique identifier for the proposal.
const proposalId = createProposal('Example Proposal Title', 'Example Proposal Description');
makeJoinInvitation()
: Returns an invitation that can be used to join the DAO. When used, it mints a new Membership NFT and allocates a specified amount of DAO tokens to the new member.
const joinInvitation = makeJoinInvitation();
makeVoteInvitation()
: Returns an invitation to vote on a proposal.
const voteInvitation = makeVoteInvitation();
vote(voterSeat, { proposalId, voteFor })
: Casts a vote for or against a proposal identified byproposalId
. The voter must have a Membership NFT and enough DAO tokens to participate. The proposal's ID must be exist in the contracts state.
vote(voterSeat, { proposalId: 1, voteFor: true });
- Token Minting: Separate mints for DAO tokens (fungible) and Membership NFTs (non-fungible).
- Proposal Handling: Proposals are stored in a Map, with methods to create and retrieve proposals.
- Voting Mechanics: Voting checks token holdings and updates proposal records with votes cast.
Simple tests cover:
- Contract installation and setup.
- Joining the DAO.
- Creating a proposal.
- Voting on a proposal.
Each test checks on token balances and proposal outcomes after operations are executed.
yarn install
yarn build
yarn test