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 Feb 28, 2019

  • Wrote exchangeRedeem feature with unit tests
  • Renamed exchangeIssueParams to exchangeInteractData; Bumped to v30 set-protocol-utils
  • Added depositModule and withdrawModule as convenience methods.
  • Added coverage by testing ExchangeInteractLibrary

@coveralls
Copy link

coveralls commented Feb 28, 2019

Pull Request Test Coverage Report for Build 4617

  • 47 of 47 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 100.0%

Totals Coverage Status
Change from base Build 4608: 0.2%
Covered Lines: 919
Relevant Lines: 919

💛 - Coveralls

@felix2feng felix2feng force-pushed the felix/exchange-redemption branch from 4419864 to 338a816 Compare March 1, 2019 01:08
nonReentrant
{
// Validate ExchangeRedeemParams
validateExchangeIssueParams(_exchangeInteractData);
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 give this a more general name? The juxtapostion between the comment and this is kinda confusing

Copy link
Contributor Author

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)

Copy link
Contributor Author

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

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

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

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"

Copy link
Contributor Author

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
    )

Copy link
Contributor Author

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

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?

Copy link
Contributor Author

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

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

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

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

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

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);
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 add multiple ABIs? I cant find it but I swear in the past there was a rule that we could only add one.

Copy link
Contributor Author

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
{

Copy link
Contributor

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;


Copy link
Contributor

Choose a reason for hiding this comment

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

whitespace

external
onlyModule
{

Copy link
Contributor

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;


Copy link
Contributor

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

Choose a reason for hiding this comment

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

Send?

@felix2feng felix2feng force-pushed the felix/exchange-redemption branch from 67f4583 to 5acd5e4 Compare March 1, 2019 19:45
@felix2feng felix2feng merged commit 4c46497 into master Mar 1, 2019
@felix2feng felix2feng deleted the felix/exchange-redemption branch March 1, 2019 20:27
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