Question asked by tsudmi on GitHub: https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1444
I get a Error: Error: Returned error: VM Exception while processing transaction: revert when calling transfer from one contract to another.
Code to reproduce
Here is a reproducible example:
ContractA.sol:
pragma solidity 0.6.2;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
contract ContractA is Initializable {
address private admin;
function initialize(address _admin) public initializer {
admin = _admin;
}
receive() external payable { }
}
ContractB.sol:
pragma solidity 0.6.2;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "./ContractA.sol";
contract ContractB is Initializable {
ContractA private contractA;
function initialize(ContractA _contractA) public initializer {
contractA = _contractA;
}
function withdraw() external payable {
payable(address(contractA)).transfer(msg.value);
}
}
It will revert on withdraw function call of ContractB.
Environment
ganache-cli: 6.9.0
openzeppelin/cli: 2.7.0
openzeppelin/upgrades: 2.7.0