0

Lets say I have a contract including the following:

uint256 public _burnFee = 3;

function setBurnFeePercent(uint256 burnFee) external onlyOwner {
        _burnFee = burnFee;
}

I compile and deploy this contract on remix and remix shows me all the functions on its interface.

Do i need to actually pass a value and call the function setBurnFeePercent or is it already running?

0

Once a contract is deployed, it does not "run itself". Functions always need to be called if you want the contract to do anything. They can be called directly or by another contract.

  • In your example, the setBurnFeePercent function takes one parameter, a uint256.
  • The function can only be called externally (the external keyword), which means that your contract cannot call it from another function.
  • It can only be called by the address set as owner of the contract (the modifier onlyOwner).
  • Finally, once successfully called, it will replace the _burnFee value by the uint256 passed as a parameter and save it on the blockchain until it is changed again through another function call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.