Skip to content

Commit

Permalink
Tribute Contracts - Documentation Website (#317)
Browse files Browse the repository at this point in the history
* Added docusaurus to organized the project documentation

Co-authored-by: mcchan1 <[email protected]>
Co-authored-by: Sophia <[email protected]>
Co-authored-by: Aaron Wright <[email protected]>
  • Loading branch information
4 people authored Jul 5, 2021
1 parent cb6ddc1 commit 5a102fd
Show file tree
Hide file tree
Showing 244 changed files with 22,680 additions and 1,920 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: documentation

on:
push:
branches: [docs]

env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install and Build 🔧
run: |
cd website
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: website/build # The folder the action should deploy.

# run: |
# cd website
# git config --global user.email "[email protected]"
# git config --global user.name "gh-actions"
# if [ -e yarn.lock ]; then
# yarn install --frozen-lockfile
# elif [ -e package-lock.json ]; then
# npm ci
# else
# npm i
# fi
# npm run deploy
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# 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.

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 e-mail 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
[email protected].
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.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
1 change: 0 additions & 1 deletion contracts/adapters/BankAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "../core/DaoConstants.sol";
import "../core/DaoRegistry.sol";
import "../extensions/bank/Bank.sol";
import "../guards/AdapterGuard.sol";
import "./interfaces/IConfiguration.sol";
import "../adapters/interfaces/IVoting.sol";

/**
Expand Down
13 changes: 13 additions & 0 deletions contracts/adapters/Configuration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ contract ConfigurationContract is
revert("fallback revert");
}

/**
* @notice Creates and sponsors a configuration proposal.
* @param dao The DAO Address.
* @param proposalId The proposal id.
* @param keys The applicant address.
* @param values The token to receive the funds.
* @param data Additional details about the financing proposal.
*/
function submitProposal(
DaoRegistry dao,
bytes32 proposalId,
Expand Down Expand Up @@ -82,6 +90,11 @@ contract ConfigurationContract is
votingContract.startNewVotingForProposal(dao, proposalId, data);
}

/**
* @notice Processing a configuration proposal to update the DAO state.
* @param dao The DAO Address.
* @param proposalId The proposal id.
*/
function processProposal(DaoRegistry dao, bytes32 proposalId)
external
override
Expand Down
40 changes: 33 additions & 7 deletions contracts/adapters/CouponOnboarding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ contract CouponOnboardingContract is
bytes32 constant TokenAddrToMint =
keccak256("coupon-onboarding.tokenAddrToMint");

uint256 chainId;
mapping(address => mapping(uint256 => uint256)) flags;
uint256 private _chainId;

mapping(address => mapping(uint256 => uint256)) private _flags;

event CouponRedeemed(
address daoAddress,
Expand All @@ -65,10 +66,22 @@ contract CouponOnboardingContract is
uint256 amount
);

constructor(uint256 _chainId) {
chainId = _chainId;
constructor(uint256 chainId) {
_chainId = chainId;
}

/**
* @notice default fallback function to prevent from sending ether to the contract
*/
receive() external payable {
revert("fallback revert");
}

/**
* @notice Configures the Adapter with the coupon signer address and token to mint.
* @param signerAddress is the DAO instance to be configured
* @param tokenAddrToMint is the coupon to hash
*/
function configureDao(
DaoRegistry dao,
address signerAddress,
Expand All @@ -81,6 +94,11 @@ contract CouponOnboardingContract is
bank.registerPotentialNewInternalToken(tokenAddrToMint);
}

/**
* @notice Hashes the provided coupon as an ERC712 hash.
* @param dao is the DAO instance to be configured
* @param coupon is the coupon to hash
*/
function hashCouponMessage(DaoRegistry dao, Coupon memory coupon)
public
view
Expand All @@ -96,17 +114,25 @@ contract CouponOnboardingContract is
)
);

return hashMessage(dao, chainId, address(this), message);
return hashMessage(dao, _chainId, address(this), message);
}

/**
* @notice Redeems a coupon to add a new member.
* @param dao is the DAO instance to be configured
* @param authorizedMember is the address that this coupon authorized to become a new member
* @param amount is the amount of units that this member will receive
* @param nonce is a unique identifier for this coupon request
* @param signature is message signature for verification
*/
function redeemCoupon(
DaoRegistry dao,
address authorizedMember,
uint256 amount,
uint256 nonce,
bytes memory signature
) external reentrancyGuard(dao) {
uint256 currentFlag = flags[address(dao)][nonce / 256];
uint256 currentFlag = _flags[address(dao)][nonce / 256];
require(
getFlag(currentFlag, nonce % 256) == false,
"coupon has already been redeemed"
Expand All @@ -122,7 +148,7 @@ contract CouponOnboardingContract is

require(recoveredKey == signerAddress, "invalid sig");

flags[address(dao)][nonce / 256] = setFlag(
_flags[address(dao)][nonce / 256] = setFlag(
currentFlag,
nonce % 256,
true
Expand Down
1 change: 0 additions & 1 deletion contracts/adapters/DaoRegistryAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "../core/DaoRegistry.sol";
import "../extensions/bank/Bank.sol";
import "../guards/MemberGuard.sol";
import "../guards/AdapterGuard.sol";
import "./interfaces/IConfiguration.sol";
import "../adapters/interfaces/IVoting.sol";

/**
Expand Down
8 changes: 8 additions & 0 deletions contracts/adapters/Distribute.sol
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ contract DistributeContract is
}
}

/**
* @notice Updates the holder account with the amount based on the token parameter.
* @notice It is an internal transfer only that happens in the Bank extension.
*/
function _distributeOne(
BankExtension bank,
address unitHolderAddr,
Expand All @@ -311,6 +315,10 @@ contract DistributeContract is
bank.internalTransfer(ESCROW, unitHolderAddr, token, amount);
}

/**
* @notice Updates all the holder accounts with the amount based on the token parameter.
* @notice It is an internal transfer only that happens in the Bank extension.
*/
function _distributeAll(
DaoRegistry dao,
BankExtension bank,
Expand Down
2 changes: 0 additions & 2 deletions contracts/adapters/NFTAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import "../core/DaoRegistry.sol";
import "../extensions/nft/NFT.sol";
import "../guards/MemberGuard.sol";
import "../guards/AdapterGuard.sol";
import "./interfaces/IConfiguration.sol";
import "../adapters/interfaces/IVoting.sol";

/**
MIT License
Expand Down
Loading

0 comments on commit 5a102fd

Please sign in to comment.