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

Custom Order Processor #48

Open
MicahZoltu opened this issue Aug 1, 2019 · 2 comments
Open

Custom Order Processor #48

MicahZoltu opened this issue Aug 1, 2019 · 2 comments

Comments

@MicahZoltu
Copy link

This is the suggested template for 0x related issues.

Summary ( 2-5 Sentences )

I would like to be able to create a 0x order that is settled by a third party contract, rather than settled by 0x.

Motivation

Moving settlement out of the 0x contracts and into whatever contracts the participants want will allow people to experiment with new/novel financial derivatives and transactions besides just simple A for B swaps, all without requiring 0x manually add support and redeploy for every new thing people want.

Currently, 0x can only be used for direct trades between two parties. It cannot be used to do more complex trades like buy-and-split operations (where two people go halfsies on something and then split the resulting purchase). By adding the ability to specify a settlement contract, 0x could support many different financial transactions beyond just swapping A for B.

This could be further extended to support n participants in the trade, where you may have 3+ people putting assets into pot and then they get out shared control of some new derivative asset, or perhaps they do a circular swap (A's assets go to B, B's assets go to C, C's assets go to A).

Specification

Note: If the general idea is acceptable I can flesh out this section to be more "technical", but I don't want to waste the effort if this is just going to sit idle or be rejected.

Maker creates and signs an order that includes:

  1. Token address they want to include in the order.
  2. Amount of the token they want to include in the order.
  3. Settlement contract address.
  4. Metadata to be supplied to the settlement contract.

When a taker fills that order, they will submit the above plus:

  1. Token address they want to include in the order.
  2. Amount of the token they want to include in the order.
  3. Metadata to be supplied to the settlement contract.

0x would then:

  1. call makerToken.transferFrom(maker, 0xExchange, makerAmount)
  2. call makerToken.approve(settlementContract, makerAmount)
  3. call takerToken.transferFrom(taker, 0xExchange, takerAmount)
  4. call takerToken.approve(settlementContract, takerAmount)
  5. call settlementContract.method(maker, makerToken, makerAmount, makerMetadata, taker, takerToken, takerAmount, takerMetadata)

The settlement contract would then presumably withdraw the tokens from 0x and then do whatever it was programmed to do to complete the settlement.

Rationale (if a suggestion is proposed)

See motivation section.

Notes

This would enable Augur to use 0x for trades without resorting to a bunch of horrific hacks.

@mintcloud
Copy link
Contributor

Hey @MicahZoltu thanks for sharing this. We just applied the new standard tagging to this ZEIP (see here).
Is this proposal still relevant? 0x Core Team does not have the bandwidth to work on this right now. Is this something you would consider pushing forward, or do you need another team to work on it?

Thanks

@MicahZoltu
Copy link
Author

I still think this is a good idea, but I'm not going to build it as part of 0x myself.

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