Skip to content

Commit

Permalink
Merge pull request #65 from decent-dao/develop
Browse files Browse the repository at this point in the history
v0.3.0 into main
  • Loading branch information
herbig authored Jun 2, 2023
2 parents b9bb9a6 + 2cdd06c commit 8e983a5
Show file tree
Hide file tree
Showing 160 changed files with 41,630 additions and 8,652 deletions.
7 changes: 3 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
MAINNET_DEPLOYER_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"
GOERLI_DEPLOYER_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"
RINKEBY_DEPLOYER_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"
SEPOLIA_DEPLOYER_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"
POLYGON_DEPLOYER_PRIVATE_KEY="0x0000000000000000000000000000000000000000000000000000000000000000"

MAINNET_PROVIDER=https://eth-mainnet.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
GOERLI_PROVIDER=https://eth-goerli.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
RINKEBY_PROVIDER=https://eth-rinkeby.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
SEPOLIA_PROVIDER=https://eth-sepolia.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
POLYGON_PROVIDER=https://eth-polygon.alchemyapi.io/v2/<YOUR ALCHEMY KEY>

ETHERSCAN_API_KEY=""
POLYGONSCAN_API_KEY=""

6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ module.exports = {
{ ignores: ["modules"] },
],
camelcase: ["error", { ignoreImports: true }],
"prettier/prettier": [
1,
{
endOfLine: "auto",
},
],
},
};
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: Check out the docs
url: https://docs.fractalframework.xyz/
about: Your question might already be answered here!
- name: Report a Vulnerability
url: https://github.com/decent-dao/fractal-contracts/blob/HEAD/.github/SECURITY.md
about: Securely report a vulnerability
- name: Join our Discord
url: https://chat.fractalframework.xyz/
about: You can ask product related questions here.
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Description

<!-- Please describe your changes -->

## Notes

<!-- Is there any additional information a reviewer should know? -->

## Issue / Notion doc (if applicable)

<!-----------------------------------------------------------------------------
If applicable, link to the relevant Github issue(s) with `closes #XXX` to auto-close it when this PR is merged.
If there is an accompanying Notion document, please link that here as well.
------------------------------------------------------------------------------>

## Testing

<!-----------------------------------------------------------------------------
If your testing steps are technical, outline steps for an engineer to verify.
If your testing steps are functional, please provide a full guide with any features requiring special attention for operations to test your branch in the preview environment.
------------------------------------------------------------------------------>

## Screenshots (if applicable)
22 changes: 22 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Security Policy

We at Fractal encourage security researchers to contact us directly and privately to report any potential security vulnerabilities in either our smart contracts or front end code.

