示例#1
0
        public IEnumerable <GenesisSmartContractDto> GetGenesisSmartContractDtos(Address zeroContractAddress)
        {
            var genesisSmartContractDtoList = new List <GenesisSmartContractDto>();

            var chainInitializationData = AsyncHelper.RunSync(async() =>
                                                              await _sideChainInitializationDataProvider.GetChainInitializationDataAsync());

            if (chainInitializationData == null)
            {
                Logger.LogWarning("Chain initialization data is null.");
                return(genesisSmartContractDtoList);
            }

            // chainInitializationData cannot be null if it is first time side chain startup.
            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Consensus.AEDPoS")).Value,
                ConsensusSmartContractAddressNameProvider.Name,
                GenerateConsensusInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("MultiToken")).Value,
                TokenSmartContractAddressNameProvider.Name, GenerateTokenInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("CrossChain")).Value,
                CrossChainSmartContractAddressNameProvider.Name,
                GenerateCrossChainInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("ParliamentAuth")).Value,
                ParliamentAuthSmartContractAddressNameProvider.Name,
                GenerateParliamentInitializationCallList(chainInitializationData));

            return(genesisSmartContractDtoList);
        }
        public override IEnumerable <GenesisSmartContractDto> GetGenesisSmartContractDtos()
        {
            var chainInitializationData = AsyncHelper.RunSync(async() =>
                                                              await _sideChainInitializationDataProvider.GetChainInitializationDataAsync());

            if (chainInitializationData == null)
            {
                return(new List <GenesisSmartContractDto>());
            }

            return(base.GetGenesisSmartContractDtos());
        }
        public IEnumerable <GenesisSmartContractDto> GetGenesisSmartContractDtos()
        {
            var genesisSmartContractDtoList = new List <GenesisSmartContractDto>();

            var chainInitializationData = AsyncHelper.RunSync(async() =>
                                                              await _sideChainInitializationDataProvider.GetChainInitializationDataAsync());

            if (chainInitializationData == null)
            {
                return(genesisSmartContractDtoList);
            }

            // chainInitializationData cannot be null if it is first time side chain startup.
            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Consensus.AEDPoS")).Value,
                ConsensusSmartContractAddressNameProvider.Name,
                GenerateConsensusInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("MultiToken")).Value,
                TokenSmartContractAddressNameProvider.Name,
                GenerateTokenInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Parliament")).Value,
                ParliamentSmartContractAddressNameProvider.Name,
                GenerateParliamentInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Referendum")).Value,
                ReferendumSmartContractAddressNameProvider.Name,
                GenerateReferendumInitializationCallList()
                );

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Association")).Value,
                AssociationSmartContractAddressNameProvider.Name
                );

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("CrossChain")).Value,
                CrossChainSmartContractAddressNameProvider.Name,
                GenerateCrossChainInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Configuration")).Value,
                ConfigurationSmartContractAddressNameProvider.Name,
                GenerateConfigurationInitializationCallList(chainInitializationData));

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("Profit")).Value,
                ProfitSmartContractAddressNameProvider.Name
                );

            genesisSmartContractDtoList.AddGenesisSmartContract(
                _codes.Single(kv => kv.Key.Contains("TokenHolder")).Value,
                TokenHolderSmartContractAddressNameProvider.Name
                );

            return(genesisSmartContractDtoList);
        }