enzymefinance / protocol

Enzyme Protocol Implementation

Home Page:https://enzyme.finance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update callOnExchange to handle arbitrary 0x v3 maker/taker fee assets

SeanJCasey opened this issue · comments

Update callOnExchange() to take a bytes[4] orderData param to handle:

  • makerAssetData
  • takerAssetData
  • makerFeeAssetData
  • takerFeeAssetData

This will be needed for integrating 0x v3's arbitrary fee types.

Remaining tasks:

  • Change orderAddresses to take 8 addressees
  • Update policies/TradingSignatures.sol
  • Trading.sol should require maker/takerFeeAsset to be in registry
  • Fix: Trading.sol should use policies/TradingSignatures.sol instead of hard-coded values
  • Integration test: maker/taker asset and maker/taker fee asset are in Registry (Trading.sol)

@travs One further change we could make is changing orderAddresses[6] to orderAddresses[8] and incorporating the maker/taker fee asset addresses and checking whether they match the assetData. Do you think that's necessary?

@SeanJCasey Good point. It makes sense to pass those in as plain addresses as well I think, just so policies can more easily observe their values if necessary. Just a crude example could be implementing a policy that limits which fees assets can be paid in.
There are more benefits to passing in the addresses, this is just one possible one

Added a few items to the checklist above regarding checking the asset and fee asset inputs more thoroughly in callOnExchange.

E.g., the check against the Registry only gets called if the methodSelector is a make or take order, but these encoded sigs are hardcoded and easy to overlook when changing these functions as we've done here. If we forget to update the sigs, those require statements will just pass silently. We should use the hardcoded values from policies/TradingSignatures, and should have an integration test to assert that an unregistered asset doesn't slip through the cracks.

closed by #851