Let's use this transaction as an example:
As a benchmark, let's use BoggedFinance data. It says that:
PHX - BNB LP PancakeSwap V2
7,924,800,360.499 PHX + 0.131 BNB
Liquidity Pool Totals
Pool adds $631,122 to total liquidity
PHX pooled: 55,236,876,104,150
BNB pooled: 910
Total LP Tokens: 6,970
KI pooled: 1,314,655,947,122
BNB pooled: 0.000
Total LP Tokens: 2,141.465
It is a swap between these two tokens:
Other addresses mentioned in the logs:
Router (v2): 0x10ed43c718714eb63d5aa57b78b54704e256024e
PHX-WBNB LP: 0x2c3a0aa216cefb8c887716b993c3158f011f967e
BscScan says that the following amounts were transferred:
For 0.1 ($34.01) Wrapped BNB (WBNB)
For 5,314,263,769 PhoenixProtocol (PHX)
i.e. 0.1 WBNB was transferred in exchange for 5,314,263,769 PHX
actual=5,314,263,769 = 5,314,263,769
However, if we were to use Bogged provided quote, the expected amount should be:
0.1 x bnb_phx = 6,064,311,946.1
((expected-actual)/((expected+actual)/2))*100 = 13.18351603551288580585
i.e. We would expect 13.18% more than what we got.
0.2% is a PancakeSwap fee.
The rest must be a combination of slippage and error between when the Bogged values were observed and when the trade took time (it is volatile market afterall).
A comment in the contract states that there is a 10% fee on every transaction, which may account for the difference.
The following events have been recorded:
This is initiator transferring 0.1 (100000000000000000/10^18) WBNB to Router.
This is Router adding 0.1 WBNB to PHX-WBNB LP.
This is PHX-WBNB LP sending 5,314,263,769 (5314263769851279617/10^9) to Buyer.
This event indicates that PHX-WBNB LP have been updated.
This event describes how much was sold (
amount1In) and how much was received (
What's interesting is that 5904737522056977352 does not align with the actual amount transferred.
i.e. actual amount is 10.52% less than what
((actual-amount_out)/((actual+amount_out)/2))*100 = -10.52631580448580946687
There is also the
This equal to 0.2% of the amount_out, which appears to be PancakeSwap fee.
(amount_in_0/amount_out)*100 = 0.21827899973501988968
At the end,
amount_out does not account for 10%, which aligns with the advertised contract fee, and it seems that there is no way to get the actual amount transferred just by looking at the
It is worth noting that the quote that we calculated using two reserves does not reflect the 10% fee, i.e. The initial expected amount (6,064,311,946) closely aligns with the
i.e. Looks like the only way to get the actual amount is by looking at the