Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

'Runtime Error: revert' - when creating contract from contract #958

Closed
tapmapp opened this issue Apr 8, 2021 · 4 comments
Closed

'Runtime Error: revert' - when creating contract from contract #958

tapmapp opened this issue Apr 8, 2021 · 4 comments

Comments

@tapmapp
Copy link

tapmapp commented Apr 8, 2021

Hello, I have this basic contracts in solidity but when i try to create a contract from another contract I have this 'Runtime Error: revert'

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;

contract User {

string public name;

constructor(string memory _name) public payable {
name = _name;
}

function getUserName() public view returns(string memory _name) {
return name;
}

}

contract Users {

User[] public users;
User public user;

function create(string memory _name) public {
User user = new User(_name);
}

function getUsers() public view returns (User[] memory _users) {
return users;
}

function getUser() public view returns (User _user) {
return user;
}

}

@trufflesuite trufflesuite deleted a comment Apr 9, 2021
@haydenyoung
Copy link

haydenyoung commented May 13, 2021

I was interested in this issue as it sounds like (but may not be) related to a new issue I recently opened #956.

@tapmapp
Copy link
Author

tapmapp commented May 13, 2021

I was interested in this issue as it sounds like (but may not be) related to a new issue I recently opened #827 (comment).

I was able to fix it, it seems it was related with the solidity version I was using on my smart contracts.
With this config on the top of the smart contract everything seems fine.

// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

Cheers! :P

@haydenyoung
Copy link

@tapmapp Thanks for the suggestion. Unfortunately, it didn't seem to resolve my issue so assuming it is unrelated.

@davidmurdoch davidmurdoch transferred this issue from trufflesuite/ganache-cli-archive Aug 19, 2021
@davidmurdoch
Copy link
Member

Closing as it seems the original issue has been resolved. Please comment below if you are still having issues.

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

No branches or pull requests

3 participants