浏览代码

issue#1980 (#2038)

* issue#1980

* fix public to external
Peter 5 年之前
父节点
当前提交
54d2aec232
共有 2 个文件被更改,包括 20 次插入20 次删除
  1. 18 18
      contracts/GSN/IRelayHub.sol
  2. 2 2
      contracts/GSN/IRelayRecipient.sol

+ 18 - 18
contracts/GSN/IRelayHub.sol

@@ -7,7 +7,7 @@ pragma solidity ^0.5.0;
  * See the https://github.com/OpenZeppelin/openzeppelin-gsn-helpers[OpenZeppelin GSN helpers] for more information on
  * how to deploy an instance of `RelayHub` on your local test network.
  */
-contract IRelayHub {
+interface IRelayHub {
     // Relay management
 
     /**
@@ -36,7 +36,7 @@ contract IRelayHub {
      *
      * Emits a {RelayAdded} event.
      */
-    function registerRelay(uint256 transactionFee, string memory url) public;
+    function registerRelay(uint256 transactionFee, string calldata url) external;
 
     /**
      * @dev Emitted when a relay is registered or re-registerd. Looking at these events (and filtering out
@@ -52,7 +52,7 @@ contract IRelayHub {
      *
      * Emits a {RelayRemoved} event.
      */
-    function removeRelayByOwner(address relay) public;
+    function removeRelayByOwner(address relay) external;
 
     /**
      * @dev Emitted when a relay is removed (deregistered). `unstakeTime` is the time when unstake will be callable.
@@ -65,7 +65,7 @@ contract IRelayHub {
      *
      * Emits an {Unstaked} event.
      */
-    function unstake(address relay) public;
+    function unstake(address relay) external;
 
     /**
      * @dev Emitted when a relay is unstaked for, including the returned stake.
@@ -95,7 +95,7 @@ contract IRelayHub {
      *
      * Emits a {Deposited} event.
      */
-    function depositFor(address target) public payable;
+    function depositFor(address target) external payable;
 
     /**
      * @dev Emitted when {depositFor} is called, including the amount and account that was funded.
@@ -113,7 +113,7 @@ contract IRelayHub {
      *
      * Emits a {Withdrawn} event.
      */
-    function withdraw(uint256 amount, address payable dest) public;
+    function withdraw(uint256 amount, address payable dest) external;
 
     /**
      * @dev Emitted when an account withdraws funds from `RelayHub`.
@@ -136,14 +136,14 @@ contract IRelayHub {
         address relay,
         address from,
         address to,
-        bytes memory encodedFunction,
+        bytes calldata encodedFunction,
         uint256 transactionFee,
         uint256 gasPrice,
         uint256 gasLimit,
         uint256 nonce,
-        bytes memory signature,
-        bytes memory approvalData
-    ) public view returns (uint256 status, bytes memory recipientContext);
+        bytes calldata signature,
+        bytes calldata approvalData
+    ) external view returns (uint256 status, bytes memory recipientContext);
 
     // Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values.
     enum PreconditionCheck {
@@ -186,14 +186,14 @@ contract IRelayHub {
     function relayCall(
         address from,
         address to,
-        bytes memory encodedFunction,
+        bytes calldata encodedFunction,
         uint256 transactionFee,
         uint256 gasPrice,
         uint256 gasLimit,
         uint256 nonce,
-        bytes memory signature,
-        bytes memory approvalData
-    ) public;
+        bytes calldata signature,
+        bytes calldata approvalData
+    ) external;
 
     /**
      * @dev Emitted when an attempt to relay a call failed.
@@ -229,12 +229,12 @@ contract IRelayHub {
      * @dev Returns how much gas should be forwarded to a call to {relayCall}, in order to relay a transaction that will
      * spend up to `relayedCallStipend` gas.
      */
-    function requiredGas(uint256 relayedCallStipend) public view returns (uint256);
+    function requiredGas(uint256 relayedCallStipend) external view returns (uint256);
 
     /**
      * @dev Returns the maximum recipient charge, given the amount of gas forwarded, gas price and relay fee.
      */
-    function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) public view returns (uint256);
+    function maxPossibleCharge(uint256 relayedCallStipend, uint256 gasPrice, uint256 transactionFee) external view returns (uint256);
 
      // Relay penalization. 
      // Any account can penalize relays, removing them from the system immediately, and rewarding the
@@ -247,12 +247,12 @@ contract IRelayHub {
      *
      * The (unsigned) transaction data and signature for both transactions must be provided.
      */
-    function penalizeRepeatedNonce(bytes memory unsignedTx1, bytes memory signature1, bytes memory unsignedTx2, bytes memory signature2) public;
+    function penalizeRepeatedNonce(bytes calldata unsignedTx1, bytes calldata signature1, bytes calldata unsignedTx2, bytes calldata signature2) external;
 
     /**
      * @dev Penalize a relay that sent a transaction that didn't target `RelayHub`'s {registerRelay} or {relayCall}.
      */
-    function penalizeIllegalTransaction(bytes memory unsignedTx, bytes memory signature) public;
+    function penalizeIllegalTransaction(bytes calldata unsignedTx, bytes calldata signature) external;
 
     /**
      * @dev Emitted when a relay is penalized.

+ 2 - 2
contracts/GSN/IRelayRecipient.sol

@@ -5,11 +5,11 @@ pragma solidity ^0.5.0;
  *
  * TIP: You don't need to write an implementation yourself! Inherit from {GSNRecipient} instead.
  */
-contract IRelayRecipient {
+interface IRelayRecipient {
     /**
      * @dev Returns the address of the {IRelayHub} instance this recipient interacts with.
      */
-    function getHubAddr() public view returns (address);
+    function getHubAddr() external view returns (address);
 
     /**
      * @dev Called by {IRelayHub} to validate if this recipient accepts being charged for a relayed call. Note that the