Last active
August 31, 2018 13:20
-
-
Save ToJen/046ee107fbe2e507f412487cd32a3539 to your computer and use it in GitHub Desktop.
Example factory 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 Cookie { | |
bool public hasChocolate; | |
function Cookie(bool _hasChocolate) public { | |
hasChocolate = _hasChocolate; | |
} | |
} | |
contract Bakery { | |
address public baker; | |
address[] public cookies; | |
function Bakery() { | |
baker = msg.sender; | |
} | |
function bakeCookie(bool _isChocolateChip) public { | |
Cookie c = new Cookie(_isChocolateChip); | |
cookies.push(c); | |
} | |
function addCookie(address _cookie) public { | |
cookies.push(_cookie); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment