I'm learning Solidity and using remix IDE.
My ultimate goal is to store list addresses in one contract and then access them via another contract. But for the sake of simplicity here I consider only one address.
Problem: The address stored in T1 contract is changed when I call it and see it in T2.
pragma solidity ^0.4.4;
contract T1{
address public a;
function T1(){
a=msg.sender;// here I want to store only the owner
}
}
pragma solidity ^0.4.4;
import "./T1.sol";
contract T2{
address public b;
T1 t1=new T1();
function T2(){
b= t1.a(); // here I want to retrive whatever's stored in a, but it
//changes
}
}
Now if you check b, the address is different than I stored in a.
Question: How can I solve the above problem?
Note: I'd like to store the address of people who call contract T1, so I think I have to use msg.sender, not a fixed one, like 0x123.