Example #1
0
        public RewardList InsertRewardList(RewardList entity)
        {
            RewardListDac dac = new RewardListDac();
            //if (dac.IsExisted(entity.BlockHash))
            //{
            //    throw new Exception("block hash has existed");
            //}
            //调接口获取奖励
            //AuthenticationHeaderValue authHeaderValue = null;
            //RpcClient client = new RpcClient(new Uri(MiningPoolSetting.API_URI), authHeaderValue, null, null, "application/json");
            //RpcRequest request = RpcRequest.WithParameterList("GetBlockReward", new List<object> { entity.BlockHash }, 1);
            //RpcResponse response = await client.SendRequestAsync(request);
            //if (response.HasError)
            //{
            //    throw new ApiCustomException(response.Error.Code, response.Error.Message);
            //}

            //long totalReward = response.GetResult<long>();
            RewardList reward = new RewardList();

            AwardSetting setting = ConfigurationTool.GetAppSettings <AwardSetting>("OmniCoin.MiningPool.Business.conf.json", "AwardSetting");

            //double extractProportion = setting.ExtractProportion;
            //double serviceFeeProportion = setting.ServiceFeeProportion;
            reward.BlockHash      = entity.BlockHash;
            reward.GenerateTime   = entity.GenerateTime;
            reward.Hashes         = entity.Hashes;
            reward.MinerAddress   = entity.MinerAddress;
            reward.OriginalReward = entity.OriginalReward;
            //reward.ActualReward = Convert.ToInt64(entity.OriginalReward * extractProportion);
            reward.ActualReward            = Convert.ToInt64(entity.OriginalReward);
            reward.Paid                    = 0;
            reward.PaidTime                = Framework.Time.EpochStartTime.Millisecond;
            reward.IsCommissionProcessed   = 0;
            reward.CommissionProcessedTime = 0;
            //此市transaction为“”,需要同步后才能写数据进去
            reward.TransactionHash = entity.TransactionHash;

            dac.Insert(reward);

            return(reward);
        }
Example #2
0
        static MiningPoolSetting()
        {
            AwardSetting setting = ConfigurationTool.GetAppSettings <AwardSetting>("OmniCoin.MiningPool.Business.conf.json", "AwardSetting");

            if (setting != null)
            {
                PoolType = setting.PoolType;
            }
            else
            {
                PoolType = null;
            }
            if (setting == null)
            {
                throw new Exception("config read from OmniCoin.MiningPool.Business.conf.json failed !!!");
            }
            API_URI_MAIN = setting.NodeRpcMainnet;
            API_URI_TEST = setting.NodeRpcTestnet;
            POS_URL_MAIN = setting.PosCheckServiceUrlMainNet;
            POS_URL_TEST = setting.PosCheckServiceUrlTestNet;
        }