嗨,我在寻找可升级/可升级的合同,然后我找到了大卫鲁根代克https://gist.github.com/darcius/6e8fa4faa6d9139f3950b6f1d9e96038的火箭池
/// @dev Only allow access from the latest version of a contract in the Rocket Pool network after deployment
modifier onlyLatestRocketNetworkContract() {
/* The owner is only allowed to set the storage upon deployment
to register the initial contracts, afterwards their direct access is disabled
only allow the owner of the storage contract to access these methods directly to set
some initial contract addresses during deployment,
after deployment their access is removed to ensure only visible contract methods
can write to storage. From then on, only registered contracts within the Rocket Pool network
can write to storage.
*/
if (msg.sender == owner) {
require(boolStorage[keccak256("contract.storage.initialised")] == false);
} else {
// Make sure the access is permitted to only contracts in our Dapp
require(addressStorage[keccak256("contract.address", msg.sender)] != 0x0);
}
_;
}有人能帮我理解这两句话吗?
keccak256("contract.storage.initialised")
keccak256("contract.address",msg.sender)
http://solidity.readthedocs.io/en/develop/units-and-global-variables.html#mathematical-and-cryptographic-functions
我知道keccak256(.)或sha3(.)计算(紧密打包的)参数的etuum-Sha-3 (Keccak-256)散列,然后返回(bytes32)。
但是我找不到任何关于".initialised“的参考资料谢谢
发布于 2018-01-13 22:12:32
正如@smarx所提到的,在这种情况下,字符串完全是任意的。Keccak256的使用是为了能够以编程方式比较字符串。
function compareStrings (string a, string b) view returns (bool){
return keccak256(a) == keccak256(b);
}https://ethereum.stackexchange.com/questions/36138
复制相似问题