切换到中文

Introduction

Permaswap Network uses AMM technology and is a fully decentralized, distributed P2P trading network.

https://mirror.xyz/permaswap.eth/ustZcDgavlm4xmYI26thEAj8W2cXlZpRkG5Jqz0iS14

Users can provide liquidity to Permaswap by running Permaswap's LP client.

Similar to the provision of liquidity to Uniswap, the provision of liquidity requires a certain amount of capital from the liquidity provider (i.e.LP), who can set the price range for market making and the amount of capital to be provided, while the LP receives a fee as income, it may also incur some impermanent loss.

Unlike Uniswap

  1. the funds of the LP of Permaswap remain in the user's own wallet and do not need to be deposited in the smart contract.
  2. Permaswap's LP needs to run the LP client program, be online all the time, validate/sign the orders sent by Router, and complete the transaction.

The currently available LP clients for Permaswap are:

  1. A GUI LP client is written in Javascript.
  2. A command line LP client is written in Golang

This article is a tutorial for Golang LP clients, which liquidity providers can follow to deploy LP nodes for automated AMM market-making in the Permaswap network.

Additional information.:

Introduction of everPay:

https://everpay.zendesk.com/hc/en-us/articles/4404204530201-Introduction-to-everPay

Assets on everPay:

https://everpay.zendesk.com/hc/en-us/articles/4405069888537-What-is-everPay-balances-

Testnet users can also receive test tokens from the faucet of everPay to test products.

https://faucet-dev.everpay.io/

Preparation

  1. everPay currently supports the Ethereum and Arweave chains.

    Users can generate accounts with Metamask wallets or Arconnet wallets and hold trading assets in everPay.

    1. Test environment: You need to have tUSDC and tAR. tUSDC these can be obtained through the test environment faucet.

      Providing liquidity requires having at least two assets. For example, to provide liquidity to a pool of tUSDC-tAR pairs, the user needs to hold both tUSDC and tAR assets.

      After obtaining tUSDC from the faucet, users can swap to obtain tAR or tADRIVE, thus making a market for the corresponding trade pair pool.

    2. Production environment: Users need to top up their assets to everPay.

      Tutorials: https://everpay.zendesk.com/hc/en-us/articles/4404197313433-Deposit

  2. The following configuration is recommended for using the Golang version of the CLI client:

    1. 512MB RAM / 1 CPU and above configuration of cloud hosting;
    2. Ubuntu systems 20.04 and above

Test environment description

Environmental Label:testnet

ChainID:5

URL:

  1. Website: https://app.permaswap.network/#/
  2. http-api https://router0-dev.permaswap.network
  3. ws-api:wss://router0-dev.permaswap.network/wslp

Supported token information:

token token tag decimals Describe
tAR bsc-tar-0xf1458ee7e9a2096bce7a21c160840a3a291bcb55 12
tARDRIVE bsc-tardrive-0xf4233b165f1b8da4f9aa94abc35c9ad2a7612979 18
tUSDC bsc-tusdc-0xf17a50ecc5fe5f476de2da5481cdd0f0ffef7712 6

Pool information for supported pairs:

Pool Pool ID token-x token-y Rate
tAR-tUSDC 0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a tAR tUSDC 0.3 %
tAR-tARDRIVE 0x196ca0c5e44d776e1d7ee1e6485030ea43ee4bad225e3312685048827eaf2a92 tAR tARDRIVE 0.3 %

Production environment description

Environmental Label:mainnet

ChainID:1

URL:

  1. Website: https://app.permaswap.network/
  2. http-api: https://router.permaswap.network
  3. ws-api:wss://router.permaswap.network/wslp

Supported token information:

token token tag decimals Describe
AR arweave,ethereum-ar-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,0x4fadc7a98f2dc96510e42dd1a74141eeae0c1543 12 Native token on Arweave
ETH ethereum-eth-0x0000000000000000000000000000000000000000 18 Native token on Ethereum
USDC ethereum-usdc-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 6 USDC erc20 token issued on Ethereum
USDT ethereum-usdt-0xdac17f958d2ee523a2206206994597c13d831ec7 6 USDT erc20 token issued on Ethereum

Pool information for supported pairs:

