Skip to content

Instantly share code, notes, and snippets.

@stupeters187
stupeters187 / BBBFA.md
Last active March 22, 2019 12:19
Bermuda Blockchain Bootcamp - Technical Track Final Assignment

Bermuda Blockchain Bootcamp - Technical Track Final Assignment

Assignment Specifications:

  • Build a smart contract using the Solidity programming language

  • The contract must have a minimum of 4 functions

  • The contract must utilize a minimum of 1 data structure (array, mapping)

@stupeters187
stupeters187 / reentrancy.sol.js
Created February 14, 2019 17:18
Reentrancy Attack
pragma solidity ^0.5.0;
contract EthStorage {
uint maxWithdrawl = 1 ether;
mapping(address => uint) public balances;
function deposit() public payable {
balances[msg.sender] += msg.value;
@stupeters187
stupeters187 / ERC777.sol.js
Created January 24, 2019 18:52
ERC777 Example
interface ERC777Token {
function name() public view returns (string);
function symbol() public view returns (string);
function totalSupply() public view returns (uint256);
function balanceOf(address owner) public view returns (uint256);
function granularity() public view returns (uint256);
function defaultOperators() public view returns (address[]);
function authorizeOperator(address operator) public;
function revokeOperator(address operator) public;
@stupeters187
stupeters187 / ERC721.sol.js
Created January 24, 2019 18:36
ERC 721 Example
pragma solidity ^0.4.20;
/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any NFT changes by any mechanism.
/// This event emits when NFTs are created (`from` == 0) and destroyed
/// (`to` == 0). Exception: during contract creation, any number of NFTs
/// may be created and assigned without emitting Transfer. At the time of
@stupeters187
stupeters187 / erc223.sol.js
Last active January 24, 2019 19:48
ERC223 Token Example
pragma solidity ^0.4.9;
/* New ERC223 contract interface */
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
@stupeters187
stupeters187 / ERC20.sol.js
Last active January 24, 2019 19:48
ERC20 Token Example
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
@stupeters187
stupeters187 / Crowdfund.sol.js
Created January 18, 2019 16:08
Crowdfunding Smart Contract Example
pragma solidity 0.5.2;
contract Crowdfunding {
address payable beneficiary;
uint goalInEther;
uint deadline;
mapping (address => uint) public contributions;
@stupeters187
stupeters187 / Escrow.sol.js
Last active March 14, 2019 22:07
Escrow Smart Contract Example
pragma solidity 0.5.2;
contract Escrow {
//state variables
address payable buyer;
address payable seller;
address arbiter;
uint public amountInWei;
@stupeters187
stupeters187 / HelloWorld.sol.js
Created January 18, 2019 16:04
Hello World Solidity Smart Contract
pragma solidity ^0.5.2;
contract HelloWorld {
uint public num;
event NewNum(address indexed _who, uint _newNum, uint _timestamp);
constructor(uint _num) public {
num = _num;
pragma solidity ^0.4.25;
contract Escrow {
address public buyer;
address public seller;
address public arbiter;
uint256 public escrowAmount;
constructor(address _buyer, address _arbiter, uint256 _escrowAmount) public {