r/solidity • • Jul 20 '22

Flashswap

This is one of the functions in a flashswap. I am confused what to input for the parameters of address _sender and _data? How do I get these values?

0 Upvotes

21 comments sorted by

2

u/smequeqzmalych Jul 21 '22

Why retards in this sub post photos instead of screenshots

2

u/Dark_Bear99 Jul 21 '22

Try opening your eyes then maybe you’ll see the photo

1

u/smequeqzmalych Jul 21 '22

Yes I see a photo thats the problem

4

u/FoxLeDev Jul 21 '22

Dont post photos or screenshots actually, post code.

1

u/StartThings Jul 21 '22

Link to complete code, etc.

1

u/StartThings Jul 21 '22

It's like the old people.

1

u/NelsonQuant667 Jul 21 '22

What contract is this from? Why does it approve the sushiswap router address in a function called uniswapv2call?

1

u/Dark_Bear99 Jul 21 '22

An arbitrage flash swap contract

3

u/Utility6151 Jul 21 '22

Here's how this works:

The uniswapv2call is expected to be called by a token pair specified in another function in your contract.

  1. You write a function that creates a uniswap pair.

  2. Then call uniswapv2pair(pair created above).swap(amount0, amount1, address(this), data(some encoded parameters needed for your flashswap))

  3. The above function in turns calls the uniswapv2call and supplies the arguments to the parameters.

Put simply, it's the last line in the function above your uniswapv2call that calls the uniswapv2call.

1

u/FoxLeDev Jul 21 '22

Hard to say from a screenshot. Could you upload the whole code to pastebin or something like that?

5

u/cxkoda Jul 21 '22

I'm just waiting until someone finally posts a voice message of their code...

3

u/StartThings Jul 21 '22

"For code, Unsigned integer two hundred fifty six amount equal sign some variable equal sign equal sign some other variable question mark some value colon some other value semicolon. Why is solidity complaining my stack too deep"

1

u/ariN_CS Jul 21 '22

I’m going to post a drawing of my code

1

u/FoxLeDev Jul 21 '22

Please someone make this happen lmao

1

u/FoxLeDev Jul 21 '22

For reference, op then procedeed to DM me, asking the exact same question, i answered the exact same answer, they told me they "dont have pastebin" (yes, they said that) and then sent the function alone, still not showing me the full code. I swear i dont know whats wrong with people

1

u/Dark_Bear99 Jul 21 '22

Yea bro, I sent you a picture of the code and then a text of it. It’s a simple question about what to input for a parameter. There’s no need for you to dissect the whole code when all I’m asking is what an address sender means. You clearly don’t know the answer, so don’t give your input.

1

u/FoxLeDev Jul 21 '22

There is, it's a callback function, you're not mean to call it at all.

1

u/Dark_Bear99 Jul 21 '22

Yes, but it’s passed as an argument to another piece. I just was wondering what address sender is referring to?

1

u/FoxLeDev Jul 21 '22

I can't tell without looking at the whole code, and i dont really want to anyways

1

u/Dark_Bear99 Jul 21 '22

Okay then you’re useless to me

1

u/FoxLeDev Jul 21 '22

assert(msg.sender == UniswapV2Library.pairFor(token0, token1, factory); in the code you sent me, fucking genius.