This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 690
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #898 from coinfoundry/oliverw
Oliverw > You're right, I've actually glanced over it in the next commit. Keep up the good work ! I'd send a VTC donation , you have any address or just use the one that's in the code? :) Thanks a lot. Greatly appreciated!
- Loading branch information
Showing
113 changed files
with
7,678 additions
and
928 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Linq; | ||
using System.Net; | ||
using Autofac; | ||
using AutoMapper; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Miningcore.Configuration; | ||
using Miningcore.Persistence; | ||
|
||
namespace Miningcore.Api.Controllers | ||
{ | ||
public abstract class ApiControllerBase : ControllerBase | ||
{ | ||
protected ApiControllerBase(IComponentContext ctx) | ||
{ | ||
mapper = ctx.Resolve<IMapper>(); | ||
clusterConfig = ctx.Resolve<ClusterConfig>(); | ||
cf = ctx.Resolve<IConnectionFactory>(); | ||
} | ||
|
||
protected readonly ClusterConfig clusterConfig; | ||
protected readonly IConnectionFactory cf; | ||
protected readonly IMapper mapper; | ||
|
||
protected PoolConfig GetPoolNoThrow(string poolId) | ||
{ | ||
if(string.IsNullOrEmpty(poolId)) | ||
return null; | ||
|
||
var pool = clusterConfig.Pools.FirstOrDefault(x => x.Id == poolId && x.Enabled); | ||
return pool; | ||
} | ||
|
||
protected PoolConfig GetPool(string poolId) | ||
{ | ||
if(string.IsNullOrEmpty(poolId)) | ||
throw new ApiException("Invalid pool id", HttpStatusCode.NotFound); | ||
|
||
var pool = clusterConfig.Pools.FirstOrDefault(x => x.Id == poolId && x.Enabled); | ||
|
||
if(pool == null) | ||
throw new ApiException($"Unknown pool {poolId}", HttpStatusCode.NotFound); | ||
|
||
return pool; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Miningcore.Api.Responses | ||
{ | ||
public class MinerSettings | ||
{ | ||
public decimal PaymentThreshold { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.