Last active
June 30, 2020 23:34
-
-
Save elenadimitrova/4fb2f43d6f7c6141db54ab14ff3f87d7 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 "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; | |
function createOrganisation(bytes32 key_) | |
{ | |
var tokenLedger = new TokenLedger(); | |
var eternalStorage = new EternalStorage(); | |
var organisation = new Organisation(tokenLedger, eternalStorage); | |
organisations[key_] = organisation; | |
OrganisationCreated(organisation, now); | |
} | |
function getOrganisation(bytes32 key_) constant returns (address) | |
{ | |
return organisations[key_]; | |
} | |
function upgradeOrganisation(bytes32 key_) | |
{ | |
address organisationAddress = organisations[key_]; | |
var organisation = Organisation(organisationAddress); | |
var tokenLedger = organisation.tokenLedger(); | |
var eternalStorage = organisation.eternalStorage(); | |
Organisation organisationNew = new Organisation(tokenLedger, eternalStorage); | |
organisation.kill(organisationNew); | |
organisations[key_] = organisationNew; | |
OrganisationUpgraded(organisationNew, now); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shouldn't this be
organisation.kill(organisation)
?