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

DEX 0 DAI Balance Misunderstanding #15

Open
benjamin852 opened this issue Feb 23, 2023 · 1 comment
Open

DEX 0 DAI Balance Misunderstanding #15

benjamin852 opened this issue Feb 23, 2023 · 1 comment

Comments

@benjamin852
Copy link

it("Should provide a caller with more DAI than they started with after a swap", async function () {

Hello and thank you very much for putting this together.

I hope this is an okay place to ask but I wanted to just clarify one thing about this test because I think I have misunderstood something.

Though this doesn't exist in the test I added a line to check the DAI balance of the simpleSwap contract before executing the swapWETHForDAI function. I also checked the SwapRouterAddress which also has 0 DAI.

When I logged that I saw that the simpleSwap has a DAI balance of 0.

I am just unclear on how this function can execute correctly if the DEX has 0 DAI balance, does the DEX not need to have liquidity of DAI in order for the receiver to be paid out in DAI when the receiver has swapped in his WETH?

How is the simpleSwap able to fund the sender with DAI if it has none?

Hope to get some clarification on this.
Thanks very much!

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

2 participants
@benjamin852 and others