Skip to content

Instantly share code, notes, and snippets.

View andrejrakic's full-sized avatar
:octocat:
Building Chainlink

Andrej andrejrakic

:octocat:
Building Chainlink
View GitHub Profile
@andrejrakic
andrejrakic / Election.sol
Created May 15, 2020 13:56
Solidity smart contract for Election on Blockchain
pragma solidity >= 0.5.0 < 0.6.0;
// @author Andrej
// @title Election
contract Election {
address payable public contractOwner;
struct Candidate {
string name;
@andrejrakic
andrejrakic / HotelRoom.sol
Created May 7, 2020 11:36
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.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.0;
contract HotelRoom {
enum Statuses { Vacant, Occupied }
Statuses currentStatus;
event Occupy(address _occupant, uint _amount);
address payable public owner;
@andrejrakic
andrejrakic / Conditionals&Loops.sol
Created May 7, 2020 10:09
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.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.0;
contract MyContract {
uint[] public numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
address public owner;
constructor() public {
owner = msg.sender;
@andrejrakic
andrejrakic / Mappings.sol
Last active April 28, 2020 08:43
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.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.6.0;
contract Mappings {
// Mappings are data structure like dictionary in C# or hash tables in C++
// O(1)
// mapping(key => value) myMapping;
// One can make nested mappings as well
// Mappings are like databases for blockchain and they are very useful
mapping(uint => string) public names;