Hey guys, I am working on a project to integrate the price of a token to a website for calculations.
The token is on BSC and pool on pancake swap. I want to use the BUSD pair price and not BNB.
I cannot find any apis to get the BUSD and I had to use a pancake function that only allows me use BNB as a base currency. This destroys the whole point because the BNB price and market cap are different from the BUSD and it is going to ruin the webapp calculations. Are there any helps please?
Oct 17, 2022, 3:46 PM
You don't have a BUSD pool?
Oct 17, 2022, 3:47 PM
i do
You know they both have different prices (bnb pool and busd pool) at some times
if you use the BNB as a base to calculate the BUSD, the price will be according to BNB pool
Oct 17, 2022, 3:48 PM
yea with BNB you can check by using route with bnb in the middle
Oct 17, 2022, 3:48 PM
it destroys the price
Oct 17, 2022, 3:49 PM
in case with busd you can check with its pool directly
Oct 17, 2022, 3:49 PM
need a way to calculate only the busd pool directly and get that price.
How do i do this and integrate to a webapp?
the only way I saw was through pancakeswap and they have to use the bnb in the middle
Oct 17, 2022, 3:49 PM
i use this
then you can put 1 token as in and put a slippage of 2% or 5% depending on the liquidity
Oct 17, 2022, 3:51 PM
This is what I am using
as you can see the middle is BNB
Oct 17, 2022, 3:54 PM
you can use path 2 and busd directly as out
Oct 17, 2022, 3:55 PM
I will give it a try and see if it works to get only BUSD pool price for webapp.
the base token (bnb) seems required. But I will give it a try now.
the base token (bnb) seems required. But I will give it a try now.
Thank you boss, I will let know what happens.
Oct 17, 2022, 4:00 PM
🙂👍
Oct 17, 2022, 4:01 PM
Hello boss
it does not work
Oct 17, 2022, 9:48 PM
oh, what happened?
Oct 17, 2022, 9:48 PM
here what i did, but in c#
Oct 17, 2022, 10:05 PM
did you changed path to 2 and take off path[1]?
Oct 17, 2022, 10:05 PM
DO you mean if i changed path 2 and take off path 1?
i changed path 0 to the custom token, path 2 is busd. That is all we changed.
path 1 is the BNB
Oct 17, 2022, 10:10 PM
you need to take off BNB path
make custom token path 0 and busd path 1
Oct 17, 2022, 10:11 PM
okay, let me try now
It failed, it says executions reverted, eth call.
Oct 17, 2022, 10:13 PM
show me code :P
Oct 17, 2022, 10:13 PM
okay, it is in c#
Oct 17, 2022, 10:14 PM
im zero on c# hehe
this is solidity btw, your call can be the same
Oct 17, 2022, 10:14 PM
Oct 17, 2022, 10:16 PM
it should look like this
then you can call this function with (token1address,busdaddress, 1 * 10 **18) >> the price of 1 token
Oct 17, 2022, 10:18 PM
That's not C#
Oct 17, 2022, 10:19 PM
this is the C# boss
the path 0 will be what please?
the path 0 will be the custom token right?
Oct 17, 2022, 10:21 PM
yes
Oct 17, 2022, 10:21 PM
then path 1 will be BUSD right?
Oct 17, 2022, 10:22 PM
getAmountsOut(
_amountIn,
path
);
_amountIn,
path
);
correct
Oct 17, 2022, 10:22 PM
it worked boss. thank you
my problem was the BUSD contract address in the end
paxos has a busd
and it looks more like binance busd than the binance busd
Oct 17, 2022, 10:33 PM
lol
Oct 17, 2022, 10:36 PM