There are 3 contracts; A
, B
, and C
. C
has a state variable with a default value. A
changes that state variable to Yerevan
. After that, B
sees that variable. Evaluating by A
is successful but B
sees the default value again. It appears that B
cannot call a updated smart contract. How can i change a state variable by an other smart contract permanently? is there any related work? please guide a beginner man. Thank you.
C:
pragma solidity ^0.5.12;
contract C{
bytes public name;
function rep(bytes memory pseudonym) public returns(string memory){
name=pseudonym;
return string(name);
}
}
A:
pragma solidity ^0.5.12;
import "./C.sol";
contract A{
bytes public fname="Yerevan";
function naming() public returns(string memory){
return C(0x8fcECc5B8d42EcF099E1cF032B1F505fbDA230A3).rep(fname);
}
}
B:
pragma solidity ^0.5.12;
import "./C.sol";
contract B{
function rep() public returns(string memory){
return string(C(0x8fcECc5B8d42EcF099E1cF032B1F505fbDA230A3).name());
}
}
C c=new C()
used for in here???