Bitcoin Forum
September 23, 2024, 06:43:13 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 »
1  Alternate cryptocurrencies / Altcoin Discussion / Question about ERC-20 Token on: September 28, 2017, 02:13:03 AM
Assuming a ERC-20 is deployed with the standard code from the website, why am I able to transfer tokens from the main address to any other ETH address with no issues, but when I send the tokens from that address to any other Ethereum address, calling "Function: transfer(address _to, uint256 _value) ***"

 it gives the following message in Etherscan:

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

What does this mean and how to fix this? Does the approve() function need to be called for every address before it can spend the tokens and can that approve function be called from the new address or must it be only from the original token creator address?




pragma solidity ^0.4.13;

contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }

contract Test {
    /* Public variables of the token */
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public totalSupply;

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

    /* This generates a public event on the blockchain that will notify clients */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /* This notifies clients about the amount burnt */
    event Burn(address indexed from, uint256 value);

    /* Initializes contract with initial supply tokens to the creator of the contract */
    function Test(
        uint256 initialSupply,
        string tokenName,
        uint8 decimalUnits,
        string tokenSymbol
        ) {
        balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
        totalSupply = initialSupply;                        // Update total supply
        name = tokenName;                                   // Set the name for display purposes
        symbol = tokenSymbol;                               // Set the symbol for display purposes
        decimals = decimalUnits;                            // Amount of decimals for display purposes
    }

    /* Internal transfer, only can be called by this contract */
    function _transfer(address _from, address _to, uint _value) internal {
        require (_to != 0x0);                               // Prevent transfer to 0x0 address. Use burn() instead
        require (balanceOf[_from] > _value);                // Check if the sender has enough
        require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
        balanceOf[_from] -= _value;                         // Subtract from the sender
        balanceOf[_to] += _value;                            // Add the same to the recipient
        Transfer(_from, _to, _value);
    }

    /// @notice Send `_value` tokens to `_to` from your account
    /// @param _to The address of the recipient
    /// @param _value the amount to send
    function transfer(address _to, uint256 _value) {
        _transfer(msg.sender, _to, _value);
    }

    /// @notice Send `_value` tokens to `_to` in behalf of `_from`
    /// @param _from The address of the sender
    /// @param _to The address of the recipient
    /// @param _value the amount to send
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
        require (_value < allowance[_from][msg.sender]);     // Check allowance
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }

    /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf
    /// @param _spender The address authorized to spend
    /// @param _value the max amount they can spend
    function approve(address _spender, uint256 _value)
        returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        return true;
    }

    /// @notice Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
    /// @param _spender The address authorized to spend
    /// @param _value the max amount they can spend
    /// @param _extraData some extra information to send to the approved contract
    function approveAndCall(address _spender, uint256 _value, bytes _extraData)
        returns (bool success) {
        tokenRecipient spender = tokenRecipient(_spender);
        if (approve(_spender, _value)) {
            spender.receiveApproval(msg.sender, _value, this, _extraData);
            return true;
        }
    }       

    /// @notice Remove `_value` tokens from the system irreversibly
    /// @param _value the amount of money to burn
    function burn(uint256 _value) returns (bool success) {
        require (balanceOf[msg.sender] > _value);            // Check if the sender has enough
        balanceOf[msg.sender] -= _value;                      // Subtract from the sender
        totalSupply -= _value;                                // Updates totalSupply
        Burn(msg.sender, _value);
        return true;
    }

    function burnFrom(address _from, uint256 _value) returns (bool success) {
        require(balanceOf[_from] >= _value);                // Check if the targeted balance is enough
        require(_value <= allowance[_from][msg.sender]);    // Check allowance
        balanceOf[_from] -= _value;                         // Subtract from the targeted balance
        allowance[_from][msg.sender] -= _value;             // Subtract from the sender's allowance
        totalSupply -= _value;                              // Update totalSupply
        Burn(_from, _value);
        return true;
    }
}
2  Alternate cryptocurrencies / Tokens (Altcoins) / Re: [PRE-ANN][ICO][BOUNTY] MEDIBOND[MEDI] - Healthcare In Your Hands || medibond.io on: August 05, 2017, 04:20:27 PM
just bought in! Seems like more and more people starting to invest, saw more transactions after last night :DDD
3  Alternate cryptocurrencies / Tokens (Altcoins) / Re: [PRE-ANN][ICO][BOUNTY] MEDIBOND[MEDI] - Healthcare In Your Hands || medibond.io on: July 25, 2017, 04:30:28 PM
What an interesting project here, an insurance is surely needed by many peoples, especially health insurance.
With this, it's surely going to bring goodness among peoples.


i mean I don't think this is "insurance" but it looks like a system to help reduce the problems that exist now in the healthcare community as there is a big monopoly between insurances software companies, hospitals, and pharmacies not to modernize technology and bureaucracy is in the way of it too since they set standards but hopefully this project will gain traction and help medical things move to the digital world, also their predictive diagnosis and treatments using artificial intelligence is very impressive if it can be implemented, I suggest more focus be given to AI and get that done first on roadmap
4  Economy / Trading Discussion / Re: How do you guys keep track of all your cryptocurrency investments? on: July 22, 2017, 07:19:52 PM
some really good options here I didn't here about before, blockifolio and coin.fyi are very nice solutions, thanks for starting this thread!
5  Bitcoin / Project Development / Re: Profitable trading bot developed, need funds to invest! on: July 21, 2017, 07:32:54 PM
Hi,

