😏House Loses

This section specifies the steps to understand the complete life cycle of a bet. Please follow the below steps to wager and bet settlement. This includes the following steps:

  • Query the initial state of the system

  • Add a market

  • Wager on the market

  • Resolve the market

  • Settle the bet

Pre-requisites

The pre-requisites are:

  1. Start the blockchain.

  2. Add tokens to the accounts for doing the transactions.

Query the Initial State of the system

The result of the below queries can be matched with the below state table of this section.

  1. Query the OVM public keys

    • Command: sged q ovm pubkeys

    • Expectation- At least three public keys should be present

  2. Query the balance of the Bettor (Please ensure to change the bettor address to your specific address)

    • sged q bank balances <address of the bettor>

  3. Query the list of markets

    • sged q market markets

  4. Query the list of bets

    • sged q bet bets

Add a market

  1. Payload: The payload for adding a market is as follows: A JWT ticket should be created out of this payload for providing it in the transaction below. The timestamps need to be updated accordingly.

    {
     "uid": "5531c60f-2025-48ce-ae79-1dc110f16001",
     "start_ts": 1668407501,
     "end_ts": 1668407601,
     "odds": [
       { uid: "9991c60f-2025-48ce-ae79-1dc110f16990", value: "1.2"},
       { uid: "9991c60f-2025-48ce-ae79-1dc110f16991", value: "1.3"},
       { uid: "9991c60f-2025-48ce-ae79-1dc110f16992", value: "1.5"},
     ],
     "status": 1,
     "meta": "sample market",
     "iat": 1668407501,
     "exp": 1668407601
    }
  2. Transaction: The transaction for adding a market is as follows: sged tx market add [ticket] --chain-id sge --from oracle

  3. Verification: The above success or failure of the above transaction can be verified using the query below. Query the transaction hash: sged q tx [tx-hash]

  4. Payload: The payload for participation in a market is as follows:

     "uid": "5531c60f-2025-48ce-ae79-1dc110f16001",
     "kyc_data": {
       "ignore": false,
       "approved": true,
       "id": "sge1uffpdv3lg4v3gdwlt6pp0ty3fr7fyyau59hzmd"
     },
     "depositor_address": "sge1uffpdv3lg4v3gdwlt6pp0ty3fr7fyyau59hzmd",
     "iat": 1668407501,
     "exp": 1668407601
    }
  5. Transaction: To participate in a market, a Deposit command is needed sged tx house deposit "5531c60f-2025-48ce-ae79-1dc110f16001" 1000000usge [ticket] --chain-id sge --from deposior

  6. Verification: The above success or failure of the above transaction can be verified using the query below. Query the transaction hash: sged q tx [tx-hash]

Wager

  1. Payload: The payload for placing a bet is as follows: Please ensure to change the kyc_id with your bettor address, and update the timestamps. A JWT ticket should be created out of this payload for providing it in the transaction below.

    {
     "selected_odds": {
       "uid": "9991c60f-2025-48ce-ae79-1dc110f16990",
       "market_uid": "5531c60f-2025-48ce-ae79-1dc110f16001",
       "value": "3.0",
       "max_loss_multiplier": "1"
     },
     "kyc_data": {
       "ignore": false,
       "approved": true,
       "id": "sge1uffpdv3lg4v3gdwlt6pp0ty3fr7fyyau59hzmd"
     },
     "exp": 1668407601,
     "iat": 1668407501,
     "iss": "Oracle",
     "sub": "Wager"
    }
  2. Transaction: The transaction for placing a bet is as follows: sged tx bet wager [uid] [amount] [ticket] --chain-id [chain-id] --from [signer-account-key] Example: sged tx bet wager 6631c60f-2025-48ce-ae79-1dc110f16123 1000000000 [ticket] --chain-id sge --from bettor

  3. Verification: The above success or failure of the above transaction can be verified using the queries and the state table below.

    1. Query the transaction hash: sged q tx [tx-hash] Expectation: Code is 0

    2. Query the list of bets saaged q bet bets Expectation: At least one wager is needed.

    3. Query the balance of the bettor saaged q bank balances sge1uffpdv3lg4v3gdwlt6pp0ty3fr7fyyau59hzmd

Resolve the market

  1. Payload: The payload for resolving the above market is as follows: A JWT ticket should be created out of this payload for providing it in the transaction below. The timestamps need to be updated accordingly.

    { 
     "uid": "5531c60f-2025-48ce-ae79-1dc110f16001",
      "resolution_ts": 1867270827,
      "winner_odds_uids": [
        "9991c60f-2025-48ce-ae79-1dc110f16990"
      ],
      "status": 4,
      "iat": 1668407501,
      "exp": 1668407601
    }
  2. Transaction: The transaction for resolving a market is as follows: sged tx market resolve [ticket] --chain-id [chain-id] --from [signer-account-key] Example: sged tx market resolve [ticket] --chain-id sge --from oracle

  3. Verification: The above success or failure of the above transaction can be verified using the query below.

    1. Query the transaction hash: sged q tx [tx-hash]

Conclusion:

The bettor has been rewarded with the payout from the house.

Last updated