Skip to content

Instantly share code, notes, and snippets.

View MidnightLightning's full-sized avatar

Brooks Boyd MidnightLightning

View GitHub Profile
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreidgmahhgq5azk6n2wwwzixoyjpcdqplavxpio2php46s5fccefszm ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@MidnightLightning
MidnightLightning / 3box.md
Last active September 18, 2020 12:27
3Box verification

This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.

✅ did:3:bafyreig7wq4mp6535skku7qcyvuzod6k2qtlch56j76pixyubjzat76c7q ✅

Create your profile today to start building social connection and trust online at https://3Box.io/

Verifying my identity on Peepeth.com 0x6954d0255cfed71d55ad8b371b4170b8bf7709dc
@MidnightLightning
MidnightLightning / Sampler.sol
Last active September 20, 2018 19:46
Sample Solidity contract
pragma solidity ^0.4.25;
contract Sampler {
string public name = "Sample Contract";
address public owner = msg.sender;
event NewOwner(address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner, "Sender is not the Owner");
@MidnightLightning
MidnightLightning / add-folder-to-ipfs.sh
Created July 30, 2018 23:00
Add folder of content to IPFS
#!/bin/bash
DOCKERCMD="docker exec -it ipfs.service"
echo "Adding folder $1 to IPFS..."
HASHES=$($DOCKERCMD ipfs add -r -q "$1" | tr -s [:space:] ' ') # Add the folder, and strip out odd characters from result output
echo $HASHES
HASHES=($HASHES) # Convert into a set
FOLDERHASH=${HASHES[-1]} # The enclosing folder's hash is the last one in the list
@MidnightLightning
MidnightLightning / app.html
Last active May 2, 2018 20:39
React component for frozen-paned table
<html>
<head>
<meta charset="UTF-8" />
<title>Table scrolling</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
<style>
/* Global styles that apply to all Datatables */
.datatable-container.scrolled-vertically .datatable-body-container {
@MidnightLightning
MidnightLightning / MoonCat Staking.md
Created August 28, 2017 13:25
MoonCat Staked asset

Mooncats have Red, Green, and Blue values that range from 0-255. Based on those parameters, they have the capacity to have their colors "mined" by staking the cat for a time in a custom-purposed extractor, producing Red Kristallum, Green Kristallum, Blue Kristallum, and Dark Kristallum.

Capacity

How much Kristallum of each color a cat can produce depends on their associated Red/Green/Blue values:

  • White-colored Genesis cats have a capacity of 5000 for all three colors.
  • Black-colored Genesis cats have a capacity of zero for all three colors.

For all other cats:

  • Base capacity is 4 times the cat's color value (so, 0-1024)

Mooncats have a unique situation where each and every one of them are uniquely identified and distinct from all the other Mooncats. In most smart-contract-based voting systems/DAOs, Ethereum addresses hold some number of tokens/shares and get some proportional voting weight. But then care has to be taken that in a given voting period for any proposal, that someone cannot vote with their shares, transfer the shares to another address, and then vote again. By having the cats be the voting unit rather than the addresses, MoonCats can solve this issue very neatly.

MoonCat Clubs

Mooncats have Red, Green, and Blue values that range from 0-255. Based on those parameters, they can be separated into different groups and vote as a unit.

Three MoonCat Clubs, one for each of Red, Green, and Blue. They each act as a DAO, where the voting rights on proposals are determined by the Red/Green/Blue values of the Cats.

The Club contracts operate like a DAO in that any member can put forth a proposal (in the form of a t

pragma solidity ^0.4.11;
contract CardboardUnicorns {
address public owner;
function mint(address who, uint value);
function changeOwner(address _newOwner);
function withdraw();
function withdrawForeignTokens(address _tokenContract);
}
contract RealUnicornCongress {
@MidnightLightning
MidnightLightning / app.js
Created March 14, 2017 18:39
ESLint Atom issue
function hello () {
console.log("Hello World!");
}
hello()