Hot answers tagged

8

This should work: pragma solidity ^0.4.24; contract Test { function checkIntegerETH(uint a) public pure returns (bool) { return (a % 1 ether == 0); } } Here we are basically confirming that a has no remainder when being divided by 1018 (1 ether).


6

There are two ways this is done today: 1. Normal Accounts Generate wallet keys / addresses that your users transfer to, and you have to send gas to those addresses in order to move funds. Downsides: collecting funds requires you to send gas to these addresses which will ultimately result in dust accumulating in these storing and managing the account ...


6

I was so kind to verify the contract source for you. This is a very common problem I also experienced. (It's extremely frustrating) Compiling: Single-File-Solidity Compiler Version: 0.4.24 Contract-Code: Copy the Coin.sol file Optimization: YES !!!!!!! (most likely you were missing that) Here is the link of your verified contract: https://etherscan.io/...


5

ERC20 is an interface by definition. MetaMask has explicit support for this type of contract. It does not support contracts with arbitrary interfaces. Hope it helps.


5

ETH + ERC20 tokens sent there are burnt Effectively. Unless someone generates the private key, in which case they'll take ownership of those funds. Note that you could pick any other unused address as a burn address, it's just people seem to have used 0x0 (and various others) as Schelling points. That there should be no owner of the private key of that ...


4

From Weenus 💪 ERC20 FaucetAnnouncing the Weenus 💪 ERC20 token faucets on the Ethereum mainnet, and Ropsten, Kovan, Rinkeby and Görli testnets: Search in your Ethereum blockchain explorer for WEENUS (18 decimals), XEENUS (18 decimals), YEENUS (8 decimals) or ZEENUS (0 decimals). Send a 0 value transaction from your account to the token contract addresses ...


4

As totalSupply variable in ERC20 is an uint256 type it can hold the largest value 2^256-1 whose value is 115792089237316195423570985008687907853269984665640564039457584007913129639935


4

Try this: contract('erc20 deployed', function(accounts) { const REVERT = "VM Exception while processing transaction: revert"; it("should not transfer 1 token from address[0] to address[1]", async function() { try { await erc20Instance.transfer(accounts[1], 1); throw null; } catch (error) { ...


4

If you are using someone else's ERC20 token, then you will not be able to do this. The approve function in a standard ERC20 contract is made to use the msg.sender which, as you have noticed, will take the form of the calling address (like a contract), rather than the root address which initiated a transaction. This is actually a way to prevent from attacks ...


4

There currently is no standard defined for what you are describing as "semi-fungible". The ERC 721 standard is for truly unique assets which are therefore NFT(non fungible tokens). To implement what you want you should use a related series of contracts each with its own total supply. The 721 spec https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md ...


4

Etherscan will recognize your contract once it will log its first Transfer event. This is how it works. Though, even before the first Transfer event was logged, you may view your contract in token tracker: https://rinkeby.etherscan.io/tokens?q=0x5238fFeAEdfc9481bd635B6E0e5eF3b05b19762a


3

Tokens and Ether are not interchangeable in functionality. Ether is a fundamental part of the Ethereum network. It is used to fund gas, which is literally the gasoline of the network. Users pay transactions fees in Ether, Miners get rewards in Ether, and Ether is managed as a part of the underlying Ethereum core blockchain. On the other hand, tokens are ...


3

1) Matching the ERC777TokensRecipient interface is optional. More specifically, one single ERC1820 registry is deployed on most Ethereum networks, always at the same address: 0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24. The ERC1820 registry contains a mapping from addresses to contract addresses verifying the ERC777TokensRecipient interface. Those ...


3

Actually you can read the "data" field in transaction receipt. Fetch transaction receipt by ethGetTransactionReceipt(txHash) Remove prefix 0x from the string. Use FunctionReturnDecoder or similar to decode value from the string to the BigInteger. Result value should be the token's transfer value


3

Everything in the blockchain is public information. Therefore you can't directly hide it. That being said, you can send your Ether balance to multiple wallets. That way your one wallet will not display your "full" balance. But, as the transactions are also public, anyone can see that Ether was sent away from one wallet and into another and if they want, ...


3

No that is not possible. Contract once deployed cannot be modified. You need to deploy new contract again.


3

... which sends 25 Bitcoin to his own address as 'Reward'... The reward hasn't been 25 BTC since July 2017, when it halved to 12.5. But who decides which reward the miner gets in case he successfully manage to solve the riddle? The title of your question implies that by "which reward" you mean the type of reward, rather than quantity. Standard block ...


3

There's nothing against that, as modifiers aren't part of the interface you expose. Depending on your modifiers though, it's pretty easy to make any number of integrations impossible (e.g. if you have a whitelist'ed address modifier, the token probably wont be tradeable on exchanges)


3

Also included in the library is a couple of examples - you can find them in their github repo. One, called SimpleToken looks like this: pragma solidity ^0.4.24; import "../token/ERC20/ERC20.sol"; /** * @title SimpleToken * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. * Note they can later distribute these ...


3

In ERC-721, each token is completely unique and non-interchangeable with other tokens. The key features of both are: ERC-20: For money and money-like tokens. ERC-721: For things and thing-like tokens. According to the nature of these tokens, nowadays most of the games are using ERC-721 tokens e.g. Cryptokitties because kitties are unique and non-...


3

You could simply use Whois0x.io, it provides a link with an identity card you set up with keybase style self post on social media. It's easier for people to donate if they do know for sure who is the receiver. It can give you something like this: 0xfFA7A52a7d30E5Bc81c031a717726FA638c76289 Then, if people connect their metamask account or their Dapp browser ...


3

Since you do not have control over the address, the tokens have been lost. If your contract does not have a burn function, unfortunately you can not update it. Perhaps what can be done is to create a new contract that copies the current contract state and includes the burn function, but I do not know if this is so simple for your case.


3

First, as pointed by @goodvibration, you don't need to recast BAT_TOKEN_ADDRESS to the ERC20 interface since you already did it when assigning its value. Second, your BATSend function should check whether the tokens transfer was successful or not since transfer returns a boolean (true if the transfer was successful, false otherwise), like that : ...


3

This is a limitation of ERC20. When Alice pays Bob, she sends a transaction to the token contract to make an accounting entry. There is no standard method for the token contract to inform Bob. The allow/transferFrom flow resolves it with a 2-step process - first authorize Bob to take from Alice, then inform Bob. Since Bob is in the loop, Bob can do what ...


3

This contract doesn't appear to implement a fallback function that accepts ether, so the transaction gets reverted. If you want your contract to do something when sent ether, implement a payable fallback function: function() external payable { // do stuff }


3

In Ethereum there are two ways of interacting with a smart contract: transactions and calls. Calls are possible only for function which are marked as pure or view. If you issue a call to such function the result is fetched directly from the node which you are connected to - the actual blockchain is not involved. Your node should have the most recent data (...


3

Actually, you should not send part of a transaction to all token holders. That is possibly infinitely expensive to do (because your list of token holders can grow indefinetely, I assume). There's no way of doing exactly that in the EVM. Just to clarify, imagine you have ten thousand token holders and someone just wants to send 1 token to a friend. How much ...


3

No, you can mint as many as you want, which will increase the total-supply (up to 2 ** 256 - 1). Make sure that the contract has a mint function; it is not a part of the ERC20 standard as far as I remember. You can add this function (or any other function for that matter), so long as you implement the standard itself.


3

Just don't use BN. You need to convert ETH to WEI. This is a very simple proccess. Web3 has some buildt in functions for this: const val = 0.15; // this guy var weiAmount = web3.toWei(val);


3

There's no way for you to get them back, tokens sent to that particular contract that you're referring to, are stuck there forever. The contract that you link to has no way to withdraw tokens mistakenly sent to it. Perhaps your best chance is to reach out to the MWAT team and explain your situation, perhaps they can try to resolve it in someway.


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