// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract Preservation{
address public timeZoneLibrary ;
address public owner ;
uint256 storedTime ;
//Sets the function signature for delegateCall
bytes4 constant setTimeSignature = bytes4(keccak256("setTime(uint256)"));
constructor(
address libraryAddr
){
timeZoneLibrary = libraryAddr;
owner = msg.sender;
}
function setFirstTime(uint256 _timeStamp) public {
timeZoneLibrary.delegatecall(abi.encodePacked(setTimeSignature, _timeStamp));
}
}
contract LibraryContract {
// stores a timestamp
uint storedTime;
function setTime(uint256 _timeStamp) public {
storedTime = _timeStamp ;
Preservation p = Preservation(address(this));
p.owner() = msg.sender ;
}
}
I was trying to modify the LibraryContract's setTime function , to make it reset the owner .
In terms of the current output , it said the expression needs to be an lvalue (i.e. referring to the last line of code p.owner()) .