From e89efe89a68cd27a2b75258c54405d74ae16ac45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:49:34 -0300 Subject: [PATCH 1/9] style(mapping-types): fix mapping style --- docs/types/mapping-types.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/types/mapping-types.rst b/docs/types/mapping-types.rst index 68f963753..454caaf05 100644 --- a/docs/types/mapping-types.rst +++ b/docs/types/mapping-types.rst @@ -95,8 +95,8 @@ The example below uses ``_allowances`` to record the amount someone else is allo contract MappingExample { - mapping (address => uint256) private _balances; - mapping (address => mapping (address => uint256)) private _allowances; + mapping(address => uint256) private _balances; + mapping(address => mapping(address => uint256)) private _allowances; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); From 4ff310cc625c4406884d63999b691da0e554e9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:50:48 -0300 Subject: [PATCH 2/9] style(common-patterns): fix mapping style --- docs/common-patterns.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/common-patterns.rst b/docs/common-patterns.rst index 1793ebd2f..766f8f35e 100644 --- a/docs/common-patterns.rst +++ b/docs/common-patterns.rst @@ -34,7 +34,7 @@ you receive the funds of the person who is now the richest. address public richest; uint public mostSent; - mapping (address => uint) pendingWithdrawals; + mapping(address => uint) pendingWithdrawals; /// The amount of Ether sent was not higher than /// the currently highest amount. From 7b8478a81b86f2f8ccae4219d5542d529227fd5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:51:26 -0300 Subject: [PATCH 3/9] style(intro-sc): fix mapping style --- docs/introduction-to-smart-contracts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index 5a278ecfb..146f2224b 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -91,7 +91,7 @@ registering with a username and password, all you need is an Ethereum keypair. // The keyword "public" makes variables // accessible from other contracts address public minter; - mapping (address => uint) public balances; + mapping(address => uint) public balances; // Events allow clients to react to specific // contract changes you declare @@ -151,7 +151,7 @@ You do not need to do this, the compiler figures it out for you. .. index:: mapping -The next line, ``mapping (address => uint) public balances;`` also +The next line, ``mapping(address => uint) public balances;`` also creates a public state variable, but it is a more complex datatype. The :ref:`mapping ` type maps addresses to :ref:`unsigned integers `. From 1edfd73b377040bfd0aef0292624652e6f0c8862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:51:56 -0300 Subject: [PATCH 4/9] style(security-considerations): fix mapping style --- docs/security-considerations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 037548431..0a86a8d59 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -336,7 +336,7 @@ field of a ``struct`` that is the base type of a dynamic storage array. The pragma solidity >=0.6.0 <0.9.0; contract Map { - mapping (uint => uint)[] array; + mapping(uint => uint)[] array; function allocate(uint newMaps) public { for (uint i = 0; i < newMaps; i++) From 72a17ceb71a8eed590578b6f788a8cbe67136bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:52:34 -0300 Subject: [PATCH 5/9] style(function-modifiers): fix mapping style --- docs/contracts/function-modifiers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contracts/function-modifiers.rst b/docs/contracts/function-modifiers.rst index bbdec1e48..b6b83bf3c 100644 --- a/docs/contracts/function-modifiers.rst +++ b/docs/contracts/function-modifiers.rst @@ -61,7 +61,7 @@ if they are marked ``virtual``. For details, please see } contract Register is priced, destructible { - mapping (address => bool) registeredAddresses; + mapping(address => bool) registeredAddresses; uint price; constructor(uint initialPrice) { price = initialPrice; } From 5b149adfcd9bfba59f2adcf6f1160558b4694005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:53:04 -0300 Subject: [PATCH 6/9] style(visibility-and-getters): fix mapping style --- docs/contracts/visibility-and-getters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contracts/visibility-and-getters.rst b/docs/contracts/visibility-and-getters.rst index 8932c5079..5bf46dea5 100644 --- a/docs/contracts/visibility-and-getters.rst +++ b/docs/contracts/visibility-and-getters.rst @@ -200,12 +200,12 @@ The next example is more complex: struct Data { uint a; bytes3 b; - mapping (uint => uint) map; + mapping(uint => uint) map; uint[3] c; uint[] d; bytes e; } - mapping (uint => mapping(bool => Data[])) public data; + mapping(uint => mapping(bool => Data[])) public data; } It generates a function of the following form. The mapping and arrays (with the From 9b0556caa4d5476d92262eae5ae01df4f8afcff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:53:33 -0300 Subject: [PATCH 7/9] style(modular): fix mapping style --- docs/examples/modular.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/modular.rst b/docs/examples/modular.rst index 697699ae6..f96b296df 100644 --- a/docs/examples/modular.rst +++ b/docs/examples/modular.rst @@ -34,7 +34,7 @@ and the sum of all balances is an invariant across the lifetime of the contract. contract Token { mapping(address => uint256) balances; using Balances for *; - mapping(address => mapping (address => uint256)) allowed; + mapping(address => mapping(address => uint256)) allowed; event Transfer(address from, address to, uint amount); event Approval(address owner, address spender, uint amount); From b403085fa15c5d35ed94b33d44c2b5abeabfb575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:54:08 -0300 Subject: [PATCH 8/9] style(layout_in_storage): fix mapping style --- docs/internals/layout_in_storage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/internals/layout_in_storage.rst b/docs/internals/layout_in_storage.rst index 53670eeb8..a492dea14 100644 --- a/docs/internals/layout_in_storage.rst +++ b/docs/internals/layout_in_storage.rst @@ -232,7 +232,7 @@ value and reference types, types that are encoded packed, and nested types. uint y; S s; address addr; - mapping (uint => mapping (address => bool)) map; + mapping(uint => mapping(address => bool)) map; uint[] array; string s1; bytes b1; From da7dfeb0c52e706859fdbe520c5d2a2506ca9cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Acosta?= Date: Wed, 1 Feb 2023 15:54:32 -0300 Subject: [PATCH 9/9] style(reference-types): fix mapping style --- docs/types/reference-types.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 6a7667b6b..771fdecee 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -686,11 +686,11 @@ shown in the following example: uint fundingGoal; uint numFunders; uint amount; - mapping (uint => Funder) funders; + mapping(uint => Funder) funders; } uint numCampaigns; - mapping (uint => Campaign) campaigns; + mapping(uint => Campaign) campaigns; function newCampaign(address payable beneficiary, uint goal) public returns (uint campaignID) { campaignID = numCampaigns++; // campaignID is return variable