Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"test.sol": {
"content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.20;\r
\r
contract CN1Storage {\r
address public immutable admin;\r
string private _cn1;\r
\r
event CN1Updated(string oldValue, string newValue);\r
\r
error NotAdmin();\r
error ValueTooLong();\r
\r
uint256 public constant MAX_LEN = 1024;\r
\r
constructor(string memory initial) {\r
admin = msg.sender;\r
_set(initial);\r
}\r
\r
modifier onlyAdmin() {\r
if (msg.sender != admin) revert NotAdmin();\r
_;\r
}\r
\r
function cn1() external view returns (string memory) {\r
return _cn1;\r
}\r
\r
function updateCN1(string calldata newValue) external onlyAdmin {\r
_set(newValue);\r
}\r
\r
function _set(string memory v) internal {\r
if (bytes(v).length > MAX_LEN) revert ValueTooLong();\r
string memory old = _cn1;\r
_cn1 = v;\r
emit CN1Updated(old, v);\r
}\r
}"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": []
}
}}
Submitted on: 2025-11-07 13:35:13
Comments
Log in to comment.
No comments yet.