Skip to main content

Questions tagged [swap]

Changing position of two items.

1 vote
2 answers
68 views

How to sort an array by only being able to swap an element with another element two positions ahead (i+2)?

I have an array of integers that I need to sort. However, the only operation allowed is to swap an element at index i with the element at index i+2. This means traditional sorting algorithms like ...
Patric's user avatar
  • 11
-1 votes
0 answers
27 views

Face swap with AKOOL API

I have a trouble for developing web application with AKOOL Api. https://docs.akool.io/ai-tools-suite/faceswap An API request responsed a result url successfully. But I'm wondering how can I receive ...
sweetier's user avatar
  • 129
0 votes
0 answers
15 views

How to complete a swap (order-exchange) in MedusaJs?

After your order is completed (payment is captured, order is fulfiled & shipped). You can create a swap. After creating a swap you receive an cart associated with the swap created that you have ...
Ronak Panchal's user avatar
0 votes
0 answers
28 views

Swap tokens on Uniswap v3 with Python code. Error - insufficient funds for gas * price + value

I try to use the following code to exchange tokens on the Uniswap V3 exchanger in the Arbitrum network. from web3 import Account, Web3 from abi import UNISWAP_V3_ROUTER2_ABI, WETH9_ABI, MIN_ERC20_ABI ...
Zevs's user avatar
  • 1
3 votes
1 answer
121 views

Optimizing a memswap function

In a code review for the following implementation of memswap(): void util_memswap(size_t psize, void *restrict p1, void *restrict p2) { unsigned char *a = p1; ...
Harith's user avatar
  • 7,235
0 votes
1 answer
162 views

Python Solana bot transaction issues

I’m attempting to create a solana bot that has limit order to buy $MAGA using raydium. However everytime i run the code, the transaction does not go through. <!-- begin snippet: js hide: false ...
Deka Halane's user avatar
1 vote
2 answers
8k views

Unexpected behaviour while swapping strings in C

I am a beginner to programming and today I was trying to swap two strings with somewhat of a raw , brute force logic . But I stumbled upon this behaviour : My code : #include <stdio.h> #include ...
Mike Billings's user avatar
0 votes
0 answers
52 views

Problem to deal with some ERC20 Tokens on Polygon-PoS (USDC, USDT) using Web3.py + Uniswap V3

gm. This is my first post here, i will do my best to be specific. I started to work and build some python scripts to automate some operations on Polygon-PoS network. I have the following working:(each ...
Robert Son Hedler's user avatar
1 vote
2 answers
963 views

Insufficient funds error during Solana transaction via Jupiter API despite adequate balance

I'm encountering a persistent "Insufficient funds" error when trying to execute a swap using the Jupiter API on the Solana blockchain, even though I have confirmed that the wallet has an ...
Val's user avatar
  • 11
0 votes
0 answers
71 views

Current prices of tokens to be exchanged with Pancakeswap

I get the list of pools with Pancakeswap Exchange V3 Subgraph API, but the price information in the pool information does not match the price on the site. Also, as the amount increases, the price on ...
S.K.'s user avatar
  • 1
0 votes
0 answers
62 views

Swap function in queue and stack: Does it copy each element or swap the addresses? C++

I have been studying on queues and stacks and as an exercise I'm trying to implement them by using the other one (stack with queue and queue with stack). It is possible to do it by using 1 queue or 1 ...
Aviosche's user avatar
0 votes
0 answers
16 views

Face Swapping Project related query

so I am working on a project in which a user takes a cola bottle scans a QR code in it clicks or uploads his/her image, and gets an output image in which he is posing with that cola bottle with a ...
akash mukherjee's user avatar
0 votes
3 answers
95 views

using for loops to swap digits

using a for loop i have to write code to swap the 2nd and 3rd digit of a number given via user input in javascript. for ( i = 0; i < entNum.length; i++) { if (i === 0) num2 = entNum[i]; ...
NewQode10's user avatar
0 votes
4 answers
51 views

How do I switch a numeric value in a column in a pandas dataframe with the value in another column?

Posting a solution to a problem that I didn't see on Stack Overflow. I have two columns in a pandas datframe. One has numeric values that need to be switched with the values in another column. ...
swilson's user avatar
  • 53
1 vote
1 answer
536 views

How to swap in base chain (Eth Layer2)

Hello Stack Overflow Community, I am working on swapping tokens in a base layer2 network using Uniswap V3 and ethers.js. I have successfully approved the transaction using the approve function, but ...
Ghassane Aboughazaouat's user avatar

15 30 50 per page
1
2 3 4 5
169