Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple address registry contract for Ethereum
pragma solidity >=0.4.22 <0.6.0;
contract registry {
address[] public addresses;
mapping(address => bool) public contains;
function register() public {
require(!contains[msg.sender]);
contains[msg.sender] = true;
addresses.push(msg.sender);
}
function getSize() public view returns (uint) {
return addresses.length;
}
function getWinner(uint index) public view returns (address) {
return addresses[index];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.