Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why check again after decrease buy's ETH, and decrease seller's token??? #2

Open
littleanti opened this issue Mar 30, 2018 · 0 comments

Comments

@littleanti
Copy link

In NEW ORDER - BID and ASK ORDER functions, why you check the balance of buyer's ETH and seller's token after decrease ETH and token??
I cannot understand.

// Overflow Check
// 09 Unit Test: balanceEthForAddress[msg.sender] is initially 3000000000000000000 (3 ETH)
require(balanceEthForAddress[msg.sender] >= totalAmountOfEtherAvailable);
require(balanceEthForAddress[msg.sender] - totalAmountOfEtherAvailable <= balanceEthForAddress[msg.sender]);

// Decrease the Buyer's Account Balance of tokens by the amount the Sell Offer Order Entry is willing to accept in exchange for ETH
balanceEthForAddress[msg.sender] -= totalAmountOfEtherAvailable;

// Overflow Checks
require(balanceEthForAddress[msg.sender] >= totalAmountOfEtherAvailable);<<<<<<<<<<<<<<<<<<<<<<<<<<< HERE

and

// Overflow Check
require(tokenBalanceForAddress[msg.sender][tokenNameIndex] >= amountOfTokensNecessary);

// Decrease the Seller's Account Balance of tokens by amount they are offering since the Buy Offer Order Entry is willing to accept it all in exchange for ETH
tokenBalanceForAddress[msg.sender][tokenNameIndex] -= amountOfTokensNecessary;

// Overflow Check
require(tokenBalanceForAddress[msg.sender][tokenNameIndex] >= amountOfTokensNecessary); <<<<<<<<<<<<<<<<<<<<<<<<<< HERE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant