I am doing a criptoCoin and I am using Solidity. I have an issue when create a crowdsale on function transfer(address receiver, uint amount);
} the compile said No visibility specified. Defaulting to "public".
function transfer(address receiver, uint amount);
^-----------------------------------------------^\
There's nothing necessarily wrong with your code - the compiler is just warning you that you didn't specify a visibility scope, and that it'll be defaulting it to public
.
Something like this is probably what you want:
function transfer(address receiver, uint amount) external {}
The external
keyword just means that the function can only be called from outside the contract - i.e. by other contracts/addresses on the Ethereum network. Other options include public
, private
, and internal
. You can read more about these visibility keywords here.