I'm trying to develop a smart contract which collect fees from other contracts.

I tried to do:

function sendFees() public {
    address payable feeCollector = payable(feeCollector addredd);

ad then I call the function like this:


But in ganache I didn’t see any balance change in feeCollector contract. In feeCollector contract there is this function:

receive() external payable {}

which, in theory, should receive all fees sent. I’m stuck and I can’t code anything else. Please help me.

2 Answers 2


There is nothing wrong with your code as long as "feeCollector addredd" is replaced with the proper address. Maybe take another look at your setup?

  • You're right, Ganache has deployed the contract with feeCollector address 0x000... Thank you very much!
    – Bombo
    Commented Feb 20, 2022 at 10:35

Using transfer to send funds is discouraged and might cause problems in your case as the target is a smart contract (see https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/).

Additionally it might be helpful if you share any errors that appear in the console (e.g. in the transaction receipts)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.