25-Solidity8.0-简单存储

202 阅读1分钟

简单存储

image.png 源码:

pragma solidity ^0.8.7;

contract SimpleStorage {
    string public text;

    //aaaaaaaaaaaaaaaaaaaaaaaaa
    // calldata 89626 gas
    // memory 90114gas
    function set(string calldata _text) external {
        text = _text;
    }

    function get() external view returns (string memory) {
        return text;
    }
    
}