Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/initial docgen md files #231

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
127 changes: 127 additions & 0 deletions docs-docgen/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# 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
[Discord](https://discord.gg/B6uDmm7hvC) ``SUPPORT/open-a-ticket channel``.

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.
76 changes: 76 additions & 0 deletions docs-docgen/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contribution Guidelines

Thank you for your interest in contributing to Swaplace! The project is an open-source build by the community. We welcome any type of contribution, suggestion or improvement, no matter how small.

### Contents

- [Open Source Guideline](#how-to-contribute)
- [Opening an Issue](#opening-issue)
- [Writing Commit Messages](#writing-commit-messages)
- [Submitting Pull Requests](#submiting-pull-requests)
- [Code Review](#code-review)
- [Coding Style](#coding-style)
- [Get in touch](#get-in-touch)

## How to Contribute

There are many ways to contribute, but here are a few steps to start:

1. Fork the repository in GitHub.
2. Check if you have any issue, suggestion or improvement to work on.

- We manage all the issues using [GitHub Projects](https://github.com/orgs/blockful-io/projects/3)

3. Send a message in the issue like
`I'm interested in this issue` or ask for more information such as `Hey, can you provide more information about this ... ?` The mantainers will then assign or provide more context about your issue. **After that, you are asigned to the issue.**

4. If a task is already assigned but you believe you can expedite the process, feel free to comment, requesting to assist or speed up the task. Additionally, you may open a pull request directly because we prioritize both code efficiency and delivery speed. Thus, we encourage multiple individuals to review the same issues and debate together to enhance the code's security.

### Congratulations ! You can now start working on the issue, and everyone is aware that you are assigned.

## Opening An Issue

Before opening an issue, please check if there is any issue already open. If there is, feel free to comment or suggest more details. We are always open to feedback and receptive to suggestions!

- Before [creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-project), check if your fork is updated.

## Writing Commit Messages

We are using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)

Some examples below:

- feat: adds or remove a new feature
- fix: fixes a bug
- refactor: rewrite/restructure your code
- chore: changes to the build process or auxiliary tools and libraries such as documentation generation
- style: changes do not affect the meaning (white-space, formatting, missing semi-colons, etc)
- test: add missing tests or correcting existing tests
- docs: affect documentation only

## Submiting Pull Requests

You can resolve an issue and after that submit a pull request fixing an issue and remember to [reference that issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword#linking-a-pull-request-to-an-issue-using-a-keyword). When submitting a PR, put the code below with the number of the issue you are closing
`Example: closes #1`

## Code Review

The maintainers will review your PR. If something is missing or a fix needs to be made, the maintainers will let you know in the PR comment.

## Coding Style

In Swaplace please use this .prettierrc.yml configuration to make the code standardized.

```
{
trailingComma: "all"
singleQuote: false
printWidth: 80
tabWidth: 2
semi: true
}
```

## Get in Touch

If you need to get in contact with the repository maintainers, please reach out in our [Discord](https://discord.gg/B6uDmm7hvC).
36 changes: 36 additions & 0 deletions docs-docgen/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Security Policy

If you believe you have found a security vulnerability in the repository, please report it to us through coordinated disclosure.

Please do not report security vulnerabilities through public **GitHub issues, discussions, or pull requests.**

Instead, please open a ticket in ``SUPPORT/open-a-ticket channel`` on [Discord](https://discord.gg/B6uDmm7hvC).


## Supported Versions


| Version | Supported |
| ------- | ------------------ |
| 1.0.x | :x: |

## Reporting a Vulnerability

Please include as much of the information listed below as you can to help us better understand and resolve the issue:

A full description of the issue.
The steps we will be taking to remedy the issue.
The patch(es), if any, that will be applied to contract.
The type of issue or type of vulnerability.
Full paths of source file(s) related to the manifestation of the issue
The location of the affected source code (tag/branch/commit or direct URL)
Any special configuration required to reproduce the issue
Step-by-step instructions to reproduce the issue
Proof-of-concept or exploit code (if possible)
Impact of the issue, including how an attacker might exploit the issue

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.

Please reach out to us ! Your contribution makes all the difference.
62 changes: 62 additions & 0 deletions docs-docgen/solidity-docgen/SwapFactory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Solidity API

## SwapFactory

_SwapFactory is a helper for creating Swaps and making asset structs.

This helper can be used on and off-chain to easily create a Swap struct to be
used in the {Swaplace-createSwap} function.

Swaplace uses a {ISwap-Swap} struct to represent a Swap. This struct is
composed of:

- The `owner` of the Swap is the address that created the Swap.
- The `allowed` address is the address that can accept the Swap. If the allowed
address is the zero address, then anyone can accept the Swap.
- The `expiry` date is the timestamp that the Swap will be available to accept.
- The `biding` are the assets that the owner is offering.
- The `asking` are the assets that the owner wants in exchange.

The Swap struct uses an {Asset} struct to represent the asset. This struct is
composed of:

- The `address` of the asset. This address can be from an ERC20 or ERC721 contract.
- The `amount` or `id` of the asset. This amount can be the amount of ERC20 tokens
or the ID of an ERC721 token.

To use other standards, like ERC1155, you can wrap the ownership of the asset
in an a trusted contract and Swap as an ERC721. This way, you can tokenize any
on-chain execution and trade on Swaplace._

### makeAsset

```solidity
function makeAsset(address addr, uint256 amountOrId) public pure virtual returns (struct ISwap.Asset)
```

_See {ISwapFactory-makeAsset}._

### makeSwap

```solidity
function makeSwap(address owner, address allowed, uint256 expiry, struct ISwap.Asset[] biding, struct ISwap.Asset[] asking) public view virtual returns (struct ISwap.Swap)
```

_See {ISwapFactory-makeSwap}._

### packData

```solidity
function packData(address allowed, uint256 expiry) public pure returns (uint256)
```

_See {ISwapFactory-packData}._

### parseData

```solidity
function parseData(uint256 config) public pure returns (address, uint256)
```

_See {ISwapFactory-parseData}._

57 changes: 57 additions & 0 deletions docs-docgen/solidity-docgen/Swaplace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Solidity API

## Swaplace

_Swaplace is a Decentralized Feeless DEX. It has no owners, it cannot be stopped.
Its cern is to facilitate swaps between virtual assets following the ERC standard.
Users can propose or accept swaps by allowing Swaplace to move their assets using the
`approve` or `permit` function._

### createSwap

```solidity
function createSwap(struct ISwap.Swap swap) public returns (uint256)
```

_See {ISwaplace-createSwap}._

### acceptSwap

```solidity
function acceptSwap(uint256 swapId, address receiver) public returns (bool)
```

_See {ISwaplace-acceptSwap}._

### cancelSwap

```solidity
function cancelSwap(uint256 swapId) public
```

_See {ISwaplace-cancelSwap}._

### getSwap

```solidity
function getSwap(uint256 swapId) public view returns (struct ISwap.Swap)
```

_See {ISwaplace-getSwap}._

### supportsInterface

```solidity
function supportsInterface(bytes4 interfaceID) external pure returns (bool)
```

_See {IERC165-supportsInterface}._

### totalSwaps

```solidity
function totalSwaps() public view returns (uint256)
```

_Getter function for _totalSwaps._

34 changes: 34 additions & 0 deletions docs-docgen/solidity-docgen/echidna/TestSwapFactory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Solidity API

## TestFactory

### has_values

```solidity
function has_values() public
```

### make_asset_array

```solidity
function make_asset_array(address addr, uint256 amountOrId) public pure returns (struct ISwap.Asset[])
```

### make_valid_swap

```solidity
function make_valid_swap(address owner, address addr, uint256 amountOrId) public view returns (struct ISwap.Swap)
```

### echidna_revert_invalid_expiry

```solidity
function echidna_revert_invalid_expiry() public view
```

### echidna_revert_invalid_length

```solidity
function echidna_revert_invalid_length() public view
```

Loading
Loading