Hot answers tagged

44

3 Primary improvements with ERC223 Eliminates the problem of lost tokens which happens during the transfer of ERC20 tokens to a contract (when people mistakenly use the instructions for sending tokens to a wallet). ERC223 allows users to send their tokens to either wallet or contract with the same function transfer, thereby eliminating the potential for ...


20

Thank you K.Fichter for the help, I just want to fully clarify the answer for anyone else who may run into this issue. Let's say you want to get the balance of a token at an Ethereum Address. Using Web3 you would do the following: var tokenContract = web3.eth.contract(contractABI).at(contractAddress) var decimal = tokenContract.decimals() var balance = ...


17

It is not really true at the moment that you can pay fees in anything except ETH, although there is some discussion about changing this. The way things normally work, you have to pay the fee in ETH. When you sent REP to the exchange you probably used ETH in your own account to deposit tokens in the exchange, and the exchange would have paid for the ...


16

I'm using web3.js version: 0.20.1 in node.js express application. I'm running Parity in Virtualbox Ubuntu machine. The correct code looks like following: var count = web3.eth.getTransactionCount("0x26..."); var abiArray = JSON.parse(fs.readFileSync('mycoin.json', 'utf-8')); var contractAddress = "0x8..."; var contract = web3.eth.contract(abiArray).at(...


16

It'd probably go something like this: User wants to deposit a token to your exchange If it's the first time the user is depositing that token then this occurs: Generate a new wallet key/pair on the server side Encrypt the private key with a secret/salt only known by the server and store the encrypted private key and public address in your database, along ...


14

Vesting with a cliff is a typical requirement for founders holding shares of a company so they don't just leave the company when they are most needed with the shares they have. The same concept has been translated to ICOs so the founders (and key team members, advisors, etc) don't just dump their tokens as soon as they are listed on exchanges. Vesting ...


13

At a high level, the main parts of ERC20 specify: 1. how tokens can be transferred by its owner 2. how tokens can be transferred on behalf of an owner 3. how to get data about the token 4. events about the token The first specifies the obvious requirement that tokens must be transferrable, and what ERC20 defines is that you would tell the token contract ...


13

I think it has to ultimately be human verification, unless it exactly matches an existing contract that's already been verified by humans. Even if all the functions that are supposed to be in the standard are there and do what they're supposed to, you can't be sure that somebody hasn't done something unexpected in a different part of the code. It's probably ...


11

The default answer would be: No, you cannot use an account without Ether for anything related to the Fancycoin, as any interaction with a standard token requires a transaction which you need to sign and broadcast to the network and conversely pay for the transaction costs in Ether (at least for the time being you can only pay fees in Ether). The more ...


11

address(EOS) will return the address of the contract with variable name EOS. address(0) is the same as "0x0", an uninitialized address. The two get compared to assert that the code that follows will only be ran if the contract that points to the EOS token (so the reference saved in variable EOS) is not yet set. If it's initialized, it will point to ...


11

There could be any number of ERC20 contracts deployed with the name string variable "Golem Network Token." However, each one of these contracts has a unique Ethereum contract address. The ERC20 contract address deployed by Golem is 0xa74476443119A942dE498590Fe1f2454d7D4aC0d. If someone else deployed a clone contract it would have a different address and ...


11

I found many answers which were out of date or were missing important information. Here's what finally worked for me in my node.js project using web3 version 1.0.0-beta.26. Note that this is for Ethereum Main Net. To use the Robsten test net, change the chainId to 0x03 // Get private stuff from my .env file import {my_privkey, infura_api_key} from '../.env' ...


11

It wasn't just just "someone"... it was the contract creator who made the transaction, and there is a function called mintTokens which allows them to exactly do this. /** * Allows owner to create tokens without ETH */ function mintTokens(address _address, uint256 amount) public onlyOwner isUnderHardCap { if(disown == 1) revert(); if (amount + ...


10

If you are using Web3.js and your token is using the standard 1018 decimal, then you can also use web3.utils.toWei() and web3.utils.fromWei() to get to and from the big numbers you want pretty easy. In this situation you can try this: var amount = 1000 var tokens = web3.utils.toWei(amount.toString(), 'ether') "1000000000000000000000" You can then ...


9

The way I think about this is that the number of tokens is: tokenSupply = tokensIActuallyWant * (10 ^ decimals) If I want 1 token with the ability to subdivide it with a precision of 2 decimal places, I represent that as 100. Similarly if I want 1 token with the ability to subdivide that to 18 decimal places, I need to represent that as ...


9

Yes you are right there is a lot of standards but the majority of them are proposals and not standards that have been adopted. You can check all the Ethereum Improvement Proposals (EIPs). ERC-190 This ERC proposes a specification for Ethereum smart contract packages. Packaging is a core piece of modern software development which is missing from the ...


9

It's an "Abstract" a.k.a. "Interface" contract. It's used to define the interface, meaning the functions that exist, their exact names and inputs/outputs while being silent about how they work internally. The idea is to use inheritance to create a compliant implementation - a contract with the exact same functions implemented. You go about it like this....


9

Firstly, they're using an assert(), not a revert(). From the docs: The assert function should only be used to test for internal errors, And: Properly functioning code should never reach a failing assert statement; if this happens there is a bug in your contract which you should fix. See: Difference between require and assert and the difference ...


8

Etherscan's FAQ page answers your first question in the "Token Tracker Listings" section. Here is what it says: Any compatible ERC20 tokens on the Ethereum blockchain can be publicly and transparently tracked via https://etherscan.io/token-search In addition to the above ERC20 token tracker, we also have a selected list of tokens at https://...


8

Escrowing ERC20 tokens: Your escrow contract needs to know when it received new tokens, from whom, and how many. This is achieved by having the "seller" create two transactions: Approval: First transaction calls token contract // tracker_0x_address is the address of the ERC20 contract they want to deposit tokens from ( ContractA ) // spender is your ...


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).


