Soldex Docs
Search…
⌃K

Create Swap Pool

Command Line instruction how create a Swap Pool
If you want to create a pool feel free to contact Soldex team for any assistance.
Required environment Ubuntu 20.04. Other Linux distributives and Mac should work too, but it can require additional steps to prepare the machine. We don’t recommend using Windows for this procedure.

Clone Soldex Swap repository (git is required):

git clone https://github.com/soldex-ai/soldex-token-swap-SC.git

Install NodeJS

sudo apt install nodejs

Install required library and Rust:

sudo apt-get install libudev-dev cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install solana cli tool (See solana-cli usage)

sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

Install spl-token-cli

cargo install spl-token-cli

Next, create a new keypair (File System Wallet)

solana-keygen new --outfile ~/.config/solana/mainnet.json
Passphrase can be empty. Non-empty passphrase store in a safe place! Without passphrase, you will not be able to recover private-key (mainnet.json) from seed!
You will get:
  • path to ID: ~/.config/solana/mainnet.json
  • pubkey: A8wk...Xu [you can see it by typing solana-keygen pubkey]
  • seed phrase to recover your new keypair: throw garden ... low response. Store seed phrase in a safe place!

Set Solana config

Next, say Solana to use your generated key and set network to mainnet
solana config set --keypair ~/.config/solana/mainnet.json --url https://api.mainnet.solana.com
Run command:
solana config get
You should receive:
Config File: </path_to>/.config/solana/cli/config.yml RPC URL: https://api.mainnet.solana.com WebSocket URL: wss://api.mainnet.solana.com/ (computed) Keypair Path: </path_to>/.config/solana/mainnet.json Commitment: confirmed
Verify your RPC URL and Keypair Path

Fulfill address with tokens

solana address
You should receive your public Solana address related to you Keypair Path
Send SOL (at least 4 SOL) and pool tokens to that address. If your token pair includes SOL, at first we need to get Wrapped SOL. Let’s say your initial Pool Liquidity contains 10 SOLX and 1 SOLX.
To get Wrapped SOL run:
spl-token wrap 1.1
You should see:
Wrapping 1.1 SOL into <your_account_address>
Signature: <your tx signature>
Please safe your_account_address. You will need it later.
Run the command:
spl-token accounts
You should see:
Token Balance
So11111111111111111111111111111111111111112 1.09796072
Here you can see other tokens too if you already sent them to your address. If you don’t - it is time to send them. In the example below we are going to create a SOLX/SOL pool with 1 SOL and 10 SOLX as initial liquidity. In your case, you need to change token addresses to yours.

Prepare .env - Pool Config file

cd soldex-token-swap-SC/js
You can use any favorite text editor for this. Just create a new .env file in the project js directory.
nano .env
Fulfill your .env file
Here is an example of SOLX/SOL token pair:
1LIVE=1 2CLUSTER=mainnet-beta 3RPC_URL='https://api.mainnet-beta.solana.com' 4TOKEN_SWAP_PROGRAM_ID='FvpxMskJCC43Nswc3W3HnyE4fWcXsiawzbkPfRYpDYmD' 5FEE_OWNER_KEY='63g44H9eJAc4DuAxv1vRMbTqZUmrtzFD247fTfuRVgh5' 6OWNER_TRADING_FEE_NUMERATOR=5 7OWNER_TRADING_FEE_DENOMINATOR=10000 8TRADING_FEE_NUMERATOR=20 9TRADING_FEE_DENOMINATOR=10000 10OWNER_WITHDRAW_FEE_NUMERATOR=0 11OWNER_WITHDRAW_FEE_DENOMINATOR=10000 12HOST_FEE_NUMERATOR=0 13HOST_FEE_DENOMINATOR=100 14 15# Variables to set 16WALLET_FILE='<Set full path /home/user/.config/solana/mainnet.json>' 17BASE_MINT_TOKEN='CH74tuRLTYcxG7qNJCsV9rghfLXJCQJbsu7i52a8F1Gn' 18BASE_AMOUNT=10 19QUOTE_MINT_TOKEN='So11111111111111111111111111111111111111112' 20QUOTE_AMOUNT=1 21LP_MINT_DECIMALS=9
Make sure you set the correct TOKEN_SWAP_PROGRAM_ID and FEE_OWNER_KEY:
TOKEN_SWAP_PROGRAM_ID='FvpxMskJCC43Nswc3W3HnyE4fWcXsiawzbkPfRYpDYmD'
FEE_OWNER_KEY='63g44H9eJAc4DuAxv1vRMbTqZUmrtzFD247fTfuRVgh5'