Pool Pool ID token-x token-y Rate
AR-USDC 0x0750e26dbffb85e66891b71b9e1049c4be6d94dab938bbb06573ca6178615981 AR USDC 0.3 %
AR-ETH 0x5f0ac5160cd3c105f9db2fb3e981907588d810040eb30d77364affd6f4435933 AR ETH 0.3 %
ETH-USDC 0x7eb07d77601f28549ff623ad42a24b4ac3f0e73af0df3d76446fb299ec375dd5 ETH USDC 0.3 %
USDC-USDT 0xdb7b3480f2d1f7bbe91ee3610664756b91bbe0744bc319db2f0b89efdf552064 USDC USDT 0.05 %

Download

Download the Linux Lp client Permaswap.linux.tar.gz from the official website.

Test environment*:https://app-dev.permaswap.network/#/pool*

Production environment*:https://app.permaswap.network/#/pool*

After downloading and unzipping, there are three files lp, lpconifg, and run.sh

  1. lpconfig is used to generate the configuration file for market making;
  2. lp runs according to the configuration file, always online, verifies/signs orders sent by a router, completes transaction;
  3. run.sh is the start lp client script。

Configuration file

Generating the profile for lp market making is a 2-step process:

  1. lpconfig --info Get information about the Pools currently available for marketing;—network Set the network to connect to, either testnet or mainnet

lpconfig --info --network testnet
  1. Generate profiles, calculate and display the required funds
lpconfig --network testnet -p {{poolid}} -low {{lowest price for market making}} -current {{current price}} -high {{highest price for market making}} -x {{amount of token x}} -c {{path of configuration file}}

Among them

-p poolid is the id of the pool, obtained from the first step;

--network Set the network to connect to, either testnet or mainnet;

-low The lowest price for market-making;

-current Current price;

-high The highest price of market-making;

-x -y The number of tokenX or tokenY in the x - y market-making calculation is only one, and the number of tokens needed for the other will be calculated automatically;

-c Path to the configuration file;

Example:

lpconfig --network testnet -p 0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a -low 1 -current 10 -high 20 -x 100 -c lp_config.json

The above command will generate a configuration file for pool 0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a( tAR-tUSDC )Market-making lp profile。

The price range is 1 tUSDC / tAR - 20 tUSDC / tAR, the current price is 10 tUSDC / tAR and the number of tokenX (i.e., tAR ) of the market-making funds is 100. The generated configuration file is lp_config.json in the current directory.

Full range market making

If the price range is full range, add option -f. The options -low and -high do not need to be provided.

Example:

lpconfig --network testnet -p 0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a -current 10 -y 1000 -c lp_config.json

Generate a configuration file for pool 0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a(tAR-tUSDC) Market making lp profile, The price range is full-range, The current price is 10 tUSDC / tAR, Market-making funds tokenY( i.e. tUSDC )The number of 1000。 The generated configuration file is lp_config.json。

More lp

There is already an lp configuration. To add a second lp configuration information, specify the -c option as the lp configuration file for the existing configuration.

Example:

lpconfig --network testnet -p 0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a -current 10 -y 1000 -c lp_config.json

At this time lp_config.json the configuration information for the first lp is already included, and the second lp configuration information is added at the end of the file.

Run lp

  1. Modify the environment variables in the run.sh run script to:

    PERMA_WS、PERMA_HTTP、LP_CONFIG、ECC_PRIVATE/AR_WALlET。

    Among them:

    PERMA_WS is the Router's WebSocket address.

    PERMA_WS is the Router's HTTP address

    The test network is set to

    export PERMA_WS="wss://router0-dev.permaswap.network/wslp"
    export PERMA_HTTP="[<https://router0-dev.permaswap.network>](<https://router0-dev.permaswap.network/>)"
    

    Official network:

    export PERMA_WS="wss://router.permaswap.network/wslp"
    export PERMA_HTTP="[<https://router.permaswap.network>](<https://router.permaswap.network/>)"
    

    LP_CONFIG for your lp profile

    If you are making a market with an eth account, ECC_PRIVATE is set to the private key of your prepared wallet. If you are using the Arweave account for market making, AR_WALlET is set to your Arweave wallet file path.

export PERMA_WS="wss://router0-dev.permaswap.network/wslp"
export PERMA_HTTP="<https://router0-dev.permaswap.network>"
export LP_CONFIG="./lp_config.json"
export AR_WALLET="ar_wallet.json"
#export ECC_PRIVATE=""
./lp
  1. Run source run.sh You can use tools such as tmux/screen to ensure that the lp program is always running online.