current position:Home>The "gas deduction" function appears in the "solid require" function?

The "gas deduction" function appears in the "solid require" function?

2022-02-03 20:51:55 Q & A of Denglian community

difference :assert(): Imagine it as an overly confident way to achieve , Even if there are mistakes , Will also execute and deduct gas.require(): Imagine it as a more polite way to achieve , You will find errors , And forgive your mistakes ( Translation notes : No deduction gas).revert(): After encountering invalid code , All States will still be rolled back , But it will be used in two different ways “ Invalid code ” Method handling : Allows you to return a numeric value , Will remain gas Return the caller .

pragma solidity ^0.4.10;contract PayTest {    address owner;    function useSuperPowers(){        require(msg.sender == owner);    }}

gas It's not necessary ether Can you change it ? I executed the code ,require The function will deduct gas(ether)?




Take the answer 1:

This is just a hint of how much money your account has , It has something to do with executing code .

gas The limitation of , adopt Gas Limit To set up .

The deducted ether is consumed gas * gas price.

stay Remix There is no need to set the gas price, gas price There will be a default value , It looks like it is. 100Gwei.




copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032051538490.html

Random recommended