Hi everyone, I’m a beginner solidity developer. While working on a project that sends eth to multiple addresses I’ve got an error and I need your feedback, help.
multi-send.sol:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract MultiSend {
function sendSameAmountTo(uint _amount, address[] memory _addresses) public payable {
for (uint i = 0; i < _addresses.length; i++) {
payable(_addresses[i]).transfer(_amount);
}
}
}
I can deploy the contract but after giving parameters to “sendSameAmountTo()” function, I get an 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.
status false Transaction mined but execution failed
Thanks in advance. Have a nice day, stay safe and take care.