I'm trying to send some Ether between contracts but I'm getting this error:
The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
My contract:
contract test {
address public owner;
address payable public receiverContract;
constructor(address payable _receiverContract) payable{
receiverContract = _receiverContract;
owner = msg.sender;
}
function sendEther() public payable {
receiverContract.transfer(msg.value);
}
receive() external payable {
}
}
The receiver contract also has a receive() external payable
function and I'm getting the error when calling sendEther()
with some Ethers and after seeding the test contract with some Ethers