Commit 84de8b9e authored by XFT-dev's avatar XFT-dev
Browse files

restructure the repo

parent 6754edfa

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
# Auto detect text files and perform LF normalization
* text=auto
# Ethereum
This document provides information about installing and running the [shifting](#shifting) and [staking](#staking) resources for the Ethereum blockchain. This directory contains backend scripts and frontend UIs that support shifting and staking on the Ethereum blockchain:
* Shifting - The shifting directory contains the following resources:
* Backend - Scripts for interacting with Offshift's shifting contracts. The following scripts are in the `backend/contracts/` directory:
* chainlink-oracle.sol - The Chainlink price feed contract.
* shift-contract.sol: The Offshift shifting contract .
* shift-with-faucet: The Offshift shifting contract and a faucet for obtaining test XFT (xftT).
* testnet-tokens.sol and xftTest-asset.sol - Testnet erc20 tokens.
* Frontend - Files for using the website or scripts frontends:
* Website - HTML files and scripts that provide a user interface for interacting with the Offshift smart contracts. The following files are in the `frontend/website/` directory:
* faucet.html - User interface for obtaining xftT.
* shift.html - User interface for converting xftT into zkAssets for testing (zkB).
* Scripts - Python and JavaScript files for shifting using your command line.
* Staking - The staking directory contains the following resources that Offshift uses for the [staking dashboard](https://dashboard.offshift.io/):
* Backend - Scripts for interacting with Offshift's staking contracts.
* Frontend - A Node and Angular based frontend app for interacting with Offshift's staking contracts.
## Requirements
Install the following tools before installing and using the shifting and staking resources:
* [npm](https://www.npmjs.com/get-npm) - Follow the instructions on the [npm page](https://www.npmjs.com/get-npm) to install npm on your system.
* [Angular](https://www.npmjs.com/package/@angular/cli) - Installing the Angular CLI requires npm. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.1. Follow the instructions on the [Angular CLI page](https://www.npmjs.com/package/@angular/cli) to install and configure Angular.
## Shifting
Clone this repository and follow the instructions below to use the included shifting tools.
### Website
Follow the steps below to perform a shift using the web app:
##### 1. Install and run the backend scripts
1. In your terminal application, navigate to the `shifting/backend` directory.
2. Run the following command to install the scripts:
```bash
npm install
```
3. Use the following command to run the scripts:
```bash
npx hardhat run scripts/deploy.js
```
##### 2. Obtain test tokens
1. Navigate to the `frontend/website` directory.
2. Use your web browser to open the `faucet.html` file.
3. Follow the onscreen prompts to connect your MetaMask wallet and request test XFT.
##### 3. Perform a test shift
1. Use your web browser to open the `shift.html` file in the `frontend/website` directory.
2. Follow the on screen prompts perform a shift from XFT to a zkAsset.
Our [Ethereum shifting guide](https://medium.com/offshift/offshift-testnet-guide-phase-two-7607c628026d) on Medium provides additional details about setting up MetaMask and using the shifting dashboard.
### Scripts
Follow the steps below to perform a shift using your command line:
##### 1. Add your private key to the script files
1. Edit the files as described below to include your private key. Your key must reference a wallet address that contains Rinkeby ETH:
* `frontend/scripts/py/script.py` - Set the value of `priv_key` to your private key:
```python
priv_key = "0x0-YOUR-PRIVATE-KEY"
```
* `frontend/scripts/js/index.js` - Add your private key to the line shown below:
```javascript
web3.eth.accounts.wallet.add(web3.eth.accounts.privateKeyToAccount("0x0-YOUR-PRIVATE-KEY"));
```
##### 2. Install and run the Python script
1. In your terminal application, open the `frontend/scripts/py` directory.
2. Run the following command to install the Python script:
```bash
pip install -r requirements.txt
```
3. Run the following command to run the Python scripts:
```bash
python3 script.py
```
##### 3. Install and run the JavaScript
1. Change to the `frontend/scripts/js` directory.
2. Run the following command to install the scripts:
```bash
npm install
```
3. Use the following command to run the scripts:
```bash
node script.js
```
##### 4. Follow the prompts to shift XFT to zkAssets
### Staking
Before using the staking resources in this repository, obtain SushiSwap Liquidity Pool (SLP) tokens by using the [SushiSwap XFT-ETH liquidity tool](https://app.sushi.com/add/0xabe580e7ee158da464b51ee1a83ac0289622e6be/ETH). You will use the staking dashboard provided here to stake the SLP.
Clone this repository and follow the instructions below to install and run the staking dashboard.
#### 1. Install the dependencies
1. In your terminal application, open the `staking/backend/config` directory.
2. Run the following code:
```bash
npm install
```
#### 2. Start the server
1. Run the following command to start the development server.
```bash
npm run start
```
2. In your web browser, open [`http://localhost:4200/`](http://localhost:4200/). You will see the staking dashboard. The page will automatically reload when you make changes to the code.
#### 3. Begin staking
Follow the onscreen prompts to connect to your MetaMask wallet and stake your SLP.
#### 4. Claim your rewards
Use the Rewards tab on the staking dashboard to claim your rewards. Rewards accrue every block and are paid in XFT and SLP.
Our [staking guide](https://medium.com/offshift/offshift-sushiswap-dual-liquidity-mining-goes-live-7d7ed036a89e) on Medium provides additional details about setting up MetaMask, obtaining SLP, and using the staking dashboard.
#### Additional Information
Depending on your requirements, you may find the following options useful:
* Code Scaffolding - Use the code below to generate components for scaffolding:
* Generate a new component:
```bash
ng generate component component-name
```
* Scaffold all the components:
```bash
ng generate directive|pipe|service|class|guard|interface|enum|module
```
* Builds - Build artifacts are stored in the `dist/` directory:
* Test Builds
```bash
npm run build
```
* Production Builds
```bash
npm run build-prod
```
* Help
* Angular CLI - See the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md) file for details about Angular.
* Angular Help - Run `ng help` to view the Angular help pages in your terminal application.
\ No newline at end of file
# Shifting
This repo includes resources for using the shifting tool in two different ways:
* Website - Use our prebuilt web apps to obtain test tokens and convert XFT to zkAssets.
* Scripts - Use our backend scripts to shift tokens using the command line.
The information below describes how to install and run the shifting resources.
## Backend
Run the following commands inside the `shifting/backend` directory:
```bash
npm install
npx hardhat run scripts/deploy.js
```
## Frontend
The sections below describe how to use the website or command line frontends.
### Website
1. Set up MetaMask and obtain test tokens. You will need Rinkeby ETH and XFT Test Assests (xftT) to test shifting.
1. In MetaMask, select the Rinkeby Test Network and obtain Rinkeby ETH from the [Rinkeby faucet](https://faucet.rinkeby.io/).
2. Use the token addresses below to add the Offshift test tokens to MetaMask:
* xftT - 0x1190fb1b00d20656549cdff689e55d072ba764f3
* zkB - 0x0e1bff82509994170026f47f1d0857fb275c3003
2. Open `frontend/website/faucet.html` in your web browser and follow the prompts to connect MetaMask to the app.
3. Click the xftT(testnet) Faucet button on the web app and follow the prompts to obtain test XFT.
4. Open `frontend/website/shift.html` in your web browser and follow the prompts to connect MetaMask to the app.
5. Select the assets that you will burn and mint.
6. Click the Approve button and follow the prompts to complete the shift.
### Scripts
1. Edit the files as described below to include your private key. Your key must reference a wallet address that contains Rinkeby ETH:
* `frontend/scripts/py/script.py` - Set the value of `priv_key` to your private key:
```python
priv_key = "0x0-YOUR-PRIVATE-KEY"
```
* `frontend/scripts/js/index.js` -
```javascript
web3.eth.accounts.wallet.add(web3.eth.accounts.privateKeyToAccount("0x0-YOUR-PRIVATE-KEY"));
```
2. In your terminal application, open the `frontend/scripts/py` directory, and run the following command:
```bash
pip install -r requirements.txt
```
3. Then run the script:
```bash
python3 script.py
```
4. Change to the `frontend/scripts/js` directory and run the following command:
```bash
npm install
```
5. Then run the script:
```bash
node script.js
```
6. Follow the prompts in your terminal to complete the shift.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment