I am defining a contract and I want to ensure a particular member variable can only be modified by me. So, specifically I want to ensure that if someone else deploys one of my contracts, then they will not be able to modify this variable.
To do this I tried to hard-code my address, and test against msg.sender in the setter
contract Sample {
address constant public myAddress = 0xe0f5206bbd039e7b0592d8918820024e2a7437b9;
uint public vari;
function setVari(uint a) {
if(msg.sender == myAddress) {
vari = a;
}
}
}
When I compile this, I get the following error
Warning: This looks like an address but has an invalid checksum. If this is not used as an address, please prepend '00'.
address constant public myAddress = 0xe0f5206bbd039e7b0592d8918820024e2a7437b9;
^----------------------------------------^
And when I try to modify this variable within geth using
myInstance.setVari.sendTransaction(22, {from: eth.accounts[0]})
the value of "vari" is not updated. (Where eth.accounts[0] is the hardcoded address in the source.)
However, if I remove the protection within setVari(), everything works as expected.
This implies to me that everything I'm doing is correct, except the hard-coding of my address.
Can anyone help? How do I hard code my account into a contract?
Thanks!
Note: the address included is one I'm using on a private test network, so you won't be able to find it in the public network. However, I got the same compiler warning when I tried hard-coding one of my real accounts addresses.