7

The token standard doesn't require you to store balances in any particular structure - a public mapping is not part of the standard - so you can simply do this: struct Account { uint balance; uint dividends; } mapping(address=>Account) accounts; Assuming you give out dividends proportional to a user's token balances, though, updating the ...


7

Update Feb 21 2018 Note that while the sending of ETH and tokens works, you cannot change the parameters of the multisig (add owner, remove owner, change owner, change daily limit). See https://github.com/bokkypoobah/EthereumWalletMultisigTest for further information. The standard Ethereum Wallet / Mist multisig contract does support ERC20 tokens. Here ...


7

Everytime you make a transaction on ethereum you need to pay a fee to the miner of the block that will calculate the result of your smart contract. While this might change in the future, for the moment fees can only be paid in ether and therefore all users of your tokens need it. Tokens in accounts with a balance smaller than the fee are stuck until the ...


7

You can do this by creating a contract and having the contract interact with the various token contracts. One method would be to create your contract, then transfer ownership of your balance on each token to the contract. Untested example (for illustrative purposes only, don't use this as is): pragma solidity ^0.4.6; contract ERC20API { function ...


7

Almost all of the docs out there refer to the 0.20 branch of web3.js which is the current stable branch. The version with promises as above is the 1.0.0-beta branch, which as of a few days ago npm installs by default. As for sample code, the following code, almost identical to yours, is working correctly for me from the node console against my own ERC20 ...


7

If you want to receive ERC20 tokens onto a new contract along with data, you can create the new contract using ERC 223 token standard. Read here (Dont be confused about the nomenclature, its ERC223 and not ERC23) When you transfer the tokens, you can also send data in the function transfer(address to, uint value, bytes data) And since ERC223 is backward ...


7

You could add a function similar to this, either in a new contract, or by extending the token contract you are using. A contract implementing this might be: import "token/BasicToken.sol"; import "ownership/Ownable.sol"; // link to these contracts below contract ZonoToken is BasicToken { function deposit() payable { owner.transfer(msg....


7

We are still writing the ERC-721 standard. 721 is about deeds. 20 is about tokens. Here is some draft language in the specification that explains the difference "Deed" word choice The noun deed is defined in the Oxford Dictionary as: A legal document that is signed and delivered, especially one regarding the ownership of property or legal rights. This ...


6

start geth console $ geth --fast console in console : var gnosisAuctionABI = [{"inputs":[{"type":"address","name":""}],"constant":true,"name":"bids","payable":false,"outputs":[{"type":"uint256","name":""}],"type":"function"},{"inputs":[{"type":"address","name":"receiver"}],"constant":false,"name":"bid","payable":true,"outputs":[{"type":"uint256","name":"...


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