Skip to main content
Mod Moved Comments To Chat
added 770 characters in body
Source Link

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

contract TRC20{
     event Approval(address indexed _owner, address indexed _spender, uint256 value);
     
     function approve(address _sender, address _spender, uint256 _value) public returns (bool success){
         allowance[_sender][_spender] = _value;
         emit Approval(_sender, _spender, _value);
         return true;
     
     }
     function transferFrom(address _from, address _to, uint256 _value) public returns(bool success){
     
         require(_value<= allowance[_from][msg.sender]);
         _transfer(_from, _to, _value);
         return true;
 }
    function _transfer(address _from, address _to, uint _value) internal{
     
       //require(_to!=0x0);
       require(balanceOf[_from]>=_value);
       require(balanceOf[_to] + _value>=balanceOf[_to]);
       uint previousBalances = balanceOf[_from] + balanceOf[_to];
     
       balanceOf[_from] -= _value;
       balanceOf[_to] +=_value;
       emit Transfer(_from, _to, _value);
       assert(balanceOf[_from]+balanceOf[_to]==previousBalances);

}




function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

contract TRC20{
     event Approval(address indexed _owner, address indexed _spender, uint256 value);
     
     function approve(address _sender, address _spender, uint256 _value) public returns (bool success){
         allowance[_sender][_spender] = _value;
         emit Approval(_sender, _spender, _value);
         return true;
     
     }
}




function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

contract TRC20{
     event Approval(address indexed _owner, address indexed _spender, uint256 value);
     
     function approve(address _sender, address _spender, uint256 _value) public returns (bool success){
         allowance[_sender][_spender] = _value;
         emit Approval(_sender, _spender, _value);
         return true;
     
     }
     function transferFrom(address _from, address _to, uint256 _value) public returns(bool success){
     
         require(_value<= allowance[_from][msg.sender]);
         _transfer(_from, _to, _value);
         return true;
 }
    function _transfer(address _from, address _to, uint _value) internal{
     
       //require(_to!=0x0);
       require(balanceOf[_from]>=_value);
       require(balanceOf[_to] + _value>=balanceOf[_to]);
       uint previousBalances = balanceOf[_from] + balanceOf[_to];
     
       balanceOf[_from] -= _value;
       balanceOf[_to] +=_value;
       emit Transfer(_from, _to, _value);
       assert(balanceOf[_from]+balanceOf[_to]==previousBalances);

}




function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }
added 402 characters in body
Source Link

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

contract TRC20{
     event Approval(address indexed _owner, address indexed _spender, uint256 value);
     
     function approve(address _sender, address _spender, uint256 _value) public returns (bool success){
         allowance[_sender][_spender] = _value;
         emit Approval(_sender, _spender, _value);
         return true;
     
     }
}




function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

contract TRC20{
     event Approval(address indexed _owner, address indexed _spender, uint256 value);
     
     function approve(address _sender, address _spender, uint256 _value) public returns (bool success){
         allowance[_sender][_spender] = _value;
         emit Approval(_sender, _spender, _value);
         return true;
     
     }
}




function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }
added 47 characters in body
Source Link

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. i use ropsten test

function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }

When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price it is element of struct, type uint. walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price. i use ropsten test

function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }
added 47 characters in body
Source Link
Loading
added 47 characters in body
Source Link
Loading
added 47 characters in body
Source Link
Loading
added 53 characters in body
Source Link
Loading
deleted 194 characters in body
Source Link
Loading
Source Link
Loading