I'am trying to send ERC20 from 1 address to another but i'am getting that error :
Blockquote Contract 0x557e4cca38277b9bf9f1f1bf333dfe4b0ac5541a Warning! Error encountered during contract execution [Bad jump destination] ERC-20 Token Transfer Error (Unable to locate Corresponding Transfer Event Logs), Check with Sender. Blockquote
Here my code, can you help me to find the issue please ?
var address = req.body.address;
var contractAddress = "0x557e4cca38277b9bf9f1f1bf333dfe4b0ac5541a"
var fromAddress = myaddress
var privateKey = privatekey
var toAddress = req.body.address
var transferAmount = 1;
// Create an async function so I can use the "await" keyword to wait for things to finish
const main = async () => {
// This code was written and tested using web3 version 1.0.0-beta.26
console.log(`web3 version: ${web3.version}`)
// Determine the nonce
var count = await web3.eth.getTransactionCount(fromAddress);
console.log(`num transactions so far: ${count}`);
// This file is just JSON stolen from the contract page on etherscan.io under "Contract ABI"
var abiArray = JSON.parse(fs.readFileSync(path.resolve(__dirname, './tt3.json'), 'utf-8'));
// This is the address of the contract which created the ERC20 token
var contract = new web3.eth.Contract(abiArray, contractAddress, { from: fromAddress });
//var contract = new web3.eth.Contract(abiArray, contractAddress, { from: myAddress });
// How many tokens do I have before sending?
var balance = await contract.methods.balanceOf(fromAddress).call();
console.log(`Balance before send: ${balance}`);
// I chose gas price and gas limit based on what ethereum wallet was recommending for a similar transaction. You may need to change the gas price!
var rawTransaction = {
"from": fromAddress,
"nonce": "0x" + count.toString(16),
"gasPrice": 2000000000,
"gasLimit": 300000,
"to": contractAddress,
"value": transferAmount,
"data": contract.methods.transfer(toAddress, transferAmount).encodeABI(),
"chainId": web3.eth.net.getId()
};
// Example private key (do not use): 'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109'
// The private key must be for myAddress
var privKey = new Buffer(privateKey, 'hex');
var tx = new Tx(rawTransaction);
tx.sign(privKey);
var serializedTx = tx.serialize();
// Comment out these three lines if you don't really want to send the TX right now
console.log(`Attempting to send signed tx: ${serializedTx.toString('hex')}`);
var receipt = await web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'));
console.log(`Receipt info: ${JSON.stringify(receipt, null, '\t')}`);
// The balance may not be updated yet, but let's check
balance = await contract.methods.balanceOf(fromAddress).call();
console.log(`Balance after send: ${balance}`);
}
main();
0x55
) which obviously no contract is deployed at, and you're surprised to get a "bad jump" error?var contractAddress = "0x55"
???