From 58514bf12aa238a8d4d6b13fa39663c807ba182b Mon Sep 17 00:00:00 2001 From: Luis Lucena Date: Mon, 18 Dec 2023 13:42:40 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=93=83=20Misc:=20add=20new=20NodeJS?= =?UTF-8?q?=20docs=20in=20README.md=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9894ba6..bda27ee 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ This repository is subjected to incentives for the community to contribute to th ## 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). +- Yarn: + +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](https://nodejs.org/download/release/v18.16.0/)). ``` npm install --global yarn @@ -24,6 +26,43 @@ Later on, install the dependencies using Yarn. yarn install ``` +- NodeJS: + +Windows: download the recommended version [v18.16.0](https://nodejs.org/download/release/v18.16.0/) + +MacOS/Linux: run the following command to install the correct version `nvm install 18.16.0` + +To make sure that NodeJS is installed correctly, open the integrated terminal in MacOS/Linux, or command line (cmd), PowerShell in Windows. +Run the following commands to verify the installed versions: + +``` +node -v +``` + +You should see this: + +``` +v18.16.0 +``` + +And also run this: + +``` +npm -v +``` + +You should see this: + +``` +9.5.1 +``` + +Later on, install the dependencies using NodeJS. + +``` +npm 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. From ab532b0fcaf6fbdb41b621a9b7d231dcd6b7ecc8 Mon Sep 17 00:00:00 2001 From: Luis Lucena Date: Wed, 20 Dec 2023 10:08:34 +0100 Subject: [PATCH 2/6] :zap: Misc: improve docs --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bda27ee..bb3f9c1 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,15 @@ This repository is subjected to incentives for the community to contribute to th 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](https://nodejs.org/download/release/v18.16.0/)). +Install Yarn globally: + ``` npm install --global yarn +``` + +Check your Yarn version: + +``` yarn --version ``` @@ -28,9 +35,13 @@ yarn install - NodeJS: -Windows: download the recommended version [v18.16.0](https://nodejs.org/download/release/v18.16.0/) +Windows: download the recommended version here: [v18.16.0](https://nodejs.org/download/release/v18.16.0/) + +MacOS/Linux: run the following command to install the correct version: -MacOS/Linux: run the following command to install the correct version `nvm install 18.16.0` +``` +nvm install 18.16.0 +``` To make sure that NodeJS is installed correctly, open the integrated terminal in MacOS/Linux, or command line (cmd), PowerShell in Windows. Run the following commands to verify the installed versions: From d7cc3b68d86a282f73f73a8ebe06d58b95229d2e Mon Sep 17 00:00:00 2001 From: Luis Lucena Date: Fri, 22 Dec 2023 22:01:02 +0100 Subject: [PATCH 3/6] :memo: Misc: update nodejs docs --- README.md | 58 ++++++++----------------------------------------------- 1 file changed, 8 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index bb3f9c1..cefc488 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,20 @@ This repository contains the core smart contracts for the Swaplace Protocol; The 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. -## Setup +### TL;DR -- Yarn: +- 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. -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](https://nodejs.org/download/release/v18.16.0/)). +## Setup -Install Yarn globally: +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). ``` npm install --global yarn -``` - -Check your Yarn version: - -``` yarn --version ``` @@ -33,47 +32,6 @@ Later on, install the dependencies using Yarn. yarn install ``` -- NodeJS: - -Windows: download the recommended version here: [v18.16.0](https://nodejs.org/download/release/v18.16.0/) - -MacOS/Linux: run the following command to install the correct version: - -``` -nvm install 18.16.0 -``` - -To make sure that NodeJS is installed correctly, open the integrated terminal in MacOS/Linux, or command line (cmd), PowerShell in Windows. -Run the following commands to verify the installed versions: - -``` -node -v -``` - -You should see this: - -``` -v18.16.0 -``` - -And also run this: - -``` -npm -v -``` - -You should see this: - -``` -9.5.1 -``` - -Later on, install the dependencies using NodeJS. - -``` -npm 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. From aa8d409fe765102a0a32fafc2a93f52dc0993c86 Mon Sep 17 00:00:00 2001 From: Luis Lucena Date: Fri, 22 Dec 2023 22:03:01 +0100 Subject: [PATCH 4/6] :zap: Misc: improve docs --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cefc488..5edde00 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,6 @@ This repository contains the core smart contracts for the Swaplace Protocol; The lightest Swap protocol in the market. -## 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. - ### TL;DR - Contracts cannot be upgraded. @@ -17,6 +13,10 @@ This repository is subjected to incentives for the community to contribute to th - 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. + ## 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). From 56c6b697f5bbb64600288ca22173a257f12d421b Mon Sep 17 00:00:00 2001 From: Luis Lucena Date: Sat, 23 Dec 2023 22:30:53 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20all=20docs=20fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 117 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 5edde00..1259451 100644 --- a/README.md +++ b/README.md @@ -17,76 +17,125 @@ This repository contains the core smart contracts for the Swaplace Protocol; The 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). +- Yarn: + +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](https://nodejs.org/download/release/v18.16.0/)). + +Install Yarn globally: ``` npm install --global yarn +``` + +Check your Yarn version: + +``` yarn --version + ``` Later on, install the dependencies using Yarn. ``` + yarn install + ``` -### Environment Variables +- NodeJS: -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. +Windows: download the recommended version here: [v18.16.0](https://nodejs.org/download/release/v18.16.0/) -WARNING: The private keys used in the `.env` file are from hardhat accounts. They are not meant to be used in production. +MacOS/Linux: run the following command to install the correct version: -### Testing and Deploying +``` +nvm install 18.16.0 +``` -Run the tests in `localhost` or try the contracts in a desired network by specifying the network name in `hardhat.config.js`. +To make sure that NodeJS is installed correctly, open the integrated terminal in MacOS/Linux, or command line (cmd), PowerShell in Windows. +Run the following commands to verify the installed versions: ``` -yarn test -yarn testnet + +node -v + ``` -Deploy the contracts in the desired network according to the networks available in `hardhat.config.js`. +You should see this: ``` -yarn deploy + +v18.16.0 + ``` -### TLDR: +And also run this: -- 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. +``` + +npm -v -### Making Assets +``` -An `Asset` is a struct that stores the contract address and the amount or ID of ERC20 or ERC721. +You should see this: ``` -struct Asset { - address addr; - uint256 amountOrId; -} + +9.5.1 + ``` -### Making Swaps +Later on, install the dependencies using NodeJS. + +``` + +npm install + +``` + +### Environment Variables + +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. -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. +### Testing and Deploying -A Swap also has an `expiry` period in seconds. The Swap can only be executed before the expiry period is reached. +Run the tests in `localhost` or try the contracts in a desired network by specifying the network name in `hardhat.config.js`. + +``` +yarn test +yarn testnet +``` -The `Asset` type represents in one hand the asset being bidded and the other for the asset being asked. +Deploy the contracts in the desired network according to the networks available in `hardhat.config.js`. ``` - struct Swap { - address owner; - address allowed; - uint256 expiry; - Asset[] biding; - Asset[] asking; - } +yarn deploy ``` + +## Contributing + +- To know more about how you can contribute [see our notion page](https://blockful.notion.site/Swaplace-Call-for-Contributors-6e4895d2a7264f679439ab2c124603fe). From e29f1265e0e1fc6f8e9ad007ccdcd48d7aac95fe Mon Sep 17 00:00:00 2001 From: Blockchain User <90667119+0xneves@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:42:15 -0300 Subject: [PATCH 6/6] refactor: fixing the installation length and logic --- README.md | 67 +++++++++---------------------------------------------- 1 file changed, 11 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 3127f60..0f17d9c 100644 --- a/README.md +++ b/README.md @@ -39,80 +39,35 @@ This repository is subjected to incentives for the community to contribute to th ## Setup -- Yarn: +You should install the dependencies using Yarn (used in the project) or npm to deploy this code. The project uses Hardhat as a development environment. Which relies on Node.js (Recommended version [v18.16.0](https://nodejs.org/download/release/v18.16.0/)). -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](https://nodejs.org/download/release/v18.16.0/)). - -Install Yarn globally: - -``` -npm install --global yarn -``` - -Check your Yarn version: - -``` -yarn --version - -``` - -Later on, install the dependencies using Yarn. - -``` - -yarn install - -``` - -- NodeJS: - -Windows: download the recommended version here: [v18.16.0](https://nodejs.org/download/release/v18.16.0/) - -MacOS/Linux: run the following command to install the correct version: - -``` -nvm install 18.16.0 -``` - -To make sure that NodeJS is installed correctly, open the integrated terminal in MacOS/Linux, or command line (cmd), PowerShell in Windows. -Run the following commands to verify the installed versions: +To make sure that NodeJS is installed correctly, open the integrated terminal and run the following command: ``` - node -v - ``` -You should see this: +### Yarn: -``` - -v18.16.0 +Install Yarn globally and check if the version appears: ``` - -And also run this: - +npm install --global yarn +yarn --version ``` -npm -v +Install the dependencies using Yarn: ``` - -You should see this: - +yarn install ``` -9.5.1 - -``` +### npm: -Later on, install the dependencies using NodeJS. +Install the dependencies using npm: ``` - npm install - ``` ### Environment Variables @@ -138,4 +93,4 @@ yarn deploy ## Contributing -- To know more about how you can contribute [see our notion page](https://blockful.notion.site/Swaplace-Call-for-Contributors-6e4895d2a7264f679439ab2c124603fe). \ No newline at end of file +- To know more about how you can contribute [see our notion page](https://blockful.notion.site/Swaplace-Call-for-Contributors-6e4895d2a7264f679439ab2c124603fe).