'Expected ';' but got ',' but below that same error doesn't appear in a .sol file
Hi so my problem is that in the trasnferFrom function where the address from is it tells me Expected ';' but got ',' but in the below function safeTrasferFrom() is doesn't give me that error
function trasferFrom() {
address from,(Here Expected ';' but got ',')
address to,
uint256 tokennId
} public override {
require(
_isApprovedOrOwner(_msgSender(),tokenId),
"ERC721: transfer caller is not owner nor approved"
);
buildings[tokenId - 1].owner = to;
_tranfer(from, to, tokenId)
}
function safeTrasferFrom() {
address from,(but here works)
address to,
uint256 tokennId,
bytes memory _data
} public override{
require(
_isApprovedOrOwner(_msgSender(),tokenId),
"ERC721: transfer caller is not owner nor approved"
);
buildings[tokenId - 1].owner = to;
_safeTrasferFrom(from, to, tokenId, _data)
}
I'm new to the blockchain and coding so it would be really nice to get some help! Thanks!
Solution 1:[1]
Okay so I fixed it lol my problem was that instead of
function trasferFrom() {
address from,(Here Expected ';' but got ',')
address to,
uint256 tokennId
} public override {
require(
_isApprovedOrOwner(_msgSender(),tokenId),
"ERC721: transfer caller is not owner nor approved"
);
buildings[tokenId - 1].owner = to;
_tranfer(from, to, tokenId)
}
it should have been
function trasferFrom(
address from,(Here Expected ';' but got ',')
address to,
uint256 tokennId
) public override {
require(
_isApprovedOrOwner(_msgSender(),tokenId),
"ERC721: transfer caller is not owner nor approved"
);
buildings[tokenId - 1].owner = to;
_tranfer(from, to, tokenId)
}
now I've got another problem but it doesn't have nothing to do with this!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RainbowFcker |
