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

Colin/exchanges #180

Closed
wants to merge 11 commits into from
Closed

Colin/exchanges #180

wants to merge 11 commits into from

Conversation

Autoparallel
Copy link
Collaborator

@Autoparallel Autoparallel commented Mar 31, 2023

This PR is set to close #154. I am reaching out to @Alexangelj and @clemlak since you two are the Solidity gurus 🙂

At the moment, I have scaffolded out a test in crates/simulate/src/exchange.rs called test_swap_from_x_liquid_exchange that will swap token_x for token_y. The goal is to have the liquid_exchange.sol announce a price that only some permissioned agent (e.g., the admin agent) can set manually. The liquid exchange can then take in any amount of token_x or token_y and give back the correct amount of the other asset based on the listed price. This, in my mind, requires either some kind of "bank" that holds a large amount of token_x and token_y or it requires active minting and burning. I don't have a preference on which we use, but we should keep track of this accounting somehow.

I had issues with allowances not being properly set. Upon calling the swap function, I was getting a Revert result due to unset allowances. This is just not familiar to me, to be honest.

Furthermore, I have not gotten the fixed point math set up properly with token decimals whatsoever.

I was also building the test test_swap_from_x_liquid_exchange prior to PR #179 so there are some changes to make in this as well. manager no longer deploys and calls, that is now passed to the admin agent. You can see other tests in simulate/lib.rs for examples. Also, it would be good to write a test_swap_from_y_liquid_exchange test as well.

Please comment if you have questions!

Here is the PR on Arbmod.

@Autoparallel Autoparallel deleted the colin/exchanges branch April 10, 2023 14:47
@Autoparallel Autoparallel restored the colin/exchanges branch April 10, 2023 14:52
@Autoparallel
Copy link
Collaborator Author

I am moving some of this to a new branch after the main refactor.

@0xJepsen 0xJepsen deleted the colin/exchanges branch June 23, 2023 16:05
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.

Infinitely liquid market
3 participants