Created
June 20, 2024 10:03
-
-
Save nerderlyne/51793c9cf46c54960d39ea8aa132fc61 to your computer and use it in GitHub Desktop.
calculate key, slot and value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.25; | |
contract MADV { | |
function getKey(address validator) public pure returns (uint192) { | |
return uint192(uint160(validator)); | |
} | |
function getSlotAndValue(address validator) public pure returns (bytes32 slot, bytes32 value) { | |
slot = bytes32(abi.encodePacked(getKey(validator))); | |
value = bytes32(abi.encodePacked(validator)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment