Esempio n. 1
0
        public Api(string node)
        {
            netnode = node;
            switch (netnode)
            {
            case "testnet":
                dexService = new DexService
                {
                    mh = mh,
                    Notify_mongodbConnStr     = mh.notify_mongodbConnStr_testnet,
                    Notify_mongodbDatabase    = mh.notify_mongodbDatabase_testnet,
                    dexContractHash           = mh.dexContractHash_testnet,
                    dexBalanceStateCol        = mh.dexBalanceStateCol_testnet,
                    dexDomainSellStateCol     = mh.dexDomainSellStateCol_testnet,
                    dexDomainBuyStateCol      = mh.dexDomainBuyStateCol_testnet,
                    dexDomainDealHistStateCol = mh.dexDomainDealHistStateCol_testnet
                };
                mobileService = new MobileService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    domainOwnerCol  = mh.domainOwnerCol_testnet
                };
                nnsDomainCrediteService = new NNSDomainCreditService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                };
                claimNNCService = new ClaimNNCService
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                };
                claimNNCTransaction = new ClaimNNCTransaction
                {
                    mh = mh,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    nelJsonRpcUrl          = mh.nelJsonRPCUrl_testnet,
                    nncClaimCol            = mh.nncClaimCol_testnet,
                    id_gas      = mh.id_gas,
                    hash_nnc    = mh.hash_nnc,
                    isStartFlag = mh.isStartApplyGasFlag,
                    accountInfo = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                };
                new Task(() => claimNNCTransaction.claimNNCLoop()).Start();
                nnsFixedSellingService = new NNSfixedSellingService()
                {
                    mh = mh,
                    Notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    Notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    Block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    Block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    NNSfixedSellingColl    = mh.NNSfixedSellingColl_testnet,
                    domainCenterColl       = mh.domainCenterColl_testnet,
                };
                newAuctionService = new NewAuctionService()
                {
                    mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    mh = mh,
                    auctionStateCol        = mh.auctionStateCol_testnet,
                    domainStateCol         = mh.domainOwnerCol_testnet,
                    cgasBalanceStateCol    = mh.cgasBalanceStateCol_testnet,
                    NNSfixedSellingService = nnsFixedSellingService
                };
                AuctionRecharge auctionRechargetTestNet = new AuctionRecharge()
                {
                    Notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    Notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    mh                 = mh,
                    nelJsonRPCUrl      = mh.neoCliJsonRPCUrl_testnet,
                    rechargeCollection = mh.rechargeCollection_testnet
                };
                auctionService = new AuctionService()
                {
                    mh = mh,
                    Block_mongodbConnStr  = mh.block_mongodbConnStr_testnet,
                    Block_mongodbDatabase = mh.block_mongodbDatabase_testnet,
                    auctionRecharge       = auctionRechargetTestNet,
                };
                bonusService = new BonusService
                {
                    Notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    Notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    mh                    = mh,
                    BonusNofityCol        = mh.bonusNotifyCol_testnet,
                    BonusNofityFrom       = mh.bonusNotifyFrom_testnet,
                    Block_mongodbConnStr  = mh.block_mongodbConnStr_testnet,
                    Block_mongodbDatabase = mh.block_mongodbDatabase_testnet,
                    //Bonus_mongodbConnStr = mh.bonusConnStr_testnet,
                    Bonus_mongodbConnStr = mh.snapshot_mongodbConnStr_testnet,
                    //Bonus_mongodbDatabase = mh.bonusDatabase_testnet,
                    Bonus_mongodbDatabase = mh.snapshot_mongodbDatabase_testnet,
                    CurrentBonusCol       = mh.currentBonusCol_testnet,
                    BonusCol = mh.bonusCol_testnet
                };
                domainService = new DomainService
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    domainOwnerCol         = mh.domainOwnerCol_testnet,
                    NNSfixedSellingService = nnsFixedSellingService
                };
                commonService = new CommonService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.block_mongodbConnStr_testnet,
                    mongodbDatabase = mh.block_mongodbDatabase_testnet,
                    //mongodbConnStr_new = mh.analy_mongodbConnStrTestnet,
                    mongodbConnStr_new = mh.analy_mongodbConnStr_testnet,
                    //mongodbDatabase_new = mh.analy_mongodbDatabaseTestnet,
                    mongodbDatabase_new = mh.analy_mongodbDatabase_testnet,
                };
                claimService = new ClaimGasService
                {
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    gasClaimCol            = mh.gasClaimCol_testnet,
                    maxClaimAmount         = int.Parse(mh.maxClaimAmount_testnet),
                };
                claimTx4testnet = new ClaimGasTransaction
                {
                    nelJsonRpcUrl          = mh.nelJsonRPCUrl_testnet,
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    gasClaimCol            = mh.gasClaimCol_testnet,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    batchSendInterval      = int.Parse(mh.batchSendInterval_testnet),
                    checkTxInterval        = int.Parse(mh.checkTxInterval_testnet),
                    checkTxCount           = int.Parse(mh.checkTxCount_testnet),
                    isStartFlag            = mh.isStartApplyGasFlag,
                };
                // 暂时放在这里,后续考虑单独整出来
                new Task(() => claimTx4testnet.claimGasLoop()).Start();
                utxoService = new UtxoService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    cgasUtxoCol     = mh.cgasUtxoCol_testnet
                };
                rechargeTx4testnet = new AuctionRechargeTransaction
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    cgasMergeTxCol         = mh.rechargeCollection_testnet,
                    neoCliJsonRPCUrl       = mh.neoCliJsonRPCUrl_testnet,
                    netType     = "testnet",
                    isStartFlag = mh.isStartRechargeFlag,
                };
                new Task(() => rechargeTx4testnet.sendTxLoop()).Start();
                break;

            case "mainnet":
                dexService = new DexService
                {
                    mh = mh,
                    Notify_mongodbConnStr     = mh.notify_mongodbConnStr_mainnet,
                    Notify_mongodbDatabase    = mh.notify_mongodbDatabase_mainnet,
                    dexContractHash           = mh.dexContractHash_mainnet,
                    dexBalanceStateCol        = mh.dexBalanceStateCol_mainnet,
                    dexDomainSellStateCol     = mh.dexDomainSellStateCol_mainnet,
                    dexDomainBuyStateCol      = mh.dexDomainBuyStateCol_mainnet,
                    dexDomainDealHistStateCol = mh.dexDomainDealHistStateCol_mainnet
                };
                mobileService = new MobileService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    domainOwnerCol  = mh.domainOwnerCol_mainnet
                };
                nnsDomainCrediteService = new NNSDomainCreditService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                };
                nnsFixedSellingService = new NNSfixedSellingService()
                {
                    mh = mh,
                    Notify_mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    Notify_mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    Block_mongodbConnStr   = mh.block_mongodbConnStr_mainnet,
                    Block_mongodbDatabase  = mh.block_mongodbDatabase_mainnet,
                    NNSfixedSellingColl    = mh.NNSfixedSellingColl_mainnet,
                    domainCenterColl       = mh.domainCenterColl_mainnet,
                };
                newAuctionService = new NewAuctionService()
                {
                    mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    mh = mh,
                    auctionStateCol        = mh.auctionStateCol_mainnet,
                    domainStateCol         = mh.domainOwnerCol_mainnet,
                    cgasBalanceStateCol    = mh.cgasBalanceStateCol_mainnet,
                    NNSfixedSellingService = nnsFixedSellingService
                };
                AuctionRecharge auctionRechargetMainNet = new AuctionRecharge()
                {
                    Notify_mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    Notify_mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    mh                 = mh,
                    nelJsonRPCUrl      = mh.neoCliJsonRPCUrl_mainnet,
                    rechargeCollection = mh.rechargeCollection_mainnet
                };

                auctionService = new AuctionService()
                {
                    mh = mh,
                    Block_mongodbConnStr  = mh.block_mongodbConnStr_mainnet,
                    Block_mongodbDatabase = mh.block_mongodbDatabase_mainnet,
                    auctionRecharge       = auctionRechargetMainNet
                };
                bonusService = new BonusService
                {
                    Notify_mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    Notify_mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    mh                    = mh,
                    BonusNofityCol        = mh.bonusNotifyCol_mainnet,
                    BonusNofityFrom       = mh.bonusNotifyFrom_mainnet,
                    Block_mongodbConnStr  = mh.block_mongodbConnStr_mainnet,
                    Block_mongodbDatabase = mh.block_mongodbDatabase_mainnet,
                    //Bonus_mongodbConnStr = mh.bonusConnStr_mainnet,
                    Bonus_mongodbConnStr = mh.snapshot_mongodbConnStr_mainnet,
                    //Bonus_mongodbDatabase = mh.bonusDatabase_mainnet,
                    Bonus_mongodbDatabase = mh.snapshot_mongodbDatabase_mainnet,
                    CurrentBonusCol       = mh.currentBonusCol_mainnet,
                    BonusCol = mh.bonusCol_mainnet
                };
                domainService = new DomainService
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    domainOwnerCol         = mh.domainOwnerCol_testnet,
                    NNSfixedSellingService = nnsFixedSellingService
                };
                commonService = new CommonService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.block_mongodbConnStr_mainnet,
                    mongodbDatabase = mh.block_mongodbDatabase_mainnet,
                    //mongodbConnStr_new = mh.analy_mongodbConnStrMainnet,
                    mongodbConnStr_new = mh.analy_mongodbConnStr_mainnet,
                    //mongodbDatabase_new = mh.analy_mongodbDatabaseMainnet
                    mongodbDatabase_new = mh.analy_mongodbDatabase_mainnet
                };
                claimService = new ClaimGasService
                {
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_mainnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    gasClaimCol            = mh.gasClaimCol_mainnet,
                    maxClaimAmount         = int.Parse(mh.maxClaimAmount_mainnet),
                };
                utxoService = new UtxoService
                {
                    mh              = mh,
                    mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    cgasUtxoCol     = mh.cgasUtxoCol_mainnet
                };
                rechargeTx4mainnet = new AuctionRechargeTransaction
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_mainnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_mainnet,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_mainnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_mainnet,
                    cgasMergeTxCol         = mh.rechargeCollection_mainnet,
                    neoCliJsonRPCUrl       = mh.neoCliJsonRPCUrl_mainnet,
                    netType     = "mainnet",
                    isStartFlag = mh.isStartRechargeFlag,
                };
                new Task(() => rechargeTx4mainnet.sendTxLoop()).Start();
                break;
            }

            initMonitor();
        }
