Hot answers tagged

4

The output you receive is in hex format. You need to conver hex to an int. Here is the full code you need to use: const contractInstance = web3.eth.contract(contractAbi).at(contractAddress); const total_supply = parseInt(contractInstance.totalSupply.getData()); console.log(total_supply); I added parseInt() to convert your hex number into a human readable ...


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

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

An ERC20 contract must exactly implement the specification described here: https://eips.ethereum.org/EIPS/eip-20. This makes the critical behavior predictable so it will be compatible with wallets and exchanges. A contract may implement additional behaviour provided it doesn't interfere with the minimum functionality. It's worth noting that exchanges and ...


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.


2

This topic is kindof interesting. There are a few things you can do: Report the token on etherscan: In my opinion this is probably the most effective thing you can do. Go to etherscan.io/dapp/0xScamTokenAddress On the bottom of the left sidebar you will find a "Report Button". Write a blog post: If you don't have a blog this solution is probably not the ...


2

In web3.js v0.x: The expression contractInstance.totalSupply.getData() would get you the encoded ABI data (byte-code) of a call to function totalSupply. In order to actually call the function and retrieve the return-value asynchronously, you should use: contractInstance.totalSupply.call().then(total_supply => { console.log(total_supply); }); In ...


2

You need to send the tokens at least once first. Otherwise this will not work. Etherscan only recognises a contract as an token after its first Transfer event. After sending the tokens once it should work perfectly!


2

pragma solidity ^0.5.0; //import ERC20 functionality ... contract Example { ERC20 public token; //@param _token the address of the DAI smart contract constructor(ERC20 _token) public { token = ERC20(_token); } function () external payable {} ...


2

For 1 you may use web3.eth.getCode(address) function of Web3 API. For contract addresses it returns contract byte code, while for non-contract addresses it returns something like "0x". For 3 it depends on what "public" means for you. If you mean whether smart contract has verified source code published at Etherscan.io, then you may use either API call to ...


2

It is unclear what layer you want to find out this information on (on-chain or off-chain). In general: Is an address a smart contract? This can be checked by seeing if there is associated code at the address. Is this smart contract ERC20 or ERC721 token? Off-chain, you can check this by observing the contract on Etherscan. There are also interfaces ...


2

Simply put, the answer is no - there is no standard way to do this, as how tokens are created isn't defined in ERC20. Additionally, you can't easily find out the holders of tokens directly from the blockchain, as the way storage data is encoded means that, even if you're looking at the raw data, you'll only be seeing the hashes of the token holder's ...


2

Decentralized Finance (DeFi) is the movement that leverages decentralized networks to transform old financial products into trustless and transparent protocols that run without intermediaries. Some may prefer to call DeFi as Open Finance, Distributed Finance, or EthFi(referring to the fact that at the moment most of existing DeFi products built on Ethereum....


1

As noted by Richard: Roadmap says "2020 Q2 - Egretia Public Chain 1.0 Release". (egretia.io) This means that its own blockchain will be launched then and its own coin released. This does not, however, say anything about when the token will be migrated into the new blockchain. But it's quite probable that the migration happens immediately when the new ...


1

Report scam domains and addresses to https://cryptoscamdb.org/ If a scam is impersonating another project, let that project know.


1

If it's an ERC20 compliant token, then you cannot freeze the holdings of another token holder.To be able to freeze the holdings of another token holder, then you would have to implement custom freezing/pausing functionality to the token before deploying to the main net.


1

Since you are working on Truffle v4, try these commands in an empty folder: npm init -y truffle init You can use truffle init --force as well. Check out this Truffle docs for this. You might want to upgrade Truffle to v5 since v5 allows you to run truffle init in a non-empty folder as well.


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