project-serum / serum-dex

Project Serum Rust Monorepo
https://projectserum.com
Apache License 2.0
616 stars 324 forks source link

Closeable markets #118

Open armaniferrante opened 3 years ago

armaniferrante commented 3 years ago

There should be an instruction for one to close dead markets to retrieve the rent exemption SOL.

valekar commented 3 years ago

@armaniferrante Is anyone working on this? Looks this is a burning topic that needs to resolved for saving money for the current hackathon. If not, I can work on this in my free time.

armaniferrante commented 3 years ago

Not currently and I don't expect this to be in the next DEX release. @sconybeare would be the person to consult for dev planning w.r.t. this feature.

valekar commented 3 years ago

@armaniferrante Thanks for the info. @sconybeare Any idea about this feature ?

tomjohn1028 commented 3 years ago

@armaniferrante @sconybeare @valekar put me in coach! PsyOptions needs this. How can I help?

valekar commented 3 years ago

@tomjohn1028 - I am trying to understand the codebase. May be I might require help in code reviewing. Once I am done, I will create a PR :)

valekar commented 3 years ago

@armaniferrante , @sconybeare - Myself and @tomjohn1028 had an architectural overview on how to solve this problem.

Our initial idea -

  1. Add a new PublicKey to the Market meta data that indicates the closing_authority. This key can only be set when initialising. If the key is not present the market cannot be closed.

  2. Create a new instruction for closing a market. This instruction must be signed by the closing_authority. It cancels all orders, unwinds, and closes the market

Drawback - This approach would have trust issues. To alleviate this issue, we could introduce time based Market -

  1. There will be no fills for X time
  2. The market unlocks closeable Market instruction after X time.

Any idea or if you already have an architecture ready for this, it would be really helpful.

Thanks,

wdstudionft commented 2 years ago

We need to solve this problem asap, I have 8 sol locked because create 2 wrong market. https://github.com/Henry-E/serum-dex/tree/97f9596541bafa8bf3907693db28901c32241666

h4rkl commented 1 year ago

Is this dead? Have a market I'd love to close.