Skip to content

Commit

Permalink
feat: project initialisation (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelJet authored Sep 24, 2024
1 parent acacad0 commit b43b7da
Show file tree
Hide file tree
Showing 16 changed files with 257 additions and 29 deletions.
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ assignees: emmanuelJet

---

---
name: Bug Report
about: Report a bug or issue in the code
title: 'bug: brief description'
labels: bug
assignees: 'emmanuelJet'

---

## Describe the Bug

A clear and concise description of what the bug is.
Expand Down
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ assignees: emmanuelJet

---

---
name: Documentation
about: Tasks involving writing or updating documentation
title: 'docs: brief description'
labels: documentation
assignees: 'emmanuelJet'

---

## Documentation Task

Describe the documentation that needs to be created or updated.
Expand Down
9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/feature-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ assignees: emmanuelJet

---

---
name: Feature Implementation
about: Template for implementing new features or functionalities
title: 'feat: brief description'
labels: enhancement
assignees: 'emmanuelJet'

---

## Feature Description

Provide a detailed description of the feature to be implemented.
Expand Down
56 changes: 56 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!---
Please read this!
Before opening a new pull request (PR), make sure you are merging to the main branch, have your GitHub Issue ID (GID), and understand the popular Git Category Flags (GCF). This will guide the creation of a perfect PR.
Here are examples of a GID and GCF.
- GID: #<ID>, where ID represents a GitHub Issue ID; e.g., #1
- GCF: breaking, build, ci, chore, docs, feat, fix, other, perf, refactor, revert, style, test, dependency.
The following section guide MUST be adhered to when creating an PR:
1. Title: This must include your primary GCF followed by a colon and a general summary of your changes in lowercase. E.g., "feat: owner role functionalities"
2. Labels: This must include a label similar to your primary GCF.
3. Body: You must follow the PR template without removing any section, even if it is empty.
4. Reviewer: You must assign '@emmanuelJet' to the PR for code review.
5. Assignee: You must include yourself as the PR assignee.
6. Project: You should select a related repo project when available for your PR.
If you have any questions or need further assistance, feel free to reach out in the comments or contact '@emmanuelJet'.
-->

## Overview
<!--
Describe the purpose of the PR so that if you looked at it in 6 months, it would be clear from the overview why this was created. E.g.:
```md
This PR entails the implementation of #2. It introduces the owner role functionality and the following actions were implemented:
- **[feat]** `OwnerContract` with owner functionalities
- **[perf]** Optimized `foundry.toml` file
- **[fix]** Deployment script
- **[refactor]** `MultiSigEnterpriseVaultContract` modifier functions
- **[dependency]** New Dependencies:
- "OpenZeppelin"
```
-->

Please replace this line with your PR overview description to include a summary of the changes made and the related GID. Also, include relevant GCF and the context of each GCF as suggested above. List any dependencies that are added, updated, and/or removed for this change.

## Other information
<!-- Any other important information to this PR, such as screenshots of how the contract behaves before and after the change. -->

<details>
<summary>Automation</summary>

### Relevant Issues
<!-- Link relevant GID(s) for which their acceptance criteria are covered by this PR, either as blockers or parent. -->
-

### Before Merging
<!--
Include any tasks needed before merging this PR using the Closes keyword. This keyword should be used alongside your GID. E.g.: Closes #<ID>
Note that '<ID>' in the example above must be replaced with the exact GitHub Issue ID number relating to your PR.
-->

</details>
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Show Forge version
run: |
forge --version
- name: Run Forge fmt
run: |
forge fmt --check
id: fmt

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

- name: Run Forge tests
run: |
forge test -vvv
id: test
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Compiler files
cache/
out/

# Ignores development broadcast logs
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/

# Docs
docs/

# Dotenv file
.env

# Miscellaneous
.gas-snapshot
.DS_Store
.private/
.vscode/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
Copyright (C) 2024 Emmanuel Joseph <[email protected]> (https://emmanueljet.com)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,59 @@
# MultiSigEnterpriseVault
An open-source, enterprise-grade Multi-Signature Vault smart contract developed using Solidity and Foundry. Features advanced access control mechanisms, separate timelocks, and robust security measures for managing digital assets.

An open-source, enterprise-grade Multi-Signature Vault smart contract developed using Solidity and Foundry. It provides advanced security, customizable timelocks, and role-based access control for managing digital assets.

## Features

- Multi-signature functionality with flexible threshold settings.
- Separate timelocks for transactions and owner overrides.
- Role-based access control (Owner, Executor, Signers).
- Secure self-destruct mechanism with safety checks.

## Getting Started

- Clone the repository:

```bash
git clone https://github.com/emmanuelJet/MultiSigEnterpriseVault.git
cd MultiSigEnterpriseVault
```

- Install dependencies:

```bash
forge install
```

- Run the compiler command:

```bash
forge build
```

- Run the test command:

```bash
forge test
```

- Run the gas-snapshot command:

```bash
forge snapshot
```

## License

```md
Copyright (C) 2024 Emmanuel Joseph <[email protected]> (https://emmanueljet.com)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
```
7 changes: 7 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc = "0.8.27"

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 1714be
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at dbb610
5 changes: 5 additions & 0 deletions remappings.txt.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/
erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/
forge-std/=lib/forge-std/src/
openzeppelin-contracts/=lib/openzeppelin-contracts/
19 changes: 19 additions & 0 deletions script/Counter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.27;

import {Script, console} from "forge-std/Script.sol";
import {Counter} from "../src/Counter.sol";

contract CounterScript is Script {
Counter public counter;

function setUp() public {}

function run() public {
vm.startBroadcast();

counter = new Counter();

vm.stopBroadcast();
}
}
14 changes: 14 additions & 0 deletions src/Counter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.27;

contract Counter {
uint256 public number;

function setNumber(uint256 newNumber) public {
number = newNumber;
}

function increment() public {
number++;
}
}
24 changes: 24 additions & 0 deletions test/Counter.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.27;

import {Test, console} from "forge-std/Test.sol";
import {Counter} from "../src/Counter.sol";

contract CounterTest is Test {
Counter public counter;

function setUp() public {
counter = new Counter();
counter.setNumber(0);
}

function test_Increment() public {
counter.increment();
assertEq(counter.number(), 1);
}

function testFuzz_SetNumber(uint256 x) public {
counter.setNumber(x);
assertEq(counter.number(), x);
}
}

0 comments on commit b43b7da

Please sign in to comment.