-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle focus floor bid case #713
Conversation
// focus launches on mainnet, the FOCUS_FLOOR_PRICE_DESO_NANOS_MAINNET value needs to be updated | ||
// based on the price of DESO at launch. | ||
const FOCUS_FLOOR_PRICE_DESO_NANOS_TESTNET = 166666 | ||
const FOCUS_FLOOR_PRICE_DESO_NANOS_MAINNET = 166666 // TODO: UPDATE ME. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lazynina While you're here, let's finalize this value to the following :)
- 40000
@@ -1010,11 +1019,11 @@ func (fes *APIServer) GetQuoteCurrencyPriceInUsd( | |||
// Find the highest bid price and the lowest ask price | |||
highestBidPrice := float64(0.0) | |||
if lowerUsername == "focus" { | |||
highestBidPrice = float64(FOCUS_FLOOR_PRICE_DESO_NANOS) / float64(lib.NanosPerUnit) | |||
highestBidPrice = float64(GetFocusFloorPriceDESONanos(fes.Params.NetworkType == lib.NetworkType_TESTNET)) / float64(lib.NanosPerUnit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always prefer pulling out the == like this:
isTestnet := fes.Params.NetworkType == lib.NetworkType_TESTNET
highestBidPrice = float64(GetFocusFloorPriceDESONanos(isTestnet)) / float64(lib.NanosPerUnit)
@@ -1010,11 +1019,11 @@ func (fes *APIServer) GetQuoteCurrencyPriceInUsd( | |||
// Find the highest bid price and the lowest ask price | |||
highestBidPrice := float64(0.0) | |||
if lowerUsername == "focus" { | |||
highestBidPrice = float64(FOCUS_FLOOR_PRICE_DESO_NANOS) / float64(lib.NanosPerUnit) | |||
highestBidPrice = float64(GetFocusFloorPriceDESONanos(fes.Params.NetworkType == lib.NetworkType_TESTNET)) / float64(lib.NanosPerUnit) | |||
} | |||
var lowestAskPrice, midPriceDeso float64 | |||
midPriceDeso, highestBidPrice, lowestAskPrice, err = fes.GetHighestBidAndLowestAskPriceFromPKIDs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer:
isFocus := lowerUsername == "focus"
midPriceDeso, highestBidPrice, lowestAskPrice, err = fes.GetHighestBidAndLowestAskPriceFromPKIDs(
pkid.PKID, &lib.ZeroPKID, utxoView, highestBidPrice)
pkid.PKID, &lib.ZeroPKID, utxoView, highestBidPrice, isFocus)
No description provided.