Created
February 4, 2017 14:46
-
-
Save bobkilla/b9d8b9cf16258da786b017f3f48fb702 to your computer and use it in GitHub Desktop.
Simple solidity membership contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.9; | |
contract Organization { | |
struct Member { // Struct | |
string nickname; | |
string city; | |
bool active; | |
} | |
mapping(address=>Member) public members; | |
uint256 public fee; | |
function Organization(uint256 _fee) { | |
fee = _fee; | |
} | |
function register(string _nickname, string _city) payable { | |
if(msg.value == fee){ | |
members[msg.sender] = Member( { | |
nickname: _nickname, | |
city: _city, | |
active: true | |
}); | |
} else { | |
throw; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
interesting