-
Notifications
You must be signed in to change notification settings - Fork 59
Exchange Redeem Feature #402
Conversation
Pull Request Test Coverage Report for Build 4617
💛 - Coveralls |
4419864 to
338a816
Compare
| nonReentrant | ||
| { | ||
| // Validate ExchangeRedeemParams | ||
| validateExchangeIssueParams(_exchangeInteractData); |
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.
Can we give this a more general name? The juxtapostion between the comment and this is kinda confusing
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.
Yeah in a separate PR, I'm going to rename everything to exchangeIssuance (requires set-protocol-utils updates)
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 ended up adding it to this PR
| setTransferProxy, | ||
| receiveTokenAmounts[i] | ||
| ); | ||
| ); |
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.
White space
|
|
||
| /** | ||
| * Exchange Set tokens for underlying components | ||
| * Exchange Set tokens for underlying components into the vault |
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.
into the vault?
| * @param _token Address of token being withdrawn | ||
| * @param _from Address to decredit for withdraw | ||
| * @param _to Address to transfer tokens to | ||
| * @param _token Address of token being withdrawn |
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 swear this has been moved around multiple times already. Last time I remember I decided on the previous way because it read better like a sentence:
"Transferring _token _from address _to address"
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.
Ok - I'm happy either way as long as its consistent. I think it got muddled when we started adding the batch functions where the arrays are put on the bottom
address _from,
address _to,
address[] calldata _tokens,
uint256[] calldata _quantities
)
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.
Can decide once and for all in a subsequent PR
|
|
||
| /** | ||
| * @title ExchangeValidationLibrary | ||
| * @title ExchangeInteractLibrary |
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.
Interact? What is this supposed to imply?
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.
open for other names. Other idea is ExchangeIssuanceLibrary (hopefully implying issuance covers issue and redeem)
| */ | ||
| library ExchangeValidationLibrary { | ||
| library ExchangeInteractLibrary { | ||
| // ============ Structs ============ |
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.
Add white spaces around these
| it('should not revert', async () => { | ||
| await subject(); | ||
|
|
||
| expect(1).to.equal(1); |
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.
?
|
|
||
| beforeEach(async () => { | ||
| subjectSetAddress = setToken.address; | ||
| subjectQuantity = subjectQuantity || ether(4); |
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.
you dont need this || pattern, if you set it in the cases own beforeEach, it will override
| it('should not revert', async () => { | ||
| await subject(); | ||
|
|
||
| expect(1).to.equal(1); |
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.
Would this tell you if it reverted? Maybe check that the resulting transaction hash is not null?
| address[] sentTokens; | ||
| uint256[] sentTokenAmounts; | ||
| address[] receiveTokens; | ||
| uint256[] receiveTokenAmounts; |
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.
One is past tense and the other is present. in favor of receivedTokens
|
|
||
| before(async () => { | ||
| ABIDecoder.addABI(Core.abi); | ||
| ABIDecoder.addABI(ExchangeRedeemModule.abi); |
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.
Can we add multiple ABIs? I cant find it but I swear in the past there was a rule that we could only add one.
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.
Yeah i believe so. Creation and Checking exchange redeem logs are working
| external | ||
| onlyModule | ||
| { | ||
|
|
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.
whitespace
| uint256[] memory quantityArray = new uint256[](1); | ||
| quantityArray[0] = _quantity; | ||
|
|
||
|
|
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.
whitespace
| external | ||
| onlyModule | ||
| { | ||
|
|
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.
whitespace
| uint256[] memory quantityArray = new uint256[](1); | ||
| quantityArray[0] = _quantity; | ||
|
|
||
|
|
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.
whitespace
| "ExchangeValidationLibrary.validateSentTokenParams: Sent token inputs must be of the same length" | ||
| _sendTokenExchangeIds.length == _sendTokens.length && | ||
| _sendTokens.length == _sendTokenAmounts.length, | ||
| "ExchangeIssuanceLibrary.validateSendTokenParams: Sent token inputs must be of the same length" |
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.
Send?
67f4583 to
5acd5e4
Compare
exchangeIssueParamstoexchangeInteractData; Bumped to v30 set-protocol-utilsdepositModuleandwithdrawModuleas convenience methods.ExchangeInteractLibrary