# Reverted with reason string 'TimelockController: underlying transaction reverted'

**URL:** <https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015>\
**Category:** Contracts\
**Created:** [November 9, 2022, 7:10am UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015 "2022-11-09T07:10:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Furkan\_Sezal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/furkan_sezal/32/6310_2.png) [@Furkan\_Sezal](https://forum.openzeppelin.com/u/Furkan_Sezal)\
**Post date:** [November 9, 2022, 7:10am UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015/1 "2022-11-09T07:10:02Z")

</div>

Hello guys .  
i am using openzepellin Govenance Wizard contract & openzepellin TimelockController .  
i am getting this error  
execution reverted: TimelockController: underlying transaction reverted" when i try to execute.  
This is all in hardhat test file. When i comment the executeTx there is no error. So this is reverting with execute func.  
I also try with do scripts with testing on localhost. it is working there.  
I saw this but looks like hasnt solved by anyone. [Execution reverted: TimelockController: underlying transaction reverted"](https://forum.openzeppelin.com/t/execution-reverted-timelockcontroller-underlying-transaction-reverted/20000)

This is function i try to call with that execute func.

```auto
function apporoveFundingByDao(
        string memory _ipfsHash,
        uint256 _fundingGoalAmount,
        uint256 _time,
        address _projectOwnerAddress
    )

```

#### 🔢 Code to reproduce

```auto
// FUNC_FUND="apporoveFundingByDao"
projectOwner = (await ethers.getSigners())[4];
governor = await ethers.getContract("GovernerContract");

 const letsTry = await ethers.getContract(
            "GovernanceToken",
            projectOwner
          );
          const args = "QmPwX1rNoYRmQAPDm8Dp7YSeFdxPKaczWaBu8NPgVpKufu";
          const encodedFunctionCall = governor.interface.encodeFunctionData(
            FUNC_FUND,
            [args, s_fundRaisingGoalAmount, s_fundingTime, projectOwner.address]
          );
const proposalTx = await governor.propose(
            [governor.address],
            [0],
            [encodedFunctionCall],
            args
          );
          const proposeReceipt = await proposalTx.wait(1);

```

After successfully voting proposalState returns 4,

```auto
 // its time to queue & execute
          governor = await ethers.getContract("GovernerContract");
          const descriptionHash = ethers.utils.keccak256(
            ethers.utils.toUtf8Bytes(args)
          );

          console.log("Queueing...");
          const queueTx = await governor.queue(
            [governor.address],
            [0],
            [encodedFunctionCall],
            descriptionHash
          );
          await queueTx.wait(1);
          await moveTime(MIN_DELAY + 1);
          await moveBlocks(1);
          console.log("Executing...");
          const executeTx = await governor.execute(
            [governor.address],
            [0],
            [encodedFunctionCall],
            descriptionHash
          );
          await executeTx.wait(1);

```

#### 💻 Environment

---

<div class="post-metadata">

**Author:** ![Furkan\_Sezal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/furkan_sezal/32/6310_2.png) [@Furkan\_Sezal](https://forum.openzeppelin.com/u/Furkan_Sezal)\
**Post date:** [November 9, 2022, 11:39am UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015/2 "2022-11-09T11:39:14Z")

</div>

When i change the projectOwner to deployer its executing but it doesnt make sence.

```auto
deployer = (await getNamedAccounts()).deployer;

  const encodedFunctionCall = governor.interface.encodeFunctionData(
          FUNC_FUND,
          [args, s_fundRaisingGoalAmount, s_fundingTime, deployer]
        );

```

---

<div class="post-metadata">

**Author:** ![Furkan\_Sezal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/furkan_sezal/32/6310_2.png) [@Furkan\_Sezal](https://forum.openzeppelin.com/u/Furkan_Sezal)\
**Post date:** [November 14, 2022, 5:56pm UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015/3 "2022-11-14T17:56:37Z")

</div>

Last update, changing to deployer was work on localhost but it didnt work on testnet. So looks like when you put some variable other then uint this function (governor.interface.encodeFunctionData) or openzeppelin contract doesnt like it. So i change address with uint address index. map that index to address. Solved the problem.

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [November 15, 2022, 1:49am UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015/4 "2022-11-15T01:49:31Z")

</div>

> [@Furkan\_Sezal](#):
>
> execution reverted: TimelockController: underlying transaction reverted"

Maybe you can paste the full code of your function `apporoveFundingByDao()`

---

<div class="post-metadata">

**Author:** ![Furkan\_Sezal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/furkan_sezal/32/6310_2.png) [@Furkan\_Sezal](https://forum.openzeppelin.com/u/Furkan_Sezal)\
**Post date:** [November 17, 2022, 3:04pm UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015/5 "2022-11-17T15:04:11Z")

</div>

```
function apporoveFundingByDao(
    string memory _ipfsHash,
    uint256 _fundingGoalAmount,
    uint256 _time,
    uint256 _projectOwnerAddressIndex
) external onlyOwner {
    // only dao can call it
    if (
        !_isEnteranceFeePaid[
            projectOwnerAddressIndex[_projectOwnerAddressIndex]
        ]
    ) {
        revert FundProject__EnteranceFeeNeeded();
    } else {
        projectToTime[projectId][_time] = block.timestamp;
        _ProjectFundingStatus[projectId] = ProjectFundingStatus.ONPROGRESS;
        time[projectId] = _time;
        projectFundingGoalAmount[projectId] = _fundingGoalAmount;
        hashToProjectId[_ipfsHash] = projectId;
        idToHash[projectId] = _ipfsHash;
        projectOwnerAddress[projectId] = projectOwnerAddressIndex[
            _projectOwnerAddressIndex
        ];
        _isApporovedByDao[projectId] = true;
        _isFunding[projectId] = true;
        emit projectGoesToFunding(projectId);
        projectId++;
    }
}

```

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [November 18, 2022, 12:19am UTC](https://forum.openzeppelin.com/t/reverted-with-reason-string-timelockcontroller-underlying-transaction-reverted/33015/6 "2022-11-18T00:19:22Z")

</div>

Seems like only one revert message in your function, so maybe you can have a check for the requirement

```auto
_isEnteranceFeePaid[
    projectOwnerAddressIndex[_projectOwnerAddressIndex]
]

```
