We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

0

You can use getBalance method to get the balance of an address: web3.eth.getBalance(address [, defaultBlock] [, callback]) // Example web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1") .then(console.log); Once you have balance, use it in data to plot the line graph as shown here and here. Hope it will help.


1

Possible reason #1: balances[from] = balances[from].sub(tokens); This line would revert if balances[from] < tokens. Possible reason #2: allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); This line would revert if allowed[from][msg.sender] < tokens. In order to avoid that, you must first call approve(from,tokens). Possible ...


0

As can be seen in the transaction details (https://ropsten.etherscan.io/tx/0xe5014c30f16c8e4114c3d3e34317d2e5b78f7ab8fcf2ec9e658c50e354d5873a, click "click to see more") you are giving 21000 gas. This is the absolute minimum amount of gas to only send Ether to an address but it does not allow for any computations. As you are calling a contract which has a ...


0

What makes a coin to be a stablecoin is an ability to exchange it for certain amount of underlying stable asset (fiat currency in your case), and people's trust that this ability will persist in future. If your stablecoin is to be implemented as ERC-20 token on Ethereum, then the token smart contract does not need to have any special functionality. Just ...


0

A contract call is simply a regular transaction where the to address is the contract address and the data field contains the encoded method and parameters.


2

As you can read in the docs: Like test contract names, all test functions must start with test, lowercase. pragma solidity ^0.5.8; import "truffle/Assert.sol"; contract TestABC { function testTotalSupplyTest() public { bool a = true; bool b = true; Assert.equal(a, b, "message ABC"); } } Output: $ truffle test Using ...


0

For a simple token, depending on your requirements, you may not need it to be pausable or even potentially even mintable. Based on the SimpleToken example you could have something like the following where the total supply of tokens is minted to the deployer of the contract, with no functionality to mint additional tokens. As always, you should do ...


0

To answer the first part of your first question: Are all ERC-20 token transfers are listed with the "0xddf252..." sha3 hash, and would the below code suffice for accurately capturing those transfers? As far as I know, the ERC20 standard dictates the prototype of the transfer function, but it doesn't dictate the prototype of the Transfer event (or even ...


1

tl;dr: your line should read: basicToken.buyToken.value(10**17)(); Explanation: basicToken.buyToken.value(10**17); looks like you are calling the buyToken function, but it is not calling it. The .value thing is a function call modifier. So when you do buyToken.value(10**17), what you are asking is please modify my function call by passing value along with ...


1

name, symbol, and decimals are marked as OPTIONAL within the ERC20 Token Standard. Each of the examples you have referenced do not include them (or includes them differently from how they are specified in your abi). The High Performance Blockchain contract specifies the number of decimals as DECIMALS in all caps, rather than the expected decimals The Icon ...


1

As you are using OpenZeppelin contracts you should be quite safe from various exploits - unless you have such in your own code which utilizes OpenZeppelin. OpenZeppelin is well known, widely used and battle-tested. As for your questions: 1) The code is secure as you are just using OpenZeppelin's functionality and not doing anything strange/fancy yourself. ...


0

As suggested here, log out of your metamask, switch your network to localhost 8545 (this option is already available) and then sign in using your ganache's mnemonic.


0

Relative adoption is partly down to the fact that the other two are legacy systems that have been in the consciousness of the blockchain community a lot longer. Partly it could also be down to some projects not requiring the richer set of features that ERC-1155 offers. For a token standard that's only been confirmed since mid-June, ERC-1155 has some pretty ...


Top 50 recent answers are included