0

CompileError: @openzeppelin/contracts/utils/Address.sol:56:42: ParserError: Expected ';' but got '{' (bool success, ) = recipient.call{ value: amount }("");

Disclaimer: Learning how to use ERC20 OpenZeppelin code, pardon the elementary question, am a student. Am using pragma solidity >=0.6.1

Here is the OpenZeppelin code

function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }     

And here is the code am migrating

pragma solidity >=0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) public ERC20("RainToken", "Rain") {
        _mint(msg.sender, initialSupply);
    }
}

                             ^

Your Answer

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

Browse other questions tagged or ask your own question.