Skip to content

Instantly share code, notes, and snippets.

@loiluu
loiluu / digix-report.md
Last active April 20, 2018 06:29
Audit report for Digix's smart contract platform
0x802Ce0C3F8085F8F6AB25c1B6fe7c6E905215879
@loiluu
loiluu / MP_CLA.md
Created March 24, 2017 15:35 — forked from retotrinkler/MP_CLA.md
Melonport Contributor License Agreement

Contributor License Agreement

The following terms are used throughout this agreement:

You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.

Project - is an umbrella term that refers to any and all GitHub open source projects.

Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.

Keybase proof

I hereby claim:

  • I am loiluu on github.
  • I am loiluu (https://keybase.io/loiluu) on keybase.
  • I have a public key whose fingerprint is 3BC5 8D17 FE5E 55A5 8264 F61B 49DE 660B 48FB 7679

To claim this, I am signing this object:

cf_code=''''
# storage[-1] = last campaign id
# campaigns:
# id: creator
# id+1: goal
# id+2: end timestamp
# id+3: pointer to place next donation
# id+4: total contribution counter
# id+2i+5: ith contributor
# id+2i+6: ith contribution
@loiluu
loiluu / recursive_example.py
Created August 21, 2014 03:55
Ethereum example of contract calling itself
__author__ = 'loi'
contract_code = '''
command = msg.data[0]
if command == 1: #option 1
contract.storage[0] = 99
contractToCall = msg.data[1]
tmp = call(contractToCall, [2], 1)
return (tmp)
#option 2
elif command == 2:
@loiluu
loiluu / lottery_example.py
Last active August 29, 2015 14:05
Lottery example in ethereum
__author__ = 'loi'
lottery = '''
init:
#Record the initiator
contract.storage[0] = msg.sender
contract.storage[1] = 0 #no. of sold tickets
contract.storage[2] = block.timestamp
code:
# If a message with 9 item is sent, that's a buy request
MAXIMUM_TICKETS = 2
@loiluu
loiluu / subcurrency_example.py
Created August 20, 2014 10:35
Example of running subcurrency in Ethereum
__author__ = 'loi'
sub_currency = """
init:
# Initial: premine 1000000 units to creator
contract.storage[msg.sender] = 1000000
code:
# If a message with one item is sent, that's a balance query
if msg.datasize == 1:
addr = msg.data[0]
return (contract.storage[addr])