Преглед изворни кода

Improve wording consistency in code/doc (#3365)

(cherry picked from commit 07b1b472c0ac3e50963c8d52cd2dac6e7e05260c)
Hadrien Croubois пре 3 година
родитељ
комит
a4750eba85

+ 2 - 2
contracts/finance/VestingWallet.sol

@@ -84,7 +84,7 @@ contract VestingWallet is Context {
     /**
      * @dev Release the native token (ether) that have already vested.
      *
-     * Emits a {TokensReleased} event.
+     * Emits a {EtherReleased} event.
      */
     function release() public virtual {
         uint256 releasable = vestedAmount(uint64(block.timestamp)) - released();
@@ -96,7 +96,7 @@ contract VestingWallet is Context {
     /**
      * @dev Release the tokens that have already vested.
      *
-     * Emits a {TokensReleased} event.
+     * Emits a {ERC20Released} event.
      */
     function release(address token) public virtual {
         uint256 releasable = vestedAmount(token, uint64(block.timestamp)) - released(token);

+ 1 - 1
contracts/governance/Governor.sol

@@ -217,7 +217,7 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive
     ) internal view virtual returns (uint256);
 
     /**
-     * @dev Register a vote with a given support and voting weight.
+     * @dev Register a vote for `proposalId` by `account` with a given `support`, voting `weight` and voting `params`.
      *
      * Note: Support is generic and can represent various things depending on the voting system used.
      */

+ 2 - 2
contracts/governance/IGovernor.sol

@@ -237,7 +237,7 @@ abstract contract IGovernor is IERC165 {
     /**
      * @dev Cast a vote with a reason and additional encoded parameters
      *
-     * Emits a {VoteCast} event.
+     * Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params.
      */
     function castVoteWithReasonAndParams(
         uint256 proposalId,
@@ -262,7 +262,7 @@ abstract contract IGovernor is IERC165 {
     /**
      * @dev Cast a vote with a reason and additional encoded parameters using the user's cryptographic signature.
      *
-     * Emits a {VoteCast} event.
+     * Emits a {VoteCast} or {VoteCastWithParams} event depending on the length of params.
      */
     function castVoteWithReasonAndParamsBySig(
         uint256 proposalId,

+ 1 - 1
contracts/interfaces/IERC3156FlashBorrower.sol

@@ -17,7 +17,7 @@ interface IERC3156FlashBorrower {
      * @param amount The amount of tokens lent.
      * @param fee The additional amount of tokens to repay.
      * @param data Arbitrary data structure, intended to contain user-defined parameters.
-     * @return The keccak256 hash of "ERC3156FlashBorrower.onFlashLoan"
+     * @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan"
      */
     function onFlashLoan(
         address initiator,

+ 4 - 0
contracts/security/PullPayment.sol

@@ -43,6 +43,8 @@ abstract contract PullPayment {
      * checks-effects-interactions pattern or using {ReentrancyGuard}.
      *
      * @param payee Whose payments will be withdrawn.
+     *
+     * Causes the `escrow` to emits a {Withdrawn} event.
      */
     function withdrawPayments(address payable payee) public virtual {
         _escrow.withdraw(payee);
@@ -63,6 +65,8 @@ abstract contract PullPayment {
      *
      * @param dest The destination address of the funds.
      * @param amount The amount to transfer.
+     *
+     * Causes the `escrow` to emits a {Deposited} event.
      */
     function _asyncTransfer(address dest, uint256 amount) internal virtual {
         _escrow.deposit{value: amount}(dest);

+ 7 - 1
contracts/token/ERC1155/ERC1155.sol

@@ -288,6 +288,8 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
     /**
      * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
      *
+     * Emits a {TransferBatch} event.
+     *
      * Requirements:
      *
      * - `ids` and `amounts` must have the same length.
@@ -321,6 +323,8 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
     /**
      * @dev Destroys `amount` tokens of token type `id` from `from`
      *
+     * Emits a {TransferSingle} event.
+     *
      * Requirements:
      *
      * - `from` cannot be the zero address.
@@ -353,6 +357,8 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
     /**
      * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
      *
+     * Emits a {TransferBatch} event.
+     *
      * Requirements:
      *
      * - `ids` and `amounts` must have the same length.
@@ -405,7 +411,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
      * and burning, as well as batched variants.
      *
      * The same hook is called on both single and batched variants. For single
-     * transfers, the length of the `id` and `amount` arrays will be 1.
+     * transfers, the length of the `ids` and `amounts` arrays will be 1.
      *
      * Calling conditions (for each `id` and `amount` pair):
      *

+ 1 - 1
contracts/token/ERC20/ERC20.sol

@@ -210,7 +210,7 @@ contract ERC20 is Context, IERC20, IERC20Metadata {
     }
 
     /**
-     * @dev Moves `amount` of tokens from `sender` to `recipient`.
+     * @dev Moves `amount` of tokens from `from` to `to`.
      *
      * This internal function is equivalent to {transfer}, and can be used to
      * e.g. implement automatic token fees, slashing mechanisms, etc.

+ 10 - 10
contracts/token/ERC721/ERC721.sol

@@ -176,17 +176,17 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
         address from,
         address to,
         uint256 tokenId,
-        bytes memory _data
+        bytes memory data
     ) public virtual override {
         require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
-        _safeTransfer(from, to, tokenId, _data);
+        _safeTransfer(from, to, tokenId, data);
     }
 
     /**
      * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
      * are aware of the ERC721 protocol to prevent tokens from being forever locked.
      *
-     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
+     * `data` is additional data, it has no specified format and it is sent in call to `to`.
      *
      * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
      * implement alternative mechanisms to perform token transfer, such as signature-based.
@@ -204,10 +204,10 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
         address from,
         address to,
         uint256 tokenId,
-        bytes memory _data
+        bytes memory data
     ) internal virtual {
         _transfer(from, to, tokenId);
-        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
+        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
     }
 
     /**
@@ -256,11 +256,11 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
     function _safeMint(
         address to,
         uint256 tokenId,
-        bytes memory _data
+        bytes memory data
     ) internal virtual {
         _mint(to, tokenId);
         require(
-            _checkOnERC721Received(address(0), to, tokenId, _data),
+            _checkOnERC721Received(address(0), to, tokenId, data),
             "ERC721: transfer to non ERC721Receiver implementer"
         );
     }
@@ -382,17 +382,17 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
      * @param from address representing the previous owner of the given token ID
      * @param to target address that will receive the tokens
      * @param tokenId uint256 ID of the token to be transferred
-     * @param _data bytes optional data to send along with the call
+     * @param data bytes optional data to send along with the call
      * @return bool whether the call correctly returned the expected magic value
      */
     function _checkOnERC721Received(
         address from,
         address to,
         uint256 tokenId,
-        bytes memory _data
+        bytes memory data
     ) private returns (bool) {
         if (to.isContract()) {
-            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
+            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                 return retval == IERC721Receiver.onERC721Received.selector;
             } catch (bytes memory reason) {
                 if (reason.length == 0) {

+ 2 - 1
contracts/token/ERC777/ERC777.sol

@@ -288,7 +288,8 @@ contract ERC777 is Context, IERC777, IERC20 {
      * the total supply.
      *
      * If a send hook is registered for `account`, the corresponding function
-     * will be called with `operator`, `data` and `operatorData`.
+     * will be called with the caller address as the `operator` and with
+     * `userData` and `operatorData`.
      *
      * See {IERC777Sender} and {IERC777Recipient}.
      *

+ 4 - 0
contracts/utils/escrow/Escrow.sol

@@ -34,6 +34,8 @@ contract Escrow is Ownable {
     /**
      * @dev Stores the sent amount as credit to be withdrawn.
      * @param payee The destination address of the funds.
+     *
+     * Emits a {Deposited} event.
      */
     function deposit(address payee) public payable virtual onlyOwner {
         uint256 amount = msg.value;
@@ -50,6 +52,8 @@ contract Escrow is Ownable {
      * checks-effects-interactions pattern or using {ReentrancyGuard}.
      *
      * @param payee The address whose funds will be withdrawn and transferred to.
+     *
+     * Emits a {Withdrawn} event.
      */
     function withdraw(address payable payee) public virtual onlyOwner {
         uint256 payment = _deposits[payee];