Created
April 21, 2016 07:46
-
-
Save chpapa/b9f91b05cec1ecbccb86c89e35581df8 to your computer and use it in GitHub Desktop.
Solidity Sample
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
contract Cannabis { | |
string public motherPlant; | |
string public plantDate; | |
string public location; | |
uint8 public supply; | |
address public grower; | |
struct Dispensary { | |
address dispensaryAddress; | |
uint8 storageJar; | |
uint8 supply; | |
} | |
struct Customer { | |
address customer; | |
} | |
mapping(address => Dispensary) public dispensary; | |
mapping(address => Customer) public customers; | |
function Cannabis( | |
string myMotherPlant, | |
string myPlantDate, | |
string myLocation, | |
uint8 weight) { | |
motherPlant = myMotherPlant; | |
plantDate = myPlantDate; | |
location = myLocation; | |
supply = weight; | |
grower = msg.sender; | |
} | |
function soldToDispensary(address toDispensary, uint8 storageJarNum, uint8 weight) { | |
if(msg.sender != grower) { throw; } | |
dispensary[toDispensary] = Dispensary({ | |
dispensaryAddress: toDispensary, | |
storageJar: storageJarNum, | |
supply: weight | |
}); | |
supply = supply - weight; | |
} | |
function soldToCustomer(address toCustomer, uint8 weight) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment