-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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