Open2

Solidityの勉強記録

kojikoji

001 Hello World

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract HelloWorld {
    string public greet = "Hello World";
}
kojikoji

002 Data Types

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract ValueTypes {
    bool public b = true;
    uint public u = 123; // uint = uint256 0 to 2**256-1
                         // uint8  0 to 2**8-1
                         // uint16 0 to 2**16-1
    int public i = -123; // int = int256 -2**256-1 to 2**256-1
                         // int128 -2**128-1 to 2**128-1
    int public minInt = type(int).min;
    int public maxInt = type(int).max;
    address public addr = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
    bytes32 public b32 = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4dfaB03FcB875f56beddC4dfa;
    bytes1 a = 0xb5;
}