Chris Beams 0827fb5c8f
Convert tabs to spaces
Prior to this change, 78% of lines in .java files with leading
whitespace used four-space indentation, while 22% used tabs.
2014-12-26 09:42:39 +01:00

34 lines
839 B
Plaintext

// the sample is good example how one can
// save program that manage his own currency
init:
// this part run only on init stage
// we are about to set the maxim
// amount of currency
contract.storage[0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826] = 10000000
code:
// the currency manager
// support two functions
if msg.datasize == 1:
// 1. balance check
addr = msg.data[0]
return(contract.storage[addr])
else:
// 2. balance manipulation
from = msg.sender
fromvalue = contract.storage[from]
to = msg.data[0]
value = msg.data[1]
if fromvalue >= value:
contract.storage[from] = fromvalue - value
contract.storage[to] = contract.storage[to] + value
return(1)
else:
return(0)