Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Format code, fix grammar & spelling
Source Link
Ismael
  • 30.3k
  • 23
  • 54
  • 97

recive Receive keyword in solidity

i am a beginner to solidity ,iI was making a smart contract in which iI wanted to send and receive ether code :-

contract coin_transfer_to { function() public payable { } function get_balance() public returns (uint) { returns address(this).balance; } }

contract coin_transfer_from{ coin_transfer_to private _instance; function coin_transfer_from () public { _instance = new coin_transfer_to(); }My code:

contract coin_transfer_to {
    function() public payable {
    }
    function get_balance() public returns (uint)
    {
        returns address(this).balance;
    }
}

contract coin_transfer_from{
    coin_transfer_to private _instance;
    function coin_transfer_from () public
    {
        _instance = new coin_transfer_to();
    }
    
    function get_balance() public returns (uint)
    {
        return address(this).balance;
    }
    
    function get_balance_of_instance() public returns (uint)
    {
       return _instance.get_balance();
    }
    
    function () public payable 
    {
        address(_instance).send(msg.value);
    }
}

}

andI got the following error in line 2 of above code which is function() public payable  :-  

error in line 2 of above code which is function() public payable{

recive keyword in solidity

i am a beginner to solidity ,i was making a smart contract in which i wanted to send and receive ether code :-

contract coin_transfer_to { function() public payable { } function get_balance() public returns (uint) { returns address(this).balance; } }

contract coin_transfer_from{ coin_transfer_to private _instance; function coin_transfer_from () public { _instance = new coin_transfer_to(); }

function get_balance() public returns (uint)
{
    return address(this).balance;
}

function get_balance_of_instance() public returns (uint)
{
   return _instance.get_balance();
}

function () public payable 
{
    address(_instance).send(msg.value);
}

}

and got the following error in line 2 of above code which is function() public payable  :- error in line 2 of above code which is function() public payable{

Receive keyword in solidity

I was making a smart contract in which I wanted to send and receive ether.

My code:

contract coin_transfer_to {
    function() public payable {
    }
    function get_balance() public returns (uint)
    {
        returns address(this).balance;
    }
}

contract coin_transfer_from{
    coin_transfer_to private _instance;
    function coin_transfer_from () public
    {
        _instance = new coin_transfer_to();
    }
    
    function get_balance() public returns (uint)
    {
        return address(this).balance;
    }
    
    function get_balance_of_instance() public returns (uint)
    {
       return _instance.get_balance();
    }
    
    function () public payable 
    {
        address(_instance).send(msg.value);
    }
}

I got the following error in line 2 of above code which is function() public payable: 

error in line 2 of above code which is function() public payable{

Source Link

recive keyword in solidity

i am a beginner to solidity ,i was making a smart contract in which i wanted to send and receive ether code :-

contract coin_transfer_to { function() public payable { } function get_balance() public returns (uint) { returns address(this).balance; } }

contract coin_transfer_from{ coin_transfer_to private _instance; function coin_transfer_from () public { _instance = new coin_transfer_to(); }

function get_balance() public returns (uint)
{
    return address(this).balance;
}

function get_balance_of_instance() public returns (uint)
{
   return _instance.get_balance();
}

function () public payable 
{
    address(_instance).send(msg.value);
}

}

and got the following error in line 2 of above code which is function() public payable :- error in line 2 of above code which is function() public payable{