def deploy_service_contracts(
            self,
            token_address: str,
            user_deposit_whole_balance_limit: int,
    ):
        """Deploy 3rd party service contracts"""
        chain_id = int(self.web3.version.network)
        deployed_contracts: DeployedContracts = {
            'contracts_version': self.contract_version_string(),
            'chain_id': chain_id,
            'contracts': {},
        }

        self._deploy_and_remember(CONTRACT_SERVICE_REGISTRY, [token_address], deployed_contracts)
        user_deposit = self._deploy_and_remember(
            contract_name=CONTRACT_USER_DEPOSIT,
            arguments=[token_address, user_deposit_whole_balance_limit],
            deployed_contracts=deployed_contracts,
        )

        monitoring_service_constructor_args = [
            token_address,
            deployed_contracts['contracts'][CONTRACT_SERVICE_REGISTRY]['address'],
            deployed_contracts['contracts'][CONTRACT_USER_DEPOSIT]['address'],
        ]
        msc = self._deploy_and_remember(
            contract_name=CONTRACT_MONITORING_SERVICE,
            arguments=monitoring_service_constructor_args,
            deployed_contracts=deployed_contracts,
        )

        one_to_n = self._deploy_and_remember(
            contract_name=CONTRACT_ONE_TO_N,
            arguments=[user_deposit.address, chain_id],
            deployed_contracts=deployed_contracts,
        )

        # Tell the UserDeposit instance about other contracts.
        LOG.debug(
            'Calling UserDeposit.init() with '
            f'msc_address={msc.address} '
            f'one_to_n_address={one_to_n.address}',
        )
        self.transact(user_deposit.functions.init(
            _msc_address=msc.address,
            _one_to_n_address=one_to_n.address,
        ))

        return deployed_contracts
def deploy_service_contracts ( self , token_address : str , user_deposit_whole_balance_limit : int , ) : chain_id = int ( self . web3 . version . network ) deployed_contracts : DeployedContracts = { 'contracts_version' : self . contract_version_string ( ) , 'chain_id' : chain_id , 'contracts' : { } , } self . _deploy_and_remember ( CONTRACT_SERVICE_REGISTRY , [ token_address ] , deployed_contracts ) user_deposit = self . _deploy_and_remember ( contract_name = CONTRACT_USER_DEPOSIT , arguments = [ token_address , user_deposit_whole_balance_limit ] , deployed_contracts = deployed_contracts , ) monitoring_service_constructor_args = [ token_address , deployed_contracts [ 'contracts' ] [ CONTRACT_SERVICE_REGISTRY ] [ 'address' ] , deployed_contracts [ 'contracts' ] [ CONTRACT_USER_DEPOSIT ] [ 'address' ] , ] msc = self . _deploy_and_remember ( contract_name = CONTRACT_MONITORING_SERVICE , arguments = monitoring_service_constructor_args , deployed_contracts = deployed_contracts , ) one_to_n = self . _deploy_and_remember ( contract_name = CONTRACT_ONE_TO_N , arguments = [ user_deposit . address , chain_id ] , deployed_contracts = deployed_contracts , ) LOG . debug ( 'Calling UserDeposit.init() with ' f'msc_address={msc.address} ' f'one_to_n_address={one_to_n.address}' , ) self . transact ( user_deposit . functions . init ( _msc_address = msc . address , _one_to_n_address = one_to_n . address , ) ) return deployed_contracts
Deploy 3rd party service contracts