From 9c733a7bf811459f3668461cf8c0fdf14c2b68a1 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Thu, 29 Aug 2019 17:58:52 +0300 Subject: [PATCH] Replace confirmRelayedCall with approveRelayedCall (#1904) * Replace confirmRelayedCall with approveRelayedCall * Update gsn-bouncers.adoc * Update deprecated enums --- docs/modules/ROOT/pages/gsn-bouncers.adoc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/modules/ROOT/pages/gsn-bouncers.adoc b/docs/modules/ROOT/pages/gsn-bouncers.adoc index fff6bf2c8..7a3affca3 100644 --- a/docs/modules/ROOT/pages/gsn-bouncers.adoc +++ b/docs/modules/ROOT/pages/gsn-bouncers.adoc @@ -81,9 +81,9 @@ function acceptRelayedCall( address(this) // Prevents replays in multiple recipients ); if (keccak256(blob).toEthSignedMessageHash().recover(approvalData) == _trustedSigner) { - return _confirmRelayedCall(); + return _approveRelayedCall(); } else { - return _declineRelayedCall(uint256(GSNRecipientSignedDataErrorCodes.INVALID_SIGNER)); + return _rejectRelayedCall(uint256(GSNRecipientSignedDataErrorCodes.INVALID_SIGNER)); } } ---- @@ -95,11 +95,11 @@ When the signatures match, the function returns the following: [source,solidity] ---- - return _confirmRelayedCall(); + return _approveRelayedCall(); // Defined on base class GSNBouncerBase // uint256 constant private RELAYED_CALL_ACCEPTED = 0; - // function _confirmRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) { + // function _approveRelayedCall(bytes memory context) internal pure returns (uint256, bytes memory) { // return (RELAYED_CALL_ACCEPTED, context); // } ---- @@ -109,11 +109,11 @@ On the other hand, when the signatures don't match, the call gets rejected with [source,solidity] ---- - return _declineRelayedCall(uint256(GSNRecipientSignedDataErrorCodes.INVALID_SIGNER)); + return _rejectRelayedCall(uint256(GSNBouncerSignatureErrorCodes.INVALID_SIGNER)); // Defined on base class GSNBouncerBase // uint256 constant private RELAYED_CALL_REJECTED = 11; - // function _declineRelayedCall(uint256 errorCode) internal pure returns (uint256, bytes memory) { + // function _rejectRelayedCall(uint256 errorCode) internal pure returns (uint256, bytes memory) { // return (RELAYED_CALL_REJECTED + errorCode, ""); // } ---- @@ -165,12 +165,12 @@ function acceptRelayedCall( returns (uint256, bytes memory) { if (_token.balanceOf(from) < maxPossibleCharge) { - return _declineRelayedCall(uint256(GSNRecipientERC20ChargeErrorCodes.INSUFFICIENT_BALANCE)); + return _rejectRelayedCall(uint256(GSNBouncerERC20FeeErrorCodes.INSUFFICIENT_BALANCE)); } else if (_token.allowance(from, address(this)) < maxPossibleCharge) { - return _declineRelayedCall(uint256(GSNRecipientERC20ChargeErrorCodes.INSUFFICIENT_ALLOWANCE)); + return _rejectRelayedCall(uint256(GSNBouncerERC20FeeErrorCodes.INSUFFICIENT_ALLOWANCE)); } - return _confirmRelayedCall(abi.encode(from, maxPossibleCharge, transactionFee, gasPrice)); + return _approveRelayedCall(abi.encode(from, maxPossibleCharge, transactionFee, gasPrice)); } ----