wyvernprotocol / wyvern-v3

Wyvern Protocol v3.1, Ethereum implementation
https://wyvernprotocol.com
MIT License
298 stars 121 forks source link

Global Maker #48

Open MarvinJanssen opened 3 years ago

MarvinJanssen commented 3 years ago

This one will never work in the current state because the sender and receiver are asserted in the static calls. Apart from that, the signatures validate with the Global Maker contract. I opted to pass some information to the Global Maker when it is constructed on where the maker address (/ from address) for specific call data will be. I do this by providing a list of function signatures and corresponding byte offsets. It makes it rather flexible and helper functions could be created to add more signatures without having to redeploy the contract.

There are multiple ways to get this to work. I assume a quick solution could be to add a call recipient address to Order (or something), and when present, pass that to the static call instead of the maker. Huge downside is that we have to change Order, obviously. Another possible solution is abandoning this model and looking at a shared proxy contract via the registry perhaps.

Input is appreciated.

cwgoes commented 3 years ago

This one will never work in the current state because the sender and receiver are asserted in the static calls.

Do you mean e.g. that the static calls assert that a particular account sent tokens? This check can just be removed.

For example, this line can be safely deleted. I just included it in the original static contracts for clarity on what was happening, but the recipient of tokens doesn't actually care where they come from (and the sender shouldn't have permissions to send them from anywhere else unless the sender is this kind of global maker contract).

MarvinJanssen commented 3 years ago

Static Market also makes those assertions:

https://github.com/wyvernprotocol/wyvern-v3/blob/e4396ab753e4963f5e38b238c4b12a015be7c46b/contracts/StaticMarket.sol#L48

I do not see how you could remove them. Do you not want to assert you are actually being sent the token requested? I guess you do not technically have to assert who the sender is but in following your draft PR, the global maker is going to be the maker on both sides, is it not?

cwgoes commented 3 years ago

I do not see how you could remove them. Do you not want to assert you are actually being sent the token requested? I guess you do not technically have to assert who the sender is but in following your draft PR, the global maker is going to be the maker on both sides, is it not?

You can allow anyone to be the sender, while asserting the right token and right amount. This will be easier to do with decoding calldata and asserting equality of particular fields instead of constructing calldata and asserting equality of the whole thing.

decapinator commented 1 year ago

we have to assert the recipient of the tokens which in this case (global maker) not possible because in both orders its the contract .. and since users approve that contract so i think its not possible to skip this assetion !! a solution would be adding the owner in extra data or adding executer ( global maker ) in order schema and use it just in executeCall function and continue the flow as is !! how do u think ?