forked from nemosminer/NemosMiner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstarpoolplus.ps1
55 lines (45 loc) · 2.04 KB
/
starpoolplus.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
. .\Include.ps1
$PlusPath = ((split-path -parent (get-item $script:MyInvocation.MyCommand.Path).Directory) + "\BrainPlus\starpoolplus\starpoolplus.json")
Try {
$starpool_Request = get-content $PlusPath | ConvertFrom-Json
}
catch { return }
if (-not $starpool_Request) {return}
$Name = (Get-Item $script:MyInvocation.MyCommand.Path).BaseName
$Location = "US"
$starpool_Request | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty Name | foreach {
$starpool_Host = "$_.starpool.biz"
$starpool_Port = $starpool_Request.$_.port
$starpool_Algorithm = Get-Algorithm $starpool_Request.$_.name
$starpool_Coin = ""
$Divisor = 1000000000
switch ($starpool_Algorithm) {
"equihash" {$Divisor /= 1000}
"blake2s" {$Divisor *= 1000}
"blakecoin" {$Divisor *= 1000}
"decred" {$Divisor *= 1000}
"keccak" {$Divisor *= 1000}
"keccakc" {$Divisor *= 1000}
"lbry" {$Divisor *= 1000}
}
if ((Get-Stat -Name "$($Name)_$($starpool_Algorithm)_Profit") -eq $null) {$Stat = Set-Stat -Name "$($Name)_$($starpool_Algorithm)_Profit" -Value ([Double]$starpool_Request.$_.actual_last24h / $Divisor)}
else {$Stat = Set-Stat -Name "$($Name)_$($starpool_Algorithm)_Profit" -Value ([Double]$starpool_Request.$_.actual_last24h / $Divisor * (1 - ($starpool_Request.$_.fees / 100)))}
$ConfName = if ($Config.PoolsConfig.$Name -ne $Null) {$Name}else {"default"}
$PwdCurr = if ($Config.PoolsConfig.$ConfName.PwdCurrency) {$Config.PoolsConfig.$ConfName.PwdCurrency}else {$Config.Passwordcurrency}
if ($Config.PoolsConfig.default.Wallet) {
[PSCustomObject]@{
Algorithm = $starpool_Algorithm
Info = $starpool
Price = $Stat.Live * $Config.PoolsConfig.$ConfName.PricePenaltyFactor
StablePrice = $Stat.Week
MarginOfError = $Stat.Fluctuation
Protocol = "stratum+tcp"
Host = $starpool_Host
Port = $starpool_Port
User = $Config.PoolsConfig.$ConfName.Wallet
Pass = "$($Config.PoolsConfig.$ConfName.WorkerName),c=$($PwdCurr)"
Location = $Location
SSL = $false
}
}
}