-
Notifications
You must be signed in to change notification settings - Fork 58
Alex/kyber wrapper issuance specs #222
Conversation
Pull Request Test Coverage Report for Build 1968
💛 - Coveralls |
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.
Good work on getting this working - seems like a pain to get all the setup together and the math right.
@@ -120,12 +152,12 @@ contract KyberNetworkWrapper is | |||
} | |||
|
|||
// Transfer any unused or remainder maker token back to the issuance order user | |||
uint remainderSourceToken = ERC20.balanceOf(_makerToken, this); | |||
if (remainderSourceToken > 0) { | |||
uint remainderMakerToken = ERC20.balanceOf(_makerToken, this); |
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.
Specify uint256
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
function getExpectedRate( | ||
address src, | ||
address dest, | ||
uint srcQty |
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.
Unless its an issue, specify uint256?
.
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 in the external folder. Leaving it to match their interface like we did in the other external files
const sourceTokenDecimals = (await makerToken.decimals.callAsync()).toNumber(); | ||
kyberConversionRatePower = new BigNumber(10).pow(18 + sourceTokenDecimals - componentTokenDecimals); | ||
const minimumConversionRate = maxDestinationQuantity.div(sourceTokenQuantity) | ||
.mul(kyberConversionRatePower) |
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 love the math steps put on their own line
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
.mul(kyberConversionRatePower) | ||
.round(); | ||
kyberTradeMakerTokenChange = sourceTokenQuantity.sub( | ||
maxDestinationQuantity.mul(kyberConversionRatePower).div(KYBER_RESERVE_CONFIGURED_RATE).floor()); |
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.
Possible to separate math steps into their own line here?
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.
Not a lot of clarity or meaning for the in between steps in this case
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.
Oh, I see what you mean, I thought it was confusing cause it's layered inside one sub already so I didn't do that here
1c74130
to
3053912
Compare
This required several updates to the snapshot including increasing the reserve balance, category cap, and imbalances.