Add CloseMarket function to redeem rent from permissioned markets #191
Add CloseMarket function to redeem rent from permissioned markets #191Henry-E wants to merge 26 commits into
Conversation
|
Added an anchor test directory that initializes a market and shuts it down again, then checks that the sol is retrieved. It's not ready for merging yet though. There needs to be more discussion of what checks are needed before the rent is retrieved. Right now though the core functions are there and there's a working test. So fitting in any requested changes ought to be straightforward. We will see though! Next up
Ok, it looks like it's possible to load up request queue and event queue then check their headers to ensure Update: Added checks that load the headers for all four queue structs and checks that their counts are empty. |
What the code currently does is correct. The event queue can check the header count and the bid/asks slabs can check the leaf_count. |
|
Ok, added the disabled flag. Going to start adding more comprehensive testing. It looks like the permissioned markets set of tests are failing because they're not using solana 1.9.0 |
…nto CloseMarkets
Henry-E
left a comment
There was a problem hiding this comment.
Finished add close market and a more full set of tests
|
@armaniferrante Ran a full set of tests on the new close market functionality. close_markets doesn't allow markets to be closed while
And even more importantly
|
armaniferrante
left a comment
There was a problem hiding this comment.
Need to add the tests to travis CI
| **bids_acc.lamports.borrow_mut() = 0; | ||
| **asks_acc.lamports.borrow_mut() = 0; | ||
|
|
||
| market.account_flags = market.account_flags | (AccountFlag::Disabled as u64); |
There was a problem hiding this comment.
Should use Closed instead of Disabled.
There was a problem hiding this comment.
Serum already has the functionality for Disabled built in from the ability to manually shutdown. I didn't find anything similar for Closed
There was a problem hiding this comment.
https://github.com/project-serum/serum-dex/blob/master/dex/src/state.rs#L1884 - Here's where new order already checks for whether a market is disabled. Is this functionality different from closing? It's possible I haven't fully understood the full extent of what the disable flag affects
|
Travis CI tests added. Arguably we still haven't come to a good conclusion on the use of I wanted to keep the actual changes made to the dex as minimal as possible. However, if it's necessary we can re-use the |
|
bump sers @Henry-E @armaniferrante pls help 🥏 |
|
up @Henry-E @armaniferrante |
|
bump |
|
what's the status of this? Any forthcoming plans to try to include this feature soon? |
|
bump |
Currently a placeholder pull request for adding a close market function.
Still TODO
Questions for @armaniferrante
market closedflag to markets so that it's clear the market is shutdown?Things I will add
Add CloseMarkets to the permissioned markets proxy exampleAdd a test to the permissioned markets javascript testsPlus any other code review and additional checks that need to be added to the function.
The pull request is mainly based on existing examples from how
CloseOpenOrdersandPrunefunctions were implemented.