hey guys just a random question

is this possible for a smart contract related to pancakeswap tokens

I want to know if this functionality is possible
1) token contract has 10% on buying or swapping BNB for the token
2) during the time of swap, it is going to do an internal txn and the smart contract receives the 10% worht of BNB in it (no tokens)

it looks like the smart contract is asking for a spend 10% more when they swap their BNB for the token

I did some test and knew i thought the transfer function is not they way to handle this kind of approach

Jan 13, 2022, 5:44 AM
the question is, is it possible for the contract to receive the 10% tax fees in BNB?
Jan 13, 2022, 5:47 AM
more like the question is, what kind of function do i need to put some modifiers on the SC to make it ask 10% more on spend on gas and the smart contract receives that 10% spend of gas /BNB
is it in swaptokensforEth function because i tested in the function transfer, it just going to treat it as a normal like get the 10% token worth and this is not what i want. I want like direct internal txn of gas used BNB to the SC
Jan 13, 2022, 5:48 AM
no, you are thinking its a lot more difficult than it is
Jan 13, 2022, 5:49 AM
I'm not 100% sure that I understand the question but that's probably a language barrier issue. Internal transactions are quite easy to implement. In the newest solidity versions you just need to call the transfer function with the amount of bnb for the tx.
Jan 13, 2022, 6:05 AM
for example picture this scenario

1) buying using BNB/WBNB against a token
2) token contract asks the buyer to spend 10% more on gas(so for 1 BNB buy its going to ask 1.1)
3) then that .1 goes to specific payable address that i can set
Jan 13, 2022, 6:08 AM
Do you want the buyer to spend 10% more gas or do you want him to spend 10% more on the payable amount of the called function?
Am I correct that gas has nothing to do with what we want to achieve here?
Jan 13, 2022, 6:23 AM
i assume lol
Jan 13, 2022, 6:23 AM
If you just want to add a 10% tax and send those 10% to a predefined address then you can do that by using the transfer function. Can you provide the function that you want to edit?
Jan 13, 2022, 6:27 AM
he wants it to claim the 10% before the sale as to avoid selling into the pool, his idea was 'mid swap, take the 10% and internal tx it to the contract', trying to maintain the price floor is the idea
Jan 13, 2022, 6:28 AM
10% more on the payable amount of the called function
++
Jan 13, 2022, 6:32 AM
told him his version wasn't suitable and was making it a bit more complicated than it is.

He could forward more gas on from the frontend but would have to rearrange things so that the extra gas was forwarded rather than refunded.

Alternatively, imo, he could grab the pair info and calculate the amountOut and deduct 10% from that which would leave the 10% bnb left over from the sale still on the table. native transfer that from the sender to the address and everyone wins

my two cents on it ^
Jan 13, 2022, 6:33 AM
yeah i was thinking of the amount0out
Jan 13, 2022, 6:34 AM
could be done more effectively tho for sure
Jan 13, 2022, 6:35 AM
I don't quite understand this. Why would you need extra gas for this? Can't you just increase the paid amount by 10%?
Jan 13, 2022, 6:36 AM
You wouldn't, he mentioned gas and so I thought of a solution using gas to answer his question a bit more thoroughly
Jan 13, 2022, 6:37 AM
Oh I see. Would probably work but it's not the recommended way of sending bnb to a contract 😂
Jan 13, 2022, 6:39 AM

© 2024 Draquery.com All rights reserved.