30 lines
588 B
Plaintext
30 lines
588 B
Plaintext
/* Example from Solidity by Example
|
|
http://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html
|
|
|
|
The Solidity code:
|
|
|
|
contract SimpleStorage {
|
|
uint storedData
|
|
|
|
function set(uint x) {
|
|
storedData = x
|
|
}
|
|
|
|
function get() constant returns (uint) {
|
|
return storedData
|
|
}
|
|
}
|
|
*/
|
|
|
|
contract SimpleStorage =
|
|
|
|
type event = int
|
|
record state = { data : int }
|
|
|
|
function init(value : int) : state = { data = value }
|
|
|
|
function get() : int = state.data
|
|
|
|
function set(value : int) =
|
|
put(state{data = value})
|