Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [contracts/oracle.sol:19:39: TypeError: Data location must be "memory"] #28

Open
reuniware opened this issue Sep 8, 2022 · 4 comments

Comments

@reuniware
Copy link

Hello,

When trying to run the sample at https://fravoll.github.io/solidity-patterns/oracle.html
In Remix.Ethereum.Org
I have the following error :

contracts/oracle.sol:19:39: TypeError: Data location must be "memory" for parameter in function, but none was given.
function __callback(bytes32 myid, string result) public {
^-----------^
@CaledoniaProject
Copy link

Try string memory result

@reuniware
Copy link
Author

Thank you, I'll try that and will let you know if that resolves the issue.

@AshishMeena137
Copy link

Write " bytes32 memory myid, string memory result ". The problem will solve.

@sufyanaslam404
Copy link

In Solidity, variables declared inside functions are by default in the memory data location, except for variables that represent state (defined outside functions), which are in the storage location.

Solidity requires you to specify the data location (memory or storage) for function parameters if they are of array type or struct type.
So write: " bytes32 memory myid, string memory result ". to solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@CaledoniaProject @reuniware @sufyanaslam404 @AshishMeena137 and others