Import value from other contract

2018-05-16 17:23:08

I am trying to pass configuration values from one contract to another, so I can change them and avoid transaction fees.

I have two contracts:

pragma solidity ^0.4.23;

import "./two.sol";

contract One{

string name;

constructor() public{

}

Two two;

function getNameFromOtherContract() public returns(string) {

name = two.getName();

return name;

}

}

And second:

pragma solidity ^0.4.23;

contract Two{

constructor() public{

}

function getName() external pure returns (string name) {

name = "Amel";

}

}

When I triger getNameFromOtherContract I get:

transact to One.getNameFromOtherContract errored: VM error: revert.

revert The transaction has been reverted to the initial state.

What would be the correct syntax and solution for this approach?