fixes
This commit is contained in:
parent
58037695d0
commit
20e3ee21d8
61
go.sum
Normal file
61
go.sum
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
|
||||||
|
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||||
|
github.com/caarlos0/env/v6 v6.10.1 h1:t1mPSxNpei6M5yAeu1qtRdPAK29Nbcf/n3G7x+b3/II=
|
||||||
|
github.com/caarlos0/env/v6 v6.10.1/go.mod h1:hvp/ryKXKipEkcuYjs9mI4bBCg+UI0Yhgm5Zu0ddvwc=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/deroproject/derohe v0.0.0-20240229002921-e9df1205b660 h1:GwFMlJiyJ72+U5xLaeqZaUcVtEIJ5DqIjHTzUX2//OU=
|
||||||
|
github.com/deroproject/derohe v0.0.0-20240229002921-e9df1205b660/go.mod h1:EWHh1VkXRnCHvyGML98kXhngDFYebmOhk/9kZ1ATJ1c=
|
||||||
|
github.com/deroproject/graviton v0.0.0-20220130070622-2c248a53b2e1 h1:nsiNx83HYmRmYpYO37pUzSTmB7p9PFtGBl4FyD+a0jg=
|
||||||
|
github.com/deroproject/graviton v0.0.0-20220130070622-2c248a53b2e1/go.mod h1:a4u6QJtGGIADg1JwujD77UtaAyhIxg14+I0C7xjyQcc=
|
||||||
|
github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA=
|
||||||
|
github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||||
|
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
|
||||||
|
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
|
github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ=
|
||||||
|
github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg=
|
||||||
|
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||||
|
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||||
|
github.com/lesismal/llib v1.1.13 h1:+w1+t0PykXpj2dXQck0+p6vdC9/mnbEXHgUy/HXDGfE=
|
||||||
|
github.com/lesismal/llib v1.1.13/go.mod h1:70tFXXe7P1FZ02AU9l8LgSOK7d7sRrpnkUr3rd3gKSg=
|
||||||
|
github.com/lesismal/nbio v1.5.6 h1:ad8s3AnZnAjMOHhnClHxWp69FsjiS40zOvJ0BYS9IG8=
|
||||||
|
github.com/lesismal/nbio v1.5.6/go.mod h1:mvfYBAA1jmrafXf2XvkM28jWkMTfA5jGks+HKDBMmOc=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||||
|
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||||
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||||
|
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||||
|
github.com/ybbus/jsonrpc/v3 v3.1.5 h1:0cC/QzS8OCuXYqqDbYnKKhsEe+IZLrNlDx8KPCieeW0=
|
||||||
|
github.com/ybbus/jsonrpc/v3 v3.1.5/go.mod h1:U1QbyNfL5Pvi2roT0OpRbJeyvGxfWYSgKJHjxWdAEeE=
|
||||||
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
|
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||||
|
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
|
golang.org/x/crypto v0.0.0-20210513122933-cd7d49e622d5/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||||
|
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||||
|
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
||||||
|
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||||
|
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU=
|
||||||
|
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
94
price.go
94
price.go
@ -142,54 +142,54 @@ func UpdateMarkets() {
|
|||||||
ltc = deroltc
|
ltc = deroltc
|
||||||
deroltc = swap
|
deroltc = swap
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mk.Lock()
|
mk.Lock()
|
||||||
defer mk.Unlock()
|
defer mk.Unlock()
|
||||||
|
|
||||||
// TODO: simplify
|
// TODO: simplify
|
||||||
if xmr > 0 {
|
if xmr > 0 {
|
||||||
mk.Pairs.XMR = xmr
|
mk.Pairs.XMR = xmr
|
||||||
mk.Update[coin.XMRDERO] = time.Now().UnixMilli()
|
mk.Update[coin.XMRDERO] = time.Now().UnixMilli()
|
||||||
IsPairAvailable[coin.XMRDERO] = true
|
IsPairAvailable[coin.XMRDERO] = true
|
||||||
} else {
|
} else {
|
||||||
t := time.UnixMilli(mk.Update[coin.XMRDERO])
|
t := time.UnixMilli(mk.Update[coin.XMRDERO])
|
||||||
if time.Since(t) > time.Minute*2 {
|
if time.Since(t) > time.Minute*2 {
|
||||||
IsPairAvailable[coin.XMRDERO] = false
|
IsPairAvailable[coin.XMRDERO] = false
|
||||||
log.Println("XMR->DERO disabled")
|
log.Println("XMR->DERO disabled")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if deroxmr > 0 {
|
}
|
||||||
mk.Pairs.DEROXMR = deroxmr
|
if deroxmr > 0 {
|
||||||
mk.Update[coin.DEROXMR] = time.Now().UnixMilli()
|
mk.Pairs.DEROXMR = deroxmr
|
||||||
IsPairAvailable[coin.DEROXMR] = true
|
mk.Update[coin.DEROXMR] = time.Now().UnixMilli()
|
||||||
} else {
|
IsPairAvailable[coin.DEROXMR] = true
|
||||||
t := time.UnixMilli(mk.Update[coin.DEROXMR])
|
} else {
|
||||||
if time.Since(t) > time.Minute*2 {
|
t := time.UnixMilli(mk.Update[coin.DEROXMR])
|
||||||
IsPairAvailable[coin.DEROXMR] = false
|
if time.Since(t) > time.Minute*2 {
|
||||||
log.Println("DERO->XMR disabled")
|
IsPairAvailable[coin.DEROXMR] = false
|
||||||
}
|
log.Println("DERO->XMR disabled")
|
||||||
}
|
}
|
||||||
if ltc > 0 {
|
}
|
||||||
mk.Pairs.LTC = ltc
|
if ltc > 0 {
|
||||||
mk.Update[coin.LTCDERO] = time.Now().UnixMilli()
|
mk.Pairs.LTC = ltc
|
||||||
IsPairAvailable[coin.LTCDERO] = true
|
mk.Update[coin.LTCDERO] = time.Now().UnixMilli()
|
||||||
} else {
|
IsPairAvailable[coin.LTCDERO] = true
|
||||||
t := time.UnixMilli(mk.Update[coin.LTCDERO])
|
} else {
|
||||||
if time.Since(t) > time.Minute*2 {
|
t := time.UnixMilli(mk.Update[coin.LTCDERO])
|
||||||
IsPairAvailable[coin.LTCDERO] = false
|
if time.Since(t) > time.Minute*2 {
|
||||||
log.Println("LTC->DERO disabled")
|
IsPairAvailable[coin.LTCDERO] = false
|
||||||
}
|
log.Println("LTC->DERO disabled")
|
||||||
}
|
}
|
||||||
if deroltc > 0 {
|
}
|
||||||
mk.Pairs.DEROLTC = deroltc
|
if deroltc > 0 {
|
||||||
mk.Update[coin.DEROLTC] = time.Now().UnixMilli()
|
mk.Pairs.DEROLTC = deroltc
|
||||||
IsPairAvailable[coin.DEROLTC] = true
|
mk.Update[coin.DEROLTC] = time.Now().UnixMilli()
|
||||||
} else {
|
IsPairAvailable[coin.DEROLTC] = true
|
||||||
t := time.UnixMilli(mk.Update[coin.DEROLTC])
|
} else {
|
||||||
if time.Since(t) > time.Minute*2 {
|
t := time.UnixMilli(mk.Update[coin.DEROLTC])
|
||||||
IsPairAvailable[coin.DEROLTC] = false
|
if time.Since(t) > time.Minute*2 {
|
||||||
log.Println("DERO->LTC disabled")
|
IsPairAvailable[coin.DEROLTC] = false
|
||||||
}
|
log.Println("DERO->LTC disabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,13 +220,13 @@ func UpdatePool() clients.ClientInfo {
|
|||||||
for p := range coin.Pairs {
|
for p := range coin.Pairs {
|
||||||
switch p {
|
switch p {
|
||||||
case coin.DEROLTC:
|
case coin.DEROLTC:
|
||||||
pair.Balance = coin.XTCGetBalance(p) - coin.Locked.GetLockedBalance(p)
|
pair.Balance = coin.XTCGetBalance(p)
|
||||||
pair.Pair = p
|
pair.Pair = p
|
||||||
case coin.DEROXMR:
|
case coin.DEROXMR:
|
||||||
pair.Balance = monero.GetBalance() - coin.Locked.GetLockedBalance(p)
|
pair.Balance = monero.GetBalance()
|
||||||
pair.Pair = p
|
pair.Pair = p
|
||||||
case coin.XMRDERO:
|
case coin.XMRDERO, coin.LTCDERO:
|
||||||
pair.Balance = dero.GetBalance() - coin.Locked.GetLockedBalance(p)
|
pair.Balance = dero.GetBalance()
|
||||||
pair.Pair = p
|
pair.Pair = p
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
|
@ -159,9 +159,9 @@ func StartClient(server url.URL) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch request.Pair {
|
switch request.Pair {
|
||||||
case coin.XMRDERO:
|
case coin.XMRDERO, coin.LTCDERO:
|
||||||
response = Dero_Swap(request)
|
response = Dero_Swap(request)
|
||||||
case coin.DEROXMR:
|
case coin.DEROXMR, coin.DEROLTC:
|
||||||
response = Reverse_Swap(request)
|
response = Reverse_Swap(request)
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user