These are chat archives for ethereum/tutorials

24th
Jan 2018
Sebastiaan vK
@Noncesense
Jan 24 2018 00:42
Hey guys
How do I allow my smart contract to only accept my ERC20 tokens?
as in users have to hold my tokens to interact with my smart contract
Matt Ober
@obo20
Jan 24 2018 01:41
does anybody know how to debug truffle javascript tests?
as in setting breakpoints and stepping through them
szAlphaWizard
@szAlphaWizard
Jan 24 2018 07:12
hi, how can i talk with ethreum
Safari
@cptsky
Jan 24 2018 09:44
Hi, I have a question. I transfered 1,000 tokens but I received 0.00000001. How to get the exact value?
ekntrtmz
@ekntrtmz
Jan 24 2018 11:40

hi guys. I am total newbie and try to create a token within mist.
When I insert function myToken (copy paste) then I get error:
Could not compile source code.
No visibility specified. Defaulting to "public".
function MyToken(
^
Spanning multiple lines.
,

What do I oversee?

I followed this tutorial:
https://www.ethereum.org/token
AmitSingh0204
@AmitSingh0204
Jan 24 2018 11:47
Anyone can help me in working with struct in solidity and javascript... https://ethereum.stackexchange.com/questions/37260/
@ekntrtmz I am able to compile your code once pragma version is specified on the top.
ekntrtmz
@ekntrtmz
Jan 24 2018 12:02
@AmitSingh0204 I specified with pragma solidity ^0.4.18;
also main function contract myToken {...} can be compiled
but whenever adding function it breakes...
AmitSingh0204
@AmitSingh0204
Jan 24 2018 12:04
I am able to add functions and perform operation in your code. Can you share your code for better clarity ?
ekntrtmz
@ekntrtmz
Jan 24 2018 12:05
hmm I solved it
I had to add "public" after function declaration...
https://www.ethereum.org/token should be updated

contract MyToken {
/ This creates an array with all balances /
mapping (address => uint256) public balanceOf;

/* Initializes contract with initial supply tokens to the creator of the contract */
function MyToken(
    uint256 initialSupply
    ) {
    balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
}

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

}

Not working

alexgiul
@alexgiul
Jan 24 2018 12:31
@cptsky do you multiply for 10^decimals?
Guys, today I try to deploy a contract on mainnet giving only 3.2 Gwei for gas...I run out of gas...1) how can I understand from gas station how much I have to provide? 2) Is it normal that the transaction goes well (I lost my small amount of ethers) but the contract fails?
eddie2024
@eddie2024
Jan 24 2018 18:02
how do you load/execute a function at a particular time while the contract is running without requireing user intervention?
Vidor Gencel
@vidorge
Jan 24 2018 18:04
eddie2024
@eddie2024
Jan 24 2018 18:06
@vidorge thanks, saw this online, I think I'll go for the option requiring human intervention