Merge GSNContext into GSNRecipient (#1906)

* Merge GSNContext into GSNRecipient

* Update GSNRecipient.test.js

* Update GSNRecipient.sol

* Make GSNRecipient inherit from Context
This commit is contained in:
Nicolás Venturo
2019-08-30 17:18:42 -03:00
committed by GitHub
parent d864228624
commit 1efa9f6281
6 changed files with 184 additions and 224 deletions

View File

@ -1,46 +0,0 @@
pragma solidity ^0.5.0;
import "./ContextMock.sol";
import "../GSN/GSNContext.sol";
import "../GSN/IRelayRecipient.sol";
// By inheriting from GSNContext, Context's internal functions are overridden automatically
contract GSNContextMock is ContextMock, GSNContext, IRelayRecipient {
function getHubAddr() public view returns (address) {
return _relayHub;
}
function acceptRelayedCall(
address,
address,
bytes calldata,
uint256,
uint256,
uint256,
uint256,
bytes calldata,
uint256
)
external
view
returns (uint256, bytes memory)
{
return (0, "");
}
function preRelayedCall(bytes calldata) external returns (bytes32) {
// solhint-disable-previous-line no-empty-blocks
}
function postRelayedCall(bytes calldata, bool, uint256, bytes32) external {
// solhint-disable-previous-line no-empty-blocks
}
function getRelayHub() public view returns (address) {
return _relayHub;
}
function upgradeRelayHub(address newRelayHub) public {
return _upgradeRelayHub(newRelayHub);
}
}

View File

@ -1,8 +1,10 @@
pragma solidity ^0.5.0;
import "./ContextMock.sol";
import "../GSN/GSNRecipient.sol";
contract GSNRecipientMock is GSNRecipient {
// By inheriting from GSNRecipient, Context's internal functions are overridden automatically
contract GSNRecipientMock is ContextMock, GSNRecipient {
function withdrawDeposits(uint256 amount, address payable payee) public {
_withdrawDeposits(amount, payee);
}
@ -22,4 +24,8 @@ contract GSNRecipientMock is GSNRecipient {
function postRelayedCall(bytes calldata, bool, uint256, bytes32) external {
// solhint-disable-previous-line no-empty-blocks
}
function upgradeRelayHub(address newRelayHub) public {
return _upgradeRelayHub(newRelayHub);
}
}