benrobot / web3.php_send_tokens_example

Send tokens using PHP
12 stars 5 forks source link

How to set the price flexibly? #5

Open yunwow opened 2 years ago

yunwow commented 2 years ago

On Web3 php send tokens_ For example, there is a variable "$factortomultipliygasestimate" in this project. When I trade the BSC chain, I am always troubled by the size of this value. The situation is as follows:

Example 1: if my BSC chain wallet has a BNB worth $25, I can only set it at 150000 - 200000. If it exceeds that, the transaction will fail. And get an error prompt "insufficient funds for gas * price + value"

Example 2: if my BSC chain wallet has a BNB worth $1000, I must set it above 250000, otherwise I will fail again. And get a new error prompt "replacement transaction underpriced"

How can I handle the correct setting of this "price" variable. Sincerely ask you!

benrobot commented 2 years ago

Can you provide more information?

It would help if you provide the exact contents of your PHP file(s) or create an repository with the exact code the reproduces this issue.

What values do you have for CHAIN_NAME, TOKEN_CONTRACT_ADDRESS, and SOURCE_ACCOUNT_ADDRESS?

yunwow commented 2 years ago

I have solved this problem. Thank you

benrobot commented 2 years ago

Can you describe your solution? It might be helpful to others.