diff --git a/docs/1rpc/design.md b/docs/1rpc/design.md index 7d9ff7a4..38d5682a 100644 --- a/docs/1rpc/design.md +++ b/docs/1rpc/design.md @@ -1,6 +1,4 @@ -## Design - -![](../assets/1rpc/1RPC_design.png){style="zoom:100%"} +![](../assets/1rpc/1RPC_intro.png){style="zoom:100%"} 1RPC employs a number of methods for users' data and metadata to remain private before requests are relayed to RPC providers. Its lightweight design is able to scale to support high traffic volume. diff --git a/docs/1rpc/introduction.md b/docs/1rpc/introduction.md index 86153863..f0e2d2c4 100644 --- a/docs/1rpc/introduction.md +++ b/docs/1rpc/introduction.md @@ -1,11 +1,34 @@ -# Introduction +# 1RPC - The relay protecting privacy for good in Web3 ## Overview -1RPC is a free RPC relay to eradicate metadata exposure and leakage with a one-click experience for users within Web3. As a proxy layer that shields user data before it reaches existing RPC endpoints, many of which continue to be centralized today, it is important to us that 1RPC neither collects nor stores user metadata in any part of the relay journey. +1RPC is a free RPC relay to eradicate metadata exposure and leakage with a one-click experience for users within Web3. As a proxy layer that shields user data before it reaches existing RPC endpoints, many of which continue to be centralized today, it is important to us that 1RPC neither collects no stores user metadata in any part of the relay journey. + +``` mermaid +graph LR + A[User client / wallet] --> B{1RPC}; + B -->C[RPC providers]; +``` + + +1RPC prevents the following data collection from RPC providers: + +- Account addresses :fontawesome-light-wallet: +association in the same wallet client (extension/mobile) +- IP address (Geolocation) 📍 +- User agent (Browser, OS) 💻📱 +- Request timestamp (Time zone) 🌎 + +### 1RPC+ To support the evolving needs of our budding community, we’ve rolled out 1RPC+ to give users more granular, dynamic control of how they interact with the blockchain. Read more about 1RPC+ [here](./1rpcplus/introduction.md) - and how users create their own bespoke RPC endpoint with transaction sanitizers that can be added, edited or removed instantly, at any time. +[Go to 1RPC+ Doc](./1rpcplus/introduction.md){ .md-button .md-button--primary } + + + + + ## Features - ### Public good diff --git a/docs/anydao/design.md b/docs/anydao/design.md deleted file mode 100644 index 91ac0930..00000000 --- a/docs/anydao/design.md +++ /dev/null @@ -1,32 +0,0 @@ -# Design - -## Architecture -**AnyDAO MVP** is composed of 4 major components: - -- **Substrate based blockchain**: Stores the related metadata and proofs for Projects and Proposals. -- **IPFS**: Stores actual data such as texts, images and public voter information. -- **Geode**: Receives, queries and aggregates user votes. Also monitors the on-chain status and handles the uploading of IPFS storage and on-chain storage. At the same time, it ensures the protection of user privacy. -- **Frontend**: Gathers all kinds of data and provides information via graphical interface, and provides interactivity for users to register projects, create proposals, cast votes and many more. - -## Concept -### Project -Represents the DAO. The creator is the default owner, and has the right to update project settings, as well as transfer the ownership to another address. -#### Workspace -Each project can configure multiple workspaces. Each workspace is composed of a chain and strategies -#### Strategy -Defines how to get the voting power of users from on-chain states, such as by calculating ERC20 token balance -### Proposal -Represents a topic where user can vote on with their assets -#### Snapshot -To ensure fairness and avoid double-entry, a snapshot mechanism is adopted in our design. When a proposal is started, the block height of each participating chain will be taken by our Geode, and the state of each user will be fetched for power aggregation. -#### Privacy Level -There are currently 4 levels of privacy settings:
-- **Public**: Details of all individual votes made by users will be made available.
-- **Private**: Total amount of votes for each option will be made available as an aggregation while the individual vote is hidden.
-- **Mixed**: Users have the option to choose to reveal their vote or to cast their vote in the form of an aggregated result.
-- **Opaque**: Only the result of the vote is revealed. All other details are hidden, including the aggregated vote amount.
-#### Update Frequency -- Stands for how often Geode executes transaction to update the on-chain state.
-- The total number of updates for a proposal is calculated by the total voting duration divided by update frequency.
-- Each execution generates a transaction fee and the proposal creator is responsible for this payment.
-- If the update frequency is not enabled, Geode will only update the IPFS and on-chain state when the proposal is ended. diff --git a/docs/anydao/guide.md b/docs/anydao/guide.md deleted file mode 100644 index 32c166c7..00000000 --- a/docs/anydao/guide.md +++ /dev/null @@ -1,72 +0,0 @@ -## Claim test tokens -- This guide assumes you have set up your wallet account. If not, please refer [here](../canarynet/userguide/setupwallet.md) -- Head to the [Automata Faucet](./spec.md#faucet). You may need to login via a Twitter account -- Choose ContextFree under the Network drop-down field -![](../assets/anydao/faucet.png) -- Input your ContextFree wallet address and click Submit -- 10 CTX tokens will be sent to your account. You can also check this on our [dashboard](./spec.md#explorer) - -## Interface layout -- Let's take a look at the [AnyDAO](https://anydao.app) [frontend](./spec.md#frontend) -![](../assets/anydao/home_empty.png) -- The left panel contains the directory -- The right panel displays all projects currently registered on [AnyDAO](https://anydao.app) - -## Connect wallet -- The connect button is located at the bottom of the left panel -- To disconnect, click on your connected wallet to locate the Disconnect button -- Connect with a PolkadotJS wallet to carry out the following: `Register Project`, `Update Project`, and `Create Proposal` - -## Create project -- Having followed the steps above, `Project Management` should appear on the left panel. Make sure you are connected with a Polkadot Extension Wallet -![](../assets/anydao/home_connected.png) -- Go to `Project Management`, then `Add a new project` -![](../assets/anydao/project_manage.png) -- Fill in your project title and description -- Upload your project icon, as well as banner -- Add workspaces for your project and select the chain -![](../assets/anydao/workspace_chain.png) -- Select a strategy from the drop-down menu -![](../assets/anydao/workspace_strategy.png) -- You should arrive at this page once done -![](../assets/anydao/project_set.png) -- Click on `Submit new project` and follow the wallet instructions to submit the transaction. Ensure your wallet has enough tokens to pay for the transaction fee -![](../assets/anydao/project_create_txn.png) -- A message should appear which means your project has been created successfully -![](../assets/anydao/project_success.png) -## Update Project -- Upon successfully creating your project, you should be able to see it under `Project Management` -![](../assets/anydao/project_registered.png) -- Select a project that has been created previously -- Adjust your settings. Once you're done, click on `Save project settings`. -- Follow the wallet instructions to submit the transaction. -![](../assets/anydao/project_update_txn.png) - -## Create Proposal -- Click on `New Proposal` -![](../assets/anydao/project_detail.png) -- Fill in a title and short description -![](../assets/anydao/proposal_empty.png) -- Click on `Define proposal configurations` to adjust your settings -![](../assets/anydao/proposal_configure.png) - - Understand the different [privacy levels](./design.md#privacy-level) - - Understand the different [voting types](./spec.md#voting-type) - - Starting date & ending date refers to the proposal voting period. Understand more about [time restriction](./spec.md#configurations) - - Understand more about [update frequency](./design.md#update-frequency) -- Click on `Publish my proposal` and follow the instructions to submit your transaction. You should be able to see your proposal once it has been successfully created -![](../assets/anydao/proposal_publish_txn.png) - -## Vote -- Go to any on-going proposal or one you have just created -![](../assets/anydao/proposal_detail.png) -- For proposals with `Mixed` privacy level, toggle `Vote Privacy` to choose whether to vote publicly or anonymously -![](../assets/anydao/vote_public.png) -![](../assets/anydao/vote_anonymous.png) - - Choose to vote publicly and details of the vote will be visible, such as: - ![](../assets/anydao/vote_public_result.png) - - Choose to vote anonymously and no details will be revealed -- Click on an option to cast your vote -- Voting only requires a signature from your wallet. No fees will be charged for voting -- You can use either Metamask wallet or Polkadot Extension Wallet according to the project's workspace configuration - -[This](https://the.anydao.app/#/project/1/proposal/1) is an example of a closed proposal diff --git a/docs/anydao/introduction.md b/docs/anydao/introduction.md deleted file mode 100644 index 4823fa51..00000000 --- a/docs/anydao/introduction.md +++ /dev/null @@ -1,20 +0,0 @@ -## Overview - -![](../assets/anydao-image.png){style="zoom:80%"} - -Governance is a perennial issue that has taken on weighted importance with the considerable growth of blockchain protocols, with many of these networks boasting billions in locked value on their platforms. Be that as it may, participation rate remains low. One of the most immediate challenges for most Web3 projects on the path of decentralization is in figuring out the tangle of collective decision making. - -[AnyDAO](https://anydao.app) is designed with powerful, intutiive tools to help make this happen. - -## Features - -- Borderless governance -
Vote aggregation across different blockchain networks (and token standards) -- Multi-chain platform -
Native support for DAOs on EVM and Substrate-based platforms -- Zero-cost voting -
Free (gasless!) to create and vote on proposals with signed messages -- Multi-tier privacy -
Adjustable privacy settings which controls the visibility of the voting results -- Custom parameters -
Voting can be done through NFTs, LP tokens or native Substrate account balances diff --git a/docs/anydao/spec.md b/docs/anydao/spec.md deleted file mode 100644 index 1903fbcc..00000000 --- a/docs/anydao/spec.md +++ /dev/null @@ -1,57 +0,0 @@ -# Specifications -## Production - -### Frontend - - -Currently supports wallet connection with [Metamask](https://metamask.io/) and [Polkadot Extension](https://polkadot.js.org/extension/) - -### Faucet - - -### Blockchain -#### Explorer -[ContextFree Dashboard](https://dashboard.ata.network/?rpc=wss%3A%2F%2Fcf-api.ata.network#/explorer) -#### Endpoints - - -#### Configurations -- Minimum voting period: 1 hour -- Maximum voting period: 30 days -- Maximum option count: 10 -- Maximum workspace number: 10 -- Maximum strategy number: 10 -#### Supported Chains -| Platform | Protocol| -|:-----------------:|:-------:| -| Automata Mainnet | Substrate | -| ContextFree Canary Network | Substrate | -| FiniteState Testnet| Substrate | -| Ethereum Mainnet | EVM | -| Ropsten Testnet | EVM | -| Kovan Testnet | EVM | -| BSC Mainnet | EVM | -| BSC Testnet | EVM | -| Polygon Mainnet | EVM | -| Polygon Testnet | EVM | -| HECO Mainnet | EVM | -| HECO Testnet | EVM | -| Moonbase Alpha Testnet | EVM | -| Avalanche Testnet | EVM | -| Avalanche Mainnet | EVM | - -#### Strategies -##### EVM -| Name | Parameter | Description | -|:----------:|:--------------:|:------------------------------:| -|ERC20Balance|Contract Address|Take `BalanceOf` as voting power| - -##### Substrate -| Name |Parameter| Description | -|:-----------:|:-------:|:-------------:| -|NativeBalance| - |Take `System/Account` and the `Free` balance as voting power| - -#### Voting Type -| Name | Parameter |Description| -|:----------:|:---------:|:---------:| -|SingleChoice| - |User can vote on only one option| diff --git a/docs/assets/1rpc/1RPC_intro.png b/docs/assets/1rpc/1RPC_intro.png new file mode 100644 index 00000000..54fc1b7c Binary files /dev/null and b/docs/assets/1rpc/1RPC_intro.png differ diff --git a/docs/canarynet/getstarted/introduction.md b/docs/canarynet/getstarted/introduction.md deleted file mode 100644 index 12d8cebe..00000000 --- a/docs/canarynet/getstarted/introduction.md +++ /dev/null @@ -1,42 +0,0 @@ -# ContextFree Network - -![](../../assets/canary.png){style="zoom:80%"} - -ContextFree is the Canary Network of Automata’s Mainnet, and this is an important milestone in realizing the technological vision of a privacy middleware platform built for Web 3.0. - -The launch of ContextFree provides a pre-production environment for real-life learnings to be applied to the eventual rollout of the Mainnet. During this time, users are invited to battle-test the code. Features are rolled out in phases to ensure the stability and security of the blockchain. - -This documentation homepage offers the necessary resources to learn about ContextFree, guides and tools to contribute to the Canary Network, either as a user looking to explore the blockchain, or to participate by running a node. Here are some background information to get you started: - -## Network Parameters -### Basic -| Config | Parameter | -|--|--| -| Expected block time| 6 seconds | -| Epoch duration | 4 hours | -| Era duration | 24 hours | -| Account prefix | 11820 | - -## Tokens -CTX are ContextFree tokens, and do not have any monetary value. Users can request for free CTX tokens by heading over to our [faucet](https://faucet.ata.network/). The initial circulation amount of CTX is set at 1 billion, and will be minted on demand. - -## Roadmap -ContextFree launch progress mimics and follows the [Roadmap](https://www.ata.network/roadmap), with faster iteration. All upgrades will be recorded in this documentation. - -## Features -
2021-09-30 Initial launch -ContextFree was launched on September 30, 2021, in Proof of Authority mode. All nodes are held by the Automata team, with most functionalities disabled. -
-
2021-10-09 Token Economics -Features related to Transfer, Staking and Token Bridge have been enabled on October 9, 2021. -
-
2021-10-12 NPoS -Nominated Proof of Stake has been enabled on October 12, 2021, and public validators will be able to join the network. -
- -## Resources -| Name | Value | -| -- | -- | -| Dashboard | | -| HTTP RPC Endpoint | https://cf-rpc.ata.network | -| Websockets RPC Endpoint | wss://cf-api.ata.network | diff --git a/docs/canarynet/node/node-type.md b/docs/canarynet/node/node-type.md deleted file mode 100644 index af714ff9..00000000 --- a/docs/canarynet/node/node-type.md +++ /dev/null @@ -1,23 +0,0 @@ -# Type of Nodes -Before an introduction to the distinct type of nodes, it is important to understand a few concepts: -* **Genesis block:** defined by a chain spec file, which describes the initial status of a chain, including the initial wasm, balances, authority set and so on. -* **Extrinsics:** a piece of information that comes from outside the chain and is included in a block, which will change the state of chain. -* **Events:** a piece of information comes from inside the chain, which may trigger some operation and change the state of chain. - -The chain starts from a initial state, and updated by **Extrinsics** or **Events**. Assume the current block height is N, a validator will takes the chain state at block N and apply changes on top of it, to construct the block N+1. - -## Archive node -**Archive Nodes** keeps all the historical state in storage. So it is convenient to use a archive node to query the state of a certain block height. For example, you can get the balance of `Alice` at block 20, or get the validator number at block 1024. As a result, running a archive node needs more disk space. Generally, archive nodes are used when you need to know the past states. - -## Full node -**Full nodes** keeps states of genesis block and serveral recently blocks in storage. By default, blocks which is older than 256 from the latest finalized block will be discarded. Besides, full node keeps extrinsics for all past blocks, so it can rebuild the chain without additional information. Full nodes need less disk space than archive node and is used when you just want to read the recently state of chain, submit or validate extrinsics. - -For running full node or archive node, please refer [here](./run-full-node.md). - -## Light node -**Light nodes** has only the runtime and current state, does not keep any of the historical state or extrinsics. Light nodes are useful for resource limited devices. - -## Validator -**Validator** is a special kind of archive node. Like archive nodes, validators keep all the historical state in storage. More importantly, validators are participants of the chain, which are responsible for validate blocks, voting for finality and so on. Validators will be rewarded for maintaining the chain and slashed for misbehavior. - -For running validator node, please refer [here](./run-validator.md). \ No newline at end of file diff --git a/docs/canarynet/node/run-full-node.md b/docs/canarynet/node/run-full-node.md deleted file mode 100644 index ca354d8b..00000000 --- a/docs/canarynet/node/run-full-node.md +++ /dev/null @@ -1,60 +0,0 @@ -# Run Full Node -## Introduction -According to description in [Type of Nodes](./node-type.md), you can run Full Node, Archive Node or Validator Node on ContextFree Network.
-In this section, we briefly introduce how to run `Full Node` or `Archive Node`
-For running `Validator Node`, please refer to the [next section](./run-validator.md). - -## Preparation -### Dependencies -- Install Docker - - Please go to [this link](https://docs.docker.com/get-docker/) to download the docker engine for your Operating System accordingly. -### Create a Local Directory To Store the Chain Data -- You may need `sudo` permission to run the following commands. - - Firstly create a folder to store the synchronized on-chain data - ``` - mkdir /chain - ``` - - Change the ownership and permission of your local storage directory to current user - ``` - sudo chown -R $(id -u):$(id -g) /chain - ``` -## Launch Node -### Launch Full Node -- Run the following command to launch a Full Node, you may need `sudo` permission: - ``` - docker run -it \ - -v "/chain:/data" \ - -u $(id -u ${USER}):$(id -g ${USER}) \ - -d \ - atactr/automata:contextfree-v0.1.0-rc4 \ - --node-type full \ - --name - ``` - - Which will return the **c_ontainer ID** of your node - - `` can be anything, but it's recommended to have something unique to make it easier to identify your node. - -### Launch Archive Node -- Run the following command to launch a Archive Node, you may need `sudo` permission: - ``` - docker run -it \ - -v "/chain:/data" \ - -u $(id -u ${USER}):$(id -g ${USER}) \ - -d \ - atactr/automata:contextfree-v0.1.0-rc4 \ - --node-type archive \ - --name - ``` - - Which will return the **container ID** of your node - - `` can be anything, but it's recommended to have something unique to make it easier to identify your node. - -## Check Launch Status -- Check whether your node downloading blocks by checking the logs - ``` - docker logs --follow - ``` -- If it works fine, the beginning of the log should look like
-![](../../assets/canaryimg/node_logs_2.png){width="673" height="463"}
- - - **Take note of your node identity behind `"Local node identity is: ..."`.** This will be very important for identifying your node on the Telemetry, as the node name can be duplicated. - - Notice that you should have a **non-zero** number of `"peers"` connected as shown in the image above. - - If the logs saying `"Error while dialing /dns/..."`, don't be panic, normally it may take a few minutes for the node to connect to the Telemetry server, after that the error will stop popping up. diff --git a/docs/canarynet/node/run-validator.md b/docs/canarynet/node/run-validator.md deleted file mode 100644 index ca4303a0..00000000 --- a/docs/canarynet/node/run-validator.md +++ /dev/null @@ -1,111 +0,0 @@ -# Run A Validator -## Introduction -You may want to run a validator, which means if you are elected into the validator set, you will be able to earn rewards. To run a validator, you need to run a validator node and stake some tokens, we will show you how to do it step by step. - -## Steps -### Install Dependencies -- Install Docker - - Please go to [this link](https://docs.docker.com/get-docker/) to download the docker engine for your Operating System accordingly. - -### Create a Local Directory To Store the Chain Data -- You may need `sudo` permission to run the following commands. - - Firstly create a folder to store the synchronized on-chain data - ``` - mkdir /chain - ``` - - Change the ownership and permission of your local storage directory to current user - ``` - sudo chown -R $(id -u):$(id -g) /chain - ``` - -### Launch the Validator Node -- Run the following command to launch a validator node, you may need `sudo` permission: - ``` - docker run -it \ - -v "/chain:/data" \ - -u $(id -u ${USER}):$(id -g ${USER}) \ - -d \ - atactr/automata:contextfree-v0.1.0-rc4 \ - --node-type validator \ - --name - ``` - - Which will return the **container ID** of your node - - `` can be anything, but it's recommended to have something unique to make it easier to identify your node. -### Check Launch Status -- Check whether your node downloading blocks by checking the logs - ``` - docker logs --follow - ``` -- If it works fine, the beginning of the log should look like
- ![](../../assets/canaryimg/node_logs_2.png){width="673" height="463"}
- - - **Take note of your node identity behind `"Local node identity is: ..."`.** This will be very important for identifying your node on the Telemetry, as the node name can be duplicated. - - Notice that you should have a **non-zero** number of `"peers"` connected as shown in the image above. - - If the logs saying `"Error while dialing /dns/..."`, don't be panic, normally it may take a few minutes for the node to connect to the Telemetry server, after that the error will stop popping up. - -### Get Session Keys Of Your Node -- Run the following command - - Install `curl` in your docker container: - ``` - docker exec -t -u root bash -c 'apt-get update | apt-get -y install curl' - ``` - - Fetch Session Keys from your container: - ``` - docker exec -t curl http://127.0.0.1:9933 -H "Content-Type:application/json;charset=utf-8" -d '{ - "jsonrpc":"2.0", - "id":1, - "method":"author_rotateKeys", - "params": [] - }' - ``` -- You will get a response like this - ``` - { - "jsonrpc": "2.0", - "result":"0xc05a9d093e4db4c1bde31977716e7a0a39d6f3d1f1bf749e7fec8371147de730af6860aeef81a11130c9fcd317b96e736f6c36141c28f382a18f9faf6e7df797eaa951ead00d12db10937003f0956e3d3444d1774d452ed045dbc1b84d1bf1471abf5d77bf5033845f01be1188a852c6f0ba703042b4d06d14314841c1096c50", - "id":1 - } - ``` -- The content after `"result"` is the session keys of your validator node - -### Set Up Accounts -- For running a validator, you need to set up two accounts: - - `Stash account`: This account holds funds bonded for staking, but delegates some functions to the Controller account. It can be kept in a cold wallet, meaning it can stays offline all the time. - - `Controller account`: This account acts on behalf of the Stash account, signalling decisions and necessary execution for staking. It only needs enough funds to pay transaction fees. - - For more details, refer to [Polkadot Keys](https://wiki.polkadot.network/docs/learn-keys). -- For how to create accounts in ContextFree, you can refer [here](../userguide/accounts.md#create-account). - -### Get Token -- Your Stash account and Controller account need to be funded with some native token - - If you already had some native token on other account, you can simply transfer to the stash and controller accounts you have created, using the dashboard by opening the `Transfer` page under the `Accounts` tab. - - If you don't have any native token, visit [Get Token from Faucet](../userguide/get-test-token.md) to get some native token. - - Alternatively, if you have some [ContextFree ERC20 token](https://ropsten.etherscan.io/token/0x8289b901CAC48EbBB1B5cb0049d1459EA1240EF7), you can follow the [Token Bridge user guide](../userguide/token-bridge.md) to convert it into native token. - -### Stake Tokens -- Visit the [Automata Dashboard](https://dashboard.ata.network/?rpc=wss%3A%2F%2Ffs-api.ata.network#/explorer) -- Go to the `Staking` section.
-![](../../assets/canaryimg/validator/staking.png){width="673" height="463}
-- Set Stash and Controller.
-![](../../assets/canaryimg/validator/stash.png){width="673" height="463}
-- Choose the stash account and controller account accordingly, set the value for staking and press `Bond` to submit the transaction.
-![](../../assets/canaryimg/validator/bond.png){width="673" height="463}
- -### Set Session Keys -- Click `Session Keys` and set the session keys you got previously.
-![](../../assets/canaryimg/validator/sessionkey.png){width="673" height="463}
-- If you are nominating someone, you need to stop nominating or you will not be able to set session keys. - -### Set Validate Parameters -- Click `Validate`
-![](../../assets/canaryimg/validator/validate.png){width="673" height="463}
-- Set the value of `reward commission percentage`, which is the rate that your validator will be commissioned with. The remaining rewards will be split among your nominators.
-![](../../assets/canaryimg/validator/validate_2.png){width="673" height="463}
-- Besides, you can choose to accept nominating or not. - -### Joining Validator Set -- If you go to the "Staking" tab, you will see a list of active validators currently running on the network. At the top of the page, it shows the number of validator slots that are available as well as the number of nodes that have signaled their intention to be a validator. You can go to the "Waiting" tab to double check to see whether your node is listed there.
-![](../../assets/canaryimg/validator/validatorset.png){width="673" height="463}
-- The validator set is refreshed every era. In the next era, if there is a slot available and your node is selected to join the validator set, your node will become an active validator. Until then, it will remain in the waiting queue. If your validator is not selected to become part of the validator set, it will remain in the waiting queue until it is. There is no need to re-start if you are not selected for the validator set in a particular era. However, it may be necessary to increase the number of native token staked or seek out nominators for your validator in order to join the validator set. - -### Congratuation -If you have followed all of these steps, and been selected to be a part of the validator set, you are now running a ContextFree validator! \ No newline at end of file diff --git a/docs/canarynet/userguide/accounts.md b/docs/canarynet/userguide/accounts.md deleted file mode 100644 index d6ced9b2..00000000 --- a/docs/canarynet/userguide/accounts.md +++ /dev/null @@ -1,38 +0,0 @@ -# Accounts -This document introduce you to the basics of ContextFree accounts. -## Account basic -The address format used in ContextFree network is **SS58**, which is a modification of Base-58-check from Bitcoin with some miner changes. More details can be found on the [Substrate github wiki](https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)). - -| Network | Address type prefix | Leading characters | Example(Alice) | -| -- | -- | -- | -- | -| Automata Network | 2349 | aA | | -| **ContextFree Network** | 11820 | a7 | a7SvTrjvshEMePMEZpEkYMekuZMPpDwMNqfUx8N8ScEEQYfM8 | -| FiniteState Network | 13107 | at | ateYGxACWo2Yu8wVi7RGJQsEQLAB25xbAHkSRpzTqMabJ38zx | -| Substrate default | 42 | 5 | 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY | - -As we known, the secret seed of account **Alice** is: `0xe5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a`. In ContextFree network, the address of **Alice** will be `a7SvTrjvshEMePMEZpEkYMekuZMPpDwMNqfUx8N8ScEEQYfM8`. But all addresses above are merely different representations of the same public key in a private-public keypair. In another word, the account in ContextFree network is compatible with other substrate-based chains. - -## Create account -There are several ways to create an ContextFree account, we will suggest you to use our official [blockchain explorer](https://dashboard.ata.network). -### Create account using explorer -1. Open official [blockchain explorer](https://dashboard.ata.network) of Automata, check the connected network on the left upper corner of web page. If the connected network is not **ContextFree Network**, click and choose **Automata ContextFree** in **TEST NETWORKS**. -![](../../assets/switch_network.jpg){width="673" height="463"} -2. Click **Accounts** in the top menu and choose **Accounts**, you will enter the accounts page. Then click **Add account** and start to create a new account. -![](../../assets/create_account0.jpg){width="673" height="463"} -3. You will see a auto generated mnemonic in the popup box, please copy this mnemonic and save it safely. -![](../../assets/create_account1.jpg){width="673" height="463"} -4. Enter an alias for this account and create a password, we suggest you to use a strong and unique password. -![](../../assets/create_account2.jpg){width="673" height="463"} -5. Click **Save** and we finish the process of creating an account. -![](../../assets/create_account3.jpg){width="673" height="463"} -6. The newly created account will be show in the list, and there will be a auto downloaded file which describe the details of this account. -![](../../assets/create_account4.jpg){width="673" height="463"} - -## Import existing account -The process of importing an existing account into blockchain explorer is similar to the process of creating one. We will show you how to import the well known **Alice** account. -1. Override the auto generated **Mnemonic** or **Raw seed** with mnemonic or seed of your existing account. -![](../../assets/import_account0.jpg){width="673" height="463"} -2. Create an alias and enter the password, the imported account will be show in the list. -![](../../assets/import_account1.jpg){width="673" height="463"} -## Wallet -Please refer to [Wallet tutorial](./setupwallet.md) if you want to create and manage accounts in polkadot extention. \ No newline at end of file diff --git a/docs/canarynet/userguide/get-test-token.md b/docs/canarynet/userguide/get-test-token.md deleted file mode 100644 index 5ebf33f9..00000000 --- a/docs/canarynet/userguide/get-test-token.md +++ /dev/null @@ -1,20 +0,0 @@ -# Get Test Token -**This is a guide on how to claim test token on the ContextFree** - -- Assume you have set up your wallet account, if not, please refer to [here](./setupwallet.md) - -## Use Automata Faucet -- Visit the [Automata Faucet](https://faucet.ata.network/), you may need to login via Twitter account to get access to the faucet page. - -### Get ContextFree Native Token -- Input your canary network wallet address under this tab, and press `Submit`.
-![](../../assets/canaryimg/faucet_native.png){width="673" height="463"}
-- Then 10 CTX native token will be sent to your address, you can check on the [Automata Dashboard](https://dashboard.ata.network). -- *Notice: You can request funding for your address for once per 24 hours.* - -### Get ContextFree ERC20 Token on Ropsten Testnet -- Input your Ropsten ETH address under this tab, and press `Submit`.
-![](../../assets/canaryimg/faucet_erc20.png){width="673" height="463"}
-- Then 10 CTX ERC20 token will be sent to your Ropsten address, you can check on [Ropsten Explorer](https://ropsten.etherscan.io). -- However the ERC20 token cannot be utilized as native token on the canary network, you can follow the instruction [here](../userguide/token-bridge.md) to use the **Automata Token Bridge** to convert it into the ContextFree native token. -- *Notice: You can request funding for your address for once per 24 hours.* \ No newline at end of file diff --git a/docs/canarynet/userguide/setupwallet.md b/docs/canarynet/userguide/setupwallet.md deleted file mode 100644 index ebeefd5d..00000000 --- a/docs/canarynet/userguide/setupwallet.md +++ /dev/null @@ -1,51 +0,0 @@ -#ContextFree Network Wallet Setup Guide - -**This is a guide on how to get onto the Automata Canary Net for Chrome users(recommended).** - -1. Go to ['ContextFree Dashboard'](https://dashboard.ata.network/?rpc=wss%3A%2F%2Fcf-api.ata.network#/explorer) -*You should reach a website which looks like the picture below.* -![](../../assets/canaryimg/img1.png){width="673" height="463"} - -2. Hover over the Accounts taskbar and click on Accounts. -*Picture showing what is needed to be clicked.* -![](../../assets/canaryimg/img2.png){width="673" height="463"} -*You should then reach this page.* -![](../../assets/canaryimg/img3.png){width="673" height="463"} - -3. Then you must click on the link called [polkadot-js extension](https://chrome.google.com/webstore/detail/polkadot{js}-extension/mopnmbcafieddcagagdcbnhejhlodfdd) on the page. -![](../../assets/canaryimg/img4.png){width="673" height="463"} -This will direct you to an extension which needs to be downloaded. You should then add this to chrome. -![](../../assets/canaryimg/img5.png){width="673" height="463"} - -4. You must then click on the plugin to create an account. This process is very easy and just requires you to record your seed phrase, which should be noted to ensure you have a way to restore control of your account, create a username and then a password. You will then have an account. -*The account should look like this in the plugin.* -![](../../assets/canaryimg/img6.png){width="673" height="463"} - -5. Once you have created your account, it will be necessary to refresh your page on Dashboard.ata.network. This will then prompt you to authorise polkadot{.js}, which you should approve. -*What the Authorize prompt looks like.* -![](../../assets/canaryimg/img7.png){width="673" height="463"} - -6. After you have allowed the application access, you should then click on the settings tab at the top of the screen. -*Click on Settings.* -![](../../assets/canaryimg/img8.png){width="673" height="463"} -Then click on Metadata. -![](../../assets/canaryimg/img9.png){width="673" height="463"} -Then click on update metadata. -![](../../assets/canaryimg/img10.png){width="673" height="463"} -This will give you another prompt from polkadot{.js} asking to add the metadata to your extension instance. Click ‘yes, do this metadata update’ -![](../../assets/canaryimg/img11.png){width="673" height="463"} - -7. After you have done this, click on the polkadot{.js} plugin again. After this click on the three dots next to your account, click on the drop down box which currently says ‘Allow Use On Any Chain’ and change it to ‘ContextFree Network.’ -![](../../assets/canaryimg/img12.png){width="673" height="463"} -After you have done this, refresh your page and click on Accounts again. If there is no exclamation mark next to your account then everything should be set up correctly. -*It should look like this.* -![](../../assets/canaryimg/img13.png){width="673" height="463"} -However, if there is an exclamation mark, then ensure that you have followed all the steps above. If you believe you have done all the steps properly, try the whole process once more and if you are still having problems then get in touch with us. -*If you have problems it would look like this.* -![](../../assets/canaryimg/img14.png){width="673" height="463"} - ---- - -**Now that you have set up everything, complete our google form with your name, email, Discord username, Telegram handle and your ContextFree Network wallet address and we will airdrop you some $CTX tokens for you to take part in the upcoming Canary Games.** - -*To participate in the Canary Games, register now with [this form](https://forms.gle/VnjEjj8x8sNxvW4Q9).* diff --git a/docs/canarynet/userguide/token-bridge.md b/docs/canarynet/userguide/token-bridge.md deleted file mode 100644 index e739880f..00000000 --- a/docs/canarynet/userguide/token-bridge.md +++ /dev/null @@ -1,87 +0,0 @@ -# Automata ContextFree Token Bridge Tutorial -## Introduction -A cross-chain bridge is a connection that allows the transfer of tokens from one chain to another. Both chains can have different protocols and rules, but the bridge provides a compatible way to interoperate securely on both sides. -The Automata team has set up a cross-chain token bridge for ContextFree between EVM (**Ropsten testnet**) and Substrate-based chains(**ContextFree canary network**) by adopting one of the currently available solutions [**ChainBridge**](https://github.com/ChainSafe/ChainBridge) built by [**ChainSafe**](https://chainsafe.io/). - -## Tutorial -### Transfer ERC20 Token to Native Token -#### Preparation -- To use the Automata Token Bridge, please ensure your explorer is Chrome and the following is installed: - - [Metamask Wallet Extension](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en) - -- Visit [Automata Token Bridge](https://cf-bridge.ata.network/). - -#### Set Up MetaMask -- Click `Connect with Ethereum Wallet(ERC20 -> Native)`.
-![](../../assets/canaryimg/evm_sub_choose.png){width="673" height="463"}
-- Select `MetaMask`.
-![](../../assets/canaryimg/evm_sub_wallet_select.png){width="673" height="463"}
-- Then you may need may need to enter password to unlock the MetaMask wallet extension if it hasn't been open for a while. -- Connect Metamask to bridge dapp.
-![](../../assets/canaryimg/evm_sub_connect_dapp.png){width="673" height="463"}
-- Change the network in MetaMask to `Ropsten Test Network`.
-![](../../assets/canaryimg/evm_sub_choose_ropsten.png){width="673" height="463"}
-- If you don't see the CTX token showing up in the assets, press `Import tokens`, enter the following specifications and press `Add Custom Token`:
-![](../../assets/canaryimg/bridge_import.png){width="673" height="463"}
- - Token Contract Address: `0x8289b901CAC48EbBB1B5cb0049d1459EA1240EF7` - - Token Symbol: `CTX` - - Token Decimal: `18`
-![](../../assets/canaryimg/bridge_addtoken.png){width="673" height="463"}
-- Then `Import Tokens`, if you already had some CTX token, the balance will be showed. -- Let's go back to the web page for the token bridge, by now it should look like this:
-![](../../assets/canaryimg/evm_sub_before_transfer.png){width="673" height="463"}
- If not you can click `Connect` and repeat the above steps. -#### Use the Bridge App -- Make sure the following fields are correct: - - Home network: `Ethereum Ropsten`. - - Destination Network: `Automata ContextFree`. -- Get some CTX ERC20 token if the balance is 0, please refer [here](./get-test-token.md#get-contextFree-erc20-token-on-ropsten-testnet). -- Make sure you have enough `ETH` on Ropsten Testnet to pay for the BridgeFee and transaction Gas Fee. If not, you can use [Ropsten Ethereum Faucet](https://faucet.ropsten.be/) to get some airdrop. -- Enter the amount of CTX you want to transfer. -- For the Destination Address, make sure that: - - the address starts with `a7`. - - the address is valid by trying [Add Contact](https://dashboard.ata.network/?rpc=wss%3A%2F%2Fcf-api.ata.network#/addresses) on Automata Dashboard. - - **double check the destination address is correct, once your token were sent to a wrong address it can never be claimed back.** -- If everything looks okay, press `Start transfer`, confirm the `Pre-flight check` and press `Start Transfer` again. -- Then a MetaMask notification will be popped up to let you allow the website to spend your CTX token, press `Confirm`. Wait a moment for that transaction to be confirmed.
-![](../../assets/canaryimg/evm_sub_init_transfer.png){width="673" height="463"}
-- Another MetaMask notification will be prompted, which is to send a transaction to trigger the actual cross-chain bridging transfer, press `Confirm`. -- Then you should be able to see this `In Transit`, it usually takes a few minutes to finish the transferring, please be patient.
-![](../../assets/canaryimg/evm_sub_wait_signature.png){width="673" height="463"}
-- Once the transferring has been completed, it will show `Transfer completed`
-![](../../assets/canaryimg/evm_sub_transfer_succ.png){width="673" height="463"}
- -- **Congratulations! You have completed your first cross-chain token transfer on Automata ContextFree!**
- Go check the balance of the destination address on [Automata Dashboard](https://dashboard.ata.network/?rpc=wss%3A%2F%2Fcf-api.ata.network#/accounts). If you can't see it, try `Add contact` in the [Address book](https://dashboard.ata.network/?rpc=wss%3A%2F%2Fcf-api.ata.network#/addresses). - -### Transfer Native Token to ERC20 Token -#### Preparation -- To use the Automata Token Bridge, please ensure your explorer is Chrome and the following is installed: - - [Polkadot{.js} Wallet Extension](https://chrome.google.com/webstore/detail/polkadot{js}-extension/mopnmbcafieddcagagdcbnhejhlodfdd) - -- Visit [Automata Token Bridge](https://cf-bridge.ata.network/). - -#### Set Up Polkadot{.js} -- Click `Connect with Substrate Wallet(Native -> ERC20)`.
-![](../../assets/canaryimg/sub_evm_choose.png){width="673" height="463"}
-- If it's your first time to use ContextFree bridge, you need to allow it to access your wallet.
-![](../../assets/canaryimg/sub_evm_wallet_connect.png){width="673" height="463"}
-- Authorize the application to access the wallet by pressing `Yes, allow this application access` on the popped up Polkadot.js notification. -- If you haven't set up your wallet addresses, please refer [here](./setupwallet.md). - -#### Use the Bridge App -- After connecting you Substrate wallet and setting up your Polkadot.js wallet extension, the Token Bridge App should be like this:
-![](../../assets/canaryimg/sub_evm_before_transfer.png){width="673" height="463"}
-- Click `Select an account`, you should be able to see a list of addresses starting with `a7`, which are ContextFree addresses injected from your Polkadot.js wallet extension.
-![](../../assets/canaryimg/sub_evm_choose_account.png){width="673" height="463"}
-- Select the address you want to transfer native token from, the page now should look like:
-![](../../assets/canaryimg/sub_evm_transfer.png){width="673" height="463"}
-- Make sure the following fields are correct: - - Select account: The address of your native token sender. - - Destination Network: `Ethereum Ropsten`. -- Get some native CTX test token if the balance is 0, please refer [here](./get-test-token.md). -- Make sure you have enough balance to pay for the Bridge Fee and the total amount to transfer. -- Fill in the `Destination Address`, which will be an Ethereum address on Ropsten Test Network starting with `0x`. -- Press `Start transfer`, you will be required to input the password to sign the transaction. -- Wait for your transfer to complete, it may take a few minutes. -- After the webpage showing `Transfer completed`. You can go to [Ethereum Ropsten Explorer](https://ropsten.etherscan.io/) to check the balance of [ContextFree ERC20 Token](https://ropsten.etherscan.io/token/0x8289b901CAC48EbBB1B5cb0049d1459EA1240EF7) of your destination address. \ No newline at end of file diff --git a/docs/conveyor/conveyorv1/automata-conveyor-controller.md b/docs/conveyor/conveyorv1/automata-conveyor-controller.md deleted file mode 100644 index f50a95a6..00000000 --- a/docs/conveyor/conveyorv1/automata-conveyor-controller.md +++ /dev/null @@ -1,201 +0,0 @@ -# Controller - -The prevention of anti-front-running is implemented by requiring that all method calls to the DEX must be only invoked by the Geode. The user submits a request to the Geode by signing the message without spending gas. The Geode later delegates that request to the DEX for a fee that is deducted from the output token. - ---- - -## **`constructor()`** - -```solidity -constructor(address _relayer,address _router,address _factory); -``` - -Initializes the Controller, Uniswap Factory, and Router contracts and assigns a relayer. - -## **`relayers`** - -```solidity -mapping (address => bool) public relayers; -``` - -Key-value pair map that keeps track of the trusted relayers. - -|Parameter|Type| | -|---|---|---| -|key|`address`|Input address| -|value|`bool`|`True`: address is a trusted relayer. `False` : otherwise| - -## **`uniswapV2TrustedPair`** - -```solidity -mapping (address => bool) public uniswapV2TrustedPair; -``` - -Key-value pair map that keeps track of the trusted Uniswap token [pair addresses](https://uniswap.org/docs/v2/smart-contract-integration/getting-pair-addresses/). - -|Parameter|Type| | -|---|---|---| -|key|`address`|Input address| -|value|`bool`|`True`: address is a trusted pair. `False` : otherwise| - -## **`relayerOnly()`** - -```solidity -modifier relayerOnly(); -``` - -Verifies `msg.sender` is a trusted relayer address, otherwise reverts the function call. - -## **`setRelayer()`** - -```solidity -function setRelayer(address _relayer) public onlyOwner() -``` - -Assigns the input address as a trusted relayer, can only be invoked by the contract owner. - -|Parameter|Type| | -|---|---|---| -|_relayer|`address`|Input address| - -## **`isTrustedUniswapV2Pair()`** - -```solidity -function isTrustedUniswapV2Pair(address pair) external override returns (bool); -``` - -Checks the input address to determine whether it is a trusted Uniswap pair address or not, returns `bool`. - -|Parameter|Type| | -|---|---|---| -|pair|`address`|Input address| - -## **`addTrustedUniswapV2Pair()`** - -```solidity -function addTrustedUniswapV2Pair(address pair) public onlyOwner(); -``` - -Adds the input address as a trusted Uniswap pair address, can only be invoked by the contract owner. - -|Parameter|Type| | -|---|---|---| -|pair|`address`|Input address| - -## **`removeTrustedUniswapV2Pair()`** - -```solidity -function removeTrustedUniswapV2Pair(address pair) public onlyOwner(); -``` - -Removes the pair address from the `uniswapV2TrustedPair` map, can only be invoked by the contract owner. - -|Parameter|Type| | -|---|---|---| -|pair|`address`|Input address| - -## **`gTokenTransferFrom()`** - -```solidity -function gTokenTransferFrom( - address asset, - address from, - address to, - uint256 amount -) public relayerOnly(); -``` - -Transfers ERC20 tokens from a sender address to a recipient address, can only be invoked by a relayer. - -|Parameter|Type| | -|---|---|---| -|asset|`address`|The address of the ERC20 token| -|from|`address`|Sender address| -|to|`address`|Recipient address| -|amount|`uint256`|Amount of tokens to be transferred| - -## **`uniswapV2AddLiquidity()`** - -```solidity -function uniswapV2AddLiquidity( - address from, - address tokenA, - address tokenB, - uint256 amountADesired, - uint256 amountBDesired, - uint256 amountAMin, - uint256 amountBMin, - address to, - uint256 deadline, - bool gasIsTokenA -) public relayerOnly(); -``` - -This method initially checks for either token A or B balance (depending on `gasIsTokenA`), to make sure that the user could pay for gas. Then, deducts the token amount, which is transferred to the relayer. - -Supplies the token pair to the Uniswap liquidity pool, can only be invoked by a relayer and input tokens must be both wrapped tokens. Any leftover tokens that are not added to the liquidity pool will be refunded to the sender. - -|Parameter|Type| | -|---|---|---| -|from|`address`|The sender address| -|tokenA|`address`|Wrapped Token A address| -|tokenB|`address`|Wrapped Token B address| -|amountADesired|`uint256`|The amount of A added to the liquidity pool if the B/A price <= (`amountofBDesired` / `amountofADesired`) price| -|amountBDesired|`uint256`|The amount of B added to the liquidity pool if the A/B price <= (`amountofADesired` / `amountofBDesired`) price| -|amountAMin|`uint256`|Bounds the extent to which the B/A price can go up before the transaction reverts. Must be <= `amountADesired`| -|amountBMin|`uint256`|Bounds the extent to which the A/B price can go up before the transaction reverts. Must be <= `amountBDesired`| -|to|`address`|The recipient address of the liquidity token. In this project, it is most likely the sender's address, since they provided liquidity, they should be entitled to getting rewarded with liquidity tokens| -|deadline|`uint256`|Unix timestamp after which the transaction is reverted| -|gasIsTokenA|`bool`|User to pay gas in Token A or Token B| - -## **`uniswapV2SwapExactTokensForTokens()`** - -```solidity -function uniswapV2SwapExactTokensForTokens( - address from, - uint256 amountIn, - uint256 amountOutMin, - address[] calldata path, - address to, - uint256 deadline -) public relayerOnly(); -``` - -This method initially checks for the balance of the input token, to make sure that the user could pay for gas. Then after the swapping of tokens, deducts the **output** token amount, which is transferred to the relayer. - -Swaps an exact amount of input tokens for as much of output tokens as possible, can only be invoked by a relayer. Any leftover tokens that are not swapped will be refunded to the sender. - -|Parameter|Type| | -|---|---|---| -|from|`address`|The sender address| -|amountIn|`uint256`|The amount of input tokens to be sent| -|amountOutMin|`uint256`|The minimum amount of tokens that must be received, otherwise the transaction reverts| -|path|`address[]`|An array of token addresses. `path.length >= 2`| -|to|`address`|Recipient of the output tokens. In this project, it is also the sender's address| -|deadline|`uint256`|Unix timestamp after which the transaction is reverted| - -## **`uniswapV2SwapTokensForExactTokens()`** - -```solidity -function uniswapV2SwapTokensForExactTokens( - address from, - uint256 amountIn, - uint256 amountOutMin, - address[] calldata path, - address to, - uint256 deadline -) public relayerOnly(); -``` - -This method initially checks for the balance of the input token, to make sure that the user could pay for gas. Then after the swapping of tokens, deducts the **output** token amount, which is transferred to the relayer. - -Swaps an amount of input tokens for exact amount of output tokens, can only be invoked by a relayer. Any leftover tokens that are not swapped will be refunded to the sender. - -|Parameter|Type| | -|---|---|---| -|from|`address`|The sender address| -|amountInMax|`uint256`|The minimum amount of tokens that must be sent, otherwise the transaction reverts| -|amountOut|`uint256`|The amount of output tokens to be sents| -|path|`address[]`|An array of token addresses. `path.length >= 2`| -|to|`address`|Recipient of the output tokens. In this project, it is also the sender's address| -|deadline|`uint256`|Unix timestamp after which the transaction is reverted| \ No newline at end of file diff --git a/docs/conveyor/conveyorv1/automata-conveyor-gtoken.md b/docs/conveyor/conveyorv1/automata-conveyor-gtoken.md deleted file mode 100644 index f0d7b53e..00000000 --- a/docs/conveyor/conveyorv1/automata-conveyor-gtoken.md +++ /dev/null @@ -1,112 +0,0 @@ -# gToken - - The goal of gTokens is to achieve front-running resistance on DEXs such as Uniswap. When two different gTokens are swapped, users can rest assured that the swapping transaction will not be attacked by front-running bots or malicious miners. This is achieved by inheriting the ERC20 contract, with modified function methods. Methods such as `transferFrom()` requires that it has to be invoked only from a trusted relayer. - - --- - -## **`constructor()`** - - ```solidity - constructor(address _token, address _controller); - ``` - -Initializes the contract, then wraps the ERC20 token and assigns the `Controller` contract instance. - -| Parameter | Type | | -|-----------|---------|--------------------------------------------------------------| -|_token |`address`| The ERC20 Token Address | -|_controller | `address` | The address of the `Controller` instance | - -## **`onlyController()`** - -```solidity -modifier onlyController(); -``` - -Verifies `msg.sender` is the Controller address. Otherwise, reverts function calls. - -## **`setController()`** - -```solidity -function setController(address _controller) public onlyOwner(); -``` - -Sets the Controller instance, can only be invoked by the contract owner. - -|Parameter|Type| | -|---|---|---| -|_controller|`address`|The address of the Controller instance| - -## **`transferFrom()`** - -```solidity -function transferFrom( - address sender, - address recipient, - uint256 amount -) public override returns (bool); -``` -Transfers gTokens from a given address to the recipient. The sender is always the address of the `Controller`, the transaction is not necessarily originated from the `Controller` contract itself, as long as the origin address is one of the trusted relayers. For the direct call method, see `internalTransferFrom()`. - -|Parameter|Type| | -|---|---|---| -|sender|`address`|The address of a trusted relayer| -|recipient|`address`|The recipient's address, most likely a token pair address. For example, an address returned by Uniswap's `getPair(tokenA, tokenB)`. -|amount|`uint256`|The amount of token to be transferred. - -This method reverts if it is not invoked from a trusted relayer. Otherwise, returns true. - -## **`transfer()`** - -```solidity -function transfer(address recipient, uint256 amount) public override returns (bool); -``` - -Transfers gTokens to a recipient. This method can only be invoked by a trusted token pair. - -|Parameter|Type| | -|---|---|---| -|recipient|`address`|The recipient's address| -|amount|`uint256`|The amount of token to be transferred| - -## **`internalTransferFrom()`** - -```solidity -function internalTransferFrom( - address sender, - address recipient, - uint256 amount -) public onlyController(); -``` - -Transfers gTokens from a given address to the recipient, similar to `transferFrom()`. This method can only be invoked directly from the `Controller` contract. - -|Parameter|Type| | -|---|---|---| -|sender|`address`|The sender's address| -|recipient|`address`|The recipient's address| -|amount|`uint256`|The amount of token to be transferred| - -## **`deposit()`** - -```solidity -function deposit(uint256 amount) public; -``` - -Wraps ERC20 token to a gToken. The gToken smart contract stores an amount of ERC20 token as a reserve and mints the same amount of wrapped ERC20 token. - -|Parameter|Type| | -|---|---|---| -|amount|`uint256`|The amount of token to be transferred| - -## **`withdraw()`** - -```solidity -function withdraw(uint256 amount) public; -``` - -Withdraws ERC20 token from the smart contract and burns the wrapped token. - -|Parameter|Type| | -|---|---|---| -|amount|`uint256`|The amount of token to be transferred| \ No newline at end of file diff --git a/docs/conveyor/conveyorv1/automata-conveyor-overview.md b/docs/conveyor/conveyorv1/automata-conveyor-overview.md deleted file mode 100644 index fbfe629c..00000000 --- a/docs/conveyor/conveyorv1/automata-conveyor-overview.md +++ /dev/null @@ -1,29 +0,0 @@ -# Overview - -Automata Conveyor is an anti-front-running service that ingests and outputs transactions in a determined order. - ---- - -Automata Conveyor currently has the following components: - -- **gToken smart contract**: inherits the ERC20 contract with modified function methods that must be invoked by trusted Geode-provided addresses. - -- **Controller smart contract**: interacts with the users and facilitates the transfer of gTokens. External calls to any functions in the contract from any addresses other than the trusted relayers will be reverted. - -- **Automata Conciliator**: TBA - -The following is an overview of the architecture. - -![Protocol-overview](/assets/conveyorv1/conveyor-protocol-flowchart.svg) - -!!! Note - The Geode is an on-chain computation resource provided by the Automata network. - - ---- - -# Smart Contract Call Graph - -The following call graph details the interaction among smart contracts. - -![Call-graph](/assets/conveyorv1/conveyor-call-diagram.svg) diff --git a/docs/conveyor/conveyorv1/fee-contract.md b/docs/conveyor/conveyorv1/fee-contract.md deleted file mode 100644 index 1924a67b..00000000 --- a/docs/conveyor/conveyorv1/fee-contract.md +++ /dev/null @@ -1,117 +0,0 @@ -# `Fee.sol` - -The contract fetches real-time price feed from Chainlink Oracles and converts the gas fee amount to an equivalent token price. - ---- - -## **`admin`** - -```solidity -mapping(address => bool) admins; -``` -Key-value pair map that keeps track of the contract admin. - -|Parameter|Type| | -|---|---|---| -|key|`address`|input addresses| -|value|`bool`|`True:` the address is an admin, `False:` otherwise| - -## **`priceContracts`** - -```solidity -mapping(bytes => address) public priceContracts; -``` -Key-value pair map that stores the address of a Chainlink pricefeed oracle contract. - -|Parameter|Type| | -|---|---|---| -|key|`bytes`|The input price feed index, with the format: `--eth`. For example, to query the USDC/ETH price from the Mainnet, enter `main-usdc-eth`| -|value|`address`|The Chainlink oracle address| - -## **`tokensMap`** - -```solidity -mapping(address => bytes) public tokensMap; -``` -Key-value pair mapping tokens to their contract addresses. - -|Parameter|Type| | -|---|---|---| -|key|`address`|The ERC20 token address -|value|`bytes`|The input price feed index, as defined in `priceContracts`| - -## **`constructor()`** - -```solidity -constructor() public; -``` -Assigns the deployer as a default admin, and pre-assigns the following price feed: - -- `main-usdc-eth` -- `main-uni-eth` -- `kovan-usdc-eth` - -## **`onlyAdmin()`** - -```solidity -modifier onlyAdmin(); -``` -Verifies `msg.sender` is a contract admin. - -## **`modifyAdmin()`** - -```solidity -function modifyAdmin(address input, bool isAdmin) public onlyAdmin(); -``` -Adds or removes admin privilege to or from the input address. - -|Parameter|Type| | -|---|---|---| -|input|`address`|The input address to be given or revoked admin privilege| -|isAdmin|`bool`|`true`: assigns admin, `false`: revokes admin| - -## **`addPriceFeed()`** - -```solidity -function addPriceFeed( - string memory priceIndex, - address feed, - address token -) public onlyAdmin(); -``` -Adds a new price feed, then maps to the token address. It can only be invoked by an admin. -To find more oracle addresses, check out the Chainlink [docs](https://docs.chain.link/docs/reference-contracts/). - -|Parameter|Type| | -|---|---|---| -|priceIndex|`string`|The input price feed index, as defined in `priceContracts`| -|feed|`address`|The address of the Chainlink price feed| -|token|`address`|The ERC20 token address| - -## **`gasPrice()`** - -```solidity -function getPrice(address token) public view returns (int256); -``` -Gets the real time price data from Chainlink in 18 decimals. - -|Parameter|Type| | -|---|---|---| -|token|`address`|The ERC20 Token address| - -## **`calculateGasInTokens()`** - -```solidity -function calculateGasInTokens( - address token, - uint256 gas, - uint256 weiPerToken -) public view returns (uint256) -``` -Returns the amount of tokens equivalent to the gas fee. - -|Parameter|Type| | -|---|---|---| -|token|`address`|The ERC20 token address| -|gas|`uint256`|The gas fee| -|weiPerToken|`uint256`|The Wei amount per token| \ No newline at end of file diff --git a/docs/conveyor/conveyorv1/fee.md b/docs/conveyor/conveyorv1/fee.md deleted file mode 100644 index 7cf3cd73..00000000 --- a/docs/conveyor/conveyorv1/fee.md +++ /dev/null @@ -1,92 +0,0 @@ -# Fee System - -## Overview: - -1) The user submits a request to the Geode to perform a transaction. For example, swapping 100 gUSDC for 100 gDAI. `swapExactTokensForTokens()` - -**Transitioning to Step 2:** -The Geode verifies that the amount of input token (USDC) is sufficient to pay for gas. The Geode can do this by simply calling the `getPrice()` method from `Fee.sol` to get USDC/ETH price in 18 decimals. For example, 1 USDC = 0.000361 ETH would yield 361000000000000. - -After Geode confirmed the user meets the minimum fee requirement, see step 2. - -2) The Geode estimates the gas limit and the gas price. The `Controller` would capture this information to perform another input token check on step 3. - -3) After the `Controller` finalizes the gas fee check, the `Controller` sends the transaction to `UniswapRouter02` to perform the swap. The Geode would pay the gas fee "out of pocket" here, to be reimbursed later on step 4. Then, calculates the actual amount of gas consumption at this point. - -4) Let's say the **fast** gas price is 49 gWei, with an average gas limit of 200,000 to perform a swap, the total gas fee (at the time of writing this) is 0.0098 ETH. The `Controller` then automatically allocates 25.48 gDAI to reimburse the Geode (or locks it in the contract itself). The user gets the remaining 74.52 gDAI. - -## Price Feed oracles that are available on Chainlink - -Click [here](https://docs.chain.link/docs/reference-contracts/) to find the oracle addresses for the following exchange rates. - -### Ethereum Mainnet - -- 1INCH / ETH -- AAVE / ETH -- ALPHA / ETH -- AMPL / ETH -- ANT / ETH -- BADGER / ETH -- BAL / ETH -- BAND / ETH -- BAT / ETH -- BNB / ETH -- BNT / ETH -- BTC / ETH -- BUSD / ETH -- BZRX / ETH -- CEL / ETH -- COMP / ETH -- COVER / ETH -- CREAM / ETH -- CRO / ETH -- CRV / ETH -- DAI / ETH -- DPI / ETH -- ENJ / ETH -- FIL / ETH -- FTM / ETH -- FTT / ETH -- GRT / ETH -- HEGIC / ETH -- HUSD / ETH -- KNC / ETH -- KP3R / ETH -- LINK / ETH -- LON / ETH -- LRC / ETH -- MANA / ETH -- MKR / ETH -- MLN / ETH -- MTA / ETH -- NMR / ETH -- OCEAN / ETH -- OGN / ETH -- OMG / ETH -- ORN / ETH -- PAX / ETH -- PAXG / ETH -- PERP / ETH -- RAI / ETH -- RARI / ETH -- REN / ETH -- REP / ETH -- RGT / ETH -- RLC / ETH -- RUNE / ETH -- SFI / ETH -- SNX / ETH -- SRM / ETH -- SUSD / ETH -- SUSHI / ETH -- TUSD / ETH -- UMA / ETH -- UNI / ETH -- USDC / ETH -- USDT / ETH -- UST / ETH -- WNXM / ETH -- WOM / ETH -- YFI / ETH -- YFII / ETH -- ZRX / ETH diff --git a/docs/conveyor/conveyorv2/design.md b/docs/conveyor/conveyorv2/design.md deleted file mode 100644 index 2a6d885c..00000000 --- a/docs/conveyor/conveyorv2/design.md +++ /dev/null @@ -1,156 +0,0 @@ -# ConveyorV2 Design - -## Summary - -ConveyorV2 is an upgrade of Automata's ConveyorV1 to support a better user -experience. -Tokens that are traded in the ConveyorV2 liquidity pools enjoy the MEV protection and transaction ordering enforcement capabilities without the need to wrap existing ERC20 tokens into gTokens. - -Similar with ConveyorV1 (formerly known as GTokens), users must sign an EIP712 message to authorize Geode to submit a transaction on the user's behalf. Users would still enjoy the benefit of gasless trading, meaning they are not required to hold native tokens like MATIC or BNB to pay for gas. -However, users are subjected to pay a service fee with an acceptable form of ERC20 tokens, such as DAI, USDC or ATA tokens. - -## Codebase - -The ConveyorV2 smart contracts are a fork of UniswapV2. To learn more about the DEX protocol, read the UniswapV2 [docs](https://docs.uniswap.org/protocol/V2/introduction). - -There are certain modifications applied to the contracts. Check out the next section for details. - ---- - -## Comparison between the UniswapV2 Protocol and ConveyorV2 - -This section highlights the modification that has been applied to the DEX protocol contracts. - -### ConveyorV2Pair - - - The addition of the `onlyRouter()` modifier. This modifier guards the `mint()`, `burn()` and `swap()` methods, such that it is made callable by the Router contract only. This modifier is the most viable for enforcing MEV protection, because it prevents any other addresses from bypassing our relayers to perform sandwich attacks. - -### ConveyorV2Factory - - - The `router()` address variable, the `ConveyorV2Pair` contract uses this value to match with the caller address. If the caller address does not match with `router()`, then the pair contract rejects the transaction. Using this approach also allows the "upgradeability" of the router. After the deployment of a newer version of the Router contract, the owner of the DEX can invoke the `setRouter()` method to map it to the new router address. At this point, all existing pair contracts would only accept function calls from the new Router contract. - -### ConveyorV2Router01 - - - The ConveyorV2 router introduces the ability for gasless trading. The user signs the EIP712 message, which is then submitted to the trusted relayer. The trusted relayer then executes the `executeMetaTx()` method, and pays gas on the user's behalf. After completion of execution, the Forwarder contract collects a service fee from the user to compensate for gas. Check out the `ERC20Forwarder` section to learn more about the Forwarder contract. - - - In an unlikely event when the relayer service is not available, the protocol owner can disable the meta-transaction functionality by invoking the `metaSwitch()` method to toggle the `metaOnly` modifier. This would allow users to directly interact with the router contract as a temporary workaround for such an extenuating circumstance. - ---- - -## ERC20 Forwarder - -The gas forwarder contract enables meta-transaction executions, which allows gas relayers to be compensated for the gas payment with ERC20 tokens. The gas forwarder contract has the ability to calculate a better estimation of the actual gas usage, including transactions that are being reverted. This way, the relayers are only compensated for the equivalent amount of ERC20 token in gas usage. - -![erc20-forwarder.png](/assets/conveyorv2/forwarder_flow.png) - -### **`constructor()`** - -Initializes the contract and assigns `msg.sender` as the default `feeHolder`. The `feeHolder` is the recipient of the ERC20 fee payment. - -### **`setConstantFee()`** - -```solidity -function setConstantFee(uint256 _newConstantFee) public onlyOwner -``` - -Updates the `constantFee` value, defaults at 21000. Requires `owner()` privilege. - -|Parameter|Type| | -|---|---|---| -| _newConstantFee | `uint256` | constant gas limit value | - -### **`setTransferFee()`** - -```solidity -function setTransferFee(uint256 _newTransferFee) public onlyOwner -``` - -Updates the ERC20 transfer gas limit, the `transferFee` value, defaults at 65000. Requires `owner()` privilege. - -|Parameter|Type| | -|---|---|---| -| _newTransfeFee | `uint256` | ERC20 transfer limit value | - -### **`setRelayer()`** - -```solidity -function setRelayer(address _relayer, bool _trusted) public onlyOwner -``` - -Assigns or revokes relayer role. Requires `owner()` privilege. - -|Parameter|Type| | -|---|---|---| -| _relayer | `address` | Relayer address | -| _trusted | `bool` | True: grant authorization; false: revoke authorization | - -### **`setFeeHolder()`** - -```solidity -function setFeeHolder(address _feeHolder) public onlyOwner -``` - -Transfers `feeHolder` role over to the input address. Requires `owner()` privilege. - -|Parameter|Type| | -|---|---|---| -| _feeHolder | `address` | Fee holder address | - -### **`MetaTransaction`** - -```solidity -struct MetaTransaction { - address from; - address feeToken; - uint256 maxTokenAmount; - uint256 deadline; - uint256 nonce; - bytes data; - bytes32 hashedPayload; -} -``` - -|Parameter|Type| | -|---|---|---| -| from | `address` | the user's address | -| feeToken | `address` | The address of the ERC20 fee token | -| maxAmountToken | `uint256` | The maximum amount of fee tokens that the users are willing to pay for the meta-tx | -| deadline | `uint256` | Meta-transactions that are executed past the deadline will be reverted | -| nonce | `uint256` | Replay protection | -| data | `bytes` | The encoded function data that is to be executed | -| hashedPayload | `bytes32` | EIP712-compliant hash struct | - -### **`executeMetaTx()`** - -```solidity -function executeMetaTx(MetaTransaction memory metatx, string memory domainName, uint256 tokenPricePerNativeToken, uint256 feeOffset, SIGNATURE_TYPE memory sig) public relayerOnly -``` - -This function executes the encoded function data, as defined in `MetaTransaction.data`. It calculates the amount of gas consumption within the enveloped function call and charges the user the fee amount that is based on the token/ETH price `tokenPricePerNativeToken`. This value is given by the Geode, calculated by an aggregation of token prices fetched from multiple sources. There are certain situations that could cause the transaction to revert, which the relayers will not be compensated for gas fee. The point of reverts are: - -- Insufficient fee token balance -- Insufficient `maxAmountToken` -- Invalid EIP 712 signature -- Out of gas error - -|Parameter|Type| | -|---|---|---| -| metatx | `MetaTransaction` | The meta-transaction body | -| domainName | `string` | The EIP712 domain name | -| tokenPricePerNativeToken | `uint256` | ERC20 token price per ETH | -| feeOffset | `uint256` | An additional amount of token to be taken into consideration when verifying the user's balance | -| sig | `SIGNATURE_TYPR` | The user's EIP712 signature | - -### **`MetaStatus`** - -```solidity -event MetaStatus(address sender, bool success, string error) -``` - -The `executeMetaTx` logs the event to indicate the status of the meta-tx. Execution failure within the meta-tx will not cause the function to revert. To view the error logs of a meta transaction, the client can simply listen for the `error` message emitted by this event. - -|Parameter|Type| | -|---|---|---| -| sender | `address` | user address | -| success | `bool` | status of the meta-tx | -| error | `string` | reason of a reverted meta-tx | diff --git a/docs/conveyor/overview.md b/docs/conveyor/overview.md deleted file mode 100644 index c1130015..00000000 --- a/docs/conveyor/overview.md +++ /dev/null @@ -1,14 +0,0 @@ -## Overview - -![](../assets/conveyor_updated.png){style="zoom:80%"} - -Automata Conveyor is a MEV Minimization solution that enforces fair ordering of transactions. The front-running-free-zone that ensures users are not disavantaged by overpaying on their transactions. - -Because blockchains are written by consensus and the content of each block is chosen by block producers - miners in PoW and validators in PoS systems - there is room and frankly, great incentive, for them to profit by front-running, back-running, sandwiching and generally exploiting transactions in their block. This is what is referred to as Maximal Extractable Value (MEV). - -## How it works - -When transactions are fed into Conveyor, the service ingest and outputs incoming transactions by a FIFO order. This means block producers cannot: - -- Inject new transactions into the Conveyor output. Any inserted transactions bypassing Conveyor is detectable by anyone because of signature mismatch. -- Delete ordered transactions. Transactions accepted by Conveyor are broadcasted throughout the network so transactions cannot be deleted unless all block producers are colluding and censoring the transactions at the same time. diff --git a/docs/index.md b/docs/index.md index a26ef867..3c66d8f0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,10 +1,16 @@ # Automata Network -Automata Network is the privacy middleware layer building for a fair Web3. Its core suite of products include [1RPC](https://www.1rpc.io), [2FA Guru](https://2fa.guru), [NFTFair](https://nftfair.app), [AnyDAO](https://anydao.app) and [XATA](https://xata.fi) to address perennial issues of exploitation on the blockchain without compromising on security. +Welcome to Automata Network’s Documentation! Automata Network is the privacy middleware layer building to protect fairness & privacy in Web3. Its core suite of products include: + +* [1RPC](https://www.1rpc.io) +* [NFTFair](https://nftfair.app) +* [2FA Guru](https://2fa.guru) +* [Carrier](https://carrier.so) + Some of our key features: -- Do-not-track privacy -- Native integration +- No tracking privacy +- Native integration supporting multichain integration - Universal compatibility Our [Medium](https://medium.com/atanetwork) is a great introduction to our vision and work. @@ -35,11 +41,10 @@ If you're interested in developing with or on Automata Network, view our develop Browse through any of our user guides below to get started: -* [XATA](./xata/introduction.md) +* [1RPC](./1rpc/introduction.md) * [NFTFair](./nftfair/users/activities.md) -* [AnyDAO](./anydao/guide.md) * [2FA Guru](./2fa/users/guide.md) -* [1RPC](./1rpc/introduction.md) +* [MEV Wiki](./mev/users/introcution.md) ## Helpful links diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css new file mode 100644 index 00000000..92baa1c9 --- /dev/null +++ b/docs/stylesheets/extra.css @@ -0,0 +1,38 @@ +.md-nav { + font-size: 0.9rem; + line-height: 1.5; +} + +.md-tabs__item { + font-weight: bold; +} + +:root { + --md-primary-fg-color: #e74c3c; + --md-primary-fg-color--light: #e74c3c; + --md-primary-fg-color--dark: #e74c3c; + --md-default-bg-color--light: #e0e0e0; + --md-default-bg-color--dark: #191919; +} + +.md-typeset .admonition.tip { + border-color: #e74c3c; +} + +.md-typeset .tip>.admonition-title:before { + background-color: #e74c3c; +} + +/* .md-sidebar, .md-sidebar__scrollwrap, .md-sidebar--primary { + background-color: rgb(246, 246, 246); +} + +.md-nav--lifted>.md-nav__list>.md-nav__item--active>.md-nav__link { + background-color: rgb(246, 246, 246); +} */ + + +.md-content__inner>:last-child { + float: right; + margin-bottom: 1rem; +} \ No newline at end of file diff --git a/docs/witness/api.md b/docs/witness/api.md deleted file mode 100644 index 41cace78..00000000 --- a/docs/witness/api.md +++ /dev/null @@ -1,233 +0,0 @@ -# Witness API - -[JSON-RPC](https://en.wikipedia.org/wiki/JSON-RPC) is a remote procedure call protocol encoded in JSON. You can use this API to send queries to our Geode instance for Witness. - -## Available Endpoints - -| Provider(s) | URL(s) | -|:--------:|:------:| -| Witness Geode Mainnet | [https://witness-geode-mainnet.ata.network:3350](https://witness-geode-mainnet.ata.network:3350){target=_blank} | - -## JSON-RPC Methods - -### geode_witness_vote - -Submits a signed Vote message in EIP712 format. - -#### Endpoint - -`https://witness-geode-mainnet.ata.network:3350/v0/geode_witness_vote` - -#### Return Code - -Returns an integer representing the status of the operation. - -| Return Code | Description | -|:-----------:|:-------------------:| -| 0 | Success | -| 1 | SignatureFailure | -| 2 | ProposalNotActive | -| 3 | AlreadyVote | -| 4 | MissingWorkspace | -| 5 | IncorrectChainId | -| 6 | InternalError | -| 7 | WorkspaceDataError | -| 8 | ChainError | -| 9 | InsufficientBalance | - -The function takes in a signed vote in EIP712 format. - -#### Data Format - -##### Request Format - -```json -{ - "id": 0, - "jsonrpc": "2.0", - "method": "geode_witness_vote", - "params": { - "vote": SignedEIP712Vote - } -} -``` - -##### *SignedEIP712Vote* Format - -```json -{ - "msg": EIP712Vote, - "v": U256, - "r": H256, - "s": H256, -} -``` -``` javascript -{ - type: "object", - properties: { - msg: {type: "object"}, - v: {type: "string"}, - r: {type: "string"}, - s: {type: "string"} - }, - required: ["msg", "v", "r", "s"] -} -``` - -##### *EIP712Vote* Format - -```json -{ - "types": { - "EIP712Domain": EIP712DomainType, - "Vote": VoteType, - }, - "domain": EIP712DomainData, - "primaryType": String, - "message": Vote, -} -``` -```javascript -{ - type: "object", - properties: { - types: { - type: "object", - properties: { - EIP712Domain: { - type: "array", - items: { - name: "string", - type: "string" - }, - minItems: 4, - maxItems: 4 - }, - Vote: { - type: "array", - items: { - name: "string", - type: "string" - }, - minItems: 4, - maxItems: 4 - }, - }, - required: ["EIP712Domain", "Vote"] - }, - domain: { - type: "object", - properties: { - name: "string", - version: "string", - chainId: "string", - verifyingContract: "string" - }, - required: ["name", "version", "chainId", "verifyingContract"] - }, - primaryType: {type: "string"}, - message: {type: "object"} - }, - required: ["types", "domain", "primaryType", "message"] -} -``` - -##### *Vote* Format - -```javascript -{ - type: "object", - properties: { - voter: "string", - proposal: "string", - option: "number", - timestamp: "number" - }, - required: ["voter", "primaryType", "domain", "message"] -} -``` - -#### Sample JSON-RPC Request - -```json -{ - "jsonrpc":"2.0", - "method":"geode_witness_vote", - "params":{ - "vote":{ - "msg":{ - "types":{ - "EIP712Domain":[ - { - "name":"name", - "type":"string" - }, - { - "name":"version", - "type":"string" - }, - { - "name":"chainId", - "type":"uint256" - }, - { - "name":"verifyingContract", - "type":"address" - } - ], - "Vote":[ - { - "name":"voter", - "type":"uint256" - }, - { - "name":"proposal", - "type":"uint256" - }, - { - "name":"option", - "type":"uint32" - }, - { - "name":"timestamp", - "type":"uint64" - } - ] - }, - "domain":{ - "name":"Witness", - "version":"0.1.0", - "chainId":"42", - "verifyingContract":"0xdEB55768F6D1a3E6771A4096531aD6ea258A925e" - }, - "primaryType":"Vote", - "message":{ - "voter":"0x0000000000000000000000007ef99b0e5beb8ae42dbf126b40b87410a440a32a", - "proposal":"0x10002c", - "option":2, - "timestamp":1617188809 - } - }, - "v":28, - "r":"0x491b2a733067508f789bb4d180329b1fd9327d79a8135997eada08b3217cbb72", - "s":"0x4e48960bef350ea161c997c3c2e881329de0d09d4fddb5781c6719308cc6b260" - } - }, - "id":73 -} -``` - -#### Sample Response - -```json -{ - "jsonrpc":"2.0", - "result":0, - "id":73 -} -``` - -#### Metamask Support - -You can use Metamask for signing and sending the message by refering here: [Sign-Typed-Data-v4](https://docs.metamask.io/guide/signing-data.html#sign-typed-data-v4). diff --git a/docs/witness/introduction-bak.md b/docs/witness/introduction-bak.md deleted file mode 100644 index 91c65901..00000000 --- a/docs/witness/introduction-bak.md +++ /dev/null @@ -1,54 +0,0 @@ -## Overview - -![](../assets/witness_updated.png){style="zoom:80%"} - -The concept of community takes on tangible form and value as blockchain gains velocity. People with real financial stake change not only the proverbial status quo, but also foster new economies and polities in the image of Web3. With so many going about to decide the future of some of the biggest and most impactful decentralized projects, we thought about the experience we wanted communities to have, and how we could value-add to that journey. - -[Witness](https://witness.ata.network) was the result. A privacy-first, off-chance governance solution with on-chain execution. - -## Features - -- Privacy -
Users can select and change different privacy settings, which allows for specific results to be displayed. Public: Voter address, number of votes. Medium: Number of votes. Private: Only the overall result is shown. -- Gasless -
Off-chain voting is gas-free. Users do not have to grapple with prohibitive gas fees to create proposals and vote on them. -- On-chain execution -
Chainhook enables calling of the on-chain contract registered at proposal creation. -- Multi-chain support -
Witness currently supports ERC20 on Ethereum, with other [EVM-based chains](https://chainlist.org/) and [Substrate-based chains](https://polkaproject.com/#/projects?cateID=1&tagID=0) in the pipeline. -- Modular -
Each function can be used standalone or together. It is entirely possible for a project to use Witness solely as a signaling tool. - -## Platforms - -Witness currently supports the following networks: - -- Ethereum (Mainnet, Kovan Testnet) -- Binance Smart Chain (Mainnet, Testnet) -- Plasm Network (Dusty Testnet) -- Clover Finance (Testnet) -- Darwinia (Pangolin Testnet) -- Moonbase (Alpha Testnet) -- Polygon (Matic Mainnet) -- Avalanche (Mainnet) -- HECO (Mainnet, Testnet) - -## Support - -| Platform | Private Voting | Chainhook | Public Voting | -|:---------------------------:|:------------------:|:------------------:|:------------------:| -| Ethereum Mainnet | :white_check_mark: | :construction: | :white_check_mark: | -| Ethereum Kovan Testnet | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Binance Smart Chain Mainnet | :white_check_mark: | :construction: | :white_check_mark: | -| Binance Smart Chain Testnet | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| Plasm Network Dusty Testnet | :white_check_mark: | :construction: | :white_check_mark: | -| Clover Finance Testnet | :white_check_mark: | :construction: | :white_check_mark: | -| Darwinia Pangolin Testnet | :white_check_mark: | :construction: | :white_check_mark: | -| Moonbase Alpha Testnet | :white_check_mark: | :construction: | :white_check_mark: | -| Polygon | :white_check_mark: | :construction: | :white_check_mark: | -| Avalanche | :white_check_mark: | :construction: | :white_check_mark: | -| HECO Mainnet | :white_check_mark: | :construction: | :white_check_mark: | -| HECO Testnet | :white_check_mark: | :construction: | :white_check_mark: | - -[evm-chains]: https://chainlist.org/ -[substrate-chains]: https://polkaproject.com/#/projects?cateID=1&tagID=0 diff --git a/docs/witness/introduction.md b/docs/witness/introduction.md deleted file mode 100644 index dbd162c4..00000000 --- a/docs/witness/introduction.md +++ /dev/null @@ -1,3 +0,0 @@ -## Introduction -!!! note - Please note: Currently, Witness has been upgraded to Anydao, please refer to [here](../anydao/introduction.md) to know more about Anydao. \ No newline at end of file diff --git a/docs/witness/user-guide-bak.md b/docs/witness/user-guide-bak.md deleted file mode 100644 index b97e9295..00000000 --- a/docs/witness/user-guide-bak.md +++ /dev/null @@ -1,255 +0,0 @@ -# Getting started - - - -## For Users - -- Connect to the corresponding network -- Search for the project in the Search bar -- Cast your vote for an active proposal - -!!! Attention - - Before voting, make sure that: - - - Your MetaMask wallet is connected to the correct network. Read more about the blockchains we support [here](#supported-chain-info) - [here](#supported-chain-info) and follow these [instructions](#adding-the-automata-network-testnet) to add them to your wallet. - - Your account has the necessary number of ERC20/BEP20 tokens to qualify for the vote as specified by the block height in the snapshot. - -![](../assets/choosenetwork.png){width="673" height="463"} -![](../assets/voteproposal_2.png){width="673" height="463"} -![](../assets/blocksnapshot.png){width="673" height="463"} - -!!! Note - - Find out how to obtain testnet tokens [here](#getting-tokens). - -Results will be displayed after voting ends. - -Private proposals: Only the final outcome is shown. - -![](../assets/result_private.png){width="673" height="463"} - -Medium proposals: Number of votes for each option will be shown. - -![](../assets/result_medium.png){width="673" height="463"} - -Public proposals: Voter information can be viewed by the public. - -![](../assets/result_public.png){width="673" height="463} - -## For Project Owners - -There are a number of roles assigned with different levels of control. Project owners can create a workspace for hosting proposals. Project teams or community members are able to create proposals. Currently, the metadata is stored on the [testnet](https://d.ata.network) of Automata Network. Connect to the testnet to create workspaces or propsals. - -### Adding the Automata Network testnet - -Add the Automata Network to your existing network using the following details: - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Automata Network | -| **New RPC URL** | https://rpcv3.ata.network/ | -| **Chain ID** | 86 | -| **Currency Symbol** | ATA | - -Alternatively, add a new network by navigating to: - -* **Profile Picture >> Settings >> Networks >> Add Network** - -or: - -* **Network name >> Custom RPC** - -![](../assets/addingautomata_m.gif){width="673" height="463"} - -### Connecting Your Metamask Wallet - -If the **Connect wallet** button continues to show up, you are **not connected**. - -![](../assets/check1_2.png){width="673" height="463"} -![](../assets/check2_2.png){width="673" height="463"} - -Follow these steps to connect your wallet: - -- Click on **Connect wallet** at the top right corner -- Click on **MetaMask** -- Select the account you wish to connect with MetaMask -- Connect your account - -![](../assets/connecting_m_2.gif){width="673" height="463"} - -### Creating a workspace - -Create a workspace from the landing [page](https://witness.ata.network/). - -!!! Tips - - Before creating a workspace for your token, ensure that: - - - **Your MetaMask wallet is connected to Automata Network** - - **Your account holds the necessary ATA tokens** - - Jump ahead to [Getting tokens](#getting-tokens) for a detailed guide. - -Begin by: - -- Clicking on **Create** -- Choose the correct blockchain network for your workspace -- Fill in your workspace name -- Fill in your workspace specifications -- Enter your token contract hash -- Click on **Create** - -![](../assets/creatingworkspace_m_2.gif){width="673" height="463"} - -### Creating a new proposal - -Head over to the [workspace](#creating-a-workspace) to create a proposal. - -![](../assets/creatingproposal_2.png){width="673" height="463"} - -!!! Tips - - Before creating a proposal, ensure that: - - - **Your MetaMask wallet is connected to Automata Network** - - **Your account contains the necessary ATA tokens** - - Jump ahead to [Getting tokens](#getting-tokens) for a detailed guide. - -Begin by: - -- Clicking on **New Proposal** -- Fill in your proposal title -- Fill in content for your proposal -- Add / Edit / Remove your voting options -- Select the start and end date -- Click on **Publish** - -![](../assets/creatingproposal_m_2.gif){width="673" height="463"} - -## Chainhook - -This feature enables calling of the on-chain contract registered at proposal creation, across our list of supported [networks](../introduction/#feature-support). - -Each voting option can be followed with a chainhook. Or, create a chainhook by: - -- Clicking on **Add Chainhook** followed by the option field -- Choose the smart contract language for your Chainhook -- Fill in the contract address where your Chainhook will take effect -- Fill in the function name -- Add arguments for your callback function - - Each argument is paired with the type and the value field - - Currently only `uint256, uint256[], address, address[]` are supported as argument types - - Follow the example for input value by hovering above the value field - -![](../assets/addchainhook.gif){width="673" height="463"} - -## Appendix - -### Setting up MetaMask - -[MetaMask](https://metamask.io/) is a cryptocurrency wallet used to interact with the Ethereum blockchain. Install the extension via the official download page [here](https://metamask.io/download.html), or simply add the extension for your browser using the links below: - -- [Chrome](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en) -- [Firefox](https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/) -- [Brave](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en) -- [Edge](https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm?hl=en-US) - -### Getting tokens -#### Getting ERC20 tokens (Ethereum Kovan Network) - -- Get tokens from Automata's [faucet](https://faucet.ata.network). -- Copy the address of your account in MetaMask by clicking on **'Copy to Clipboard'** -- Paste the address into the input field for your desired token. -- Click **Submit**. - -![](../assets/gettingtoken1_m.gif){width="673" height="463"} - -When receiving ERC-20 tokens, the relevant contract hash can be found next to the network name "Ethereum Kovan Network". This information can be copied by clicking on the **Copy** button. - -![](../assets/gettingtoken2_m.gif){width="673" height="463"} - -#### Getting BEP20 tokens in the Binance Smart Chain test network -- To get tokens in the BSC test network, search for the contract address using . -- Use the faucet or to receive tokens. - -### Supported Chain Info - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | BSC mainnet | -| **New RPC URL** | https://bsc-dataseed1.defibit.io/ | -| **Chain ID** | 56 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | BSC testnet | -| **New RPC URL** | https://data-seed-prebsc-1-s1.binance.org:8545/ | -| **Chain ID** | 97 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Plasm Dusty testnet | -| **New RPC URL** | https://rpc.dusty.plasmnet.io:8545/ | -| **Chain ID** | 80 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Clover testnet | -| **New RPC URL** | https://rpc.clover.finance/ | -| **Chain ID** | 1023 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Dawinia Pangolin testnet | -| **New RPC URL** | https://pangolin-rpc.darwinia.network/ | -| **Chain ID** | 43 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Moonbase Alpha testnet | -| **New RPC URL** | https://rpc.testnet.moonbeam.network/ | -| **Chain ID** | 1287 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Polygon | -| **New RPC URL** | https://rpc-mainnet.matic.network | -| **Chain ID** | 137 | - -| Field | Value | -|:-------------------:|:------------------------:| -| **Network Name** | Avalanche | -| **New RPC URL** | https://api.avax.network/ext/bc/C/rpc | -| **Chain ID** | 43114 | - -- Ethereum Mainnet and Kovan Testnet are not listed here since they are supported by Metamask by deafult. - -### Get supported by Witness - -We are happy to onboard more EVM networks onto Witness. Please provide the following details for us to get started with the integration: - -- Chain ID -- JSON-RPC URL -- Blockchain Explorer URL (optional) -- Faucet (for testnet) diff --git a/docs/witness/user-guide.md b/docs/witness/user-guide.md deleted file mode 100644 index dbd162c4..00000000 --- a/docs/witness/user-guide.md +++ /dev/null @@ -1,3 +0,0 @@ -## Introduction -!!! note - Please note: Currently, Witness has been upgraded to Anydao, please refer to [here](../anydao/introduction.md) to know more about Anydao. \ No newline at end of file diff --git a/docs/xata/faq.md b/docs/xata/faq.md deleted file mode 100644 index 41354532..00000000 --- a/docs/xata/faq.md +++ /dev/null @@ -1,25 +0,0 @@ -# FAQ -Frequently asked questions. - -* **Will there be a XATA token?** - - There are no plans to launch a XATA token at the moment. Please do not engage in any form of trade or liquidity farming with any XATA token out there in the wild. - -* **Are there any risks in providing liquidity to a liquidity pool such as ATA/USDT?** - - Yes. All liquidity farming activities are subjected to the risk of impermanent loss. We suggest doing your own calculations as to whether yield farming and earning LP fees are more profitable than holding ATA to decide on the best course of action. - - More information on impermanent loss can be found in this article: - [https://academy.binance.com/en/articles/impermanent-loss-explained](https://academy.binance.com/en/articles/impermanent-loss-explained) - -* **How do I connect on my mobile browser?** - - Select Wallet Connect, which will generate a QR code. Use the mobile Metamask app to scan the QR code to approve transactions on your mobile browser. - -* **Why was my transaction rejected?** - - There are many possible reasons. One of the most common is that users have insufficient tokens or propose too low a transaction fee. Periods of network congestion can also result in rejected transactions. If there's urgency to access a particular network, consider using other RPCs for each of these chains based on the articles below: - -**BSC RPCs:** [https://docs.binance.org/smart-chain/developer/rpc.html](https://docs.binance.org/smart-chain/developer/rpc.html) - -**Polygon Aggregator RPC:** [https://blog.polygon.technology/polygon-rpc-gateway-will-provide-a-free-high-performance-connection-to-the-polygon-pos-blockchain/​](https://blog.polygon.technology/polygon-rpc-gateway-will-provide-a-free-high-performance-connection-to-the-polygon-pos-blockchain/) diff --git a/docs/xata/farming-guide.md b/docs/xata/farming-guide.md deleted file mode 100644 index f1406085..00000000 --- a/docs/xata/farming-guide.md +++ /dev/null @@ -1,27 +0,0 @@ -## Step-by-Step Guide to farming on XATA - -### Step 1 : Visit the Farm Page -You should be able to see the available farming pools by clicking on the 'Farm' tab in [https://app.xata.fi/](https://app.xata.fi/#/swap) - -![](../assets/xata/farm.png){style="zoom:80%"} - -Feel free to use the filter/search functions to find a pool for your favorite token, or the one you wish to stake. - -### Step 2: Add Liquidity -If you have not already done this, head over to our [Liquidity Pool Guide](./liquiditypool-guide.md) to add liquidity to the token pair. - -### Step 3: Stake LP tokens -After adding liquidity, return to the Farm page to stake. -Click on the 'Stake Tokens' button after opening a farm - -![](../assets/xata/stake.png){style="zoom:80%"} - -That's it, you're done! You should start seeing rewards in 'Rewards Earned' over time. - -## Claim Rewards -At any point in time, you can claim your rewards without unstaking, by clicking ' Harvest' after opening a farm. This will send all accumulated reward tokens to your wallet. - -## Withdraw or exit the farm -Unstake any amount of your LP tokens by clicking the 'Unstake Tokens' button. The remainder of your LP tokens will continue receiving rewards. - -If you wish to unstake all your LP tokens, you should click the 'Unstake All and Harvest' button instead. This will claim all rewards and unstake all of your LP tokens in the same transaction. diff --git a/docs/xata/introduction.md b/docs/xata/introduction.md deleted file mode 100644 index aee516ab..00000000 --- a/docs/xata/introduction.md +++ /dev/null @@ -1,37 +0,0 @@ -# Introduction - -![](../assets/xata_updated.png){style="zoom:80%"} - -XATA is a Fair Liquidity Provisioning protocol that minimizes Maximal Extractable Value (MEV), with anti-front-running supported across multiple chains including Polygon Network and Binance Smart Chain. - -Notably, Automata's approach does not rely on any miner bribe nor modification to address MEV. - -## Features -Powered by Conveyor, XATA creates an unalterable, front-running-free zone: - -* **Ordered privacy** - Transaction ordering is not revealed unless it is determined and unalterable. No one, including hosting nodes, will know the ordering before it is decided. -* **Gasless Transactions** - Users pay gas fee directly in the tokens to be swapped. Native tokens (i.e. BNB, ETH) are no longer required when users are swapping tokens frequently. -* **Chain Agnostic** - XATA provides anti-front-running across multiple chains, including Polygon Network and Binance Smart Chain, with further support planned in the near future. -* **No 3rd party involvment** - As a stand-alone protocol, XATA does not require any additional miner bribe nor any prior modification on miners' part to work. - -## How XATA works - -XATA arranges transactions in a determined, unbiased order. On the protocol, users are able to view the amount of tokens saved from front-running directly as a result of MEV protection. - -* It is impossible for malicious actors to inject new transactions into XATA's output due to signature mismatch. - -* It is also not possible to delete ordered transactions either, as transactions are broadcasted throughout the network. - -## Get started - -Check out this 2 minute video overview: - - - -
Follow our in-depth [guide](./liquiditypool-guide.md) to learn the basics of using XATA. - -## Resources -* [Twitter](https://twitter.com/teamxata) -* [MEV.tax](https://mev.tax) -* [Telegram](https://t.me/xataprotocol) -* [Medium](https://www.medium.com/@teamxata) diff --git a/docs/xata/liquiditypool-guide.md b/docs/xata/liquiditypool-guide.md deleted file mode 100644 index f12dc825..00000000 --- a/docs/xata/liquiditypool-guide.md +++ /dev/null @@ -1,137 +0,0 @@ -# Swap & Liquidity Pool Guide - -## Connecting Your Wallet - -!!! note - Please note: Currently, XATA only supports the Polygon (MATIC) network & Binance Smart Chain (BSC). Support for other chains will be launched very soon. - -For this guide, we will be using Metamask with a Polygon wallet address to connect to XATA. Please ensure that you have these ready: - -* [Metamask extension](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en) installed to your chrome browser. - -* Wallet address created on the Polygon Network - See this [guide on how to set up a wallet and custom RPC for the Polygon Network.](https://medium.com/stakingbits/setting-up-metamask-for-polygon-matic-network-838058f6d844) - -* Ensure that you have some MATIC on your wallet address to pay for gas fees. - -Once you have prepared everything, let's begin connecting our wallet to XATA: - -* Head over to XATA at [app.xata.fi.](https://app.xata.fi/) -* Click on “Connect to a Wallet” on the top right corner. - -![](../assets/xata/connect_wallet.jpeg){style="zoom:80%"} - -* Select “Metamask” - -![](../assets/xata/metamask.jpeg){style="zoom:80%"} - -* The Metamask extension prompt will appear. Ensure that your account is checked with a tick and click "Next". - -![](../assets/xata/metamask_next.jpeg){ style="display: block; margin: 0 auto" } - -* Another Metamask extension prompt will appear, click on "Connect". - -![](../assets/xata/metamask_connect.jpeg){ style="display: block; margin: 0 auto" } - -If you have done everything right, the user’s address and balance should appear on the top-right corner as shown in this image. -![](../assets/xata/connect_complete.jpeg){style="zoom:80%"} - -## Swapping Tokens - -* Click on "Swap" at the top left corner. -* Select the tokens that you are swapping for. - -![](../assets/xata/select_token.jpeg){style="zoom:60%; display: block; margin: 0 auto"} - -* The token at the bottom is what you will receive for trading in the tokens at the top. The estimated output token amount will be calculated based on the tokens' monetary value ratio from the liquidity pool. - -![](../assets/xata/swap.jpeg){style="zoom:80%"} - -* Click on the gear icon to adjust the "Slippage Tolerance" and "Transaction Deadline" & "Multihop" for your transaction if necessary. - -![](../assets/xata/settings.jpeg){style="zoom:80%"} - -* **Slippage tolerance**: The % of the price change that a user can tolerate. For instance, if the value were set at 0.5%, then the transaction will be reverted if the token price change is greater than 0.5%. -* **Transaction deadline**: The amount of time in seconds after the transaction is submitted. If a transaction were executed past the deadline, it will be reverted. -* **Multihop**: When a user is attempting to swap USDC for DAI, and such a LP pair does not exist, this trade must go through an intermediary token (USDT) from another existing LP pair. The trade route would look like this: USDC -> USDT -> DAI. - -* Once you are ready, click on "Swap" and a prompt on XATA will appear. Click on "Confirm Swap" to proceed. - -![](../assets/xata/confirm_swap.jpeg){style="zoom:80%"} - -* Do take note that if you have not used these tokens on XATA before, you will need to approve each tokens when prompted before conducting the swap. - -![](../assets/xata/metamask_confirm.png){style="zoom:80%; display: block; margin: 0 auto"} - -* Next, a Metamask extension prompt will popup to request for signature. Click "Sign" to proceed. - -![](../assets/xata/metamask_sign.jpeg){style="zoom:80%; display: block; margin: 0 auto"} - -* Once this is done, your swap will be completed when the transaction is confirmed on the blockchain. You can also see how much MEV was protected in your trade using XATA. - -![](../assets/xata/swap_complete.jpeg){style="zoom:80%"} - -## Liquidity Pools -You are also given the option to provide liquidity to XATA by creating a LP (Liquidity Pool) token pair. -### Adding Liquidity -To do this, please follow these steps: - -* Click on "Pool" in the top left hand corner. - -![](../assets/xata/pool.jpeg){style="zoom:80%"} - -* Click on "Add Liquidity" - -![](../assets/xata/add_liquidity.jpeg){style="zoom:80%"} - -* Click on the dropdown arrow to select each tokens for your LP pair, then key in the quantity for each. - -![](../assets/xata/add_liquidity_token.jpeg){style="zoom:80%"} - -![](../assets/xata/select_token.jpeg){style="zoom:60%; display: block; margin: 0 auto"} - -* If you have not used these tokens on XATA before, you will need to click on approve tokens for each of them before you can "Create Pool & Supply" - -![](../assets/xata/add_liquidity_confirm.jpeg){style="zoom:80%; display: block; margin: 0 auto"} - -* Once both tokens are approved, click "Supply", then click "Create Pool & Supply" if you're creating a new liquidity pool. - -![](../assets/xata/add_liquidity_supply.png){style="zoom:80%; display: block; margin: 0 auto"} - -* A Metamask extension prompt for a Signature Request will popup. Click "Sign" to complete the process. - -![](../assets/xata/add_liquidity_sign.jpeg){style="zoom:80%"} - -* Once your transaction has been confirmed on the blockchain, you will receive your LP token as a representation of your equity of the pool. - -![](../assets/xata/add_liquidity_complete.jpeg){style="zoom:80%"} - -### Removing Liquidity -* To remove liquidity, click on “Pool” to view all your liquidity pools. Then click on "Manage" on the liquidity pool of your choice. Then click "Remove". - -![](../assets/xata/pool_remove.jpeg){style="zoom:80%"} - -* Next, select the percentage of liquidity you would like to remove from your pool. Then click "Approve". - -![](../assets/xata/remove_liquidity_approve.jpeg){style="zoom:80%"} - -* A Metamask extension prompt will appear for an approval, Click on "Sign" to proceed. - -![](../assets/xata/remove_liquidity_approve_sign.jpeg){style="display: block; margin: 0 auto"} - -* Once approved, you can now click on the "Remove" button to trigger another signature request. - -![](../assets/xata/remove_liquidity.jpeg){style="zoom:80%"} - -* A Metamask extension prompt for signature request will popup. Click on "Sign" again to proceed. - -![](../assets/xata/remove_liquidity_sign.jpeg){style="zoom:60%; display: block; margin: 0 auto"} - -* The final confirmation popup on XATA will appear. Click on "Confirm" to complete the process. - -![](../assets/xata/remove_liquidity_confirm.png){style="zoom:60%; display: block; margin: 0 auto"} - -* Once your transaction is confirmed on the blockchain, you will receive your tokens from the removed liquidity pool. - -![](../assets/xata/remove_liquidity_complete.jpeg){style="zoom:80%"} - - diff --git a/docs/xata/sdk.md b/docs/xata/sdk.md deleted file mode 100644 index 5c905032..00000000 --- a/docs/xata/sdk.md +++ /dev/null @@ -1,228 +0,0 @@ -# SDK - -## The XATA-API module -The source code for this module can be found [here on Github](https://github.com/xata-fi/xata-sdk/tree/main/src/xata-api) , inside the `./src/xata-api directory`. - -Each function within this module bundles the process of EIP712 signing, fee token calculation, and submitting meta transaction into a single workflow. The supported functions are the following: - -* `addLiquidity()` -* `swapExactTokensForTokens()` -* `swapTokensForExactTokens()` -* `removeLiquidity()` - -Using this module, developers no longer required to manually construct a transaction request that looks like this: -```json -{ - "method": "POST", - "headers": - { - "Content-Type": "application/json" - }, - "body": "{\"jsonrpc\":\"2.0\",\"method\":\"/v2/metaTx/swapTokensForExactTokens\",\"id\":1,\"params\":[\"137\",{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"Forwarder\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"feeToken\",\"type\":\"address\"},{\"name\":\"maxTokenAmount\",\"type\":\"uint256\"},{\"name\":\"deadline\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"},{\"name\":\"hashedPayload\",\"type\":\"bytes32\"}]},\"domain\":{\"name\":\"ConveyorV2\",\"version\":\"1\",\"chainId\":\"0x89\",\"verifyingContract\":\"0xe4C5Cf259351d7877039CBaE0e7f92EB2Ab017EB\"},\"primaryType\":\"Forwarder\",\"message\":{\"from\":\"0x10D73FE8e15414E7F1468eeb7A5A61A1aeec00C8\",\"feeToken\":\"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174\",\"maxTokenAmount\":\"0x01\",\"deadline\":\"0x6179545d\",\"nonce\":\"0x20\",\"data\":\"0xf208e6ab000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000f185900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000010d73fe8e15414e7f1468eeb7a5a61a1aeec00c8000000000000000000000000000000000000000000000000000000006179545d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f\",\"hashedPayload\":\"0x5d299a1b988679b037e32d430bf2fbf03d5eb93949968c076c745ff2ffc18fe3\"}},\"28\",\"0xd8d7fdacaec4de579ee45c079cea896b576e994539f7980ec2ffb0c268fc07e3\",\"0x30dec79f68543f5785931f729ced63aabf5bc26219a11031150bced204d78ece\"]}" -} -``` -​ - -## Installation -To use XATA-API module, you must first install the XATA SDK package from [NPM](https://www.npmjs.com/package/@xatadev/sdk). - -```sh -yarn add @xatadev/sdk -``` - -We recommend you use Yarn to run the installation. If you prefer to use NPM (as some of us do!), just run the installation using this command: - -```sh -npm i @xatadev/sdk -``` - -!!! warn - It's best not to mix up the use of package managers to avoid resolution inconsistencies. Talk to your team and ask which package manager they are using. -​ -## Getting Started -To use the module, simply do the following 3 steps: - -1. Declare an instance of the XATA module. -```javascript -import { Xata } from '@xatadev/sdk'; - ​ -const xataApi = new Xata(); -``` - -1. Initiate the instance -```javascript -const feeToken = '<0xAddress>' -await xataApi.init(web3Provider, feeToken) - -// use this method to change the fee token -const otherFeeToken = '<0xOtherAddress>' -await xataApi.setFeeToken(otherFeeToken) -``` - - -1. Interact with XATA - - You may now interact with the XATA router using Uniswap-like functions. These functions return API responses like the one below: -```json -// response example -{ - "jsonrpc": "2.0", - "result": { - "errorMessage": null, - "success": true, - "txnHash": "0x3a130c90692053f412a26f6d7914bb7637f0193c0a7054621d3e3c3a7d13c24a" - }, - "id": 1 -} -``` - -We'll take a closer look at these functions in the following section. -​ -## Router Methods - -### Add Liquidity -Adds liquidity to the pool. If liquidity for the supplied pair does not exist in the pool then this router will initiate liquidity creation automatically. - -```javascript -await xataApi.addLiquidity() -``` - -| Parameter | Type | Description | -| ----------|------|------------ | -| tokenA | `string` | Token A address | -| tokenB | `string` | Token B address | -| amountADesired |
`ethers.BigNumber` | The amount of A added to the liquidity pool if the B/A price <= (`amountBDesired`/`amountADesired`) | -| amountBDesired | `ethers.BigNumber` | The amount of B added to the liquidity pool if the A/B price <= (`amountADesired`/`amountBDesired`) | -| amountAMin | `ethers.BigNumber` | Bounds the extent to which the B/A price can go up before the transaction reverts. Must be <= `amountADesired` | -| amountBMin | `ethers.BigNumber` | Bounds the extent to which the A/B price can go up before the transaction reverts. Must be <= `amountBDesired` | -| user | `string` | The user's address. The liquidity provider and the recipient of LP tokens | -| deadline | `BigNumber` | Unix timestamp after which the transaction is reverted | -| gasLimit | `BigNumber` | Optional: Gas limit for calculating the token fee amount. This value may not be the actual gas limit used in the transaction | -| gasPrice | `BigNumber` | Optional: Gas price for calculating the token fee amount. This value may not be the actual gas price used in the transaction | - -### Swap Exact Tokens For Tokens -Swap an exact amount of input tokens for as many output tokens as possible. - -```javascript -await xataApi.swapExactTokensForTokens() -``` - -| Parameter | Type | Description | -| ----------|------|------------ | -| amountln |
`ethers.BigNumber`| The amount of input tokens to send | -| amountOutMin | `ethers.BigNumber` | The minimum amount of output tokens that must be received for the transaction not to revert.| -| path | `address[]` | An array of token addresses. `path.length >= 2` | -| user | `address` | The user's address | -| deadline | `unit256` | Unix timestamp after which the transaction is reverted | -| gasLimit | `BigNumber` | Optional: Gas limit for calculating the token fee amount. This value may not be the actual gas limit used in the transaction | -| gasPrice | `BigNumber` | Optional: Gas price for calculating the token fee amount. This value may not be the actual gas price used in the transaction | - -### Swap Tokens For Exact Tokens -Receive an exact amount of output tokens for as few input tokens as possible. - -```javascript -await xataApi.swapTokensForExactTokens() -``` - -| Parameter | Type | Description | -| ----------|------|------------ | -| amountOut |
`ethers.BigNumber` | The amount of output tokens to receive | -| amountInMax | `ethers.BigNumber` | The maximum amount of input tokens that must be sent for the transaction not to revert. | -| path | `address[]` | An array of token addresses. `path.length >= 2` | -| user | `address` | The user's address | -| deadline | `uint256` | Unix timestamp after which the transaction is reverted | -| gasLimit | `BigNumber` | Optional: Gas limit for calculating the token fee amount. This value may not be the actual gas limit used in the transaction | -| gasPrice | `BigNumber` | Optional: Gas price for calculating the token fee amount. This value may not be the actual gas price used in the transaction | - -### Remove Liquidity -Withdraws a pair of tokens by burning LP tokens. This method consists of a 2-steps flow; it requires the LP holders to first sign a permit message, allowing the router to burn LP tokens, then proceeds with the actual LP tokens removal. - -First, sign the message by calling the permitLP function. (No gas required) - -```javascript -await xataApi.permitLP() -``` - -| Parameter | Type | Description -|-----------|------|------------ -| pairAddr | `string` | The LP token address -| owner | `string` | The owner of the LP tokens. A.k.a. the user's address -| spender | `string` | The recipient address for the allowance. (XATA Router address) -| value |
`ethers.BigNumber` | The liquidity value to approve -| nonce | `ethers.BigNumber` | The nonce used for signing the message -| deadline | `uint256` | Unix timestamp after which the transaction is reverted - -It will return a Signature object that is required for removing liquidity. - -```json -{ - "v": number, - "r": string, - "s": string -} -``` - -Once you receive the signature object from the permitLP then you can invoke the removeLiquidity function to withdraw tokens. - -```javascript -await xataApi.removeLiquidity() -``` - -|Parameter | Type | Description -|----------|------|------------| -| tokenA | `string` | Token A address -| tokenB | `string` | Token B address -| liquidity |
`ethers.BigNumber` | The amount of liquidity to remove -| amountAMin | `ethers.BigNumber` | The amount of tokenA that must be received before the transaction reverts -|amountBMin | `ethers.BigNumber` | The amount of tokenB that must be received before the transaction reverts | -| user | `string` | The user's address. The liquidity provider and the recipient of LP tokens -| deadline | `BigNumber` | Unix timestamp after which the transaction is reverted -| sig | `SignatureLike` | A signature object received from `permitLP()` -| gasLimit | `BigNumber` | Optional: Gas limit for calculating the token fee amount. This value may not be the actual gas limit used in the transaction -| gasPrice | `BigNumber` | Optional: Gas price for calculating the token fee amount. This value may not be the actual gas price used in the transaction | - -## Relay Config -When a transaction request is successfully sent to one of the API routers, the transaction is forwarded and processed by Geode – one of our technologies that can increase privacy and eliminate trading MEV. To do this, the XATA SDK stores the Geode relay configuration as part of the API module. - -```javascript -... -[ChainId.MATIC]: 'https://conveyor-prod-matic.ata.network', -[ChainId.BSC]: 'https://conveyor-prod-bsc.ata.network', -... -``` - -Developers can freely customize these endpoints to meet their application needs. To customize it, set new endpoint value(s) for each chain that is supported by your app. [You can find the config here.](https://github.com/xata-fi/xata-sdk/blob/main/src/xata-api/lib/relayer.ts) - -### Using a Test Relay on Development - -XATA API works on production mode by default, and therefore the transaction request also gets forwarded to production-grade Geode. If you are under the development stage and want to test the transaction on a separate relay, you need to make a couple of changes. - -Update the relay configuration as in the previous section. What makes it different from the previous one is that you have to set the endpoint value(s) under the `Environment.STAGING` object instead of `Environment.PRODUCTION`. - -```javascript -[Environment.PRODUCTION]: { - ... - [ChainId.MATIC]: 'https://conveyor-prod-matic.ata.network', - [ChainId.BSC]: 'https://conveyor-prod-bsc.ata.network', - ... -}, -[Environment.STAGING]: { - ... - [ChainId.MATIC]: 'https://your-test-relay.endpoint', - [ChainId.BSC]: 'https://your-test-relay.endpoint', - ... -} -``` - -Update the XATA initiation code on your app. - -```javascript -// Add new Environment enum import -import { Environment, XATA } from '@xatadev/sdk' - ​ -const xataApi = new Xata(); -const feeToken = '<0xAddress>' - -// Add 3rd param to override the SDK env mode -await xataApi.init(web3Provider, feeToken, Environment.STAGING); -``` \ No newline at end of file diff --git a/docs/xata/smart-contract.md b/docs/xata/smart-contract.md deleted file mode 100644 index 008b08c5..00000000 --- a/docs/xata/smart-contract.md +++ /dev/null @@ -1,28 +0,0 @@ -# Smart Contracts - -## What do these contracts do? -Here are the official smart contract addresses for XATA on each network that we currently support. Please ensure that you are interacting with the correct contract addresses with your wallet to protect yourself from phishing attempts. - -* **Factory Contract** - The "Factory" is responsible for creating new exchange contracts for each token pairs. -* **Router Contract** - The "Router" performs requirement checks needed for swapping tokens, adding liquidity, and removing liquidity. - -## Official XATA Smart Contract Addresses - -### Polygon Network - -**Factory Contract:** [0x5f8017621825BC10D63d15C3e863f893946781F7](https://polygonscan.com/address/0x5f8017621825BC10D63d15C3e863f893946781F7#code) - -**Router Contract:** [0xe4C5Cf259351d7877039CBaE0e7f92EB2Ab017EB](https://polygonscan.com/address/0xe4C5Cf259351d7877039CBaE0e7f92EB2Ab017EB#code) - -**Farm Contracts:** - -* ATA/USDT: [0x3dD417Ff4144bE35f203CB2CA569adF01Cd3574a](https://polygonscan.com/address/0x3dD417Ff4144bE35f203CB2CA569adF01Cd3574a#code) - -### Binance Smart Chain Network -**Factory Contract:** [0x5f8017621825BC10D63d15C3e863f893946781F7](https://bscscan.com/address/0x5f8017621825BC10D63d15C3e863f893946781F7#code) - -**Router Contract:** [0xe4C5Cf259351d7877039CBaE0e7f92EB2Ab017EB](https://bscscan.com/address/0xe4C5Cf259351d7877039CBaE0e7f92EB2Ab017EB#code) - -**Farm Contracts:** - -* ATA/USDT: [0x3dD417Ff4144bE35f203CB2CA569adF01Cd3574a](https://bscscan.com/address/0x3dD417Ff4144bE35f203CB2CA569adF01Cd3574a#code) \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 136cfda8..635914bb 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,8 +6,43 @@ site_author: Automata Team repo_url: https://github.com/automata-network/docs nav: - - General: - - The MEV Wiki: + - 1RPC: + - Introduction: ./1rpc/introduction.md + - Design: ./1rpc/design.md + - User Guide: ./1rpc/guide.md + - 1RPC+: + - Introduction: ./1rpc/1rpcplus/introduction.md + - User Guide: ./1rpc/1rpcplus/guide.md + - Specification: ./1rpc/1rpcplus/spec.md + - FAQs: ./1rpc/faq.md + - NFTFair: + - Introduction: ./nftfair/introduction.md + - User Info: + - Overview: ./nftfair/users/activities.md + - FAQs: ./nftfair/users/faq.md + - Contracts: + - Summary: ./nftfair/contracts/summary.md + - NFTFairFactory: ./nftfair/contracts/factory.md + - NFTFairTreasury: ./nftfair/contracts/treasury.md + - NFTFairVault: ./nftfair/contracts/vault/base.md + - Vault Templates: + - FIFO Vault: ./nftfair/contracts/vault/templates/fifo.md + - Mystery Boxes Vault: ./nftfair/contracts/vault/templates/mysteryboxes.md + - 2FA Guru: + - Introduction: ./2fa/introduction.md + - User Info: + - User Guide: ./2fa/users/guide.md + - FAQs: ./2fa/users/faq.md + - Developer Info: + - Workflow: ./2fa/developers/workflow.md + - Contracts: + - Summary: ./2fa/contracts/summary.md + - TwoFactorBase: ./2fa/contracts/TwoFactorBase.md + - TwoFactorAuthentication: ./2fa/contracts/TwoFactorAuthentication.md + - Appendix: ./2fa/contracts/2FAppendix.md + - FAQs: ./2fa/developers/faq.md + - MEV Wiki: + - MEV Wiki: - Introduction: ./mev/introduction.md - Resource List: ./mev/resource-list.md - Terms and Concepts: ./mev/terms-and-concepts.md @@ -19,81 +54,6 @@ nav: - MEV Minimization / Prevention: ./mev/solutions/mev-minimization-prevention.md - Others: ./mev/solutions/others.md - Miscellaneous: ./mev/misc.md - - User Guide: - - NFTFair: - - Introduction: ./nftfair/introduction.md - - User Info: - - Overview: ./nftfair/users/activities.md - - FAQs: ./nftfair/users/faq.md - - Contracts: - - Summary: ./nftfair/contracts/summary.md - - NFTFairFactory: ./nftfair/contracts/factory.md - - NFTFairTreasury: ./nftfair/contracts/treasury.md - - NFTFairVault: ./nftfair/contracts/vault/base.md - - Vault Templates: - - FIFO Vault: ./nftfair/contracts/vault/templates/fifo.md - - Mystery Boxes Vault: ./nftfair/contracts/vault/templates/mysteryboxes.md - - AnyDao: - - Introduction: ./anydao/introduction.md - - Design: ./anydao/design.md - - Specification: ./anydao/spec.md - - User Guide: ./anydao/guide.md - - 1RPC: - - Introduction: ./1rpc/introduction.md - - Design: ./1rpc/design.md - - User Guide: ./1rpc/guide.md - - 1RPC+: - - Introduction: ./1rpc/1rpcplus/introduction.md - - User Guide: ./1rpc/1rpcplus/guide.md - - Specification: ./1rpc/1rpcplus/spec.md - - FAQs: ./1rpc/faq.md - - 2FA Guru: - - Introduction: ./2fa/introduction.md - - User Info: - - User Guide: ./2fa/users/guide.md - - FAQs: ./2fa/users/faq.md - - Developer Info: - - Workflow: ./2fa/developers/workflow.md - - Contracts: - - Summary: ./2fa/contracts/summary.md - - TwoFactorBase: ./2fa/contracts/TwoFactorBase.md - - TwoFactorAuthentication: ./2fa/contracts/TwoFactorAuthentication.md - - Appendix: ./2fa/contracts/2FAppendix.md - - FAQs: ./2fa/developers/faq.md - - XATA: - - Introduction: ./xata/introduction.md - - Smart Contracts: ./xata/smart-contract.md - - Swap & Liquidity Pool Guide: ./xata/liquiditypool-guide.md - - Farming Guide: ./xata/farming-guide.md - - SDK: ./xata/sdk.md - - FAQ: ./xata/faq.md - - Witness: - - Introduction: ./witness/introduction.md - - User Guide: ./witness/user-guide.md - # - Witness API: ./witness/api.md - - Developers: - - ContextFree Network: - - Get Started: - - Introduction: ./canarynet/getstarted/introduction.md - - User Guide: - - Set up Wallet: ./canarynet/userguide/setupwallet.md - - Get Test Token: ./canarynet/userguide/get-test-token.md - - Use Token Bridge: ./canarynet/userguide/token-bridge.md - - Node: - - Node Types: ./canarynet/node/node-type.md - - Run Full Node: ./canarynet/node/run-full-node.md - - Join as Validator: ./canarynet/node/run-validator.md - - Conveyor: - - Overview: ./conveyor/overview.md - - ConveyorV1: - - ./conveyor/conveyorv1/automata-conveyor-overview.md - - ./conveyor/conveyorv1/automata-conveyor-gtoken.md - - ./conveyor/conveyorv1/automata-conveyor-controller.md - - ./conveyor/conveyorv1/fee.md - - ./conveyor/conveyorv1/fee-contract.md - - ConveyorV2: - - ./conveyor/conveyorv2/design.md - theme: name: material custom_dir: overrides @@ -101,8 +61,7 @@ theme: # Light mode - media: "(prefers-color-scheme: light)" scheme: default - primary: orange - accent: orange + accent: deep orange toggle: icon: material/toggle-switch-off-outline name: Switch to dark mode @@ -110,7 +69,7 @@ theme: # Dark mode - media: "(prefers-color-scheme: dark)" scheme: slate - primary: orange + accent: deep orange toggle: icon: material/toggle-switch name: Switch to light mode @@ -119,7 +78,7 @@ theme: - instant # https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#navigation-tabs - navigation.top - - navigation.tabs + - navigation - toc.integrate # - navigation.expand - content.tabs.link @@ -154,6 +113,9 @@ markdown_extensions: - pymdownx.arithmatex: generic: true +extra_css: + - stylesheets/extra.css + extra: social: - icon: fontawesome/brands/github @@ -166,6 +128,7 @@ extra: link: https://t.me/ata_network - icon: fontawesome/brands/discord link: https://discord.com/invite/Us8cxTVRxG + generator: false extra_javascript: - javascripts/config.js @@ -173,4 +136,9 @@ extra_javascript: - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.2/highlight.min.js -copyright: Copyright © 2021 Automata Network +copyright: Copyright © 2023 Automata Network + +plugins: + - search + - git-revision-date-localized: + enable_creation_date: false diff --git a/requirements.txt b/requirements.txt index a9447f23..8d9b92ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ mkdocs>=1.0.4 mkdocs-material>=4.6.2 +mkdocs-git-revision-date-localized-plugin>=1.2.0 \ No newline at end of file