Hallo, ich habe nach aktualisierbaren/aktualisierbaren Verträgen gesucht, dann habe ich diesen Rocket Pool von David Rugendyke https://gist.github.com/darcius/6e8fa4faa6d9139f3950b6f1d9e96038 gefunden
/// @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);
}
_;
}
Könnte mir jemand helfen, diese beiden Zeilen zu verstehen:
keccak256("contract.storage.initialised")
keccak256("contract.address", msg.sender)
http://solidity.readthedocs.io/en/develop/units-and-global-variables.html#mathematical-and-cryptographic-functions
Ich weiß, dass keccak256(...) oder sha3(...) das Ethereum berechnet- SHA-3 (Keccak-256) Hash der (dicht gepackten) Argumente, gibt dann (bytes32) zurück
aber ich konnte keinen Hinweis zu ".initialized" finden. Danke
Wie @smarx erwähnt hat, sind die Zeichenfolgen in diesem Fall völlig willkürlich. Die Verwendung von Keccak256 besteht darin, die Zeichenfolgen programmgesteuert vergleichen zu können.
Wie vergleicht man Saiten in Festigkeit?
function compareStrings (string a, string b) view returns (bool){
return keccak256(a) == keccak256(b);
}
Benutzer19510