1

I have written and deployed the following contract (source published):

https://ropsten.etherscan.io/address/0xCaD97e58Ea88De59802F676e911E60099C5Df714

When executing the function 'fillBid' using Mist I am being told: "it seems this transaction will fail if you submit it it may consume all the gas you send"

Sending the transaction non the less (https://ropsten.etherscan.io/tx/0x4c309daead9b976aa742c0ac30a75a5f6d22a083f46ba1753c88115a8b391c69) results in:

"Warning! Error encountered during contract execution [Bad instruction]"

I am starting to think it is something bleedingly obvious but I just can't figure it out. I am especially perplexed because there are literally no conditions on it.

UPDATE 2017-07-02:

(Almost) exact same code over at https://ropsten.etherscan.io/address/0x26c8532AE5953053Ea721c9922c3Ec8A1ab8129a

works just fine: https://ropsten.etherscan.io/tx/0xe8f0f4e2ea04a4cccb370766fc94e2d3f9d3e2e585865285c11a41433a4dd7b0

UPDATE 2017-07-03:

So I removed everything but the amount calculations and the transfer commands and it still fails: https://ropsten.etherscan.io/tx/0x683bcdbc4f4250b439b53692302dc8e75c6f42f6ce8243200b94d74565964267

UPDATE 2017-07-03_2: I have isolated the problem to this code:

uint256 _amountEthart;
_amountEthart = highestBidPrice / 40;
registrar.transfer(_amountEthart);

Executing fillBid1 errors out: https://ropsten.etherscan.io/tx/0xddc9505f4e794310091ffad933594da182d4c18f83764e33b39d3a5ca065e365

Executing fillBid or fillBid2 is fine: https://ropsten.etherscan.io/tx/0xce73e6a7cbc95e28538a29ff3e774462697e985897a5b924d1f719c46194bd12

2 Answers 2

3

It seems you are making a transfer to registrar at (0x3a9d5dE80e728DF511581c71F7A332CabF661b99). But the contract at that address does not define a fallback function.

You have to add function() payable {} to make the contract accept transfers.

1
  • You rescued me from the brink of insanity - thank you!
    – Steve
    Commented Jul 3, 2017 at 6:45
0
_amountOwner = highestBidPrice / 10000 * ownerCommission;
        _amountEthart = highestBidPrice / 40;
        _amountSeller = highestBidPrice - _amountOwner - _amountEthart;

from the above you're order of precedence is messed up, use paranthesis to indicate which part of the calculation you want to run first, and also you don't seem to be calculating the amount you want to send in wei.

1
  • I updated the original question with more examples of where the (exact) same code works fine in another contract.
    – Steve
    Commented Jul 2, 2017 at 16:03

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.