* issue#1980

* fix public to external
pull/2048/head^2
Peter 5 years ago committed by Nicolás Venturo
parent d006a750ee
commit 54d2aec232
  1. 36
      contracts/GSN/IRelayHub.sol
  2. 4
      contracts/GSN/IRelayRecipient.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 * 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. * how to deploy an instance of `RelayHub` on your local test network.
*/ */
contract IRelayHub { interface IRelayHub {
// Relay management // Relay management
/** /**
@ -36,7 +36,7 @@ contract IRelayHub {
* *
* Emits a {RelayAdded} event. * 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 * @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. * 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. * @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. * 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. * @dev Emitted when a relay is unstaked for, including the returned stake.
@ -95,7 +95,7 @@ contract IRelayHub {
* *
* Emits a {Deposited} event. * 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. * @dev Emitted when {depositFor} is called, including the amount and account that was funded.
@ -113,7 +113,7 @@ contract IRelayHub {
* *
* Emits a {Withdrawn} event. * 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`. * @dev Emitted when an account withdraws funds from `RelayHub`.
@ -136,14 +136,14 @@ contract IRelayHub {
address relay, address relay,
address from, address from,
address to, address to,
bytes memory encodedFunction, bytes calldata encodedFunction,
uint256 transactionFee, uint256 transactionFee,
uint256 gasPrice, uint256 gasPrice,
uint256 gasLimit, uint256 gasLimit,
uint256 nonce, uint256 nonce,
bytes memory signature, bytes calldata signature,
bytes memory approvalData bytes calldata approvalData
) public view returns (uint256 status, bytes memory recipientContext); ) external view returns (uint256 status, bytes memory recipientContext);
// Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values. // Preconditions for relaying, checked by canRelay and returned as the corresponding numeric values.
enum PreconditionCheck { enum PreconditionCheck {
@ -186,14 +186,14 @@ contract IRelayHub {
function relayCall( function relayCall(
address from, address from,
address to, address to,
bytes memory encodedFunction, bytes calldata encodedFunction,
uint256 transactionFee, uint256 transactionFee,
uint256 gasPrice, uint256 gasPrice,
uint256 gasLimit, uint256 gasLimit,
uint256 nonce, uint256 nonce,
bytes memory signature, bytes calldata signature,
bytes memory approvalData bytes calldata approvalData
) public; ) external;
/** /**
* @dev Emitted when an attempt to relay a call failed. * @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 * @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. * 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. * @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. // Relay penalization.
// Any account can penalize relays, removing them from the system immediately, and rewarding the // 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. * 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}. * @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. * @dev Emitted when a relay is penalized.

@ -5,11 +5,11 @@ pragma solidity ^0.5.0;
* *
* TIP: You don't need to write an implementation yourself! Inherit from {GSNRecipient} instead. * 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. * @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 * @dev Called by {IRelayHub} to validate if this recipient accepts being charged for a relayed call. Note that the

Loading…
Cancel
Save