0

i have token created on smart contract. contract address is 0x1fa1a89f72c1011122e62261bb962b123ac40a76

i have tried to transfer token several time and i am getting the following error. Warning! Error encountered during contract execution [Bad instruction]

https://etherscan.io/tx/0x7d7571080d6469a558847c075283d30ef197ca69ba8761242ec469a44521e248

the smart contract source code is

contract FRPoint {
    /* Public variables of the token */
    string public standard = 'Token 0.1';
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public initialSupply;

    /* This creates an array with all balances */
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;


    /* Initializes contract with initial supply tokens to the creator of the contract */
    function FRPoint() {

         initialSupply = 90000000000000000000;
         name ="FRP$";
        decimals = 9;
         symbol = "FRP";

        balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
        uint256 totalSupply = initialSupply;                        // Update total supply

    }

    /* Send coins */
    function transfer(address _to, uint256 _value) {
        if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough
        if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
        balanceOf[msg.sender] -= _value;                     // Subtract from the sender
        balanceOf[_to] += _value;                            // Add the same to the recipient

    }







    /* This unnamed function is called whenever someone tries to send ether to it */
    function () {
        throw;     // Prevents accidental sending of ether
    }
}

I have lost ether as gas while doing transaction and is it possible to get it back.

  • Hi there. It would be a good idea to test your contract on the testnet before pushing it onto the main net. That way you can minimise any ether loss. – Richard Horrocks Sep 8 '17 at 9:38
  • No, it is not possible to get the ether spent for gas "back"; the point of the cost is to limit the amount of computation and storage used (to prevent overloading the network). Even when transactions don't work as expected, they still consume resources of the Ethereum network. Giving people a way to get a refund on the ether spent on gas would defeat the purpose of having a price on gas in the first place. – lungj Sep 8 '17 at 13:39
0

In this transaction, and the other recent failed ones, you are trying to call the approve() method, which the contract does not implement. This is why it is failing.

This is not an ERC20 token, so you only need to call transfer(), as in this successful transaction.

  • is there any remedy to incorporate approve in contract so that i can approve exchange transfer – shashi Sep 8 '17 at 9:41
  • which are all other factors is required to consider token as erc20? – shashi Sep 8 '17 at 9:42
  • The ERC20 description is here. There are lots of "standard" implementations that people use, e.g. OpenZeppelin's token. – benjaminion Sep 8 '17 at 9:52

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.