I'm new to this entire space, so please bear with me.
I'm trying to create a betting app. I want people to sign the contract and say they'll put up some money that they'll either win or lose depending on the outcome of some event.
Lets say I want them to put up money by 8 AM, then all funds are locked in for that betting pool.
Then the event might have an outcome from any time between 8 AM and say 3 PM, but I want the bet to be settled whenever the outcome is decided within that window. Ex: if it ends at 11, settle at 11. If it ends at 2, settle at 2.
The only way I can retrieve the outcome of the event is by doing an API call. The API will look at this specific event, and it returns "undecided" if the event is ongoing but not over. Only once the event is over will it return either "success" or "fail".
Would I have to just periodically check this with an oracle to settle this bet? That seems like a waste of money since there's fees on these oracle calls. Ideally I'd want to have some intermediary script calling the API on my app's end without any blockchain involved, then once it notices that the event has been decided, it can try to settle the bet between the two parties and use an oracle to verify the result (that would be just one API call).
Intuitively my idea on how to do this is to just use myself (the application) as the intermediary in these bets. Put my app's "intermediary" address in the pool along with all other people who actually want to bet. Have some external function/file somewhere else constantly checking the API for the outcome of the event to be either success or fail, and once it has been decided, tell my app's intermediary address to call the settle() function for the bet - paying the oracle fee and paying out the right people based on the result of the API call.
To do this, I'd need to call a .sol function or contract function from an external file - is this possible?
I'll take any ideas, thank you for the help.