Skip to content
Verified contractExactMIT

AddrStorage

Address0xe7a0b825238515709e075a85d69bb0e24fccf34e
Balance

0 ETH

 

Transactions

3

 

Compiler

solc 0.8.26

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
21,650,496
Creation transaction
0xe6a94e34b9…7437d41743

02.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract AddrStorage {
    // 合约部署者
    address public owner;

    // 指定的固定地址
    address public constant fixedManager = 0x053c9A21721d98eC030CC538d3900aEE54645288;

    // 存储的字符串
    string private storedString;

    // 仅部署者或固定地址可执行的修饰器
    modifier onlyAuthorized() {
        require(
            msg.sender == owner || msg.sender == fixedManager,
            "Caller is not authorized"
        );
        _;
    }

    // 构造函数:在部署时设置合约创建者并初始化字符串
    constructor(string memory initString) {
        owner = msg.sender;
        storedString = initString;
    }

    // 对外提供读取字符串的方法
    function getAddrString() external view returns (string memory) {
        return storedString;
    }

    // 修改字符串,只允许合约创建者或指定地址调用
    function setAddrString(string calldata newString) external onlyAuthorized {
        storedString = newString;
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.