Context: I am developing a smart contract system using Solidity that involves two contracts:

HashedTimeLockEther (Main contract) Messenger (Interface contract) Objective: I want the HashedTimeLockEther contract to notify the Messenger contract when a certain function (like create) is called.

  • Is the Messenger only an Interface or is there a contract implementation of the same too ? Commented May 8 at 11:22
  • it has smart contract as well Commented May 8 at 11:24
  • Okay, and you can basically edit the code of both the contracts (HashedTimeLockEther and Messenger), I mean you're the one who is deploying them. Right? Commented May 8 at 11:26
  • No, Interface of messenger can implement anyone and pass to create function as argument Commented May 8 at 11:33
  • Okay, so you can't edit anything in the code of Messenger contract, it's already deployed? Commented May 8 at 11:45

1 Answer 1


If you can edit both the contracts (Messenger as well as HashedTimeLockEther), then in the Messenger contract:

  1. Define a boolean variable (say isCreateFunctionCalled).
  2. And, define a function (say createFunctionCalled()) that would change the value of isCreateFunctionCalled to true. Also, you can add a revert condition in order to make this function only callable by the HashedTimeLockEther contract.

Here' the minimal implementation of the same:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Messenger {

    error Messenger__NotHashedTimeLockEther();

    bool public isCreateFunctionCalled;
    address immutable hashedTimeLockEtherAddress;

    constructor(address _hashedTimeLockEtherAddress) {
        hashedTimeLockEtherAddress = _hashedTimeLockEtherAddress;

    function createFunctionCalled() external {
        if (msg.sender != hashedTimeLockEtherAddress) {
            revert Messenger__NotHashedTimeLockEther();
        isCreateFunctionCalled = true;

    // Rest of the code

interface IMessenger {
    function isCreateFunctionCalled() external view returns (bool);
    function createFunctionCalled() external;

    // Rest of the code

contract HashedTimeLockEther {

    function create(address messengerAddress) external {
        // Rest of the body of the create() function

    // Rest of the code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.