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

circular arbitrage issue #76

Open
osmangokc opened this issue Jan 3, 2025 · 4 comments
Open

circular arbitrage issue #76

osmangokc opened this issue Jan 3, 2025 · 4 comments

Comments

@osmangokc
Copy link

how does this allow circular arbitrage mode work. should i enter wsol mint for both input and output mint?

@shirotech
Copy link

shirotech commented Jan 14, 2025

@osmangokc took abit of digging, but the answer I've derived is not what you wanted. The quotes will give you a blank path, what you need to do is create 2 separate quote (for example SOL => USDC, and USDC => SOL), concat the route plans together and pass it to /swap or /swap-instructions endpoint.

@EsperanzaBunny
Copy link

@osmangokc took abit of digging, but the answer I've derived is not what you wanted. The quotes will give you a blank path, what you need to do is create 2 separate quote (for example SOL => USDC, and USDC => SOL), concat the route plans together and pass it to /swap or /swap-instructions endpoint.

hi, i have an issue like this after create 2 separate quote (for example SOL => USDC, and USDC => SOL), concat the route plans together and pass it to /swap-instructions endpoint. Got a lil bit stuck here, can you give me an explaination in detail ? I appreciate your help

> Program log: Instruction: SharedAccountsRoute
> Program log: panicked at programs/jupiter/src/token_nostd.rs:24:43: range end index 64 out of range for slice of length 0
> Program[ Jupiter Aggregator v6 ](https://solscan.io/account/JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4)consumed 5655 of 200000 compute units
> Program returned error: SBF program panicked

@shirotech
Copy link

shirotech commented Jan 17, 2025

@EsperanzaBunny You will also need to copy the input props to your final quote, here is a sample code:

q2.routePlan = q1.routePlan.concat(q2.routePlan);
q2.inAmount = q1.inAmount;
q2.inputMint = q1.inputMint;

Then submit quote2 to /swap endpoint.

*note that you will need to set useSharedAccounts to false, or it will complain about not supporting it for arbitrage or something like that.

Hope this all helps, and good luck!

@SocialAnxty
Copy link

@EsperanzaBunny You will also need to copy the input props to your final quote, here is a sample code:

q2.routePlan = q1.routePlan.concat(q2.routePlan);
q2.inAmount = q1.inAmount;
q2.inputMint = q1.inputMint;
Then submit quote2 to /swap endpoint.

*note that you will need to set useSharedAccounts to false, or it will complain about not supporting it for arbitrage or something like that.

Hope this all helps, and good luck!

I have useSharedAccounts set to false and its still telling me

Input and output mints are not allowed to be equal","errorCode":"CIRCULAR_ARBITRAGE_IS_DISABLED"

any ideas?

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

No branches or pull requests

5 participants
@shirotech @osmangokc @SocialAnxty @EsperanzaBunny and others