Skip to content

Instantly share code, notes, and snippets.

@wemeetagain
wemeetagain / gist:9677553
Created March 21, 2014 01:10
Sample Crowdfunded Employment Contract
// [AMT] - Withdraw AMT from contract
// tracks 'employee' withdrawal time, amount, and contract balance starting at storage[500]
if tx.value < 100 * block.basefee:
stop
if tx.sender == CONTRACT_CREATOR:
// if a withdrawal amount is set, attempt withdrawl
if tx.data[0] > 0:
WITHDRAWAL_LOG_INDEX = contract.storage[499] + 500
LAST_WITHDRAWAL_TIME = contract.storage[WITHDRAWAL_LOG_INDEX]
@wemeetagain
wemeetagain / gist:9457099
Last active May 6, 2019 16:02
topic-grouped lists of addresses with linked id contracts
// convenience nameserver
// name -> address
// address -> name
// [name, newOwnerAddress (optional)]
// only one name allowed per address
// newOwnerAddress will only be applicable if the name is already claimed
// if the name is invalid, stop
if tx.data[0] < 100:
// contract 1
// convenience nameserver
// name -> address
// address -> name
// [name, newOwnerAddress (optional)]
// only one name allowed per address
// newOwnerAddress will only be applicable if the name is already claimed