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 Jun 15, 2018

Core issuance flow. Some interesting diffs: decided not to call deposit in issuance in order to save gas on the extra incrementVaultOwner call for the deposited amounts. Just subtract the amount of the component that was already in there.

Changed STANDARD_INITIAL_TOKENS constant to DEPLOYED_TOKEN_QUANTITY

@asoong asoong requested a review from a team June 15, 2018 07:07
case (/^(uint)\d*\[\]/.test(type)): {
break;
}
case (/^(uint)\d*/.test(type)): {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed indentation.

_;
}

// Verify set was created by core and is enabled for issuance
Copy link
Contributor

Choose a reason for hiding this comment

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

don't mention issuance. i use the same for redeem

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

/* ============ Modifiers ============ */

// Validate quantity is multiple of natural unit
modifier isValidQuantity(uint _quantity, address _setToken) {
Copy link
Contributor

Choose a reason for hiding this comment

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

lets mention natural unit in the modifier, isValidQuantity of what? we have another "quantity verifier" right below with nonZero check. maybe isNaturalUnitMultiple?

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

/**
* Issue
*
* @param _setAddress Array of the addresses of the ERC20 tokens
Copy link
Contributor

Choose a reason for hiding this comment

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

these descriptions seem off?

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


// Decrement the vault balance of the owner for the component
if (amountToDecrement > 0) {
IVault(vaultAddress).decrementTokenOwner(
Copy link
Contributor

@justinkchen justinkchen Jun 15, 2018

Choose a reason for hiding this comment

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

we need to do this first. Right now i think you have a reentrancy attack. in ITransferProxy, we call ERC20.transferFrom which is a function out of our control. it can re-call into here from the transfer proxy cal on line 243 and the balance on line 235 will not have been updated yet

}

// Increment the vault balance of the set token for the component
IVault(vaultAddress).incrementTokenOwner(
Copy link
Contributor

Choose a reason for hiding this comment

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

are we storing set token balance in vault? @bweick told me we were just storing balances of sets on the SetToken itself?

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 to tell us the balance of the components in the vault that belong to the set
the set token itself keeps the balance of each user

}

/* ============ Getter Functions ============ */

Copy link
Contributor

Choose a reason for hiding this comment

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

remove

Copy link
Contributor

Choose a reason for hiding this comment

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

nvm this space is on purpose

var argValue: any = value;
switch (true) {
case (/^(uint)\d*\[\]/.test(type)): {
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work? Don't we want to set the argValue to be an array of BigNumbers if this is the 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.

Yup, it worked for me

await coreWrapper.approveTransfersAsync(components, transferProxy.address);

const componentAddresses = _.map(components, (token) => token.address);
componentUnits = _.map(components, () => ether(4)); // Multiple of of naturalUnit
Copy link
Contributor

Choose a reason for hiding this comment

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

Small typo in comment

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

@coveralls
Copy link

coveralls commented Jun 15, 2018

Pull Request Test Coverage Report for Build 237

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

Totals Coverage Status
Change from base Build 234: 1.5%
Covered Lines: 84
Relevant Lines: 90

💛 - Coveralls

@asoong asoong merged commit 9db5bfc into master Jun 15, 2018
@asoong asoong deleted the alex/issue branch June 16, 2018 03:45
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.

6 participants