Hot answers tagged

2

The target contract is a non standard ERC20 token. It should have three topics, two indexed parameters and the event id and the transfer value in the data field. But it has four topics instead. "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x000000000000000000000000c5ec6937d3278311e2ace517df214717310c0820", "...


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.


1

...0 gas, 0 ether but plenty of tokens transferred Just to be clear, the transaction required 47,435 gas. (gas is a measure of work done by the EVM - you can't have a 0 gas transaction.) ... but still the person who send this had spent total 0$ in fees, correct? Correct. They just submitted a transaction with gas price set to 0, which is fine. Now I ...


1

There are only two possibilities: a) Your contract deployment reverts, spending all gas b) Your deployment is too complicated (does it have a for loop?) To debug this, keep deleting code from your contract until the deployment works. Then add code back until it works. Continue this process exhaustively until you identify the line of code causing the ...


1

The error states that either the deployment is always failing or it exceeds the gas limit. You may want to try deploying to ganache-cli local testnet as I suspect that your deployment is failing on a revert and you will want to see the reason message. Alternatively you could share your smart contract code. I deployed the following sample ERC721 using ...


1

The constructor doesn't take a name. Change your code to: constructor (ChampTokenSale _tokenContract, uint256 _tokenPrice) public { admin = msg.sender; tokenContract = _tokenContract; tokenPrice = _tokenPrice; } (See "Creating Contracts" in the docs.)


1

You misunderstood the flow. You have User => Escrow.deposit() 1. Escrow => token.approve(this, amount) 2. Escrow => token.transferFrom(msg.sender, amount); // msg.sender did not approve this That won't work for the same reason I (for example) can't approve myself to withdraw your funds and then do it. It has to go: User => token....


1

No, this is not a cryptocurrency exchange, it's a website where people ask and answer questions about Ethereum.


1

To deploy and to interact with a smart contract on the Ethereum mainnet you will need Ether to pay the transaction fees. You can develop on a local testnet (e.g. ganache-cli) and/or public testnets: Ropsten, Rinkeby, Kovan, Goerli. For public testnets there are faucets which will give you testnet Ether to use. There are also mobile wallets that will connect ...


1

First, it can be difficult to achieve one-to-one product-token mapping as ERC20 is standard for non-unique tokens. Have you tried ERC-721 standard? http://erc721.org/ But if you want to stick to ERC20, I guess you want something like this (sorry if there are some minor typos, I typed it in the website's text box) Token.sol ... //place to store privileged ...


1

If you arrived here looking for a way to print the events emitted during your tests, you can do this with the --show-events flag: truffle test --show-events


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