Skip to content

Instantly share code, notes, and snippets.

View khofesh's full-sized avatar
🏠
Working from home

Fahmi Ahmad khofesh

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am khofesh on github.
  • I am fahmiahmad (https://keybase.io/fahmiahmad) on keybase.
  • I have a public key ASDu7dItkCcQcu_Fz1Omwq52JhOXPjE1G9knaRUM42tNMQo

To claim this, I am signing this object:

@khofesh
khofesh / contracts...1_Storage.sol
Created September 8, 2021 15:05
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
@khofesh
khofesh / contracts...2_Owner.sol
Created September 8, 2021 15:06
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title Owner
* @dev Set & change owner
*/
contract Owner {
@khofesh
khofesh / contracts...3_Ballot.sol
Created September 8, 2021 15:06
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title Ballot
* @dev Implements voting process along with vote delegation
*/
contract Ballot {
@khofesh
khofesh / contracts...MyContracts.sol
Created September 8, 2021 15:06
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
contract MyContracts {
string public myString = "Hello World!";
}
@khofesh
khofesh / contracts...Variables.sol
Created September 8, 2021 15:06
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
contract WorkingWithVariables {
uint256 public myUint;
bool public myBool;
uint8 public myUint8;
address public myAddress;
string public myString = "Ethereum is cool!";
function setMyUint(uint256 _myUint) public {
@khofesh
khofesh / contracts...SendMoney.sol
Created September 8, 2021 15:07
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
contract SendMoney {
uint public balanceReceived;
uint public lockedUntil;
function receiveMoney() public payable {
balanceReceived += msg.value;
lockedUntil = block.timestamp + 1 minutes;
}
@khofesh
khofesh / contracts...StartingStopping.sol
Created September 8, 2021 15:07
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
contract StartingStopping {
address public owner;
bool public paused;
constructor() {
owner = msg.sender;
}
@khofesh
khofesh / contracts...SimpleMappingExample.sol
Created September 8, 2021 15:07
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
contract SimpleMappingExample {
mapping(uint => bool) public myMapping;
mapping(address => bool) public myAddressMapping;
mapping (uint => mapping(uint => bool)) uintUintBoolMapping;
function setValue(uint _index) public {
myMapping[_index] = true;
}
@khofesh
khofesh / contracts...mappingStructs.sol
Created September 8, 2021 15:07
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.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract MappingsStructExample {
struct Payment {
uint amount;
uint timestamp;
}