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

Conversation

@felix2feng
Copy link
Contributor

@felix2feng felix2feng commented Jan 11, 2019

ChangeLog:

  • PayableExchangeIssue.sol is in the skipped files for coverage due to coverage's inability to instrument and handle .send/.transfer functions
  • ICore: add interface for issueTo
  • IExchangeIssueModule: expose exchange issue function
  • ExchangeIssueLibrary: Export ExchangeIssue struct so it can be used elsewhere
  • Create Mocks and interfaces for Wrapped Ether
  • PayableExchangeIssue: Write functions for issueRebalancingSetWithEther
  • Unit tests for payableExchangeIssue
  • Supporting wrappers and web3 helper functions

@coveralls
Copy link

coveralls commented Jan 11, 2019

Pull Request Test Coverage Report for Build 3654

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 3570: 0.0%
Covered Lines: 769
Relevant Lines: 769

💛 - Coveralls

@felix2feng felix2feng changed the title [WIP] Exchange Issue into RB Set Using Eth Exchange Issue into RB Set Using Eth Jan 11, 2019
@felix2feng felix2feng requested review from asoong and bweick January 11, 2019 20:46
uint256 rbSetNaturalUnit = ISetToken(_rebalancingSetAddress).naturalUnit();

// Ensure that the base Set quantity is a multiple of the rebalancing Set natural unit
uint256 rbSetNormalizedBaseSetQuantity = _baseSetIssueQuantity.div(rbSetNaturalUnit).mul(rbSetNaturalUnit);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unsure what this line of code is supposed to do. Is this flipped with the line below? Wouldn't you want to see how many rebalancing set tokens you can issue and then make sure it's a multiple of the rebalancing set?

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 Think its flipped

.solcover.js Outdated
'lib/AddressArrayUtils.sol',
'mocks',
'external',
'supplementary/PayableExchangeIssue.sol' // Transfer functions cannot be properly tested
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you link to the github issue here?

*/
interface IExchangeIssueModule {


Copy link
Contributor

Choose a reason for hiding this comment

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

spaces?

library ExchangeIssueLibrary {
// ============ Structs ============

struct ExchangeIssue {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename this? ExchangeIssueParams? ExchangeIssueRequest?

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

{
// Commit the address and instance of Core to state variables
core = _core;
coreInstance = ICore(_core);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we store both of these again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Slightly more gas efficient and cleans up multiple instantiations of instances

private
{
// Return any excess base Set to the user
uint256 leftoverBaseSet = ERC20Wrapper.balanceOf(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a weird edge case, will the user possibly be expecting balance of a static set? I think we should give these to the rebalancing set @bweick. That way, when the rebalance starts, all of it gets redeemed and the excess can be converted into shares of the new set? Not sure if that messes with the supply, but we do calculate the "max issue amount" at the end of the rebalance and these components could contribute to it.

private
returns (uint256)
{
uint256[] memory rbSetUnits = ISetToken(_rebalancingSetAddress).getUnits();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a separate getter for rebalancing set token that clarifies what this is instead of doing units[0]? Add it to the IRebalancingSetToken maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm good call. We have something called Unit shares already. I'll use that.

// Ensure that the base Set quantity is a multiple of the rebalancing Set natural unit
uint256 rbSetIssueQuantity = possibleIssuableRBSetQuantity.div(rbSetNaturalUnit).mul(rbSetNaturalUnit);


Copy link
Contributor

Choose a reason for hiding this comment

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

extra whitespace?

private
returns (uint256)
{
uint256[] memory rbSetUnits = ISetToken(_rebalancingSetAddress).getUnits();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why shorthand this? rbSetUnits is not clear. Just call it unitShares maybe?

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

Copy link
Contributor Author

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

Addressed all except for the Base Set refund. In theory, our application / backend should never produce more base Sets than needed (it would be a bug).

{
// Commit the address and instance of Core to state variables
core = _core;
coreInstance = ICore(_core);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Slightly more gas efficient and cleans up multiple instantiations of instances

private
returns (uint256)
{
uint256[] memory rbSetUnits = ISetToken(_rebalancingSetAddress).getUnits();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm good call. We have something called Unit shares already. I'll use that.

private
returns (uint256)
{
uint256[] memory rbSetUnits = ISetToken(_rebalancingSetAddress).getUnits();
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

@felix2feng felix2feng merged commit 536f93e into master Jan 13, 2019
@felix2feng felix2feng deleted the felix/supplementary-rb-issue branch January 13, 2019 21:44
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.

5 participants