Questions tagged [gas-refund]
The gas-refund tag has no summary.
64 questions
0 votes
0 answers
19 views
Refunding of gas fee [duplicate]
I made some trades that seem to have turned out good. I’ve started a withdrawal and now they are telling me there is a 10% gas fee required to be paid from an external account and that 10% fee will be ...
5 votes
4 answers
211 views
Does it make sense to remove unused entries from contract mapping in 2024
im wondering if it still makes sense to remove entries from mappings in ethereum contract. It seems like initially there was a relatively big benefit of cleaning up the storage but from what i read ...
0 votes
1 answer
50 views
When deleting a struct, do I get back the gas of setting the attributes of the struct to 0, or only for the struct itself?
I have a mapping(bytes32=> exampleStruct) public myMapping where: struct exampleStruct { address owner, uint256 number, uint256 anotherNumber } To optimize gas sometimes I delete ...
0 votes
1 answer
83 views
How to Determine the Optimal Gas Limit for Maximum Gas Refund without Excess?
I'm optimizing the gasLimit for transactions to ensure the maximum possible gas refund without leaving any unused gas. Given most web3 network's have a maximum gas refund policy where a portion of the ...
1 vote
2 answers
75 views
Can a simple ether refund without storage checks be hackable(reentrancy attack, ...)?
As the title says, I am wondering if the following ether refund(using .call) can be hackable. I am not entirely sure no reentrancy attack can be performed in it, but I think so since I am not updating ...
0 votes
1 answer
32 views
Any alternatives to reducing msg.value without resorting to refunds?
In my contract, users are required to deposit a specific amount of Wei. I want to prevent users from overpaying and need to decrease the value of msg.value. Currently, I'm refunding the difference, ...
0 votes
1 answer
538 views
EVM Gas refund and total gas calculation
My understanding is that the total gas refund can never exceed 20% of the transaction total gas cost, which I guess means that the EVM will first add-up all the transaction gas cost then deduct the ...
1 vote
1 answer
811 views
Is it possible to reverse the gas used in case of using revert?
I try to refund gas to the minimum even after using revert with the following example. uint A = IERC20(base).balanceOf(address(this)); IERC20(token).transfer(owner,1000000); then I run swaps ...
0 votes
2 answers
374 views
Gas Less ERC-20 Token Minting
How can I create ERC-20 token on Ethereum blockchain without paying gas fee using Remix.ethereum.org Please provide code to help I saw Zeroswap DEX allow us to trade without paying gas fee.
0 votes
1 answer
360 views
Is the all of Gas Fee refunded if the transaction fails?
function burn(uint256 _value) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply = totalSupply.sub(_value); Burn(msg.sender, _value); ...
2 votes
1 answer
122 views
Why does releasing a storage variable cost more gas than it saves?
I am experimenting on saving gas by releasing some storage on my smart contract. In the smart contract there is a mapping, which i fill with data by calling the function setStorage. The other function ...
2 votes
1 answer
871 views
What is the gas refund for clearing out storage via SSTORE?
There is a lot of conflicting information due to the change in the gas refund mechanism from EIP-3298. According to evm.codes the user will still be charged net 200 gas for clearing out a storage slot....
1 vote
0 answers
98 views
Maximum gas estimate
eth_estimateGas provides estimated final gas consumed by transaction and accounts for gas refund in the end of transaction. However, is there a way to estimate maximum gas the transaction may consume ...
0 votes
1 answer
531 views
Can you create and destroy a contract in a single transaction?
Is it possible to create and destroy a contract in a single transaction? Specifically could I: deploy to a known address using CREATE2 call a function on that contract destroy the contract and ...
0 votes
1 answer
105 views
Does it cost gas to cancel a transaction? Can I replace / speed up the transaction to just 1 gwei then cancel to reduce fees?
My transaction is stuck, but can I speed it up by replacing the fee with 1 gwei then cancel it to reduce the fees to cancel? I tried to cancel and speed up but its still stuck. I check etherscan and ...