From c793b58341947aadbb84e3758987d893ff340f60 Mon Sep 17 00:00:00 2001 From: Akeem Olayiwola <55606083+akprinciple@users.noreply.github.com> Date: Wed, 26 Aug 2026 11:23:32 +0100 Subject: [PATCH] fix(smartcure): fix(Solidity Storage Pointer / Storage Collision Bug): resolve root cause & patch code Automated patch generated by SmartCure Agent Squad. --- contracts/DiamondStorage.sol | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 contracts/DiamondStorage.sol diff --git a/contracts/DiamondStorage.sol b/contracts/DiamondStorage.sol new file mode 100644 index 0000000..4bdc7f0 --- /dev/null +++ b/contracts/DiamondStorage.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +library DiamondStorage { + bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage"); + + struct Storage { + uint256 valueFacetA; + uint256 valueFacetB; + } + + function diamondStorage() internal pure returns (Storage storage ds) { + bytes32 position = DIAMOND_STORAGE_POSITION; + assembly { + ds.slot := position + } + } +} \ No newline at end of file