Hot answers tagged

2

I guess it depends on how paranoid you are. These two functions are private and so the rest of your code may prevent reentrancy. However if you really want to be safe you could introduce a mutex of some sort, like: bool isTransferring = false; function transferFunds(uint _value) private { require(isTransferring == false, "Rentrancy Detected"); ...


2

In function transfer: balances[msg.sender] = (balances[msg.sender] - tokens); You are not verifying balances[msg.sender] >= tokens. And so when balances[msg.sender] < tokens, the unsigned value of balances[msg.sender] - tokens will typically be huge. For example, consider the following case: balances[msg.sender] == 0 tokens == 1 Then balances[msg....


1

Ropsten is, well, a testnet. It can be used for testing various blockchain functionalities but everything in Ropsten is useless in the "real" world. You can't use Ropsten assets in the main chain and all assets in Ropsten are worthless. So if you want your assets to have some real users, real usage and possibly read value you should put it into the mainnet. ...


1

Short answer is: not necessary. ERC-20 standard requires token owner to personally initiate, or at least approve all transfers of his tokens, so when using ERC-20 functions, token owner has to execute some transaction from his own address in order to move tokens forward. If token owner uses an Externally Owned Address (EOA) to hold tokens, then executing ...


1

To begin with, change this: goods[msg.sender].add(amount); To this: goods[msg.sender] = goods[msg.sender].add(amount); And this: bids[msg.sender].add(startPrice); To this: bids[msg.sender] = bids[msg.sender].add(startPrice); You probably also want to change this: startPrice = startPrice*100000000*amount To this: startPrice = startPrice.mul(...


1

One is protocol and one is an app. You explicitly write the procedure for both cases. Ether The EVM uses ether to financially incentivize securing the network and verifying transactions. All ether originate with a found block and a reward paid to the miner that found it. In a contract, msg.value is the amount of ether sent to a function, and the ...


1

The question is too broad. An ERC20 token gives you the accounting and transferability as well as compatibility with wallets and exchanges. Great. In theory, you can sell the tokens for money if anyone will buy them. Why would they? It's not a rhetorical question. This is an economics, mechanism-design question. It's a little too broad to describe ...


1

This is definitely possible off-chain, as one may monitor or query Transfer events. In general, this is not possible to do on-chain, as token transfer do not leave any trace, so smart contract may not verify that some token transfer actually happened. However, smart contact may verify that token balance of certain address (probably smart contract's own ...


Only top voted, non community-wiki answers of a minimum length are eligible