-
-
Save cicorias/c75925398a3acc892becd42deac583cf to your computer and use it in GitHub Desktop.
This file contains hidden or 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