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: add market (auction paradigm 2) to server #298

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

anihamde
Copy link
Contributor

This PR adapts the server code to welcome market orders/swaps that are in Auction Paradigm 2 (bidding in one of the tokens swapped, rather than in native token).

This PR does so in the minimal way--there are some outstanding changes that will improve the code quality later on in future PRs. Some of these are:

  • Remove wallet_program_router_account, use a different way to check the bid belongs to Auction Paradigm 2. i.e. use parsed instruction data, fact that AP2 will include swap ix.
  • Refactor db longer-term. Maybe think about separate OpportunityMarket flag (rather than relying on filtering on the router account)
  • Think about good ways to tilt test this, once program is updated

@anihamde anihamde marked this pull request as draft December 17, 2024 19:37
auction-server/Cargo.lock Outdated Show resolved Hide resolved
}

#[derive(Serialize, Deserialize, ToSchema, Clone, PartialEq, Debug)]
pub enum QuoteTokenAmount {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use serde to rename the internal fields here (for better api). Maybe take a look at docs to see how to api structure is looking like?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can talk on this part together

Copy link
Contributor

Choose a reason for hiding this comment

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

We can also rename this to sth else :-? Maybe like QouteType?

auction-server/api-types/src/opportunity.rs Outdated Show resolved Hide resolved
auction-server/src/auction/service/verification.rs Outdated Show resolved Hide resolved
auction-server/src/auction/service/verification.rs Outdated Show resolved Hide resolved
auction-server/src/opportunity/entities/opportunity_svm.rs Outdated Show resolved Hide resolved
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "program", rename_all = "lowercase")]
pub enum OpportunityMetadataSvmProgram {
Limo(OpportunityMetadataSvmProgramLimo),
Phantom(OpportunityMetadataSvmProgramWallet),
Swap(OpportunityMetadataSvmProgramWallet),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should make sure that there is no phantom opportunity inside the DB. Maybe add a task to backlog for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean that we don't currently have any opportunities of this sort saved in the db?

auction-server/src/opportunity/service/get_quote.rs Outdated Show resolved Hide resolved
auction-server/src/opportunity/service/get_quote.rs Outdated Show resolved Hide resolved
auction-server/src/opportunity/service/get_quote.rs Outdated Show resolved Hide resolved
@danimhr
Copy link
Contributor

danimhr commented Dec 18, 2024

There are some errors when running cargo check which we can resolve

@@ -135,7 +186,7 @@ impl Service<ChainTypeSvm> {
// Add metrics
let labels = [
("chain_id", input.quote_create.chain_id.to_string()),
("wallet", "phantom".to_string()),
("router", input.quote_create.router.to_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.

we can also pass in the auth name from post_quote if we prefer

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