Skip to content

Commit

Permalink
Merge pull request #214 from web3wagers/dev
Browse files Browse the repository at this point in the history
merge dev into main
  • Loading branch information
adrianvrj authored Nov 8, 2024
2 parents 0326faa + 32454c6 commit 0d9cd33
Show file tree
Hide file tree
Showing 74 changed files with 4,573 additions and 2,959 deletions.
4 changes: 4 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"projectName": "gostarkme",
"projectOwner": "web3wagers"
}
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/odhack_issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: ODHack Issue
about: Issue that will be solved during an ODHack
title: ''
labels: ''
assignees: ''

---

### This issue will be part of ODHack8.0, please apply via Onlydust app
- Please read [contributors guide](https://github.com/web3wagers/gostarkme/blob/dev/CONTRIBUTORS_GUIDE.md) before asking for an issue.
96 changes: 55 additions & 41 deletions .github/workflows/contract_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ name: CI

on:
pull_request:
branches:
- dev

push:
branches:
- dev
- main

jobs:
check-lint:
determine-changes:
runs-on: ubuntu-latest
outputs:
contracts_dir: ${{ steps.changes.outputs.contracts_dir }}
steps:
- uses: actions/checkout@v2

Expand All @@ -14,71 +23,76 @@ jobs:
id: changes
with:
filters: |
contracts_dir:
contracts_dir:
- 'contracts/src/**'
- name: Install scarb
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5
check-lint:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- uses: actions/checkout@v2

- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"

- name: Run scarb fmt
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
scarb fmt
- name: Run Scarb formatting
if: needs.determine-changes.outputs.contracts_dir == 'true'
working-directory: contracts
run: scarb fmt

- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No linting perfomed since no changes have been detected in the contracts directory."

check-contracts-changes:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- uses: actions/checkout@v2

- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
contracts_dir:
- 'contracts/src/**'

- name: Install scarb
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"

- name: Run Scarb check
if: needs.determine-changes.outputs.contracts_dir == 'true'
working-directory: contracts
run: scarb check

- name: Run scarb check
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
scarb check
- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No contracts checks done since no changes have been detected in the contracts directory."

run-tests:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
- name: Install Scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
filters: |
contracts_dir:
- 'contracts/src/**'
scarb-version: "2.6.5"

- name: Install scarb
if: steps.changes.outputs.contracts_dir == 'true'
run: |
cd contracts
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5

- name: Install snfoundry
uses: foundry-rs/setup-snfoundry@v3
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
starknet-foundry-version: "0.20.1"
starknet-foundry-version: "0.27.0"

- name: Run Cairo tests
if: needs.determine-changes.outputs.contracts_dir == 'true'
id: cairo_tests
run: bash scripts/run_tests.sh

- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No tests were run since no changes have been detected in the contracts directory."
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.snfoundry_cache
target
.DS_Store
.DS_Store

contracts/.snfoundry_cache/https___starknet_mainnet_public_blastapi_io_rpc_v0_7_519354_v3.json
2 changes: 2 additions & 0 deletions CONTRIBUTORS_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The best way to contribute to our projects is by opening a new issue <a href="ht

# Pull Requests

When assigned, please fork the repo and create a new branch to develop your issue. Once finished, open a PR and it will be reviewed by a mantainer ASAP.

1. When picking up an issue give a brief presentation about yourself.

```
Expand Down
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ Go Stark Me is a modern platform designed to make fundraising for important caus

Join us on Go Stark Me and make a difference by supporting meaningful projects in a secure and efficient manner.

## UML Diagram

![UML Class Diagram](https://github.com/user-attachments/assets/479c9296-e3ac-4ad3-bf79-5f458c456a45)


## Our Vision for UI

You can check the prototype we have in mind and suggest any improvement, if you feel capable of reproducing some of the pages please contact one of the product owners.
Expand All @@ -25,6 +20,7 @@ You can check the prototype we have in mind and suggest any improvement, if you

- [EmmanuelAR](https://github.com/EmmanuelAR)
- [adrianvrj](https://github.com/adrianvrj)
- [bitfalt](https://github.com/bitfalt)

## Want to Contribute?

Expand All @@ -35,10 +31,33 @@ If you are interested in contributing to Go Stark Me, please follow these steps:
3. Wait to be assigned to the issue.

Official Discord Channel:

- [Web3Wagers](https://discord.gg/sEpnC6JB2U)

You can also contact us on Telegram:

- [@adrian_vrj](https://t.me/adrian_vrj)
- [@EmmanuelDevCr](https://t.me/EmmanuelDevCr)
- [@bitfalt](https://t.me/bitfalt)

## Adding yourself as a contributor

If you've contributed to this project, you can easily add yourself to the contributors list by commenting on any issue or pull request with: `@all-contributors please add <your-github-username> for <contribution-type>`

For example: `@all-contributors please add @@adrian_vrj for code, doc, business, and ideas`

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind welcome!
1 change: 0 additions & 1 deletion contracts/.snfoundry_cache/.prev_tests_failed

This file was deleted.

84 changes: 74 additions & 10 deletions contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,80 @@
# Go Stark Me - Backend Setup 💻

### Steps to Run the Backend 🥳
## Steps to Run the Backend 🥳

1. **Navigate to the Contracts Directory 🔍**

Ensure you are in the correct directory where the Cairo contracts are stored.

```bash
cd gostarkme/contracts
2. **Compile gostarkme backend 🛠️**
```bash
scarb build
3. **Run gostarkme unit test**
```bash
snforge test
4. **Run code formatter 📝**
```bash
scarb fmt
```

2. **Setup your environment**

- Scarb v2.6.5 : [here](https://docs.swmansion.com/scarb/download.html#install-via-asdf).
```bash
asdf install scarb 2.6.5
```
```bash
asdf global scarb 2.6.5
```
- Starknet Foundry v0.27.0: [here](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html).
```bash
asdf install starknet-foundry 0.27.0
```
```bash
asdf global starknet-foundry 0.27.0
```
**Setup your environment(Different option for macOS)**

- Scarb v2.6.5 : [here](https://docs.swmansion.com/scarb/download.html#install-via-asdf).
```bash
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.6.5
```
Place it in the path:
```bash
export PATH="$HOME/.local/bin:$PATH"
```
It is recommended to restart the terminal.
- Starknet Foundry v0.27.0: [here](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html).
```bash
curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh -s -- -v 0.27.0
```
Place it in the path:
```bash
echo 'export PATH="$HOME/.asdf/shims:$HOME/.asdf/bin:$PATH"' >> ~/.zshrc
```
```bash
echo 'export PATH="$HOME/.foundry/bin:$PATH"' >> ~/.zshrc
3. **Compile Go Stark Me Backend 🛠️**
To build the contracts, run the command:
```bash
scarb build
```

4. **Run Go Stark Me Unit Tests ✅**

To run the unit tests for the contracts, run the following command:

```bash
scarb run test
```
or
```bash
snforge test
```

5. **Run Code Formatter 📝**

To format your contracts, simply run the command:

```bash
scarb fmt
```

## UML Diagram

![UML Class Diagram](https://github.com/user-attachments/assets/479c9296-e3ac-4ad3-bf79-5f458c456a45)
4 changes: 2 additions & 2 deletions contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.10.0#d7

[[package]]
name = "snforge_std"
version = "0.20.1"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.20.1#fea2db8f2b20148cc15ee34b08de12028eb42942"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"
7 changes: 6 additions & 1 deletion contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ starknet = "2.6.4"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.10.0" }

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.20.1" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.27.0" }

[scripts]
test = "snforge test"

[[target.starknet-contract]]
casm = true

[[tool.snforge.fork]]
name = "Mainnet"
url = "https://starknet-mainnet.public.blastapi.io/rpc/v0_7"
block_id.number = "519354"
2 changes: 1 addition & 1 deletion contracts/src/constants/donator/donator_constants.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// *************************************************************************
pub mod DonatorConstants {
pub const INITIAL_LEVEL: u32 = 1;
pub const INITIAL_MAX_STARKS_DONATION_TO_NEXT_LEVEL: u64 = 10;
pub const INITIAL_MAX_STARKS_DONATION_TO_NEXT_LEVEL: u256 = 10;
}
2 changes: 2 additions & 0 deletions contracts/src/constants/funds.cairo
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pub mod state_constants;
pub mod fund_constants;
pub mod fund_manager_constants;
pub mod starknet_constants;
5 changes: 3 additions & 2 deletions contracts/src/constants/funds/fund_constants.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// FUND CONSTANTS
// *************************************************************************
pub mod FundConstants {
pub const UP_VOTES_NEEDED: u32 = 100;
pub const UP_VOTES_NEEDED: u32 = 50;
pub const INITIAL_UP_VOTES: u32 = 0;
pub const INITIAL_GOAL: u64 = 0;
pub const INITIAL_GOAL: u256 = 0;
pub const MINIMUM_GOAL: u256 = 500;
}
11 changes: 11 additions & 0 deletions contracts/src/constants/funds/fund_manager_constants.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// *************************************************************************
// FUND MANAGER CONSTANTS
// *************************************************************************
pub mod FundManagerConstants {
pub const FUND_MANAGER_ADDRESS: felt252 =
0x02bbab4d3c77dd83dfe47af99c9a3188a660e9c652a2f7af3d21df213f4882cd;
pub const VALID_ADDRESS_1: felt252 =
0x0388012BD4385aDf3b7afDE89774249D5179841cBaB06e9E5b4045F27B327CE8;
pub const VALID_ADDRESS_2: felt252 =
0x0528A7ba821024a8eC44dff0bFFe15443d811F233e4de7AB1a8C26f251597c4c;
}
11 changes: 11 additions & 0 deletions contracts/src/constants/funds/starknet_constants.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use starknet::ContractAddress;

// *************************************************************************
// STARKNET CONSTANTS
// *************************************************************************
pub mod StarknetConstants {
pub const STRK_TOKEN_ADDRESS: felt252 =
0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d;
pub const STRK_TOKEN_MINTER_ADDRESS: felt252 =
0x0594c1582459ea03f77deaf9eb7e3917d6994a03c13405ba42867f83d85f085d;
}
1 change: 1 addition & 0 deletions contracts/src/constants/funds/state_constants.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ pub mod FundStates {
pub const RECOLLECTING_VOTES: u8 = 1;
pub const RECOLLECTING_DONATIONS: u8 = 2;
pub const CLOSED: u8 = 3;
pub const WITHDRAW: u8 = 4;
}
Loading

0 comments on commit 0d9cd33

Please sign in to comment.