I have the following code:
function payout() public payable {
uint ordersLength = orders.length;
uint totalRaised = 0;
for (uint i = 0; i < ordersLength; i++) {
totalRaised += orders[i].amount;
emit Amount(orders[i].amount);
}
for (uint i = 0; i < ordersLength; i++) {
payable(orders[i].investor).transfer(msg.value * orders[i].amount / totalRaised);
emit onPayout(orders[i].investor, creator, orders[i].investorId, creationId, creatorId, block.timestamp,
msg.value * orders[i].amount / totalRaised);
}
}
But upon compiling the contract, I'm getting this error:
project:/contracts/Creation.sol:59:13: ParserError: Expected primary expression.
payable(orders[i].investor).transfer(msg.value * orders[i].amount / totalRaised);
^-----^
How to fix this?