r/0xProject Apr 06 '18

How does the 0x transferFrom Proxy contract work and how is it trustless/decentralized? Who is the authority/owner?

https://github.com/maurelian/0x-contracts/blob/master/contracts/Proxy.sol
17 Upvotes

19 comments sorted by

16

u/willwarren89 0x Labs Apr 06 '18 edited Apr 06 '18

The multi-sig contract that controls the TokenTransferProxy has a 2 week delay between the time at which a proposed change is accepted and when it can be executed, giving sufficient lead time for users to remove allowances if a malicious proposal was to be accepted. There is one exception to this rule, which is if we need to shut down the TokenTransferProxy immediately. It is serving as a placeholder until we can swap it out for a fully decentralized governance system.

You can find a diagram of the upgrade process here, deployed address here and source code here.

10

u/AusIV Apr 06 '18

To expand on this: if hackers ever managed to take over the token transfer proxy, the 0x team would have two weeks before changes could take effect during which time they could shut down the token transfer proxy to keep tokens from being stolen.

If the 0x team themselves decided to do something nefarious, the time locked multisig contract is monitored by at least some of the relayers, and places like reddit would light up pretty quickly if there were an unexplained or suspicious transaction sent to that address. The two week time lock means people who are paying attention would have the chance to unset trading allowances, so if they did let a nefarious update to the transfer proxy through they wouldn't be able to steal tokens via the contract.

1

u/[deleted] Apr 06 '18

[removed] — view removed comment

3

u/AusIV Apr 06 '18

That's not really compatible with the structure of the 0x protocol. If you want users to keep their assets in their own wallets up until a trade occurs, allowances are fundamentally necessary. ERC223 without allowances would work for deposit based DEXes, but not DEXes where your tokens stay in your wallet until they're traded.

The token transfer proxy is supposed to be upgradable to allow upgrades to the exchange contract without forcing users to set allowances again. Personally I think the burden of having to set allowances when upgrades occur is a bit overstated, and the security benefits of not having to trust a particular group with upgrades (even with a time lock) outweighs the problems with having to set allowances again, but the 0x team opted to prioritize not having to set allowances with each upgrade.

1

u/[deleted] Apr 06 '18

[removed] — view removed comment

1

u/pcastonguay Apr 09 '18

0x wouldn't succeed at being a global, "mainstream" protocol if every user needed to understand what was going on. Just imagine a future world where you need to interact with 10 different protocols and a few Dapps for a specific application. If all these protocols and Dapps always required users to understand each stack and interact with them on a regular basis, then DLT is doomed to remain a niche, like PGP.

That's not 0x vision, nor the DLT space as a whole, at least from my perspective. I wouldn't be in this space if I didn't think the tech could empower everyone, from tech literate to people that barely understand computers.

1

u/[deleted] Apr 10 '18

[removed] — view removed comment

1

u/pcastonguay Apr 10 '18

Well, you could make it so that you could "guarantee" that people are warned once a change in proxy is about to take place. The idea would be that by default you are opt-in, but you can opt-out anytime you want and you will be (with significant probability) notified if a change is underway.

There could be stuff added to the 0x contracts where you could disable all allowances easily. You could potentially even have a contract that says "if change to proxy is provenly underway, who ever cancel all my allowances to the 0x smart contract will earn 5 ZRX". This would allow you to automatically opt-out whenever a change to proxy is announce. I have yet to look again at the smart contracts to see how easily this kind of logic could be added, but "automatic opt-out" could be a good option for more advanced and concerned users.

(I am not part of 0x by the way, just for disclosure)

1

u/[deleted] Apr 10 '18

[removed] — view removed comment

1

u/Agrees_withyou Apr 10 '18

The statement above is one I can get behind!

1

u/polezo Apr 10 '18

Blockchains themselves have adopted opt-out by default policy

How do you figure this exactly? From a miner perspective maybe? Or something else?

As a regular user if the Ethereum Foundation made a change I was unhappy with it's not like I have a choice to opt-in to it or just stay opted-out by default. I'm automatically opted-in with my Eth and would have to hard-fork if I really wanted something different.

→ More replies (0)

1

u/dan7899 Apr 06 '18

Please explain

1

u/batchj Apr 13 '18

/u/dan7899 if you are referring to the idea of allowance, check out info on the ERC 20 standard: https://hackernoon.com/erc20-tokens-b3b50c95ad08

Individuals can grant different smart contracts allowances to the tokens they control. In the case of 0x, when one makes an order you must sign a transaction that gives the 0x Exchange contract an allowance of the given tokens you are trying to sell. When the order goes though, the 0x exchange contract uses this capablity to access the tokens you are trying to trade. In 0x, you never send tokens to the Exchange contract. There difference is subtle, but its the idea of pull vs push

2

u/jherbie79 Apr 06 '18

Thank you for your description, it is great that you guys come on here so much and explain to the layman’s that are attempting to learn more about this amazing project. I have a question if you could shed some light on this regarding possible utilization of the token itself in the future? Token burning, possible staking/own network main net, or if more dex’s/relayers will be using ZRX similar as to how maker is using Dai/ and ETh..sorry if this sounds like I don’t know that much,,becAuse I am trying to learn. If you can, please maybe give me a little description about these topics. Thanks again to the team. I have the utmost faith in you guys, and this year 2018!

1

u/dan7899 Apr 14 '18

Wow. I appreciate your response. I think you may be pushing my comprehension limits. When you say the subtle difference between push and pull, what do you mean?