Skip to content

Instantly share code, notes, and snippets.

View jeroenouw's full-sized avatar
🎯
Focusing

jeroenouw jeroenouw

🎯
Focusing
View GitHub Profile
@jeroenouw
jeroenouw / Freelancer.sol
Created September 3, 2018 13:06
Freelancer.sol
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
/** @title Freelancer contract */
contract Freelancer {
address public owner;
uint256 private coins;
uint256 private cash;
bytes32 private service;
@jeroenouw
jeroenouw / contract.sol
Last active September 3, 2018 13:15
contract with global variables
contract Freelancer {
address public owner;
uint256 private coins;
uint256 private cash;
bytes32 private service;
/* here comes all the code */
}
@jeroenouw
jeroenouw / events.sol
Created September 3, 2018 13:09
events
event logFreelancerChanged(
address indexed owner,
bytes32 firstname,
bytes32 lastname,
uint256 coins,
uint256 cash,
bytes32 service
);
event logAssetsChanged(address indexed owner, uint256 coins, uint256 cash, bytes32 service);
@jeroenouw
jeroenouw / struct.sol
Last active September 3, 2018 13:13
struct
struct FreelancerData {
bytes32 firstname;
bytes32 lastname;
uint256 coins;
uint256 cash;
bytes32 service;
}
@jeroenouw
jeroenouw / mapping.sol
Created September 3, 2018 13:10
mapping
mapping (address => FreelancerData) FreelancersData;
@jeroenouw
jeroenouw / modifier.sol
Last active September 3, 2018 13:12
modifier
/**
* @dev Modifier which checks if sender is equal to owner.
*/
modifier onlyFreelancer() {
require(owner == msg.sender, "Sender not authorized.");
_;
}
@jeroenouw
jeroenouw / constructor.sol
Created September 3, 2018 13:10
constructor
/**
* @dev Constructor which inits at contract creation.
*/
constructor() public {
owner = msg.sender;
coins = 0;
cash = 0;
service = "";
}
@jeroenouw
jeroenouw / functions.sol
Created September 3, 2018 13:11
functions
/**
* @dev Sets all data for freelancer
* @param _firstname The first name of the freelancer
* @param _lastname The last name of the freelancer
* @param _coins Amount of coins available
* @param _cash Amount of cash available
* @param _service Service offered by the freelancer
* @return FreelancerData struct of the owner
*/
function setFreelancer(
@jeroenouw
jeroenouw / versions.sol
Created September 3, 2018 13:14
versions
pragma solidity 0.4.24;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
import 'package:flutter/material.dart';
class ReusableScreen extends StatelessWidget {
final String screenTitle;
final IconData tileIcon;
final String tileTitle;
final String tileSubtitle;
final Function cancelButtonAction;
final Function proceedButtonAction;