Created
January 10, 2018 21:52
-
-
Save critesjosh/fbabcaec8ec19d0bad0dba9983810402 to your computer and use it in GitHub Desktop.
Truffle pet shop tutorial 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.4; | |
contract Adoption { | |
address[16] public adopters; | |
// Adopting a pet | |
function adopt(uint petId) public returns (uint) { | |
require(petId >= 0 && petId <= 15); | |
adopters[petId] = msg.sender; | |
return petId; | |
} | |
// Retrieving the adopters | |
function getAdopters() public constant returns (address[16]) { | |
return adopters; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment