-
Notifications
You must be signed in to change notification settings - Fork 59
Core issuance flow #54
Conversation
test/logs/log_utils.ts
Outdated
| case (/^(uint)\d*\[\]/.test(type)): { | ||
| break; | ||
| } | ||
| case (/^(uint)\d*/.test(type)): { |
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.
Fixed indentation.
contracts/core/Core.sol
Outdated
| _; | ||
| } | ||
|
|
||
| // Verify set was created by core and is enabled for issuance |
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.
don't mention issuance. i use the same for redeem
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
contracts/core/Core.sol
Outdated
| /* ============ Modifiers ============ */ | ||
|
|
||
| // Validate quantity is multiple of natural unit | ||
| modifier isValidQuantity(uint _quantity, address _setToken) { |
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.
lets mention natural unit in the modifier, isValidQuantity of what? we have another "quantity verifier" right below with nonZero check. maybe isNaturalUnitMultiple?
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
contracts/core/Core.sol
Outdated
| /** | ||
| * Issue | ||
| * | ||
| * @param _setAddress Array of the addresses of the ERC20 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.
these descriptions seem off?
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
contracts/core/Core.sol
Outdated
|
|
||
| // Decrement the vault balance of the owner for the component | ||
| if (amountToDecrement > 0) { | ||
| IVault(vaultAddress).decrementTokenOwner( |
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.
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( |
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.
are we storing set token balance in vault? @bweick told me we were just storing balances of sets on the SetToken itself?
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 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 ============ */ | ||
|
|
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.
remove
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.
nvm this space is on purpose
| var argValue: any = value; | ||
| switch (true) { | ||
| case (/^(uint)\d*\[\]/.test(type)): { | ||
| break; |
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.
Does this work? Don't we want to set the argValue to be an array of BigNumbers if this is the 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.
Yup, it worked for me
test/core.spec.ts
Outdated
| await coreWrapper.approveTransfersAsync(components, transferProxy.address); | ||
|
|
||
| const componentAddresses = _.map(components, (token) => token.address); | ||
| componentUnits = _.map(components, () => ether(4)); // Multiple of of naturalUnit |
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.
Small typo in 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.
+1
Core issuance flow. Some interesting diffs: decided not to call deposit in issuance in order to save gas on the extra
incrementVaultOwnercall for the deposited amounts. Just subtract the amount of the component that was already in there.Changed
STANDARD_INITIAL_TOKENSconstant toDEPLOYED_TOKEN_QUANTITY