Provide correct token addresses:

Set correct BASE_MINT_TOKEN. It’s the first token in your pool token pair. SOLX token address is:
Soldex (SOLX) | Solscan
BASE_MINT_TOKEN='CH74tuRLTYcxG7qNJCsV9rghfLXJCQJbsu7i52a8F1Gn'
BASE_AMOUNT is the inited amount of the first token in your pool:
BASE_AMOUNT=10
Set correct QUOTE_MINT_TOKEN. It’s the second token in your pool token pair. Wrapped SOL token address is:
Wrapped SOL (SOL) | Solscan
QUOTE_MINT_TOKEN='So11111111111111111111111111111111111111112'
QUOTE_AMOUNT is the inited amount of the second token in your pool:
QUOTE_AMOUNT=1
To calculate inited tokens price in a pool you need:
QUOTE_AMOUNT / BASE_AMOUNT = TOKEN_PRICE
11 / 10 = 0.1 2where 1 SOLX = 0.1 SOL 3or 41 SOL = 10 SOLX
Double-check that everything is correct and save your .env file.
Make sure, you have enough token balance in your wallet ~/.config/solana/mainnet.json
Soldex Pool fee policy is available here. If you don’t follow it your pool can be danylisted and not supported by Soldex protocol. For additional questions please write us by email at [email protected]

Create Pool

Make sure you are in the project directory soldex-token-swap-SC
Run
npm install
Create pool
cd js; npm run create-pool; cd -
If everything is ok, you should receive something like:
1fetchedTokenSwap.tokenProgramId: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA :TOKEN_PROGRAM_ID :TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA 2fetchedTokenSwap.tokenAccountA: J7KrzLz58u44WJQjnfVRWqfG3v65voUUfJd94YuAffNo :tokenAccountA :HDosqJarQUqUWHTDP7GLZj6ukGTkn1GWYZreWQgrR4HN 3fetchedTokenSwap.tokenAccountB: 8Wx3GYEt1wMNpuFswvEuncGyQc8UZyo2fZhpyLVjgsyx :tokenAccountB :J7FoUw4mL3GBucvn7sup7Sg2HfxiumPA61KG63p4hU1h 4tokenSwap.mintA: CH74tuRLTYcxG7qNJCsV9rghfLXJCQJbsu7i52a8F1Gn :mintA.publicKey :CH74tuRLTYcxG7qNJCsV9rghfLXJCQJbsu7i52a8F1Gn 5tokenSwap.mintB: So11111111111111111111111111111111111111112 :mintB.publicKey :So11111111111111111111111111111111111111112 6tokenSwap.poolToken: 3jkJdWKdst2rL2ab7HKong1YNXf2pwgfptizoRFa2pME 7tokenSwap.feeAccount: GqzfNL9gre1zj6roZw3CJtfwK1aYe6dzG3wCvXeoiqG4 8TRADING_FEE_NUMERATOR: 20 :tokenSwap.tradeFeeNumerator.toNumber() :20 9TRADING_FEE_DENOMINATOR: 10000 :tokenSwap.tradeFeeDenominator.toNumber() :10000 10OWNER_TRADING_FEE_NUMERATOR: 5 :tokenSwap.ownerTradeFeeNumerator.toNumber() :5 11OWNER_TRADING_FEE_DENOMINATOR: 10000 :tokenSwap.ownerTradeFeeDenominator.toNumber() :10000 12OWNER_WITHDRAW_FEE_NUMERATOR: 0 :tokenSwap.ownerWithdrawFeeNumerator.toNumber() :0 13OWNER_WITHDRAW_FEE_DENOMINATOR: 10000 :tokenSwap.ownerWithdrawFeeDenominator.toNumber() :10000 14HOST_FEE_NUMERATOR: 0 :tokenSwap.hostFeeNumerator.toNumber() :0 15HOST_FEE_DENOMINATOR: 100 :tokenSwap.hostFeeDenominator.toNumber() :100 16curveType: 0 :tokenSwap.curveType :0
Last modified 4mo ago