Skip to content
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

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Conversation

lazynina
Copy link
Member

No description provided.

@lazynina lazynina marked this pull request as ready for review January 29, 2025 01:28
@lazynina lazynina requested a review from a team as a code owner January 29, 2025 01:28
// 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.
Copy link
Member

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)
Copy link
Member

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(
Copy link
Member

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)

@lazynina lazynina merged commit 12569e4 into main Jan 29, 2025
1 of 2 checks passed
@lazynina lazynina deleted the ln/get-quote-currency-price-enhancements branch January 29, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants