0

I am having difficulty spending the funds in a smart contract address.

The smart contract address was generated using an ETH forwarder smart contract - https://github.com/primozkocevar/SigWallet-ERC20/blob/master/contracts/Forwarder.sol.

I'm stuck at sending ERC20 tokens out of the address - https://ropsten.etherscan.io/address/0x53c021a405c7af363ecf69ef22ea8e5614d0d1ff.

Can someone guide/help me on this ?

6
  • Which function are you trying to call?
    – Ismael
    Aug 7, 2021 at 4:30
  • flushTokens function in the forwarder contract @Ismael Aug 8, 2021 at 0:08
  • I have been able to fix the issue, I had to change the modifier restriction of the Forwarder contract Aug 8, 2021 at 3:44
  • That's nice I have just checked the contracts in remix.ethereum.org against the FixedSupply token and it worked when calling flushTokens from the same account that deployed the contract because it uses the onlyParent modifier. If you solved your question it would be nice if you can write an answer so the question can be marked as resolved.
    – Ismael
    Aug 8, 2021 at 3:50
  • @Ismael thanks for your feedback. The problem was the modifier in the flushToken function. I had to use the deployer account to call the function. function flushTokens(address tokenContractAddress) public onlyParent { } Aug 26, 2021 at 18:33

1 Answer 1

0

I solved this problem by first ensuring that the deployer of this account was the caller of the flushToken function in the contract

function flushTokens(address tokenContractAddress) public onlyParent {
    ERC20Interface instance = ERC20Interface(tokenContractAddress);
    uint256 forwarderBalance = instance.balanceOf(address(this));
    if (forwarderBalance == 0) {
      revert();
    }
    if (!instance.transfer(parentAddress, forwarderBalance)) {
      revert();
    }
    // fire of an event just for the record!
    emit TokensFlushed(address(this), forwarderBalance, tokenContractAddress);
  }

To make things more flexible, I removed the onlyParent modifier for this function, so that it can be called from any account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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