The main logic of the House module definitions and methods.
There are several steps for subaccount create to be made:
Check for existing subaccount.
Generate a new ID.
Create a new account extracted from the generated ID.
Set the new account into the account keeper.
Store the owner, locked balances, and account summary in the state.
There are several steps for a subaccount top-up to be made:
Get account summary and locked balances from the state.
Update the account Summary and locked balances.
Send tokens from the transaction signer to the subaccount balance in the bank module.
There are several steps for a subaccount withdrawal to be made:
Get the account summary from the state.
Calculate the withdrawable balance according to the unlock timestamps and spend and lost amounts.
Update the account summary withdrawn amount.
Send tokens from the subaccount to the owner's balance.
There are several steps for a wager by a subaccount to be made:
Check the existence of the subaccount for the bettor.
Verify the ticket and unmarshal the payload and validate.
Use bet module's methods to prepare a bet object.
Withdraw the needed amount first from the unlocked, then the locked if there is not enough unlocked balance.
Use bet module to place the bet for the owner's account.