Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d32d0a1
Update the description of env example
rayedsikder Apr 29, 2025
35712c2
Modularize deploy scripts
rayedsikder Apr 29, 2025
5c826c1
Add Implementation deployment script
rayedsikder Apr 29, 2025
11dc746
Update import
rayedsikder Apr 29, 2025
ff76aae
Update env to specify fee params
rayedsikder Apr 29, 2025
1131b24
Update .env structure
rayedsikder Apr 29, 2025
ca5d6d7
Add setup script for platform
rayedsikder Apr 29, 2025
cb38d13
Improve validations and fix logical issues
rayedsikder May 8, 2025
9575d7a
Improve validation
rayedsikder May 8, 2025
aa2c93e
Improve validation in GlobalParams
rayedsikder May 8, 2025
bde4053
Update code docs
rayedsikder May 8, 2025
a4ffc80
Remove redundant variable `CAMPAIGN_INFO`
rayedsikder May 8, 2025
32b7b16
Call `_safeMint` after state changes in `_pledge`
rayedsikder May 8, 2025
c1595f4
Update docs
rayedsikder May 14, 2025
9e26d61
Update license type and imports
rayedsikder May 15, 2025
317463f
Move TestUSD inside mocks
rayedsikder May 15, 2025
a84b65d
Update readme
rayedsikder May 15, 2025
90058a5
Update GitHub Actions workflow to use actions/upload-artifact@v4
rayedsikder May 15, 2025
ff71719
Update test.yml to install release version of foundry
rayedsikder May 15, 2025
42bbfad
Update foundry version
rayedsikder May 15, 2025
65ce096
Update to use the default version
rayedsikder May 15, 2025
63d74fe
Update test.yml to install dependencies
rayedsikder May 15, 2025
a0a168e
Update OpenZeppelin version in test.yml
rayedsikder May 15, 2025
3e7b98e
Update file name `DeployAllAndSetup.s.sol` to `DeployAllAndSetupAllOr…
rayedsikder May 20, 2025
8e3b6d7
Update `TestUSD` to `TestToken`
rayedsikder May 22, 2025
4bbd918
Add defaults for TestToken
rayedsikder May 22, 2025
561b8e6
Update env.example
rayedsikder May 22, 2025
cfd145b
Add Code of Conduct
rayedsikder May 22, 2025
cc290d0
Add Contribution Guidelines
rayedsikder May 22, 2025
cea10ac
Update foundry.toml
rayedsikder May 22, 2025
9cce955
Update Readme.md
rayedsikder May 22, 2025
c76f696
Add audit report
rayedsikder May 22, 2025
847ebcd
Update .env structure
rayedsikder May 22, 2025
ab5811e
Remove unused `CampaignInfoOwnershipTransferred`
rayedsikder May 22, 2025
1f67917
Use >= `_revertIfCurrentTimeIsNotLess` and <= in `_revertIfCurrentTim…
rayedsikder May 22, 2025
b6945e2
Add helper functions
rayedsikder Jun 6, 2025
98bd8fe
Update git source
rayedsikder Jun 6, 2025
a71b944
Update function name
rayedsikder Jun 6, 2025
e9dd49d
Add contribution and licensing info
rayedsikder Jun 6, 2025
c0aca4e
Remove TestUSD link
rayedsikder Jun 6, 2025
1b198e0
Add test cases
rayedsikder Jun 6, 2025
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
29 changes: 19 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,44 @@ jobs:
name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check-out the repo
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Debug Info
run: |
pwd
ls -la
cat foundry.toml

- name: Install dependencies
run: |
# Install OpenZeppelin contracts version 5.3.0
forge install OpenZeppelin/openzeppelin-contracts@v5.3.0
ls -la lib/

- name: Run Forge build
run: |
forge --version
forge remappings
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
run: forge test -vvv
id: test

- name: Run gas report
run: |
forge test --gas-report > gas-report.txt
run: forge test --gas-report > gas-report.txt
if: always()
id: gas

- name: Archive gas report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: gas-report
path: gas-report.txt
path: gas-report.txt
133 changes: 133 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@

# 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, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* 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,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their 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.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
197 changes: 197 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
# Contributing to CC Protocol

Thank you for your interest in contributing to the Creative Crowdfunding Protocol! This document provides detailed guidelines to help you contribute effectively.

## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [Getting Started](#getting-started)
- [Issues](#issues)
- [Development Environment](#development-environment)
- [Development Workflow](#development-workflow)
- [Branching Strategy](#branching-strategy)
- [Making Changes](#making-changes)
- [Testing](#testing)
- [Documentation](#documentation)
- [Smart Contract Development Guidelines](#smart-contract-development-guidelines)
- [Security Best Practices](#security-best-practices)
- [Gas Optimization](#gas-optimization)
- [Code Style](#code-style)
- [Pull Request Process](#pull-request-process)
- [PR Requirements](#pr-requirements)
- [Review Process](#review-process)
- [Community](#community)

## Code of Conduct

Please read our [Code of Conduct](./CODE_OF_CONDUCT.md) to understand the behavior we expect from all contributors.

## Getting Started

### Issues

#### Create a New Issue

If you want to add or modify the content of this project:

1. [Search if an issue already exists](https://github.com/ccprotocol/ccprotocol-contracts/issues)
2. If a related issue doesn't exist, create a new issue using the appropriate template
3. Discuss the proposed changes with the community before starting work
4. Wait for issue assignment or approval before submitting a PR

#### Solve an Issue

Scan through our [existing issues](https://github.com/ccprotocol/ccprotocol-contracts/issues) to find one that interests you. You can use labels to filter issues:

- `good first issue`: Suitable for newcomers
- `bug`: Issues with the existing code
- `enhancement`: New features or improvements
- `documentation`: Documentation improvements
- `help wanted`: Issues where help is particularly needed

### Development Environment

1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/YOUR_USERNAME/ccprotocol-contracts.git
cd ccprotocol-contracts
```
3. Add the original repository as upstream:
```bash
git remote add upstream https://github.com/ccprotocol/ccprotocol-contracts.git
```
4. Install development dependencies:
```bash
forge install
```
5. Copy and configure environment variables:
```bash
cp .env.example .env
# Edit .env with your settings
```

## Development Workflow

### Branching Strategy

- `main`: Production-ready code
- `develop`: Integration branch for features
- Feature branches: Named as `feature/your-feature-name`
- Bug fix branches: Named as `fix/bug-name`

Always create your working branch from `develop`:

```bash
git checkout develop
git pull upstream develop
git checkout -b feature/your-feature-name
```

### Making Changes

1. Ensure your changes address a specific issue
2. Make commits with clear, descriptive messages
3. Keep changes focused and atomic
4. Rebase your branch regularly to incorporate upstream changes:
```bash
git fetch upstream
git rebase upstream/develop
```

### Testing

All code changes must include appropriate tests:

1. Write unit tests for new functionality
2. Run the test suite to ensure all tests pass:
```bash
forge test
```
3. For more detailed test output:
```bash
forge test -vvv
```
4. Run gas reports to ensure efficiency:
```bash
forge test --gas-report
```

### Documentation

1. Update or add NatSpec comments for all public functions:
```solidity
/**
* @notice Brief explanation of the function
* @param paramName Description of the parameter
* @return Description of the return value
*/
function exampleFunction(uint256 paramName) public returns (bool) {
// Function implementation
}
```
2. Update relevant documentation in the `docs/` directory
3. Include a summary of documentation changes in your PR

## Smart Contract Development Guidelines

### Security Best Practices

1. Follow established security patterns
2. Use OpenZeppelin contracts where appropriate
3. Be aware of common vulnerabilities (reentrancy, frontrunning, etc.)
4. Avoid complex control flows that are difficult to audit
5. Consider formal verification for critical functions

### Gas Optimization

1. Be mindful of storage vs. memory usage
2. Batch operations when possible
3. Use appropriate data types (uint256 is often most gas-efficient)
4. Consider gas costs in loops and data structures
5. Include gas reports in PRs for significant changes

### Code Style

1. Follow Solidity style guides
2. Use meaningful variable and function names
3. Format your code using the prettier
4. Keep functions small and focused
5. Use appropriate visibility modifiers (public, external, internal, private)

## Pull Request Process

1. Update the README or documentation if needed
2. Ensure all CI checks pass
3. Create a pull request to the `develop` branch
4. Fill in the PR template with all required information
5. Request review from relevant team members

### PR Requirements

- PR title should be descriptive and reference the issue (e.g., "Fix #123: Add timestamp validation")
- All tests must pass
- Code must be properly formatted
- New code should be covered by tests
- Changes should be well-documented
- Commit history should be clean and logical

### Review Process

1. At least one core contributor must review and approve the changes
2. Address all review comments promptly
3. CI checks must pass
4. Changes may require revision based on feedback
5. Once approved, a maintainer will merge the PR

## Community

- **GitHub Issues**: For bugs and feature requests
- **Discord**: For quick questions and community discussions
- **Pull Requests**: For code review discussions

Join our community on [Discord](https://discord.gg/4tR9rWc3QE).

## License

By contributing to CC Protocol, you agree that your contributions will be licensed under the project's [MIT License](./LICENSE).
Loading