I am getting generic error every time I try to modify the code. I am passing byte32 value as "0xabcd" and address value as "0xca35b7d915458ef540ade6068dfe2f44e8fa733c" in Setaddress function.
The error is as below:
"transact to EternalStorage.setAddress errored: VM error: revert. revert The transaction has been reverted to the initial state. Note: The constructor should be payable if you send value. Debug the transaction to get more information."
Below is my code
pragma solidity ^0.4.17;
contract EternalStorage {
address owner = msg.sender;
address latestVersion;
mapping(bytes32 => uint) uIntStorage;
mapping(bytes32 => address) addressStorage;
modifier onlyLatestVersion() {
require(msg.sender == latestVersion);
_;
}
function upgradeVersion(address _newVersion) public {
require(msg.sender == owner);
latestVersion = _newVersion;
}
// *** Getter Methods ***
function getUint(bytes32 _key) external view returns(uint) {
return uIntStorage[_key];
}
function getAddress(bytes32 _key) external view returns(address) {
return addressStorage[_key];
}
// *** Setter Methods ***
function setUint(bytes32 _key, uint _value) onlyLatestVersion external {
uIntStorage[_key] = _value;
}
function setAddress(bytes32 _key, address _value) onlyLatestVersion external payable{
addressStorage[_key] = _value;
}
// *** Delete Methods ***
function deleteUint(bytes32 _key) onlyLatestVersion external {
delete uIntStorage[_key];
}
function deleteAddress(bytes32 _key) onlyLatestVersion external {
delete addressStorage[_key];
}
}