How add custom token to swap? Bsc

It work with custom token that you send, but this one dont want to calculate. I think that sending will work. But i need to calculate.

How can i do that? Did enyone have this problem?

I think the only reason is that price of token i 0. So how can i Change that? Thanks

give your token a value and increase slippage. (with or without slippage changer).

Create a liquidity pool in for your custom token in one of the existing DEX aggregated by 1inch and be an intial liquidity provider. You can set the price of the token by having 50% of the token and 50% of other token (e.g. BNB) both with the same value. Once a liquidity pool exist, a price could be calculated from that, and itโ€™ll automatically be supported by 1inch as well :raised_hands:

Just remember the reason why these tokens have price are the supply of the token within the liquidity pool, not some data gained from website such as CMC or Coingecko because theyโ€™re separate.

2 Likes

Can someone explain a better where this code need to be pasted

// Adding custom tokens

const customTokens = {
  "0x2180F5cC1ddf117640963AE91868948bd3EF6838": {
    address: "0x2180F5cC1ddf117640963AE91868948bd3EF6838",
    decimals: 9,
    logoURI:
      "https://assets.coingecko.com/coins/images/20985/small/_VoQPDDs_400x400.jpg?1638168643",
    name: "AscensionArcade",
    symbol: "AAT",
  },
};

when I try to put code in DEX.jsx I always getting this

src/components/DEX/DEX.jsx
  Line 173:7:   Insert `ยทยท`                                                           prettier/prettier
  Line 278:23:  Insert `ยทยท`                                                           prettier/prettier
  Line 279:25:  Insert `ยทยท`                                                           prettier/prettier
  Line 280:1:   Replace `ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท` with `ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท`  prettier/prettier
  Line 281:23:  Insert `ยทยท`                                                           prettier/prettier
  Line 282:1:   Insert `ยทยท`                                                           prettier/prettier

Thank you but this not working I dont know why

Does this code going to dex.jsx or useinchdex.js I m confused about diffrent answersโ€ฆThank you

It goes to useinchdex.js in setTokens

yes but then I have problem with compile with .then((tokens)

can you share your code what working for you that I can see where I have mistake.

I Solve problem with prettier

1.first open prettierrc and delete code only leave { }
2.second open prettierignore and add this line code src/

then is problem solved with compile.

you can just yarn format to format with prettier, but that works too

The addition of prettier is mainly to enforce good code styling :raised_hands:

If I add custom token code how I can make that that token If working on bsc network only can be showed on binance smart chain not on eth and polygon?

hey bro, mine saying โ€œโ€˜tokensโ€™ is defined but never used.โ€

please help

You can ignore this warning or just comment out the line where tokens is defined.

1 Like

hello with this code i only see the custom token on the list and without the above code i get this error in the image when hit SWAP

Screen Shot 2022-06-15 at 14.22.24

I AM GETTING this in console
Screen Shot 2022-06-15 at 14.44.22