diff --git a/libs/remix-debug/src/solidity-decoder/decodeInfo.ts b/libs/remix-debug/src/solidity-decoder/decodeInfo.ts index 5384b1af86..d506e5ca3e 100644 --- a/libs/remix-debug/src/solidity-decoder/decodeInfo.ts +++ b/libs/remix-debug/src/solidity-decoder/decodeInfo.ts @@ -336,7 +336,9 @@ function computeOffsets (types, stateDefinitions, contractName, location) { console.log('unable to retrieve decode info of ' + variable.typeDescriptions.typeString) return null } - if (!variable.constant && storagelocation.offset + type.storageBytes > 32) { + const immutable = variable.mutability === 'immutable' + const hasStorageSlots = !immutable && !variable.constant + if (hasStorageSlots && storagelocation.offset + type.storageBytes > 32) { storagelocation.slot++ storagelocation.offset = 0 } @@ -344,12 +346,13 @@ function computeOffsets (types, stateDefinitions, contractName, location) { name: variable.name, type: type, constant: variable.constant, + immutable, storagelocation: { - offset: variable.constant ? 0 : storagelocation.offset, - slot: variable.constant ? 0 : storagelocation.slot + offset: !hasStorageSlots ? 0 : storagelocation.offset, + slot: !hasStorageSlots ? 0 : storagelocation.slot } }) - if (!variable.constant) { + if (hasStorageSlots) { if (type.storageSlots === 1 && storagelocation.offset + type.storageBytes <= 32) { storagelocation.offset += type.storageBytes } else { diff --git a/libs/remix-debug/src/solidity-decoder/stateDecoder.ts b/libs/remix-debug/src/solidity-decoder/stateDecoder.ts index 0e27ac740c..b7908da3c3 100644 --- a/libs/remix-debug/src/solidity-decoder/stateDecoder.ts +++ b/libs/remix-debug/src/solidity-decoder/stateDecoder.ts @@ -15,9 +15,13 @@ export async function decodeState (stateVars, storageResolver) { try { const decoded = await stateVar.type.decodeFromStorage(stateVar.storagelocation, storageResolver) decoded.constant = stateVar.constant + decoded.immutable = stateVar.immutable if (decoded.constant) { decoded.value = '' } + if (decoded.immutable) { + decoded.value = '' + } ret[stateVar.name] = decoded } catch (e) { console.log(e)