Hi Dani
Thank you for your reply. I’m trying to do as you suggested. But I get an error when trying to deposit into a contract address (there’s is enough ether on the sending account).
Multisigwallet contract:
function addDeposit(address payable _from, uint _amount) external payable {
depositLog.push(Deposit(_from, _amount, depositLog.length));
}
function getWalletAddress() external view returns (address payable) {
address convertContractAddress = address(this);
address payable payableWalletAddress = address(uint160(convertContractAddress));
return payableWalletAddress;
}
From exchange contract:
interface MultiSigWalletInterface{
function addDeposit(address payable _from, uint _amount) external payable;
function getWalletAddress() external returns (address);
}
contract Exchange {
MultiSigWalletInterface multisigWalletInstance = MultiSigWalletInterface(0xb3502940731B7a65F9bbDB73369c7729c8197665);
address payable walletAddress;
constructor() {
walletAddress = address(uint160(multisigWalletInstance.getWalletAddress()));
}
mapping(address => uint) balances;
function depositToWallet() payable external {
walletAddress.transfer(msg.value);
multisigWalletInstance.addDeposit(msg.sender, msg.value);
}
Could you please tell me why that is? The error occurs when calling depositToWallet():
walletAddress.transfer(msg.value); ---- at this line.
Edit, I know I am converting address(this) to payable twice. But it shouldn’t make a difference.
Edit 2, set payable to function getWalletAddress() external returns (address payable);
Did not help though.