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 "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; |
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 EternalStorage{ | |
mapping(bytes32 => uint) UIntStorage; | |
function getUIntValue(bytes32 record) constant returns (uint){ | |
return UIntStorage[record]; | |
} | |
function setUIntValue(bytes32 record, uint value) | |
{ |
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) |
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 "ProposalsLibrary.sol"; | |
contract Organisation | |
{ | |
using ProposalsLibrary for address; | |
address public eternalStorage; | |
function Organisation(address _eternalStorage) { | |
eternalStorage = _eternalStorage; | |
} |
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 "ITokenLedger.sol"; | |
contract Organisation | |
{ | |
ITokenLedger public tokenLedger; | |
function Organisation(address _tokenLedger) { | |
tokenLedger = ITokenLedger(_tokenLedger); | |
} | |
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 ITokenLedger { | |
function generateTokens(uint256 _amount) {} | |
} | |
contract TokenLedger { | |
uint256 total_supply; | |
mapping (address => uint256) balances; | |
function generateTokens(uint256 _amount) |
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 "ITokenLedger.sol"; | |
import "ProposalsLibrary.sol"; | |
contract Organisation | |
{ | |
ITokenLedger public tokenLedger; | |
using ProposalsLibrary for address; | |
address public eternalStorage; | |
function Organisation(address _tokenLedger, address _eternalStorage) { |
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 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 |
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 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 |
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 DataVerifiable { | |
/// @notice throws if ether was sent accidentally | |
modifier refundEtherSentByAccident() { | |
if(msg.value > 0) throw; | |
_ | |
} | |
/// @notice throw if an address is invalid |
OlderNewer