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

Conversation

bweick
Copy link
Contributor

@bweick bweick commented Jul 3, 2018

…oreState. Missing from this is logic reconciling fill and cancel amounts against openOrder amounts. That is to follow in the next PR.

@bweick bweick requested review from a team and asoong July 3, 2018 17:51
});

// Make sure cancel order comes from maker
require(order.makerAddress == msg.sender);
Copy link
Contributor

Choose a reason for hiding this comment

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

add a message here. require(..., message)

Copy link
Contributor

Choose a reason for hiding this comment

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

also, who is the maker here and who is the sender?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well they should be the same person. You don't want any random person to be able to cancel an order, only the order maker should be able to do that.

});

it("marks the correct amount as filled in orderFills mapping", async () => {

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove white space

await subject();

const filled = await core.orderFills.callAsync(issuanceOrderParams.orderHash);

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: whitespace

assertTokenBalance(setToken, existingBalance.add(subjectQuantityToIssue), signerAddress);
});

it("marks the correct amount as filled in orderFills mapping", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure your test pulls the value before (even if it's 0), and checks that the ending value is what you intended. See: coreIssuance.spec.ts#transfers the required tokens from the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool

}

it("marks the correct amount as canceled in orderCancels mapping", async () => {

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove whitespace

await subject();

const canceled = await core.orderCancels.callAsync(issuanceOrderParams.orderHash);

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: whitespace

require(order.makerAddress == msg.sender);

// Verify order is valid and return amount to be cancelled
validateOrder(
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 matter if the user is trying to cancel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would say it does to avoid adding unnecessary data to storage, also this function will contain the openOrderAmount calculations in the next PR, so more of a placeholder.

@coveralls
Copy link

coveralls commented Jul 3, 2018

Pull Request Test Coverage Report for Build 405

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

Totals Coverage Status
Change from base Build 403: 0.0%
Covered Lines: 212
Relevant Lines: 212

💛 - Coveralls

@asoong
Copy link
Contributor

asoong commented Jul 3, 2018

Squash and rebase

@bweick bweick force-pushed the brian/cancel_order branch from 26261ee to 8bc28db Compare July 3, 2018 21:15
@bweick bweick force-pushed the brian/cancel_order branch from 8bc28db to 783a457 Compare July 3, 2018 21:17

// Make sure cancel order comes from maker
require(order.makerAddress == msg.sender, INVALID_CANCEL_ORDER);

Copy link
Contributor

Choose a reason for hiding this comment

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

Also check that the order hasn't been already cancelled?

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 my original comment addresses that...it's gonna be in the next PR.

@bweick bweick merged commit 69ae2d3 into master Jul 3, 2018
@asoong asoong deleted the brian/cancel_order branch July 4, 2018 22:57
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.

4 participants