1

From the Solidity documentation: A contract can have at most one fallback function, declared using fallback () external [payable] (without the function keyword). This function cannot have arguments, cannot return anything and must have external visibility. It is executed on a call to the contract if none of the other functions match the given function ...


1

Since you are passing value > 0 in: contract.methods.main(amount, guess).send({value: amountWei, ...}, ...) You need to declare function main as payable.


1

It's not easy to conjure up a trivial example. Based on the comments, I think the main concerns are approximately: Clean up expired information responsibly and capture the gas refund offered for releasing unneeded storage. Avoid iteration. https://blog.b9lab.com/getting-loopy-with-solidity-1d51794622ad Access information in O(1), by user, by epoch, globally ...


Only top voted, non community-wiki answers of a minimum length are eligible