Last active
July 13, 2017 08:46
-
-
Save elenadimitrova/be21ee95b8ee480086b72dd4712a4763 to your computer and use it in GitHub Desktop.
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
import "EternalStorage.sol"; | |
library ProposalsLibrary { | |
function getProposalCount(address _storageContract) constant returns(uint256) | |
{ | |
return EternalStorage(_storageContract).getUIntValue(sha3("ProposalCount")); | |
} | |
function addProposal(address _storageContract, bytes32 _name) | |
{ | |
var idx = getProposalCount(_storageContract); | |
EternalStorage(_storageContract).setBytes32Value(sha3("proposal_name", idx), _name); | |
EternalStorage(_storageContract).setUIntValue(sha3("proposal_eth", idx), 0); | |
EternalStorage(_storageContract).setUIntValue(sha3("ProposalCount"), idx + 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment