Skip to content

Commit

Permalink
Fix owner/SystemAccount setup for HCHelper (wasn't updated for determ…
Browse files Browse the repository at this point in the history
…inistic deployment).

 Changes to be committed:
	modified:   contracts/core/HCHelper.sol
  • Loading branch information
mmontour1306 committed May 21, 2024
1 parent d291a73 commit 9991fc9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions contracts/core/HCHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract HCHelper {
using SafeERC20 for IERC20;

// Owner (creator) of this contract.
address public owner;

// Response data is stored here by PutResponse() and then consumed by TryCallOffchain().
// The storage slot must not be changed unless the corresponding code is updated in the Bundler.
mapping(bytes32=>bytes) ResponseCache;

// Owner (creator) of this contract.
address public owner;

// BOBA token address
address public tokenAddr;

Expand All @@ -40,7 +40,6 @@ contract HCHelper {
address immutable entryPoint;

constructor(address _entryPoint, address _tokenAddr, uint256 _pricePerCall) {
owner = msg.sender;
entryPoint = _entryPoint;
tokenAddr = _tokenAddr;
pricePerCall = _pricePerCall;
Expand All @@ -52,6 +51,11 @@ contract HCHelper {
RegisteredCallers[contract_addr].url = url;
}

function initialize(address _owner) public {
require(msg.sender == owner || address(0) == owner, "Only owner");
owner = _owner;
}

function SetSystemAccount(address _systemAccount) public {
require(msg.sender == owner, "Only owner");
systemAccount = _systemAccount;
Expand Down Expand Up @@ -101,7 +105,7 @@ contract HCHelper {

// Remove one or more map entries (only needed if response was not retrieved normally).
function RemoveResponses(bytes32[] calldata mapKeys) public {
//require(msg.sender == owner, "Only owner");
require(msg.sender == systemAccount, "Only systemAccount may call RemoveResponses");
for (uint32 i = 0; i < mapKeys.length; i++) {
delete(ResponseCache[mapKeys[i]]);
}
Expand Down

0 comments on commit 9991fc9

Please sign in to comment.