Skip to content

Commit

Permalink
invert the require condition for balance check
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbok committed Apr 25, 2024
1 parent 24e3c30 commit 1052354
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/introduction-to-smart-contracts.rst
Expand Up @@ -119,7 +119,7 @@ registering with a username and password, all you need is an Ethereum keypair.
// Sends an amount of existing coins
// from any caller to an address
function send(address receiver, uint amount) public {
require(amount > balances[msg.sender], InsufficientBalance(amount, balances[msg.sender]));
require(amount <= balances[msg.sender], InsufficientBalance(amount, balances[msg.sender]));
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
Expand Down

0 comments on commit 1052354

Please sign in to comment.