账户
0xfa...a92c
0xfA...A92c

0xfA...A92c

$500
此合同的源代码已经过验证!
合同元数据
编译器
0.8.22+commit.4fc1097e
语言
Solidity
合同源代码
文件 1 的 1:MyFirstScrollContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract MyFirstScrollContract {
    // Public statement accessible by anyone to see that this is your first contract
    string public firstContractStatement;

    // Address of the contract owner
    address public contractOwner;

    // Event to log the affirmation of the first contract and owner
    event Affirmation(address owner, string statement);

    // The initializer serves as a constructor substitute
    function initialize() public {
        // Ensure that this function behaves like a constructor and is called only once
        require(contractOwner == address(0), "Already initialized");

        // Set the owner to the sender of the transaction
        contractOwner = msg.sender;

        // A simple statement indicating this is your first contract on Scroll Network
        firstContractStatement = "This is my first contract on the Scroll Network.";

        // Emit an event to log the action
        emit Affirmation(contractOwner, firstContractStatement);
    }

    // Function to affirm the contract's purpose
    function affirmContract() public view returns (string memory) {
        require(
            msg.sender == contractOwner,
            "Only the owner can affirm the contract."
        );
        return firstContractStatement;
    }
}
设置
{
  "compilationTarget": {
    "MyFirstScrollContract.sol": "MyFirstScrollContract"
  },
  "evmVersion": "shanghai",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"string","name":"statement","type":"string"}],"name":"Affirmation","type":"event"},{"inputs":[],"name":"affirmContract","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"firstContractStatement","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"}]