Remix never returns a transaction - but everything works - why?

by Zach   Last Updated September 11, 2019 05:28 AM - source

This code supposedly works. Its supposed to let the owner withdrawal collected ERC20 tokens in a contract.

It calls the balanceOf() for the erc20, then calls transfer().

The withdrawal works - but in remix, there is never anything returned instead it just says -

transact to BullionixGenerator.withdrawal pending ...

Here is the code:

function withdrawal() onlyOwner
  returns (bool){
    require(isOnline == false);
    uint256 temp = _checkBalance(); //calls checkBalance which will revert if no balance, if balance pass it into transfer as amount to withdrawal MAX
    require(ERC20.transfer(msg.sender, temp)); 
    emit Withdrawal(msg.sender, temp);
    return true;    
function _checkBalance() internal view returns (uint256){
    uint256 tempBalance = ERC20.balanceOf(address(this)); //checking balance on contract
   require(tempBalance > 0, "Revert: Balance is 0!");  //do I even have a balance? Lets see. If no balance revert. 
    return tempBalance;  //here is your balance! Fresh off the stove. 

tl;dr - code works but remix never returns anything for a receipt. Only with this one function. I've tried commenting out things but I can't find whats causing an issue with remix - note: event was added AFTER the bug, so its not from the indexed event params.

Related Questions

How can I pass struct from one contract to another?

Updated January 10, 2019 23:28 PM

Gas Estimatation

Updated January 02, 2019 03:28 AM