Esempio n. 2
0
        public Api(string node)
        {
            netnode = node;
            switch (netnode)
            {
            case "testnet":
                commonService = new CommonService
                {
                    mh = mh,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    analy_mongodbConnStr   = mh.analy_mongodbConnStr_testnet,
                    analy_mongodbDatabase  = mh.analy_mongodbDatabase_testnet,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    neoCliJsonRPCUrl       = mh.neoCliJsonRPCUrl_testnet,
                    debug_mongodbConnStr   = mh.debug_mongodbConnStr_testnet,
                    debug_mongodbDatabase  = mh.debug_mongodbDatabase_testnet,
                };
                compileService = new CompileService
                {
                    mh = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    ossClient = new OssFileService(mh.nelOssRPCUrl_testnet)
                };
                compileServiceNew = new CompileServiceNew
                {
                    mh = mh,
                    debug_mongodbConnStr  = mh.debug_mongodbConnStr_testnet,
                    debug_mongodbDatabase = mh.debug_mongodbDatabase_testnet,
                    ossClient             = new OssFileService(mh.nelOssRPCUrl_testnet),
                    debugger = new CompileFileService(mh.nelDebugRPCUrl_testnet),
                    py_path  = mh.py_path
                };
                claimService = new ClaimGasService
                {
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    gasClaimCol            = mh.gasClaimCol_testnet,
                    maxClaimAmount         = int.Parse(mh.maxClaimAmount_testnet),
                };
                claimTx4testnet = new ClaimGasTransaction
                {
                    nelJsonRpcUrl          = mh.nelJsonRPCUrl_testnet,
                    assetid                = mh.id_gas,
                    accountInfo            = AccountInfo.getAccountInfoFromWif(mh.prikeywif_testnet),
                    mh                     = mh,
                    notify_mongodbConnStr  = mh.notify_mongodbConnStr_testnet,
                    notify_mongodbDatabase = mh.notify_mongodbDatabase_testnet,
                    gasClaimCol            = mh.gasClaimCol_testnet,
                    block_mongodbConnStr   = mh.block_mongodbConnStr_testnet,
                    block_mongodbDatabase  = mh.block_mongodbDatabase_testnet,
                    batchSendInterval      = int.Parse(mh.batchSendInterval_testnet),
                    checkTxInterval        = int.Parse(mh.checkTxInterval_testnet),
                    checkTxCount           = int.Parse(mh.checkTxCount_testnet)
                };
                //
                new Task(() => claimTx4testnet.claimGasLoop()).Start();
                break;

            case "mainnet":
                break;
            }
        }