Skip to content

Instantly share code, notes, and snippets.

@hihiben
Created August 2, 2022 02:55
Show Gist options
  • Save hihiben/886ee64a267e4d12bf329b19d9a9a8eb to your computer and use it in GitHub Desktop.
Save hihiben/886ee64a267e4d12bf329b19d9a9a8eb to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
library LibFacet1 {
bytes32 constant storagePosition = keccak256("diamond.storage.LibFacet1");
struct DiamondStorage {
uint256 n;
}
function diamondStorage() internal pure returns (DiamondStorage storage ds) {
bytes32 position = storagePosition;
assembly {
ds.slot := position
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment