Optimize 0x wrapper, reduce unnecessary slices #155
Conversation
43dc288
to
3837afe
Compare
Pull Request Test Coverage Report for Build 1144
💛 - Coveralls |
@@ -72,42 +73,65 @@ contract ZeroExExchangeWrapper { | |||
/* ============ Public Functions ============ */ | |||
|
|||
/** | |||
* IExchangeWrapper interface delegate method. | |||
* IExchange interface delegate method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some changes to call everything IExchangeWrapper vs IExchange. Thought it was clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, this file was heavily contested in the rebase so I just went with mine. Will make these changes.
*/ | ||
function exchange( | ||
address _taker, | ||
address _, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is _
a good name? Could it ever get conflated with _
in a modifier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty standard nomenclature for unused variables, just to be clear now. It will get used when we work in relayer fees.
* | expirationUnixTimeStampSec | 256 | | ||
* | salt | 288 | | ||
* | makerAssetData | 320 | | ||
* | takerAssetData | 320 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, updated
bytes memory orderBody = _ordersData.slice( | ||
_offset, | ||
_offset.add(orderLength) | ||
uint256 takerAssetStart = _header.makerAssetDataLength.add(320); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Clarify 0x order library parsing of order data, reduce number of slices. Saving around 40k gas in the process.