Skip to content

Instantly share code, notes, and snippets.

Avatar

Brendan Asselstine asselstine

View GitHub Profile
View Compound Governance Voting using Gnosis Multisig
1. Open the multisig wallet.
2. Click "Add" for a new Multisig transaction
3. Enter the address 0xc0dA01a04C3f3E0be433606045bB7017A7323E38
4. Cut and paste the abi:
[{
"constant": false,
"inputs": [
View PoolTogether_Draw_Timeline.md
Time Step Open Committed Rewarded
Week 1 Draw 1
Week 2 Draw 2 Draw 1
Week 3 Draw 3 Draw 2 Draw 1
Week 4 Draw 4 Draw 3 Draw 2
Week 5 Draw 5 Draw 4 Draw 3
@asselstine
asselstine / CoordinationGame.mmd
Created Nov 19, 2018
Coordination Game Mermaid Diagram
View CoordinationGame.mmd
graph TD
A[Application Listed]
C[Application Removed]
B[Challenged]
D[Approved]
E[Coordination Game]
F{Tokens > Fork Threshold}
G{Tokens > Fork Threshold}
@asselstine
asselstine / zosMerge.js
Created Nov 15, 2018
Merges the latest zos proxies into Truffle artifacts
View zosMerge.js
#!/usr/bin/env node
const fs = require('fs')
const shell = require('shelljs')
const program = require('commander')
const util = require('util')
const readFile = util.promisify(fs.readFile)
const writeFile = util.promisify(fs.writeFile)
program
@asselstine
asselstine / Work.sol
Created Nov 1, 2018
Work Contract supported deposits and withdrawals
View Work.sol
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import './IndexedAddressArray.sol';
contract Work is Ownable {
using IndexedAddressArray for IndexedAddressArray.Data;
address public jobManager;
@asselstine
asselstine / IndexedAddressArray.sol
Created Nov 1, 2018
Adds the ability to remove an address directly from an array
View IndexedAddressArray.sol
pragma solidity ^0.4.24;
library IndexedAddressArray {
struct Data {
address[] addresses;
mapping(address => uint256) indices;
}
function pushAddress(Data storage self, address _value) internal returns (uint256) {
View Work.sol
pragma solidity ^0.4.24;
import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
import './IndexedAddressArray.sol';
contract Work is Ownable {
using IndexedAddressArray for IndexedAddressArray.Data;
address public jobManager;
@asselstine
asselstine / test.sh
Last active Sep 26, 2018
Docker separated ganache runner
View test.sh
docker run --rm -it -d --name ganache-cli -p 8145:8545 trufflesuite/ganache-cli:latest -e 10000000000 -l 4700038 -h 0.0.0.0; \
truffle compile --network=test && truffle test --network=test $1; \
EXIT_STATUS=$?; \
echo 'Shutting down ganache-cli...'; \
docker stop ganache-cli && echo 'Shut down ganache-cli' & \
exit $EXIT_STATUS
@asselstine
asselstine / ganache.sh
Created Sep 12, 2018
Ganache startup script
View ganache.sh
#! /bin/sh
mkdir -p .ganache
ganache-cli \
--db .ganache \
-l 4700038 \
-i 1234 \
-e 100000000000 \
-a 10 \
-u 0 \
-m "rose dynamic miracle summer near tell genius label video check stumble miss"
@asselstine
asselstine / IntUnderflow.sol
Created Sep 12, 2018
A Simple Example of Integer underflow
View IntUnderflow.sol
pragma solidity ^0.4.4;
/*
This contract is vulnerable to an attacker exploting
integer underflow. When you subtract from unsigned integers
at their lowest value (0), they cycle to their highest value.
Similarly, adding 1 to a max value unsigned integer will
cycle it to zero.
*/