Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Conversation

asoong
Copy link
Contributor

@asoong asoong commented Sep 29, 2018

This required several updates to the snapshot including increasing the reserve balance, category cap, and imbalances.

  • Added a kyber trade as one of the liquidity sources in the core issuance happy path spec.
  • Added helper method on the contract for getting conversion rates from kyber network so we don't need to use their library/api in ours

@asoong asoong requested a review from a team September 29, 2018 12:49
@coveralls
Copy link

coveralls commented Sep 29, 2018

Pull Request Test Coverage Report for Build 1968

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0008%) to 99.858%

Totals Coverage Status
Change from base Build 1959: 0.0008%
Covered Lines: 511
Relevant Lines: 511

💛 - Coveralls

Copy link
Contributor

@felix2feng felix2feng left a 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify uint256

Copy link
Contributor Author

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
Copy link
Contributor

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?.

Copy link
Contributor Author

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)
Copy link
Contributor

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

Copy link
Contributor Author

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());
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@asoong asoong force-pushed the alex/kyber_wrapper_issuance_specs branch from 1c74130 to 3053912 Compare September 30, 2018 21:16
@asoong asoong merged commit dc62f23 into master Sep 30, 2018
@asoong asoong deleted the alex/kyber_wrapper_issuance_specs branch September 30, 2018 21:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants