I own a contract (contract A), which in turn, when deployed, created a secondary contract (Contract B).

I have funds trapped in contract B, contract B, has a function that allows its owner to withdraw funds in the contract, but with the OnlyOwner modifier.

The owner of contract B is contract A, I cannot execute the call because a contract cannot sign the transaction, is there any possibility of resolving this?

I need use this function:

function processAccount(address payable account, bool automatic) public onlyOwner returns (bool) {
    uint256 amount = _withdrawDividendOfUser(account);

    if(amount > 0) {
        lastClaimTimes[account] = block.timestamp;
        emit Claim(account, amount, automatic);
        return true;

Or even, it would solve the problem if I could change the owner of contract B, moving it to a wallet.

but only the owner can do that, and unfortunately it's another contract.

Or even, it would solve the problem if I could change the owner of contract B, moving it to a wallet.

but only the owner can do that, and unfortunately it's another contract.

It is a contract for an ERC20 token with dividends in BNB.

We published it in 2021 and we did not have full knowledge, so perhaps we failed to foresee some situations.

The logic of the contract is,

Wallet deploy the Contract A (ERC20) Token, automatically contract B (dividends) was created and published as owner of contract A.

I have a relevant amount of BNB within contract B and would like to try to redeem it.

The calls provided for in contract A to interact with B do not include transferring ownership of contract B or calling the processaccount() function.

If I could call the transferownership() of Contract B (Dividends) easily I would transfer it to a wallet and then I could successfully use the ProcessAccount() function and then I would be able to redeem the BNB in the contract. Or at least calling the processaccount() function directly from Contract A would also work.

The problem is:

TransferOwnerShip() and ProcessAccount() are set to OnlyOwner, that is, only contract A can call, but there is no function in contract A specifies to do this.

Neither contract A nor contract B have delegate or upgradeable functions.

One of the few things that I have at my disposal to use to my advantage is that contract A has an upgradedividendTracker() function that results in incorporating a new contract within contract A replacing the current dividend contract, and this occurs without changing the ownership of the original dividend contract.

  • Provide the entire contract code or at least a link to the deployed contracts on a block explorer, this way, users will be able to help you to the best of their abilities.
    – Rohan Nero
    Sep 14, 2023 at 20:05

1 Answer 1


Unfortunately, if you have already deployed both contracts without implementing a method to change the owner or call the processAccount() function, then the funds are lost forever.

For future reference, always test your contract code prior to deploying to a real network such as Ethereum mainnet, because smart contract code is immutable by design, meaning it can never be altered.

  • Couldn't I solve my problem by creating a third contract that I had delegated, assuming that I can include a third contract within my main contract to command? In this case, could I implement the third contract that had a delegate function to call the transferownership function in contract B, while preserving the message.sender from contract A? Nov 11, 2023 at 4:41
  • So contract A would make a call to the intermediate contract and the intermediate contract would make a delegatecall to contract B, passing msg.sender from A? Nov 11, 2023 at 4:42

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.