diff --git a/packages/hardhat/contracts/payWithEth.sol b/packages/hardhat/contracts/payWithEth.sol index ab3aa2e..33212f3 100644 --- a/packages/hardhat/contracts/payWithEth.sol +++ b/packages/hardhat/contracts/payWithEth.sol @@ -24,14 +24,21 @@ contract NunyaBusiness { constructor(address _gateway) { gateway == _gateway; + secretContract.retreivePubkey(); } modifier onlyGateway { - require (gateway, "No gateway set"); + require (gateway!=address(0), "No gateway set"); require (msg.sender==gateway, "Only gateway can call callbacks. Use the user function instead"); _; } + function setSecretContractPubkey (bytes32 _key) public onlyGateway { + require (secretContractPubkey==bytes32(0), "Key already set"); + // TODO: Make sure it's our secret contract setting the key, not some interloper + secretContractPubkey=_key; + } + // Function wrapped in secret network payload encryption function makeRef(string calldata secret) public returns (string memory){ string memory ref = secretContract.makeRef(secret);