Merge pull request #13916 from NicoAcosta/mapping-style

Fix mapping style in docs
This commit is contained in:
Kamil Śliwak 2023-02-01 20:56:29 +01:00 committed by GitHub
commit 78608e8d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 13 deletions

View File

@ -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.

View File

@ -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; }

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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 <mapping-types>` type maps addresses to :ref:`unsigned integers <integers>`.

View File

@ -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++)

View File

@ -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);

View File

@ -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