When I am trying to call ERC20 token transfer function from another contract (contract to contract call) in ethereum private blockchain network is not working, but if I try to call directly from js it's working.
Below I have shown the contract and js call.
ERC20.sol
function transfer(address sender, address receiver, uint256 numTokens) public returns (bool)
{
require(numTokens <= balances[admin]);
balances[admin] = balances[admin].sub(numTokens);
balances[receiver] = balances[receiver].add(numTokens);
emit Transfer(admin, receiver, numTokens);
return true;
}
ABcontract.sol
function tokentransfer(address sender, address receiver) public returns (bool) {
ERC20Basic instance = ERC20Basic(erc20address);
instance.transfer(sender,account,1000);
return true;
}
app.js
tokentransfer:function(){
ABcontract.deployed().then(function(instance){
instance.tokentransfer(sender,receiver,{from:sender,gas:4600000});
})
},
Sender have 1000 tokens by using ERC20 createtoken function.
Truffle v4.1.15 (core: 4.1.15)
Solidity v0.4.25 (solc-js)
node v10.19.0
Network : Private blockchain (Note:It's working in testrpc)
Help will be appreciated.