From 789477bfbfb8fccf30cece3247884df070608bf4 Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Thu, 7 Mar 2019 15:18:27 -0600 Subject: [PATCH] Minor Solidity suggestion Just reading through this and figured I'd suggest a more concise snippet. --- libraries/shared/factories/storage/EXAMPLE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/shared/factories/storage/EXAMPLE.md b/libraries/shared/factories/storage/EXAMPLE.md index 288b61f4..6943f407 100644 --- a/libraries/shared/factories/storage/EXAMPLE.md +++ b/libraries/shared/factories/storage/EXAMPLE.md @@ -26,7 +26,7 @@ contract Contract { function add_address(address addr) public { bool exists = addresses[addr] > 0; - addresses[addr] = addresses[addr] + 1; + addresses[addr]++; if (!exists) { emit AddressAdded(addr, ++num_addresses); } @@ -164,4 +164,4 @@ The mappings would be able to lookup storage keys reflecting `num_addresses` or The repository would be able to persist the value or `num_addresses` or any slot in `addresses`, using metadata returned from the mappings. -The mappings and repository could be plugged into the common storage transformer, enabling us to know the contract's state as it is changing. \ No newline at end of file +The mappings and repository could be plugged into the common storage transformer, enabling us to know the contract's state as it is changing.