1

I have a contract that I've been able to successfully make web3 calls on. However, after adding this function to a new version of the contract:

function removeDevice(address owner, string dev_addr)public{
    delete registeredTo[dev_addr];
    for(uint i = 0; i < ownership[owner].length;i++){
        if(keccak256(ownership[owner][i].device_address) == keccak256(dev_addr)){         
            ownership[owner][i] = ownership[owner][ownership[owner].length-1];
            delete postedItems[owner][postedItems[owner].length-1];
            postedItems[owner].length--;
            break;
        }
    }
}

Every function that sends data to the contract generates a "new BigNumber() not a base 16 number: " error, and fails.

ownership[owner][i].device_address and dev_addr are both strings, and I assume the error is being generated by the comparison of the two, since other functions in my contract do similar operations without issue. I have also double-checked to make sure that I'm using the correct contract address and ABI, and I am using version 0.4.21 of Solidity, which appears to be the most up-to-date version, so I am certain that the issue stems from this block of code; I just cannot figure out how to go about fixing it.

2
  • 1
    Please share the code that's calling that function.
    – user19510
    Commented Mar 29, 2018 at 0:40
  • 2
    If there's a full stack trace, indicating what line of code is causing that error, please share that. The error is on the JavaScript side.
    – user19510
    Commented Mar 29, 2018 at 0:42

1 Answer 1

2

Found the issue. My updated contract wasn't executing on the blockchain because the gas requirement was bigger than what was being provided. It is kind of weird that web3 generates TypeErrors when the root of the issue is having no contract to call on, but that's what was happening.

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.