Architecture of Betex Smart Contracts

Betex
2 min readJan 16, 2018

--

Main purpose of smart contracts is ensuring a transparent betting mechanism for the common pool of liquidity. Smart contracts were built under the following restrictions:

  • The bet occurs by the means of transferring the SBT token into a common liquidity pool for a given event in the system;
  • The network commission (Ethereum) should be as small as possible;
  • Reward payout (including the transfer of the commission) is realized by a smart contract based on the data received from the oracle.

The architectural system is based on the following smart contracts:

  • SBT token contract complies with ERC-20 standard. SBT is a stable (relatively to the USD rate) token, the exchange rate of which is artificially maintained, with emissions and burning made during the exchange operations.
  • Exchange contract is a smart contract for automatic exchange of ETH to SBT and vice versa. ETH/SBT rate is regularly updated with an oracle and artificially maintained at 1:1 / USD level. When crediting ETH, the required amount of SBT is being emitted. When withdrawing ETH, corresponding amount of SBT tokens is being burned.
  • It is also planned to implement time restrictions on the token use. If the token is not used in the Betex system for a certain period of time, it is automatically exchanged back to the ETH source address. This may prevent speculations with tokens.
  • Betex smart contract is a management system for liquidity pools (betting baskets). It accepts bids by moving SBT token to a specific pool (basket) for a limited period of time. After the waiting time has expired, the payout is redistributed among the players based on the oracle data.
  • Commission smart contract is the contract-aggregator of commission fees. It charges the entire commission from operations in the system. The distribution of the commission is made by this contract once in a certain period of time (currently, once in 24 hours).
  • Referral smart contract is contract managing the referral program. Betex supports a single-level referral program and redistributes part of the commission to the referral addresses. This smart contract stores the necessary dependencies.

The implementation of smart contracts is carried out considering all modern practices and approaches, including the overflow checks, 100% test coverage and statistical control of Gas used.

--

--