Questions tagged [gas-refund]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

Does self-destruct() delete contracts data from the storage as well?

Destroying two contracts: (1) contract A with 1 integer variable stored in it and (2) contract B with 100 integer variables stored in it, would result in the same amount of refund: 24000 gas. So does ...
0
votes
1answer
72 views

How to refund gas to the smart contract caller? (What is the number?)

I have this function: function setAccount(BaseUBI _ubi, address _user, uint256 _startTime, uint _esiaID, bool _setToZero) external { uint256 _refund = (gasleft() + 0/*FIXME*/) * tx....
3
votes
2answers
197 views

Gas refunds via “Self-destruct” prior to a revert()

In a transaction that eventually calls revert(), if prior to the revert we have SELFDESTRUCT some contracts and thus received a gas refund, does the gas refund also get reverted?
0
votes
1answer
31 views

is it possible to get gas refunded if a smart contract call fails to complete?

I am using trust wallet, and whilst using a number of exchanges (for example - uniswap, balancer liquidity pool) I have paid gas prices without the exchange actually taking place. Is it possible to ...
1
vote
1answer
20 views

If gas is refunded, is it required to call? [duplicate]

Suppose a smart contract external function uses very much gas, but refunds (with .transfer()) the used gas to the caller. Question: Can it be called with a small amount of gas despite it uses much? ...
19
votes
3answers
3k views

How do gas refunds work?

Gas refunds are provided when clearing storage or calling SELFDESTRUCT on contracts. The Yellow Paper mentions that refunds are "being capped up to a maximum of half...". What exactly is ...
0
votes
1answer
25 views

Refund mechanism - How is it possible to have transactions with M$ fee?

As stated here, my current understanding is that an unused gas is refund when the transaction succeeds (otherwise it is fully consumed) Lately I found an article about some fee mistakes that led to ...
1
vote
1answer
92 views

How to use / see refunded gas in ETH blockchain?

I buy a GAStoken contract which requires say 21000 GAS at 1 Gwei and later when we delete/destroy the contract when the Gwei is around 50. I understand that we will get around 50% refund of GAS at the ...
1
vote
1answer
89 views

ClaimRefund Process

One of the PreICO is cancelled so they are providing me refund of my ETH. They are asking me to enter their ABI/JSON and ClaimRefund through myether wallet under my login. Can using the Claimrefund ...
1
vote
1answer
44 views

How can I measure the gas used in a block of code?

This answer explains well how to measure the gas used in a block of code. I had actually been using this method before I found that answer: pragma solidity 0.4.26; import './IERC20Token.sol'; ...
0
votes
1answer
277 views

Is there a drawback of setting a too high gas limit for a transaction?

Say, I want to send a transaction that consumes around ~40,000 gas. Could I just set the gas limit of the transaction to 1 million or is there some disadvantage and I should set a more realistic gas ...
0
votes
0answers
52 views

GasToken.io free transaction fails above certain 'threshold'

I've played around with the gastoken.io GST2 contract in remix (and on the mainnet) and immediately stumbled across the following problem: If I want to free previously minted token the execution of ...
0
votes
0answers
34 views

Which are the operations providing gas refund available immediatly for the current running transaction?

Most of gas refund operation aren’t available immediately, but instead increase the refund counter (which if I understand correctly is refunded not after the end of contract creation or call by ...
1
vote
1answer
30 views

Does the 10,000 refund apply to booleans too?

I understand from this thread that you're refunded up to 10,000 gas when setting a value to 0. Does this also apply to boolean values? That is, going from true to false?
1
vote
1answer
119 views

is there any way to have a permanent refund contract for ERC20 tokens?

Im a newbie when it comes to Ethereum but from what I gather, there is a type of crowdsale where if the goal is not met, the investors can send back their tokens and get a refund. However, this is ...
0
votes
1answer
68 views

Which `EVM` bytecode is actually used to “deposit” the transferred Ether?

A quick question. Which EVM opcode is actually used to "deposit" the transferred Ether into the contract? From the EVM opcode list, there are only two opcodes related to the fund transfer: balance and ...
2
votes
0answers
36 views

Is the refund gas paid up-front?

Excerpt from chapter 9 of the yellow paper, "Execution Model", describing the behaviour of the EMV when clearing storage: This refund is effectively paid up-front since the initial usage of a ...
4
votes
2answers
141 views

Understanding the formal description of a transaction and its associated refunds

Excerpt from page 8 of the yellow paper: I fully understand that contracts can self-destruct and, when that happens, according to this thread, all the balance is refunded to the address specified as ...
8
votes
2answers
813 views

Why does delete increase overall gas cost?

My understanding is there is a gas refund for delete and the idea is to encourage developers to remove garbage from contract states. Consider this contract with a delete-enabled index of keys to ...
0
votes
1answer
85 views

Gas usage higher when using the delete keyword

I'm currently working on a marketplace demo for the consensys bootcamp, you can find my entire code here. Stores inside the marketplace (which are structs) are stored inside a mapping and the keys ...
1
vote
1answer
221 views

How to use ETH GAS refund in contracts?

How can we use refunded GAS from a transaction in subsequent ETH transfers? In general, how is refunded GAS used? How can we check the status of the amount of refunded GAS?
1
vote
4answers
105 views

Is our smart contract required gas,every time it executes.

form my understandings, after the first execution of a smart contract, the network will return the remaining gas to the contract sender. if so, how will the contract obtain gas for future execution??...
1
vote
2answers
146 views

Refunding gas fomula in Ethereum yellow paper

After execution of the transaction by miner, the transactor is refunded a remaining gas. it is explained in section 6 of Ethereum's yellow paper. When calculating the amount to be refunded gas, the ...
1
vote
0answers
302 views

Paying for gas on behalf of users?

I'm exploring ways to enable contracts/dApp owners to pay for gas on behalf of users. I know contact abstraction should enable this eventually, and the first step has been done with EIP208 which ...
0
votes
1answer
57 views

storage gas refund, is gas only refunded when storage is completely deleted? What if a key / value in a mapping is deleted?

I have a which tracks ids for some structs for different users. mapping (address => uint[]) usersStuff This mapping for each user can grow or shrink. If it happens to shrink to 0 for a single ...
1
vote
2answers
351 views

How can I claim a refund from a failed ICO (Watertech)

My questions is about claiming a refund from a failed ICO. The ICO in question is WaterTech and the token is WATR
2
votes
2answers
429 views

Resetting storage slot increases gas usage although should decrease it

I have a simple contract that deletes the last element of the array: pragma solidity^0.4.11; contract GasRefundTest { uint[] myArray = [1, 2]; function deleteLastElem() public returns(...
0
votes
2answers
741 views

Can't claim EOS tokens. Problem with GAS amount when claim EOS tokens

To make story short,I participated in 167 EOS distribution period, so i've sent ETH amount to their account 0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf. Then i've registered my public EOS key and right ...
0
votes
2answers
5k views

ICO refund: “Insufficient funds…account you tried to send transaction from does not have enough funds” [duplicate]

EDIT: Please note that this concern revolves around the "Contracts" portion of MyEtherWallet. I'm not trying to send funds from my account, I'm trying to recover funds for a failed ICO using the ...
0
votes
0answers
275 views

Obtaining Gas and Gas Price Solidity

I added the following two lines of code to my function: uint gas_remaining = msg.gas; //irrelevant code.... refund = refund + ((gas_remaining - msg.gas) * tx.gasprice); For some reason this is ...
4
votes
0answers
111 views

Autorefill isn't working on Improved Coin code

I've been trying to write a token contract with the autorefill function, but perhaps the code for the token example on the ethereum website is somewhat outdated, because it isn't working. Did anybody ...
3
votes
0answers
217 views

How to send custom tokens without ether? [duplicate]

I would like my customers to send a custom token without thinking of a certain amount of ether for gas. So I've tried the standard-token at ethereum.org. There's a way described to auto refill the ...
6
votes
1answer
2k views

Is it possible to refund or cancel a contract based wallet transaction?

Is it possible to refund/cancel transactions? I have sent Ether to a merchant and the funds are away from my wallet, but the merchant said I used a wrong wallet... (I sent from my contract wallet ...
21
votes
2answers
2k views

What type of operations have negative gas costs?

I understand that some operations cost negative gas because they free up space on the blockchain, such as selfdestructs. What are all the operations that can have negative gas? Does this only occur ...
6
votes
2answers
2k views

How to know, inside the contract function, the amount of gas that will be refunded in the end

Consider the following situation: my function can be divided into 2 parts Always consumes constant gas; Always results in a refund of 0 < R < 1500000 gas. After the second part had happened, ...
14
votes
3answers
808 views

How come I need to specify a higher gasLimit than estimateGas?

If a contract call predictably requires 41043 of gas to be processed as estimated by estimateGas, how come I need to specify gasLimit of ~70000 to be processed?
18
votes
1answer
6k views

How to clear large arrays without blowing the gas limit?

As posted by redditor ethererik in the post GovernMental's 1100 ETH jackpot payout is stuck because it uses too much gas, 1,100 ethers are stuck in limbo because the payout of this GovernMental ...
5
votes
1answer
762 views

How can contracts be designed to use gas refunds?

A transaction may have some gas refunds, but such refunds can only be used within the transaction: the gas refund is not converted to ether and refunded to the sender's account. How can contracts be ...