Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
f4488b6
Add initial constants and data variables for Governance DAO Smart Con…
esthercodez1 Dec 22, 2024
c9bb49c
Add data maps for members, proposals, and votes in Governance DAO Sma…
esthercodez1 Dec 22, 2024
4c481de
Add collaborations map and private utility functions in Governance DA…
esthercodez1 Dec 22, 2024
db6166b
Add private utility functions for proposal and collaboration validati…
esthercodez1 Dec 22, 2024
97b6c57
Add private function to update member reputation in Governance DAO Sm…
esthercodez1 Dec 22, 2024
28584a1
Add public functions for joining and leaving the DAO in Governance DA…
esthercodez1 Dec 22, 2024
418f079
Add public functions for staking and unstaking tokens in Governance D…
esthercodez1 Dec 22, 2024
e058009
Add public functions for proposal creation and voting in Governance D…
esthercodez1 Dec 22, 2024
da400f8
Add public function to execute proposals in Governance DAO Smart Cont…
esthercodez1 Dec 22, 2024
56416b8
Add public functions for treasury management in Governance DAO Smart …
esthercodez1 Dec 22, 2024
d3f598b
Add reputation system functions in Governance DAO Smart Contract
esthercodez1 Dec 22, 2024
170f577
Add public function for proposing cross-DAO collaborations in Governa…
esthercodez1 Dec 22, 2024
46085d1
Add public function to accept cross-DAO collaborations in Governance …
esthercodez1 Dec 22, 2024
5cf5214
Add getter functions in Governance DAO Smart Contract
esthercodez1 Dec 22, 2024
13ba0df
Add contract initialization block in Governance DAO Smart Contract
esthercodez1 Dec 22, 2024
6085c6d
Add initial project documentation
esthercodez1 Dec 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our Standards

Examples of behavior that contributes to a positive environment:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes
- Focusing on what is best for the overall community

Examples of unacceptable behavior:

- The use of sexualized language or imagery, and sexual attention or advances
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement through the project's issue tracker.
All complaints will be reviewed and investigated promptly and fairly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Contributing to Governance DAO Smart Contract

We love your input! We want to make contributing to the Governance DAO Smart Contract as easy and transparent as possible, whether it's:

- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer

## We Develop with Github

We use Github to host code, to track issues and feature requests, as well as accept pull requests.

## We Use [Github Flow](https://github.com/github/docs/blob/main/content/get-started/using-github/github-flow.md)

Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. Issue that pull request!

## Smart Contract Development Guidelines

1. **Security First**

- Always prioritize security in your changes
- Follow established security patterns
- Add appropriate checks and validations

2. **Code Style**

- Follow Clarity best practices
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions focused and modular

3. **Testing**

- Add tests for new functionality
- Ensure existing tests pass
- Test edge cases and failure scenarios

4. **Documentation**
- Update documentation for any changes
- Add inline comments for complex logic
- Update error code documentation

## Any contributions you make will be under the MIT Software License

In short, when you submit code changes, your submissions are understood to be under the same [MIT License](LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern.

## Write bug reports with detail, background, and sample code

**Great Bug Reports** tend to have:

- A quick summary and/or background
- Steps to reproduce
- Be specific!
- Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

## License

By contributing, you agree that your contributions will be licensed under its MIT License.
22 changes: 12 additions & 10 deletions Clarinet.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@

[project]
name = "GovDAO"
authors = []
description = ""
telemetry = true
requirements = []
[contracts.gov-dao]
path = "contracts/gov-dao.clar"
depends_on = []

[repl]
costs_version = 2
parser_version = 2

[repl.analysis]
passes = ["check_checker"]

[repl.analysis.check_checker]
# If true, inputs are trusted after tx_sender has been checked.
strict = false
trusted_sender = false
# If true, inputs are trusted after contract-caller has been checked.
trusted_caller = false
# If true, untrusted data may be passed into a private function without a
# warning, if it gets checked inside. This check will also propagate up to the
# caller.
callee_filter = false

# [contracts.counter]
# path = "contracts/counter.clar"
# depends_on = []
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MIT License

Copyright (c) 2024 Esther Sunday

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAM
148 changes: 148 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Governance DAO Smart Contract

A decentralized autonomous organization (DAO) smart contract built on Stacks blockchain for transparent and decentralized governance.

## Overview

This smart contract implements a comprehensive DAO system that enables:

- Decentralized decision-making through proposals and voting
- Member management with reputation and staking mechanisms
- Treasury management with secure fund handling
- Cross-DAO collaboration capabilities
- Reputation system with activity-based adjustments

## Features

- **Membership Management**

- Join/leave DAO functionality
- Token staking and unstaking
- Reputation-based system
- Activity tracking

- **Proposal System**

- Create and vote on proposals
- Automatic proposal expiration
- Weighted voting based on reputation and stake
- Transparent execution of approved proposals

- **Treasury Management**

- Secure fund handling
- Donation capabilities
- Balance tracking
- Controlled fund distribution

- **Reputation System**

- Dynamic reputation scoring
- Activity-based reputation gains
- Inactivity decay mechanism
- Weighted voting power

- **Cross-DAO Collaboration**
- Propose collaborations with other DAOs
- Accept/reject collaboration proposals
- Track collaboration status

## Getting Started

### Prerequisites

- Stacks blockchain environment
- Clarity smart contract development tools
- STX tokens for testing and deployment

### Installation

1. Clone the repository
2. Deploy the contract to the Stacks blockchain
3. Initialize the contract

### Usage

#### Joining the DAO

```clarity
(contract-call? .governance-dao join-dao)
```

#### Creating a Proposal

```clarity
(contract-call? .governance-dao create-proposal
"Proposal Title"
"Proposal Description"
u1000)
```

#### Voting on a Proposal

```clarity
(contract-call? .governance-dao vote-on-proposal u1 true)
```

#### Staking Tokens

```clarity
(contract-call? .governance-dao stake-tokens u1000)
```

## Contract Functions

### Member Management

- `join-dao`: Join the DAO as a new member
- `leave-dao`: Leave the DAO
- `stake-tokens`: Stake STX tokens
- `unstake-tokens`: Unstake previously staked tokens

### Proposal Management

- `create-proposal`: Create a new proposal
- `vote-on-proposal`: Vote on an active proposal
- `execute-proposal`: Execute an approved proposal

### Treasury Management

- `get-treasury-balance`: Get current treasury balance
- `donate-to-treasury`: Make a donation to the treasury

### Reputation System

- `get-member-reputation`: Get a member's reputation
- `decay-inactive-members`: Apply reputation decay to inactive members

### Cross-DAO Collaboration

- `propose-collaboration`: Propose collaboration with another DAO
- `accept-collaboration`: Accept a collaboration proposal

## Error Codes

- `ERR-NOT-AUTHORIZED (u100)`: Unauthorized access
- `ERR-ALREADY-MEMBER (u101)`: User is already a member
- `ERR-NOT-MEMBER (u102)`: User is not a member
- `ERR-INVALID-PROPOSAL (u103)`: Invalid proposal
- `ERR-PROPOSAL-EXPIRED (u104)`: Proposal has expired
- `ERR-ALREADY-VOTED (u105)`: Member has already voted
- `ERR-INSUFFICIENT-FUNDS (u106)`: Insufficient funds
- `ERR-INVALID-AMOUNT (u107)`: Invalid amount specified

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

## Security

For security concerns, please refer to our [SECURITY.md](SECURITY.md) file.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

For support and questions, please open an issue in the repository.
Loading