This gist details the decisions I made, the tests I conducted, the observations recorded, and the directions I took while building out an API for Project Greenfield.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
/** Simple contract to store Ether */ | |
contract Vault | |
{ | |
address owner; | |
uint balance; | |
// Modifier for authenticating owner | |
modifier ownerOnly(address _owner) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
/** Simple fund raising contract */ | |
contract Donation | |
{ | |
address beneficiary; | |
uint donations; | |
uint goal; | |
uint amountRaised; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
contract Escrow { | |
address public buyer; | |
address public seller; | |
uint public balance; | |
uint public requiredDeposit; | |
uint public price; | |
uint public sellerCollateral; | |
uint public buyerCollateral; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
contract ID { | |
address creator; | |
struct identity { | |
string name; | |
uint age; | |
uint height; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.18; | |
contract login { | |
address creator; | |
struct account { | |
bytes32 username; | |
bool admin; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.8; | |
contract FunBucks { | |
struct accounts { | |
string name; | |
uint balance; | |
bool active; | |
bool funOfficer; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 Syntax | |
function Person(firstName,lastName,age) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.age = age; | |
this.sayName = function() { | |
return 'Hello, my name is ' + this.firstName + ' ' + this.lastName + '.'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Numbers pipeline | |
const nums = [10, 20, 30, 40]; // Array of numbers | |
let addNums = nums => nums.reduce((acc, x) => acc + x); // Adds all numbers in an array together | |
let divideByTwo = number => number / 2; | |
// Function to be used as callback in reduce. Will pass function a as an argument (callback) in function b (higher order function). | |
let _pipe = (a,b) => arg => b(a(arg)) | |
// Reduces a potentially infinite number of operations using the above '_pipe' function. | |
// This allows two function at a time, one as a callback to the other (higher order) function. The result of which is then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--primary-font: "Poppins", "sans-serif"; | |
--font-color: #525252; | |
--font-light: #707070; | |
} | |
body { | |
font-family: var(--primary-font); | |
margin: 0; | |
overflow-x: hidden; |