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

Add Lifi price provider #1453

Merged
merged 4 commits into from
Dec 30, 2024
Merged

Add Lifi price provider #1453

merged 4 commits into from
Dec 30, 2024

Conversation

aminsato
Copy link
Contributor

@aminsato aminsato commented Dec 5, 2024

Fixes #1136

Lifi returns prices in USD, but we have enhanced it to support conversion into other currencies as well

@aminsato aminsato requested a review from yvebe December 5, 2024 16:37
contractAddress
)
}
}.awaitAll().associate { (contractAddress, priceInUsd) ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it because that lifi only have USD price , thus we use USDT to convert it to local currency?
maybe leave a comment here , so it will be easier for people to understand it in the future

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it because that lifi only have USD price , thus we use USDT to convert it to local currency? maybe leave a comment here , so it will be easier for people to understand it in the future

Exactly
Added comment to make it more clear

Comment on lines 220 to 221
//Since Lifi provides prices in USD, we use USDT to convert them into the local currency
contractAddress to mapOf(currency to priceInUsd * tetherPrice)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnnyluo
Here

@aminsato aminsato requested a review from johnnyluo December 10, 2024 08:29
@Serializable
internal data class LiQuestResponseJson(
@SerialName("priceUSD")
val priceUSD: String,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val priceUSD: String,
val priceUsd: String,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

)
} catch (e: Exception) {
BigDecimal.ZERO
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do null here, and decide if we want zero in other places

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@aminsato aminsato requested a review from yvebe December 11, 2024 10:03
@aminsato aminsato self-assigned this Dec 24, 2024
@yvebe yvebe merged commit ec294ba into main Dec 30, 2024
1 check passed
@yvebe yvebe deleted the add/lifi-price branch December 30, 2024 08:33
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.

[ADD] price for VTHOR
3 participants