Question on debugging/changing coinbase dynamically (Truffle + TestRPC)

Hi, I'm testing the following contract using Truffle framework and deploying on TestRPC network.
I load it up in the browser and it seems to work. What I wonder is if it is possible to change the coinbase dynamically.
For example, after I've send some MetaCoins from user1 to user2 then I want to change the coinbase to user2
and reload the app to show me the MetaCoins balance of user2.
Can I achieve that?

contract MetaCoin {
mapping (address => uint) balances;

function MetaCoin() {
balances[tx.origin] = 10000;
}

function sendCoin(address receiver, uint amount) returns(bool sufficient) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
return true;
}
function getBalanceInEth(address addr) returns(uint){
return ConvertLib.convert(getBalance(addr),2);
}
function getBalance(address addr) returns(uint) {
return balances[addr];
}
}

Comments

Sign In or Register to comment.