I have developed a profitable trading bot which trades on the bittrex exchange and checks all coin pairs in 1 minute intervals for potential trends. So far I have turned 1 BTC into 2,6 BTC within just 24 hours. Currently the bot doesn't trade with real money because my bittrex balance is 0. If somebody sends me 0.05 BTC I will set up your own copy of the bot to trade live 24/7.

Eh, skeptical but PM me, I'm willing to try for 0.05 BTC, if you have a demo video or screenshots of actual statistics you've run with this bot that'd be fantastic!
6  Alternate cryptocurrencies / Tokens (Altcoins) / Re: [PRE-ANN][ICO][BOUNTY] MEDIBOND[MED] - Healthcare In Your Hands || medibond.io on: July 21, 2017, 03:18:50 PM
Other than bowhead health and patientory are there any other major healthcare related token projects that secure medical data? I know you guys want to do secure data but are you unique in that you do the multisignature between different insurance entities?  I know AI for doctors is unique as I haven't seen it elsewhere but is there more?
7  Alternate cryptocurrencies / Announcements (Altcoins) / Re: 💸💸💸 [BOUNTY] VOTES 💸💸💸 on: July 20, 2017, 06:26:56 PM
Registered! good luck on this
8  Alternate cryptocurrencies / Tokens (Altcoins) / Re: [PRE-ANN][ICO][BOUNTY] MEDIBOND[MED] - Healthcare In Your Hands || medibond.io on: July 20, 2017, 04:35:32 AM
Planning to join the RT campaign bounty! The project looks very interesting, keeping an eye on this one
9  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] KAPPA [ICO] July 10-24: Sarcastic cryptocurrency on: July 10, 2017, 03:02:56 PM
Interesting! Whitepaper not loading in Chrome, anything I should do?
If all you see is a white piece of paper, then it's loading just fine!  Wink

hehe, I understood that shortly after posting the reply here haha  Grin
10  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] KAPPA [ICO] July 10-24: Sarcastic cryptocurrency on: July 10, 2017, 02:28:55 PM
Interesting! Whitepaper not loading in Chrome, anything I should do?
11  Alternate cryptocurrencies / Marketplace (Altcoins) / Re: DCR & Exodus.io Puzzle on: July 05, 2017, 09:55:31 PM
Just as an update it looks like the puzzle was solved now

https://twitter.com/decredproject/status/881945616892305408
12  Economy / Trading Discussion / Re: Where should i invest 45 BTC risk free on: July 04, 2017, 03:40:31 AM
45 BTC is far too many to just invest in one place risk free. I'd suggest put some into a credible alt with a good staking return, give some of them out as loans on trusted and verified platforms, reserve some away just to not touch and maybe come back to in a couple years when Bitcoin is much higher, and the rest I'd suggest you trade with cautiously.
13  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN][DCR] Decred - Hybrid PoW/PoS | btcsuite Devs | Tons of New Features | Go on: June 28, 2017, 02:52:09 AM
where would you suggest is the best place to stake if you've got under 50 DCR?
14  Alternate cryptocurrencies / Marketplace (Altcoins) / DCR & Exodus.io Puzzle on: June 27, 2017, 12:58:54 AM
If you guys haven't checked it out, Decred & Exodus.io are doing a $5000.00 Puzzle Competition -> http://exodus.io/decred

We're on the final step! Join us on the Decred Slack (http://decred.slack.com) in the #puzzles channel for full updates and collaborated participation with other players!
15  Bitcoin / Bitcoin Discussion / Re: How do you store your bitcoins? on: June 20, 2017, 03:14:26 AM
I store some of my crypto assets in an interesting way - I make puzzles (images) out of them which only I know how to decipher with a certain scheme/maze. In the image are the priv keys. Perhaps not the safest but it works for me.
16  Bitcoin / Bitcoin Discussion / Re: Why Cash is better than Bitcoin. on: June 08, 2017, 02:31:29 AM
Bitcoin is already BETTER THAN the currently existing currency, its also BETTER THAN cash because you can do this through internet without any hustle in a rough way.

exactly. agreed
17  Bitcoin / Bitcoin Discussion / Re: Bitcoin banned in Ecuador on: May 30, 2017, 06:57:46 PM
Quite foolish for any government to try and ban Bitcoin or any other p2p crypto currencies. It won't work.
18  Bitcoin / Bitcoin Discussion / Re: How to guarantee BTC growth on: May 29, 2017, 01:50:47 PM
In a way the reward halving and increasing difficulty to mine new Bitcoins almost makes it necessary for price to increase for miners to be interested to spend their money on power to continue to mine, so its kind of built in, reasons for BTC growth.
19  Economy / Trading Discussion / Re: What is your trading strategy? on: May 26, 2017, 06:34:56 PM
Follow good traders on twitter

Follow the overall BTC/USD market (good for determining when to get into alts)

Follow major alts (LTC, ETH, DCR, UBQ, CLAM, XRP, etc) trends

Get into a good Telegram or Slack group of dedicated traders (since markets are 24/7, good to have people in other timezones who can follow markets at times you're not awake and can ping you messages or trends you missed)

Execute trades!
20  Economy / Speculation / Re: Buy In The Dips Guys on: May 26, 2017, 01:44:44 AM
Difficult part will be to figure out how low the dips can go. So far if the fallout hasn't happened yet then it doesn't resemble any past trends w/regards to length of time in between swings. Will be an interesting ride forward.
Pages: [1] 2 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!