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

doc: [ISSUE-137] Update readme #148

Merged
merged 2 commits into from
Dec 19, 2023
Merged
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
68 changes: 31 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,38 @@

This repository contains the core smart contracts for the Swaplace Protocol; The lightest Swap protocol in the market.

### TL;DR

- Contracts cannot be upgraded.
- Contracts have no ownership.
- Contracts don't charge fees.
- There are no external contract dependencies.
- The protocol operates using available allowances.

## Incentives

This repository is subjected to incentives for the community to contribute to the project. The incentive distribution and amount are being discussed but the eligibility has already started.

## Features

- **Create Swaps**: A Swap has an `owner` and an `allowed` address. The `owner` is the one that can cancel the swap while the `allowed` address is the one that can execute the swap but anyone can accept if it's set as the Zero Address. A Swap also has an `expiry` period in seconds. The Swap can only be executed before the expiry period is reached. The `Asset` type represents on one hand the bidding assets and on the other hand the asking assets.

```
struct Swap {
address owner;
address allowed;
uint256 expiry;
Asset[] biding;
Asset[] asking;
}
```

- **Accept Swaps**: You can accept swaps that have an `allowed` address equal to your or the `Zero Address`. As long as you provide the asked assets.

- **Cancel Swaps**: You can cancel swaps that haven't been `expired`.

- **Swap Factory**: Aids new swap creations to be used on Swaplace. Check `contracts/SwapFactory.sol`.

## Setup

You should install the dependencies using Yarn to deploy this code to a local testnet. The project uses Hardhat as a development environment. Which relies on Node.js (Recommended v18.16.0).
Expand All @@ -26,7 +54,7 @@ yarn install

### Environment Variables

The project comes with a `.env.example` file. You should rename it to `.env` and fill the variables with your own values. Most RPC providers offer free testnet nodes. You can use [Alchemy](https://www.alchemy.com/) or [Infura](https://infura.io/) to get a free node.
The project comes with a `.env.example` file. You should rename it to `.env` and fill the variables with your values. Most RPC providers offer free testnet nodes. You can use [Alchemy](https://www.alchemy.com/) or [Infura](https://infura.io/) to get a free node.

WARNING: The private keys used in the `.env` file are from hardhat accounts. They are not meant to be used in production.

Expand All @@ -45,40 +73,6 @@ Deploy the contracts in the desired network according to the networks available
yarn deploy <network>
```

### TLDR:

- Contracts cannot be upgraded.
- Contracts have no ownership.
- Contracts don't charge fees.
- There are no external contract dependencies.
- The protocol operates using available allowances.

### Making Assets

An `Asset` is a struct that stores the contract address and the amount or ID of ERC20 or ERC721.

```
struct Asset {
address addr;
uint256 amountOrId;
}
```

### Making Swaps

A Swap also has an `owner` and an `allowed` address. The `owner` is the one that can cancel the swap while the `allowed` address is the one that can execute the swap but anyone can accept if
it`s set as the Zero Address.
## Contributing

A Swap also has an `expiry` period in seconds. The Swap can only be executed before the expiry period is reached.

The `Asset` type represents in one hand the asset being bidded and the other for the asset being asked.

```
struct Swap {
address owner;
address allowed;
uint256 expiry;
Asset[] biding;
Asset[] asking;
}
```
- To know more about how you can contribute [see our notion page](https://blockful.notion.site/Swaplace-Call-for-Contributors-6e4895d2a7264f679439ab2c124603fe).
Loading