Skip to content

Instantly share code, notes, and snippets.

View maurelian's full-sized avatar
💯

Maurelian maurelian

💯
View GitHub Profile
$ npm test
> cryptokitty@1.0.0 test /Users/primary/Projects/cryptokitties-bounty
> truffle test
Compiling ./contracts/Auction/ClockAuction.sol...
Compiling ./contracts/Auction/ClockAuctionBase.sol...
Compiling ./contracts/Auction/SaleClockAuction.sol...
Compiling ./contracts/Auction/SiringClockAuction.sol...
Compiling ./contracts/Debuggable.sol...
@maurelian
maurelian / -
Created January 16, 2018 14:25
function controlSelf() {
eval "defaults write org.eyebeam.SelfControl BlockDuration -int $1"
extras=""
if [ "$2" = "nuke" ]; then
extras="inbox.google.com slack.com"
fi
blacklist="facebook.com news.ycombinator.com reddit.com twitter.com $extras"
eval "defaults write org.eyebeam.SelfControl HostBlacklist -array $blacklist"
defaults read org.eyebeam.SelfControl
sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --install > /dev/null 2>&1
@maurelian
maurelian / mem_vs_stor_arguments.sol
Last active January 17, 2018 20:54
Some sample code for better understanding the implications of the storage/memory keywords when used in function arg
pragma solidity ^0.4.18;
// Some sample code for better understanding the implications of the storage/memory keywords
// when used in function args
library Libby {
struct Nums {
uint8 num;
uint8 num2;
@maurelian
maurelian / .solhint.json
Created January 19, 2018 21:26
Solhint config oriented towards security
{
"NOTE": "this JSON file configures solhint for errors on security risks, and warnings on areas that should be scrutinized further. It ignores items of style as configured.",
"rules": {
"reentrancy": "error",
"avoid-sha3": "error",
"avoid-suicide": "error",
"avoid-throw": "error",
"func-visibility": "error",
"state-visibility": "error",
"check-send-result": "error",
## [It would be nice to import a library, another contract's interface, or a
## parent to inherit from]
## but that's not supported. Yes, inheritance is dangerous, but code reuse can
## be very beneficial as
## well. I believe adoption will be held back by this.
## [Declare a positive number] Why change the type from `uint256`? `num` is
## less descriptive, ie. it could include irrational numbers for all I know.
## Also, will 4-byte identifiers be compatible with solidity?
## ie. `bytes4(keccak256('uint256'))` or `bytes4(keccak256('num'))` ? Or is
1544a46634426c84943c1b63667209200aad493d
@maurelian
maurelian / -
Created February 15, 2018 17:06
pragma solidity ^0.4.0;
contract C {
uint[] x; // the data location of x is storage
// the data location of memoryArray is memory
function f(uint[] memoryArray) public {
x = memoryArray; // works, copies the whole array to storage
var y = x; // works, assigns a pointer, data location of y is storage
y[7]; // fine, returns the 8th element
layout title date
post
contract creation golf
2018-02-22 17:33

Fun little learning exercise, what's the shortest bytecode you can send that will publish a contract with non-zero bytecode? The response to getCode() should have some characters that aren’t either 0 or x.

To test it out:

@maurelian
maurelian / UtxoToken.sol
Last active December 23, 2022 21:26
UTXO Token
pragma solidity ^0.4.10;
// Based on Alex Miller's design, with minor revisions to appease the compiler, and incorporate Christian Lundkvist's
// input about hash collisions.
contract Bitcoin {
struct UTXO {
address owner;
uint value;