hey, could someone help me? I’m trying to. create test token using truffle and openzeppelin. But I’m. getting error during compiling! but i’m. using default tutorial box. what am I doing wrong?

Nov 3, 2020, 7:24 PM
What's the error
Nov 3, 2020, 7:24 PM
,@openzeppelin/contracts/utils/Address.sol:53:32: ParserError: Expected ',' but got 'payable'
function sendValue(address payable recipient, uint256 amount) internal {
^-----^
i’ve found how to fix it. but why was it happen? when i’m using tutorial from openzeppelin 🙂
default ERC20 contract
Nov 3, 2020, 7:26 PM
Possibly version mismatch
Happens to me a lot when I try to upgrade 0.4 to 0.7
Nov 3, 2020, 7:33 PM
which version should i use?
Nov 3, 2020, 7:33 PM
Well, latest :)
Nov 3, 2020, 7:34 PM
but im using version from openzepellin’s contract 😄
pragma solidity ^0.6.0;
Nov 3, 2020, 7:35 PM
Hmm that's wierd, coz I just compiled the same code and it works properly...
Nov 3, 2020, 7:39 PM
could you tell me your node version and solc version?
Nov 3, 2020, 7:40 PM
I am on remix
Nov 3, 2020, 7:41 PM
got it, thanks
will continue learing 🙂 then resolve this issue somehow 🙂
Nov 3, 2020, 7:42 PM
💪 keep coding
Nov 3, 2020, 7:42 PM
thanks!
it’s correct version.
https://docs.openzeppelin.com/contracts/3.x/erc20
same issue
Nov 3, 2020, 7:48 PM
Is your function of type payable ?
Nov 3, 2020, 7:53 PM
nope
have an empty contract
pragma solidity ^0.6.0;

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

contract GLDToken is ERC20 {
constructor(uint256 initialSupply) public ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
}
Nov 3, 2020, 7:53 PM
0.4.24?
Nov 3, 2020, 8:06 PM
it’s my local version. i think during compilint another version is used
but im not sure
added into truffle.json
compilers: {
solc: {
version: "^0.6.0"
}
}
and it works! thanks
Nov 3, 2020, 8:08 PM
Solidity ?
Of course
Google our guide
Thanks
Nov 3, 2020, 8:38 PM

© 2024 Draquery.com All rights reserved.