mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 06:38:05 -05:00
37 lines
1.4 KiB
Solidity
37 lines
1.4 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.15;
|
|
|
|
import {ILensVersion} from 'contracts/interfaces/ILensVersion.sol';
|
|
import {Errors} from 'contracts/libraries/constants/Errors.sol';
|
|
import {TransparentUpgradeableProxy} from '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol';
|
|
|
|
contract LensVersion is ILensVersion {
|
|
string internal constant version = '2.0.4';
|
|
|
|
bytes20 internal constant gitCommit = hex'91fb968ff155ed065dad4146f65a1a8c45b8f922';
|
|
|
|
event LensUpgradeVersion(address implementation, string version, bytes20 gitCommit, uint256 timestamp);
|
|
|
|
/// @inheritdoc ILensVersion
|
|
function getVersion() external pure override returns (string memory) {
|
|
return version;
|
|
}
|
|
|
|
/// @inheritdoc ILensVersion
|
|
function getGitCommit() external pure override returns (bytes20) {
|
|
return gitCommit;
|
|
}
|
|
|
|
function emitVersion() external {
|
|
(, bytes memory adminData) = address(this).delegatecall(abi.encodeCall(TransparentUpgradeableProxy.admin, ()));
|
|
(, bytes memory implementationData) = address(this).delegatecall(
|
|
abi.encodeCall(TransparentUpgradeableProxy.implementation, ())
|
|
);
|
|
if (msg.sender != abi.decode(adminData, (address))) {
|
|
revert Errors.NotHub();
|
|
}
|
|
emit LensUpgradeVersion(abi.decode(implementationData, (address)), version, gitCommit, block.timestamp);
|
|
}
|
|
}
|