Skip to content

Instantly share code, notes, and snippets.

@Jesserc
Created November 11, 2023 20:53
Show Gist options
  • Save Jesserc/ab8d70933bea3082b8c6233cfda297fd to your computer and use it in GitHub Desktop.
Save Jesserc/ab8d70933bea3082b8c6233cfda297fd to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "contracts/1_Storage.sol";
contract Example {
// DATA-TYPES
/*
strings, boolean, floats -> 2/10 -> 0.004, 0.04498, 0.033444 (does not exist), integers (uint, int), address, arrays, mapping, structs, enums, bytes
*/
// VALUE TYPES
bool condition;
bool status = true;
// integers (decimals) (uint - ONLY positive integers/numbers, int - negative & positive integers/numbers)
uint integer;
uint number = 10;
// uint num2 = -2; // does not work
int negativeNumber = -20;
int positiveNumber = 20;
// addresses
address myAddress = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4; // 20 bytes - 40 hex characters
// REFERENCE TYPES
// Strings
// string name;
string name = "Jesserc";
// Arrays
// can be made with different value data-types
// you must specify the type of array
bool[] statuses;
}
/*
Basic file structure of smart contracts
*/
// high level language (solidity) -> low level language (bytecode)
/*
An example of a bytecode, generated from a solidity high level code
0x6080604052348015600e575f80fd5b50603e80601a5f395ff3fe60806040525f80fdfea2646970667358221220fde5ef0ba354b59e06f7dd063f42f88063beeb5e929638489fe4fddcba1fafd464736f6c63430008150033
Bytecode (compiled smart contracts) runs on the Ethereum virtual machine (EVM).
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment