Hot answers tagged

4

If you are sending Ethers to a wallet address, it's perfectly ok to use transfer. The problem with the transfer function is that it forwards a constant amount of gas (2300) to the recipient. If the recipient is a wallet, that gas is not used nor needed. If the recipient is another contract, the contract has 2300 gas to do some processing (it's mostly enough ...


4

There are 3 numbers to be concerned about here Gas units consumed per transaction is how much gas used for the transaction which is really a measure of the complexity of the transaction. This depends on how many operations or storage the smart contract is using. Price per Gas unit is how much you're willing to pay for 1 Gas unit. This affects how fast your ...


3

I noticed that swapping some tokens in Uniswap to exactly the same amount of ETH, at the same time, has much higher gas fees than other tokens. Why is this? Aren't the swap transactions identical for all tokens? Some token transfer() function has more instructions (if clauses) than others. Plus it also depends on if the Ethereum Virtual Machine storage can ...


2

They override the transfer function and do different logic on them.


1

This already exists actually. You could integrate GSN (Gas Station Network) in order to pay the gas for user transactions. Usually, it is the company or the smart contract owner who pays all the gas fees for all user transactions on the system. You could make your own rules of how the transaction gas is paid. You could read more about it here: https://docs....


1

If you want the exact data from Etherscan gas tracker you can use their APIs. Gas Oracle API (docs): https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=YourApiKeyToken Response: { "status": "1", "message": "OK", "result": { "LastBlock": "12845223", ...


1

I have two suggestions You can optimize your code to make it work more efficiently, here are some tips. You can enable the solidity optimizer, see more about it here.


1

Currently Ethereum is the most used blockchain so its unlikely that the gas fee will go low at anytime. I would suggest that you deploy that contract on Binance Smart chain, fees are low that side and everything else gets to be the same.


Only top voted, non community-wiki answers of a minimum length are eligible