Skip to content

Instantly share code, notes, and snippets.

View elenadimitrova's full-sized avatar

Elena elenadimitrova

View GitHub Profile
import "Organisation.sol";
import "TokenLedger.sol";
import "EternalStorage.sol";
contract Parent {
event OrganisationCreated(address organisation, uint now);
event OrganisationUpgraded(address organisation, uint now);
mapping(bytes32 => address) public organisations;
contract EternalStorage{
mapping(bytes32 => uint) UIntStorage;
function getUIntValue(bytes32 record) constant returns (uint){
return UIntStorage[record];
}
function setUIntValue(bytes32 record, uint value)
{
import "EternalStorage.sol";
library ProposalsLibrary {
function getProposalCount(address _storageContract) constant returns(uint256)
{
return EternalStorage(_storageContract).getUIntValue(sha3("ProposalCount"));
}
function addProposal(address _storageContract, bytes32 _name)
import "ProposalsLibrary.sol";
contract Organisation
{
using ProposalsLibrary for address;
address public eternalStorage;
function Organisation(address _eternalStorage) {
eternalStorage = _eternalStorage;
}
import "ITokenLedger.sol";
contract Organisation
{
ITokenLedger public tokenLedger;
function Organisation(address _tokenLedger) {
tokenLedger = ITokenLedger(_tokenLedger);
}
contract ITokenLedger {
function generateTokens(uint256 _amount) {}
}
contract TokenLedger {
uint256 total_supply;
mapping (address => uint256) balances;
function generateTokens(uint256 _amount)
import "ITokenLedger.sol";
import "ProposalsLibrary.sol";
contract Organisation
{
ITokenLedger public tokenLedger;
using ProposalsLibrary for address;
address public eternalStorage;
function Organisation(address _tokenLedger, address _eternalStorage) {
contract Ownable {
address public owner = msg.sender;
/// @notice check if the caller is the owner of the contract
modifier onlyOwner {
if (msg.sender != owner) throw;
_
}
/// @notice change the owner of the contract
import "EternalStorage.sol";
library SecurityLibrary
{
event AdminAdded(address _user);
event AdminRemoved(address _user);
// Manages records for admins stored in the format:
// sha3('admin:', address) -> bool isUserAdmin , e.g. 0xd91cf6dac04d456edc5fcb6659dd8ddedbb26661 -> true
contract DataVerifiable {
/// @notice throws if ether was sent accidentally
modifier refundEtherSentByAccident() {
if(msg.value > 0) throw;
_
}
/// @notice throw if an address is invalid