Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created August 20, 2022 18:42
Show Gist options
  • Save libert-xyz/64186ae5e5e24a771b18a751e4d39cf7 to your computer and use it in GitHub Desktop.
Save libert-xyz/64186ae5e5e24a771b18a751e4d39cf7 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.16+commit.07a7930e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract DataTypes {
bool public boo = true;
// unit is only for positive integers
uint8 public u8 = 1;
uint16 public u16 = 14;
uint256 public u256 = 476;
uint public udefault = 566;
// Negative integers are allowed with int
int public negative = -412;
int public negative2 = -8;
int public intpostitive = 32;
//Checking min and max of the int value type
int public minInt = type(int).min;
int public maxInt = type(int).max;
int8 public minInt8 = type(int8).min;
int8 public maxInt8 = type(int8).max;
uint8 public minuInt8 = type(uint8).min;
uint8 public maxuInt8 = type(uint8).max;
//Adress value type
address public addr = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c;
//Bytes are a sequence of bytes or dynamic array of bytes
bytes1 a = 0xb5;
bytes1 public byteb = 0x56; // [01010110]
//Unassiged variables have default values
bool public defaultBoo; //False
uint public defaultUint; //0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment