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

Feat: get_altcoin_quote endpoint #58

Merged
merged 7 commits into from
Mar 13, 2024
Merged

Conversation

irisdv
Copy link
Collaborator

@irisdv irisdv commented Mar 6, 2024

Close #57

@irisdv irisdv changed the base branch from master to feat/cairo2 March 6, 2024 08:40
@irisdv irisdv requested a review from Th0rgal March 6, 2024 14:26
@irisdv irisdv marked this pull request as ready for review March 6, 2024 14:26
@irisdv irisdv added the 🔥 Ready for review This pull request needs a review label Mar 6, 2024
Copy link
Member

@Th0rgal Th0rgal left a comment

Choose a reason for hiding this comment

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

This code looks good to me, I don't see any reason it would fail. However, I think we need to be very careful because an issue with it could cause a lot of damage (if someone can generate signatures allowing him to buy domains for 0 STRK for example). Because we rely on the AVNU API, I would like if you could change the configuration to allow us to add some security margin. Instead of just having a token_support with generic data, I would like something like this:

[altcoins]
private_key = "123"

# Ethereum (ETH) is not enabled for the moment as it is already supported by default buy.
# [altcoins.ETH]
# address = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
# min_price = 1
# max_price = 1
# decimals = 18
# max_quote_validity = 3600 # in seconds for ETH

[altcoins.STRK]
address = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"
min_price = 500
max_price = 5000
decimals = 18
max_quote_validity = 300 # it moves faster so we reduce the quote validity

[altcoins.USDC]
address = "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8"
min_price = 2000
max_price = 10000
decimals = 6 # not sure really
max_quote_validity = 600

[altcoins.USDT]
address = "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8"
min_price = 2000
max_price = 10000
decimals = 18
max_quote_validity = 600

Finally, could you please move the endpoints out of the avnu folder, because it is not really an avnu feature (we could use another source for pricing) and it is not the path chosen in the axum macro.

src/endpoints/avnu/get_altcoin_quote.rs Outdated Show resolved Hide resolved
@Th0rgal Th0rgal added ❌ Change request Change requested from reviewer and removed 🔥 Ready for review This pull request needs a review labels Mar 8, 2024
@irisdv irisdv requested a review from Th0rgal March 11, 2024 09:27
@irisdv irisdv added 🔥 Ready for review This pull request needs a review and removed ❌ Change request Change requested from reviewer labels Mar 11, 2024
Copy link
Member

@Th0rgal Th0rgal left a comment

Choose a reason for hiding this comment

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

I have a question

src/endpoints/get_altcoin_quote.rs Show resolved Hide resolved
@Th0rgal Th0rgal added ❌ Change request Change requested from reviewer and removed 🔥 Ready for review This pull request needs a review labels Mar 12, 2024
@irisdv irisdv added 🔥 Ready for review This pull request needs a review and removed ❌ Change request Change requested from reviewer labels Mar 13, 2024
@Th0rgal Th0rgal merged commit f4a4a16 into feat/cairo2 Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 Ready for review This pull request needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants