示例#1
0
    def change_owner(self):
        org_id = self.args.org_id
        # Check if Organization exists
        (found, _, _, owner, _, _, _) = self._getorganizationbyid(org_id)
        self.error_organization_not_found(org_id, found)

        new_owner = self.args.owner
        if not is_checksum_address(new_owner):
            raise Exception(
                "New owner account %s is not a valid Ethereum checksum address"
                % new_owner)

        if new_owner.lower() == owner.lower():
            raise Exception(
                "\n{} is the owner of Organization with id={}!\n".format(
                    new_owner, org_id))

        self._printout(
            "Creating transaction to change organization {}'s owner...\n".
            format(org_id))
        try:
            self.transact_contract_command(
                "Registry", "changeOrganizationOwner",
                [type_converter("bytes32")(org_id), self.args.owner])
        except Exception as e:
            self._printerr(
                "\nTransaction error!\nHINT: Check if you are the owner of {}\n"
                .format(org_id))
            raise
示例#2
0
 def get_members_from_args(self):
     if (not self.args.members):
         return []
     members = [m.replace("[", "").replace("]", "") for m in self.args.members.split(',')]
     for m in members:
         if not is_checksum_address(m):
             raise Exception("Member account %s is not a valid Ethereum checksum address"%m)
     return members
示例#3
0
    def change_owner(self):
        org_id = self.args.org_id
        # Check if Organization exists
        (found, _, _, owner, _, _, _) = self._getorganizationbyid(org_id)
        self.error_organization_not_found(org_id, found)

        new_owner = self.args.owner
        if not is_checksum_address(new_owner):
            raise Exception("New owner account %s is not a valid Ethereum checksum address"%new_owner)

        if new_owner.lower() == owner.lower():
            raise Exception("\n{} is the owner of Organization with id={}!\n".format(new_owner, org_id))

        self._printout("Creating transaction to change organization {}'s owner...\n".format(org_id))
        try:
            self.transact_contract_command("Registry", "changeOrganizationOwner", [type_converter("bytes32")(org_id), self.args.owner])
        except Exception as e:
            self._printerr("\nTransaction error!\nHINT: Check if you are the owner of {}\n".format(org_id))
            raise