If the issue you are reporting is not a security vulnerability, simply [open a new GitHub issue](https://github.com/decent-dao/fractal-contracts/issues/new/choose).

## Reporting a Vulnerability

If you would like to disclose a vulnerability in Fractal, please send a new email to [[email protected]](mailto:[email protected]).

Please include the following information in your email:

- The date / time you first identified the vulnerability.
- How you identified the vulnerability.
- Step by step instructions for performing the vulnerability.
- Any additional information about the vulnerability.

## Secure Communication

If you prefer secure communication, please use the following GPG key:

https://keys.openpgp.org/search?q=security%40decentlabs.io
49 changes: 49 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish NPM Package
on:
release:
types: [created]

jobs:
deploy:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'

- name: Install node modules
run: npm install

- name: Compile contracts
run: npx hardhat compile

- name: Run contract tests
id: run-tests
run: npx hardhat test
env:
GOERLI_PROVIDER: ${{ secrets.GOERLI_PROVIDER }}
publish:
name: Publish Contracts
environment: global
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Compile and publish
run: npm run publish-packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on:
push:
branches:
- develop
pull_request:
types: [opened, synchronize]

jobs:
deploy:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'

- name: Install node modules
run: npm install

- name: Compile contracts
run: npx hardhat compile

- name: Run contract tests
id: run-tests
run: npx hardhat test
env:
GOERLI_PROVIDER: ${{ secrets.GOERLI_PROVIDER }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ coverage
coverage.json
typechain
typechain-types
.idea
dist/

#Hardhat files
cache
artifacts

deployments/localhost
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,4 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
- Steps to reproduce
- 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)

## Any contributions will be under the Unlicense Software License
When you submit code changes, your submissions are understood to be under the same [Unlicense](https://choosealicense.com/licenses/unlicense/) that covers Fractal.
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
37 changes: 17 additions & 20 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
This is free and unencumbered software released into the public domain.
MIT License

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
Copyright (c) 2023 fractal-framework

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
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 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 BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

For more information, please refer to <https://unlicense.org>
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, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
85 changes: 67 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
# Fractal Contracts

## Architecture
### VetoGuard.sol
## Azorius Protocol
A Safe module which allows for composable governance.

The VetoGuard is a Gnosis Guard contract that enables a Fractal parent DAO to block or "veto" transactions on a child DAO from being executed. This also supports a child DAO being "frozen" by a parent DAO, which prevents the child DAO from executing any transaction until the freeze period has ended.
Azorius conforms to the [Zodiac](https://github.com/gnosis/zodiac) pattern for Safe modules.

### VetoERC20Voting.sol
The Azorius contract acts as a central manager of DAO Proposals, maintaining the specifications of the transactions that comprise a Proposal.

The VetoERC20Voting contract enables token holders of a parent DAO governance ERC-20 token to vote on vetoing child DAO transactions, and vote on freezing a child DAO. This implements a "one-token-one-vote" vote counting schema.
All voting details are delegated to `BaseStrategy` implementations, of which an Azorius DAO can have any number.

### FractalNameRegistry.sol
Azorius was forked from and heavily based on the [Usul](https://github.com/SekerDAO/Usul) module, by [SekerDAO](https://github.com/SekerDAO).

The FractalNameRegistry is a global contract for all Fractal DAOs which enables DAOs to configure a human-readable string that represents their DAO's name. These name strings are non-unique, and not used for identifying a DAO. They are purely utilized for UX purposes.

### FractalModule.sol

The FractalModule is a Gnosis Module contract that may be "installed" on a Fractal Gnosis Safe. This module enables other Fractal DAOs, typically a "parent" DAO, to execute transactions through the child DAO's Gnosis Safe. This may be utilized for functionality such as a "clawback", when a parent DAO claims back some or all of a child DAO's treasury.
## Contract Documentation
[NatSpec](https://docs.soliditylang.org/en/v0.8.17/natspec-format.html) documentation for Azorius Protocol contracts [are available here](./docs).

## Local Setup & Testing

Clone the repository:
```shell
git clone ...
git clone https://github.com/decent-dao/fractal-contracts.git
```

Lookup the recommended Node version to use in the .nvmrc file and install and use the correct version:
Look up the recommended Node version to use in the `.nvmrc` file and install and use the correct version:
```shell
nvm install
nvm use
Expand All @@ -35,7 +31,7 @@ Install necessary dependencies:
npm install
```

Add `.env` values replacing the private key and provider values for desired networks
Copy the example `.env` and replace the values for the desired networks
```shell
cp .env.example .env
```
Expand All @@ -50,13 +46,66 @@ Run the tests
npm run test
```

## Deploy Contract to <network>
Update natspec doc files after modifying contracts
```shell
npx hardhat docgen
```

## Deploy Contracts to `<network>`
```shell
npx hardhat deploy --network <network>
```

## Local Hardhat deployment
Deployed contracts can be verified on Etherscan via the following command:
```shell
npx hardhat verify --network {network name} {contract address}
```

To deploy the Fractal contracts open a terminal and run:
Currently, this is done manually for each contract deployed, found in `deployments/<network>/XXX.json`

## Local Hardhat deployment
To deploy the Fractal contracts to a local node:
```shell
npx hardhat node
```

## NPM Package
The core contracts in this repository are published in an NPM package for easy use within other repositories.

To install the npm package in your project, run:
```shell
npm i @fractal-framework/fractal-contracts
```

To include uncompiled contracts within typechain-types follow [these steps](https://www.npmjs.com/package/hardhat-dependency-compiler).

## Publishing new versions to NPM
First, increment the version in `package.json`, then:
```shell
npm install
```

to get those version updates into package-lock.json
```shell
npm run publish:prepare
```

to fully clean the project, compile contracts, create typechain directory, and compile the typechain directory
```shell
npm publish
```

to publish the compiled typechain files and solidity contracts to NPM
```shell
git commit
git push
```

## Versioning
Fractal follows a modified style of semantic versioning (https://semver.org/) specific to a smart contract use case.

There are three types of releases:

- **MAJOR**: Rare, and correlates to a major overhaul to the core DAO governance contracts. These are changes incompatible with prior contract versions and would require an existing DAO's successful proposal to migrate to. A major version will have undergone a professional smart contract audit.
- **MINOR**: Adds backwards-compatible functionality and additional utility or optimizations to the core governance smart contracts. New functionality will not impact the existing core governance contracts, will be optional for a DAO to utilize, and will have undergone either a contract audit or community bug bounty.
- **PATCH**: Also rare, but adds bug and/or security fixes. No new functionality will be introduced and the code may or may not have a contract audit or bug bounty, depending on the context and severity of the issue. Also depending on the context of the issue, DAOs may be required to pass a proposal to migrate to this new version.
Loading

0 comments on commit 8e983a5

Please sign in to comment.