-
Notifications
You must be signed in to change notification settings - Fork 15
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
StaticCallAssetProxy #39
Comments
Looking at this with my order-book pruning hat on, this could be very challenging to support in a generic way. OpenRelay prunes our orderbook by monitoring events. If an order specifies a predicate function we've never seen, we don't even know if there are events we could monitor that would tell us when the predicate would invalidate the order, let alone what those events look like. I could see implementing support for a specific set of predicate functions we know how to monitor, but as described I don't think we could support this in an open-ended way. |
@AusIV This is definitely a challenge. It's a challenge we've already encountered with certain ERC20 tokens which can have Maker restrictions. In the wild we've seen "proof of use", "blacklisted" addresses which aren't picked up by standard events. The best way to test the validity, and something that is already supported in 0x.js, is to simulate the underlying transfer. We understand that there are tradeoffs in adding this behaviour, there are use cases where an event is not possible (post-dated orders). Our job in the tooling is to also provide a succinct and efficient way of bulk checking these orders. Working towards standardised predicates will help keep this efficient. |
While there are NFTs that keep their metadata onchain, the prevailing model for NFTs is to point to meta-data about the asset off-chain through a URI, so as to reduce gas costs. As such, the NFT use case for this ZEIP may not have as many uses without some kind of an oracle, which I imagine is beyond the scope of the ZEIP? Unless, we could perhaps specify how an oracle would be implemented, providing a standard, similar to how the tokenURI is (sort of) standardized with the ERC721 spec. Is that work worth doing as part of this ZEIP? |
Right, and we always encourage people to validate orders before they submit them to the blockchain - there's always going to be the risk of latency meaning an order we serve is unfillable by the time a user tries to fill it, but we try not to keep unfillable orders on our books. If we allow these orders with arbitrary predicates, our only option would be to periodically retest them, which works if we just have a handful, but doesn't scale very well. To be clear, I'm not opposing this feature at all. I think it's very useful in some narrower use cases, I just don't think there's any way to build an event-based order watcher that handles this asset type in a generic way, and I think this is the first 0x asset type where that's the case. I am curious how the 0x order watcher plans to handle this. |
I think it is unlikely that you will find a heterogeneous liquidity pool where some orders put these checks in place and others do not. My guess is that stateful assets will be offered on specialized, niche marketplaces that only accept orders if a specific set of checks are in place. The marketplaces will want to protect their users from trades producing unexpected results and so they will take care of these checks on their users' behalf. |
How important is this use case for everyone? The current thinking is to actually split this out into 2 separate proxies in order to support this. The first would work exactly as described, but could not be used for whitelists of any kind because the taker is probably not known in advance. The second would expect the receiving contract to have a specific interface and would forward the
Alternatively, we can have a single proxy and just append |
Summary
We introduce a new asset proxy for validating an order bundle during settlement through an arbitrary, read-only callback.
Motivation
One issue when trading non-fungible items (kitties, composables, CDPs) is that many of these assets are stateful. Their value is derived from the state at a given point in time. If this state were to be modified, the value of the asset is also potentially modified.
We wish to implement a method to guarantee for the buyer of an asset that the state remains desirable throughout the entire settlement process.
StaticCallProxyAssetData Fields
Usage
The
StaticCallAssetProxy
“asset” is intended to be mixed with real assets within aMultiAssetProxy
bundle, such as:When the
MultiAssetProxy
executes the transfer of this asset, theStaticCallAssetProxy
will perform the following read-only check:If the above condition is not satisfied, the asset proxy will revert, aborting the entire trade. A maker can even chain multiple
StaticCallAssetProxy
assets inside theMultiAssetProxy
bundle to perform multiple state checks, or they can use a bespoke contract to aggregate all checks (or perform more complex checks) in a single call.Altogether, this allows the maker to establish some sort of state guarantees on the asset(s) being traded. And, since callbacks can access any on-chain state, we imagine some pretty creative uses could arise.
StaticCallAssetProxy Implementation
A pseudo-code implementation of the asset proxy would look like:
Example Use Cases
Challenges
eth_call
fill is the only way to generally validate these asset bundles.from
,to
, andamount
fields are currently ignored, but could be useful to the callback— for example, to check the KYC status of the taker.The text was updated successfully, but these errors were encountered: