Skip to content

Instantly share code, notes, and snippets.

View sepisoltani's full-sized avatar
🎯
Focusing

Sepehr Soltani sepisoltani

🎯
Focusing
View GitHub Profile
contract Example{
function test() public {
//6e91ec6b618bb462a4a6ee5aa2cb0e9cf30f7a052bb467b0ba58b8748c00d2e5
keccak256(abi.encodePacked("aaaab"));
//b1f078126895a1424524de5321b339ab00408010b7cf0e6ed451514981e58aa9
keccak256(abi.encodePacked("aaaac"));
}
contract Example{
string name = "sepehr";
function _multiply(uint a, uint b) private pure returns (uint) {
return a * b;
}
}
contract Example{
string x = "hello";
function sayHello() public view returns (string memory) {
return x;
}
}
contract Example{
string x = "hello";
function sayHello() public returns (string memory) {
return x;
}
}
contract Example{
uint[] numbers;
function _addToArray(uint _number) private {
numbers.push(_number);
}
}
contract Example{
struct Person {
uint age;
string name;
}
Person[] public people;
function createNewPersonAndAddToArray() public {
contract Example{
eatHotDogs("sepehr", 100);
}
contract Example{
function eatHotDogs(string memory _name, uint _amount) public {
}
}
contract Example{
Person[] people; // dynamic Array, we can keep adding to it
}
contract Example{
// Array with a fixed length of 2 elements:
uint[2] fixedArray;
// another fixed Array, can contain 5 strings:
string[5] stringArray;
// a dynamic Array - has no fixed size, can keep growing:
uint[] dynamicArray;