コード例 #1
0
def ms_get(project_id, milestone_id) -> Milestone:
    """
    Pulls an existing Milestone from storage using the input attributes, and returns
    a Milestone object
    Args:
        project_id (str):
            ID for referencing the project

        milestone_id (str):
            ID for referencing the Milestone
            
    Return:
        (Milestone):
            Returns a Milestone object containing attributes
    """
    storage = StorageManager()
    ms = Milestone()

    # Pull Milestone info
    milestone_info_serialized = storage.get_triple('MS', project_id,
                                                   milestone_id)
    milestone_info = storage.deserialize_bytearray(milestone_info_serialized)

    if len(milestone_info) == 4:
        # Saves vars to object
        ms.project_id = project_id
        ms.milestone_id = milestone_id
        ms.title = milestone_info[0]
        ms.subtitle = milestone_info[1]
        ms.extra_info_hash = milestone_info[2]
        ms.progress = milestone_info[3]

    return ms
コード例 #2
0
    def kyc_status(self, project_id, address):
        """
        Gets the KYC Status of an address

        Args:
            args (list):
                list a list of arguments
            
            sts (SmartTokenShare):
                Smart Token Share reference object
        Return:
            (bool): Returns the kyc status of an address
        """
        storage = StorageManager()

        return storage.get_triple(project_id, 'KYC_address', address)
コード例 #3
0
    def test_create(self):
        fs = FundingStage()

        # Running start_new_crowdfund()
        fs.create(self.test_project_id, self.test_funding_stage_id,
                  self.test_start_block, self.test_end_block, self.test_supply,
                  self.test_tokens_per_gas)

        # Pull output from storage
        storage = StorageManager()
        output = storage.get_triple('FS', self.test_project_id,
                                    self.test_funding_stage_id)

        # Check Test
        if output == self.test_fs_info:
            print('test_create PASSED')
            return True

        print('test_create FAILED')
        return False
コード例 #4
0
ファイル: FundingStage.py プロジェクト: nickazg/TheConstruct
def fs_get(project_id, funding_stage_id) -> FundingStage:
    """
    Pulls an existing Funding Stage from storage using the input attributes, and returns
    a FundingStage object
    Args:
        project_id (str):
            ID for referencing the project

        funding_stage_id (str):
            ID for referencing the funding stage
            
    Return:
        (FundingStage):
            Returns a funding stage object containing attributes
    """
    storage = StorageManager()
    fs = FundingStage()

    # Pull FundingStage info
    fs_info_serialized = storage.get_triple('FS', project_id, funding_stage_id)

    if not fs_info_serialized:
        print('fs_info_serialized is null')
        return None

    fs_info = storage.deserialize_bytearray(fs_info_serialized)

    # Saves vars to object
    fs.project_id = project_id
    fs.funding_stage_id = funding_stage_id
    fs.start_block = fs_info[0]
    fs.end_block = fs_info[1]
    fs.supply = fs_info[2]
    fs.tokens_per_gas = fs_info[3]
    fs.in_circulation = fs_info[4]

    return fs
コード例 #5
0
    def get_kyc_submission(self, project_id, address):
        """    
        Submits a KYC information to the smart contract 
        Args:
            sts (SmartTokenShare):
                Smart Token Share reference object
            
            address (str):
                Wallet address to whitelist
        Returns:
            (list): Of KYC submission list (address, phys_address, first_name, last_name, id_type, id_number, id_expiry, file_location, file_hash)
        """
        storage = StorageManager()

        # Gets sts object
        sts = sts_get(project_id)

        # Checking the invoker is the owner/admin
        if CheckWitness(sts.owner):
            if len(address) == 20:

                # Deserialises bytearray back into a list
                serialized_kyc_sub = storage.get_triple('KYC', project_id, address)
                return storage.deserialize_bytearray(serialized_kyc_sub)                
コード例 #6
0
ファイル: FundingStage.py プロジェクト: nickazg/TheConstruct
def fs_get_addr_balance(fs: FundingStage, addr):
    storage = StorageManager()
    balance = storage.get_triple(fs.project_id, fs.funding_stage_id, addr)
    print('balance')
    return balance