-
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
MultiAssetProxy: Allow multiple assets per side of a single order #23
Comments
VoteVote has started: http://0x.org/vote. Vote ends approximately 2019-02-25 5pm PST. [
{
"zeip": 23,
"title": "ZEIP23: Trade Bundles of Assets",
"startBlock": 7234093,
"endBlock": 7268071
}
] DeploymentFunction call represents the state change. All state changes are made through the AssetProxyOwner (a multisig with a 2 week time-lock), which owns the contracts in the 0x protocol. Each transaction contains the relevant function call.
Deployment ValidationThe MultiAssetProxy: 0x8a13e81fa50eca62fdec7f5d16e513a86e95481b has previously been deployed. These are the state changes to connect the MultiAssetProxy to the rest of the protocol.
AssetProxyOwner: 0x17992e4ffb22730138e4b62aaa6367fa9d3699a6
ERC20Proxy: 0x2240dab907db71e64d3e0dba4800c83b5c502d4e
ERC721Proxy: 0x208e41fb445f1bb1b6780d58356e81405f3e6127
Exchange: 0x4f833a24e1f95d70f028921e27040ca56e09ab0b
|
The vote has been finalised and accepted. The protocol is now transitioning to accept this state.
This protocol change will be completed on 2019-03-11. |
Summary
The current
AssetPoxy
contracts only allow an order to buy or sell a single asset at a time. SincemakerAssetData
andtakerAssetData
are byte arrays of arbitrary length, we can actually provide enough information to allow a maker to buy or sell multiple assets with a single order. TheMultiAssetProxy
will allow for this and is completely backwards compatible.Motivation
Specification
Requirements
MultiAssetProxy
should support an arbitrary number of transfers for any asset type that is supported within the protocol (currently or in the future).MultiAssetProxy
should not require users to set new approvals.MultiAssetProxy
should allow for partial fills (i.e if a maker wants to sell 2000 ZRX and 4000 BAT at once, the order can still be partially filled).Asset data encoding
If we wish to support partial fills, the
MultiAssetProxy
should expect data to be encoded using the following function signature:These arguments will represent an array of
amounts
and an array ofassetDatas
, where anamount
at indexi
will correspond to theassetData
at indexi
.Partial Fills
Note that the
amounts
encoded in the top levelassetData
will be multiplied by the order'samount
before transferring the asset. If a maker wants to sell 2000 ZRX and 4000 BAT and allow for partial fills, thenamounts
will equal[1, 2]
andorder.makerAssetAmount
will be2000
. If the maker does *not *want to allow partial fills, thenamounts
will equal[2000, 4000]
andorder.makerAssetAmount
will be1
.Architecture
The
MultiAssetProxy
will inheritMixinAssetProxyDispatcher
andMixinAuthorizable
. All otherAssetProxy
contracts should be registered within theMultiAssetProxy
, and eachAssetProxy
contract must also authorize theMultiAssetProxy
. TheMultiAssetProxy
must also authorize and be registered within theExchange
contract. When an order'sassetData
specifies theMultiAssetProxy
, the chain of calls looks like:Exchange
contractMultiAssetProxy
MultiAssetProxy
callsAssetProxy
contracts [0, ..., n]Pseudocode
Issues
This addition requires a lot of extra links to be created for each
AssetProxy
. The current structure is suboptimal for this due to the 2 week timelock and inability to batch transactions within theAssetProxyOwner
. It is possible that there may be some transaction ordering dependencies in the future since each one must be executed individually. I propose that batch transaction functionality is added to theAssetProxyOwner
, although this is not immediately necessary.The text was updated successfully, but these errors were encountered: