-
Notifications
You must be signed in to change notification settings - Fork 59
Alex/kyber network proxy wrapper #215
Conversation
Pull Request Test Coverage Report for Build 1859
💛 - Coveralls |
felix2feng
left a comment
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.
This is really good! This is just my initial perusal, but I only have surface-level comments. I'll take another peek in a bit
| ); | ||
|
|
||
| // Update current bytes | ||
| scannedBytes = scannedBytes.add(160); |
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.
If the trade data size is fixed, can we make this a variable defined on the top of the file vs. a magic number?
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.
Normally, yes. In solidity, no since it’s another reference which adds gas
| // Transfer any unused issuance order maker token back to user | ||
| uint remainderSourceToken = ERC20.balanceOf(_trade.sourceToken, this); | ||
| if (remainderSourceToken > 0) { | ||
| ERC20.transfer( |
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.
OPTIMIZATION: Performing a transfer each time seems costly. Is there a way we can accumulate the remainderSourceToken and send it once after all Kyber trades have been executed?
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
| import { BigNumber } from 'bignumber.js'; | ||
| import { Address, Bytes, KyberTrade } from 'set-protocol-utils'; | ||
|
|
||
| import ChaiSetup from '../../../utils/chaiSetup'; |
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.
Use path aliases! @utils
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
| * | ||
| * TODO: Currently passes change back to the issuance order maker | ||
| * | ||
| * @param _maker Unused address of issuance order signer to conform to IExchangeWrapper |
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.
Comment is a little misleading because the address is used for transferring leftover tokens
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
felix2feng
left a comment
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.
This is a great. Looking forward to the following integration tests.
Approve modulo getting the small knits in. The optimization piece can be added later as long as we add a card for it.
| * | ||
| * | Data | Location | | ||
| * |----------------------------|-------------------------------| | ||
| * | sourceToken | 0 | |
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.
Seems useful to add the data type as well.
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.
Just needs to show which parameter is at which index, the types are revealed in the struct at the top of this file
| ); | ||
| } | ||
|
|
||
| // Ensure the maker token is allowed to be transferred by Set TransferProxy |
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.
Knit: Space between Transfer and Proxy
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.
Leaving it in, meant to refer to the contract name
a6cfec7 to
4c7334d
Compare
4c7334d to
36b3e27
Compare
Things to do separately: