New answers tagged

1

There is no advantage in terms of gas, let alone the fact that you don't even need gas in order to call a read-only function, since no mining is required (but for the sake of this question, let's assume that you call it from an actual state-changing function, which does consume gas). The additional cost of calling a function instead of reading the variable ...


1

Assuming that the contracts you inherit from (ERC20, Pausable, Ownable) are standard contracts and only have their standard functionality, you simply don't have function withdrawETH defined anywhere. You are either using a wrong name or you forgot to implement the function. Furthermore your buying and selling logic is incorrect. Buying should send tokens ...


3

It is not always the case that the latest version is safest. In my opinion, you should not use the latest version as to give it time to be used, tested, and potentially exploited. It is valuable to read the changelog of each version for any bug fixes. For example: Solidity v0.5.16 fixed a bug that was present in all previous versions. If you are using ...


1

Let's see this function : function getERCapprove(IERC20 _token, address _spender, uint256 _value) public returns (bool){ return _token.approve(_spender, _value); } Here the Stacking contract approves _spender for _token. What you are looking for is the opposite : the user approves the Stacking contract to let it transfer his tokens in the ...


0

It should be fine if you inherit from ERC20, but in this case it is not necessary. You can invoke ERC20 constructor directly since it is a base for ERC20Burnable. contract Token is ERC20Burnable { constructor() ERC20("My token", "ToK") public { } } Solidity has some limitations so perhaps its behavior may be arbitrary.


Top 50 recent answers are included