{'fraction_non_alphanumeric': 0.02104854368932039, 'fraction_numerical': 0.004699029126213592, 'mean_word_length': 4.713556689593965, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Unihedge -- A decentralized market prediction platform

Unihedge is a decentralized platform for prediction markets with a novel approach. Using Harberger Tax (HTAX) economic policies a new type of prediction market, named HTAX prediction market, was build. HTAX prediction market derivates from Dynamic PariMutuel (DPM) type of prediction markets thus offering its users an unlimited liquidity for any preferred time horizon. It tries to solve some problems of DPM by introducing a new incentive mechanism to support early information incorporation and a protection against share readjustment for hedgers. In the paper also implementation of platform on Ethereum Virtual Machine (EVM) is presented with the usage of Decentralized Exchange (DEX) as an price discovery mechanism for prediction market resolutions.


Introduction
Traditional prediction markets have been centralized in a way where a trustworthy entity maintains a ledger to aggregate trades, similarly the outcome determination of an event and payouts distribution to traders is trusted to a centralized authority [1]. However, centralized prediction markets have many risks and limitations: they do not allow global participation, they limit what types of markets can be created or traded, and they require traders to trust the market operator not to steal funds and to resolve markets correctly [2]. Similar problems in traditional payment systems have led to the emergence of blockchain technology and cryptocurrencies (e.g. Bitcoin [3]). With a decentralized approach, blockchain technology eliminates the centralized intermediary of payments processing and hands over this task to the entire network. Further development of blockchain technology introduced an ability to append logic to transactions which resulted in creation of new type of programmable blockchains (Ethereum [4]) that were able to run computer programs or so called smart contracts in completely autonomous and trusted way.
Smart contracts have enabled the decentralization of traditional financial industry by offering decentralized applications for exchanges (Uniswap [5]), lending (Aave [6]), derivatives (Syntetix [7]), prediction markets (Augur [2], Gnosis [8], Polymarket [9]) and others all united under one ecosystem called DeFi (Decentralized Finance [10]). Example of successful usage of blockchain properties is project named Augur which is a decentralized platform for prediction markets. Augur contracts are totally automated and they hold and transfer users funds, resolve markets and perform other tasks defined by the smart contracts without involvement of developers or any other third parties.
In this paper we are focusing on prediction markets as a specific part of broader DeFi ecosystem where we present the Unihdge platform with a novel approach to prediction markets. In next section the analysis of existing prediction markets designs are presented, next a concept of HTAX prediction market is presented, flowed by an introduction of decentralized platform Unihedge which implements HTAX prediction market concept for the execution on the Ethereum Virtual Machine (EVM).

Prediction markets
Through the years a variety of financial and wagering mechanisms have been developed for all types of wagering (e.g. sports, horse racing, political events, world news) to support hedging (e.g. insuring) against exposure to uncertain events and speculative trading on uncertain events [11]. One of those mechanism are prediction markets, which are defined as markets that are run for the primary purpose of information aggregation where market prices forecast future events [12].
Prediction markets operate in a form of a market that offers its participants an opportunity to trade outcomes based on their expectations regarding the likelihood of future events.
Prediction markets operate using contracts, which transform a forecasting outcome into an agreement between participating parties. Contracts are being constructed via trading mechanisms that matches buyers and sellers. There are several trading mechanisms (Table 1) among which Continues Double Auction (CDA), Call Auctions (CA), Market Scoring Rules (MSR), parimutuel (PM) and dynamic parimutuel (DPM) are the most commonly used in the field of prediction markets [13].
• CDA is the most commonly used trading mechanism in prediction markets. Traders submit buy and sell orders that are placed on the order book and if matched the contract is made [14]. One of the main advantages of CDA is that this type of markets pose no risk for the market operator as contracts are made between buyers and sellers [15]. However, with few traders the markets may suffer from illiquidity. Orders can then not be matched and therefore the bid-ask spread can be huge and no contract can be created [16].
• CA participants place orders to buy or sell units at certain buying or selling prices for a predetermined point in time [14]. They use single price auctions that match the orders of buyers and sellers, and then, a single trading price is chosen that will maximize volume. CA are more liquid than CDA but limits flexibility for participants.
• MSR acts like a two-sided market maker that provides infinite liquidity for the sell and buy side of the market with a variable but bounded maximum loss that can be regarded as a subsidy for the market [16]. If traders improve the prediction by moving the prices into the right direction they can expect a positive payoff, otherwise they will lose money. New information is hence reflected immediately [13]. However these market makers are not typically used in real money prediction markets, since taking the opposite side of all trades could result in losses for the market operator.
• PM markets wagers goes into a central pool and is later divided among the winners [11]. This provides infinite liquidity for wager placement and circumvents the thin market problem of CDA. There is no need for a matching order from another trader. But one shortcoming of parimutuel markets is that there is no incentive to buy contracts early, especially not if new information is expected before the market closes.
• DPM trading mechanism is a hybrid between the CDA and PM trading mechanism. The DPM offers infinite buy-in liquidity and thus acts as a one-sided market maker always offering to sell at some price and moving the price according to demand. Prices are computed using a price function which can differ depending on the properties that are desired. The DPM also does not exhibit any risk of losses for the market operator due to its redistribution of money. Selling still has to occur through a CDA mechanism because there is no market maker accepting sell offers. First if they are using prediction market as a protection against price volatility of an underling asset. This type of participants, called hedgers, are wagering small amounts on rare unfavourable outcomes. For hedgers the participation in prediction market acts as an insurance, which means they are willing to pay relatively small premium for protection and get sufficiently compensated if unfavourable and rare event occurs. DPM trading mechanism incentivise early placements of wagers with a price function that readjust participants shares in the favour of early participants. Readjustment of shares can pose a risk for hedgers to get devalued to such a degree that their initial wager doesn't provide sufficient compensation.
The second situation in which early participants can be deterred from participation occurs if they obtain some relevant information about predicted event that will greatly change odds of outcomes. If a participant with this information places wager immediately it reveals it's position which attracts other participants and the readjustment of shares begins.
The incentive for the early information incorporation is thus dependent on the price function of DPM which can present a complex calculation.
DPM trading mechanism presents a complex solution for both market operator and participants. Market operator has a challenging task to properly set price function so the market will attract participants and participants have a challenging task to include share readjustment process in their payoff calculations. In this paper we present HTAX prediction market that with the usage of Harberger tax economic policies offers an alternative solution to DMP problems.

Concept
Harberger Tax (HTAX) prediction market concept implements HTAX policies in order to provide an environment for the users to trade on the future values of the underlying asset.

Harberger tax policy
In general HTAX is an economic policy that aims to strike a balance between pure private ownership and total commons ownership of assets in order to increase general welfare of society [17]. In this taxation system, asset owners self-assess the value of assets they own and pay a tax rate of on that value. Whatever value owners specify for the asset, they must immediately sell it to anyone at that price. HTAX works as follows: • Asset owners determines the value of their asset, and pay tax rate on that price. Tax is collected on yearly basis.
• Anyone at any time can acquire an asset at the owner's price, immediately taking ownership of the asset upon purchase. The new owner then sets a new price.
Asset owners are incentivized to set a low price to minimize the amount of taxes they have to pay. At the same time, owners are incentivized to set a price high enough to discourage others from buying it away too easily. This creates a balancing act for owners to price an asset at the value they are willing to pay to keep it [18].

Market design
Prediction markets have to be designed and implemented carefully in order to ensure that they are suitable for aggregating traders' information [19]. The key design elements comprise of specification of contracts, trading mechanism, and the incentives provided to ensure information revelation [15]. Implementation of HTAX policies into design of the prediction market follows same structure from contracts to trading mechanism and incentives.

Contracts
Prediction markets participants form binding agreements called contracts with each other that clearly defines agreement conditions and resolutions. HTAX prediction market introduces a standardised product called lot that is part of the contract and can be traded amongst participants.

Lot
Lot derives from the concept of virtual land L which is a two dimensional set with one dimension being time t and other being outcome domain of the observed event of the prediction market o d (example: future price of an asset) as defined in Equation 1.
Land is divided into smaller pieces called lots that can be traded between users. Lots are subjected to the HTAX policies that transforms them into assets. Lots are formed by discretization of virtual land in both dimensions. Time discretization (sampling) with fixed period (period) divides time dimension into equal parts called frames. Each frame is defined by start and end time as shown in Equation 2.
The discretization (quantization) of the event outcome domain divides it into discrete sets of outcomes with top and bottom limits as shown in Equation 3. ∆o represents granularity of quantization process.
Lot is defined as a container with four barriers, two of time and two of outcome as shown in Equation 4.
An example of lots is shown in Figure 1.  • Created: Contract c(t created ) is created at time t created and at same time the contract's outcome event is defined.
• Opened: Contract in opened state allows trading of the lots.
• Closed: Contract in closed state has ended trading at time t closed which means no lot can be resold.
• Matured: Contract is matured when predicted event occurs at time t matured where t matured > t closed . After maturation of the contract the reporting of the outcome of predicted event begins.
• Reported: Outcome is reported to the contract via arbitrary oracle system • Resolved: Resolvement of the contract determines winning lot and calculate shares of the reward for current and past owners of the winning lot.
• Settled: Contract in settled state has distributed winnings to the users.

Trading mechanism
Trading mechanism enables creation and modification of contracts. In HTAX prediction market each frame can hold one contract which means a contract can hold only lots that belongs to the same frame ({lot n,0 , n,1 , ..., lot n,m }). Trading mechanism enables two main contract process: lot trading and tax collection.

Lot trading
Lot trading is a process where lots change ownership. Lot can be purchased (change ownership) if the acquisition price, set by the current owner, is matched by another trader. When the lot is purchased the new owner sets new acquisition price for the lot. If lot has no owner the starting acquisition price of the lot is zero.

Tax collection
Tax collection is a process where each owner gets charged with a tax proportional to the acquisition price and duration of the ownership for the lot as shown in Equation 5.
Rate (rate) and (period) form a tax rate (example: 1%/year) to be collected from the owners of the lots. All tax collected per lot is collected in a pool (pool n ) and is equal to the sum of taxes collected from all owners (O) until contract is closed as shown in Equation 6. span i represents the duration of the ownership over lot by owner i, price i is set price for lot by owner i and n is the frame's number.

Incentives
Incentives represents incomes for the users of the platform. There are two type of incentives a direct incentives in the form of rewards and an indirect incentive in the form of lot trading.

Direct incentives
Direct incentives are rewards that are provided by the frame's pool. The amount for rewards in a pool is equal to the total tax collected according to Equation 6. Each frame has one winning lot to which whole pool is assigned. Lot has won if outcome value sits inside lot's outcome set 7.
The amount in a pool assigned to the winning lot belongs to the lot's current owner.

Indirect incentives
Indirect incentives represents an income opportunity for the users to gain on the future price movements of the lots (speculation). For example users can buy cheaper lots further in time where uncertainty for those lots to win is higher and later sell them when uncertainty is lower.

Concept summary
HTAX prediction market concept introduces a new type of property called lot which is a part of a virtual land that represents all future values of observed variable. The ownership of lots prevents share readjustment process of DPM as only way to acquire lot is to purchase it from the current owner which sets its selling conditions. This feature benefits the hedgers and participants with new information.
It benefits hedgers when a hedger purchase a lot with low probability of winning for low price. Their acquisition price should be set high enough that selling it would compensate their loss in the underling asset. In the case where the lot won't be sold and would won, the hedger benefits from the reward.
It benefits participants with new information when participant with a new information, sets price for the revelling information by setting acquisition price for the lot. This stimulates participants with new information to purchase the lot as soon as the information arrives and by doing so gain an advantage over other participants.
One more advantage of HTAX prediction market is that at the time of lot purchasing users knows minimum payoff amount that this purchase will generate. At the time of the lot purchase the current reward pool amount and tax that needs to be paid are known. From this information the buyer can calculate his minimum reward in case no one purchase his lot or sets the acquisition price that provides him some gain. This property offers additional simplification for participation in this type of prediction market.
To conclude, HTAX prediction market eliminates the risk for the market creator to correctly set a price function, relieves participants of complex calculation of their payoff, it prevents share readjustment process for the hedgers and incentivises early information incorporation.

Decentralized platform
Unihedge is a decentralized platform build as a fully decentralized application that can run on any EVM compatible blockchain. It implements HTAX prediction market concept in the form of smart contracts. In the forthcoming section the definition of the market parameters is presented, followed by description of market creation and operation processes.

HTAX prediction market
Implementation of HTAX prediction market as smart contract requires parameters that are listed in the table 2. integer tax that is charged to the owners of lots % market fee integer fee that is collected by the market operator % protocol fee integer fee that is collected by the the platform % accounting token is an ERC20 token that is used for lot trading, trading pair address represents a Decentralized Exchange (DEX) market that provides rate discovery for a pair of ERC20 tokens, granularity sets the outcome span of the lots based on definition of lot in section 2.2.1, initial timestamp sets debut time for market operations (before this time market is not operational), period sets the frames duration based on definition of the frame in section 2.2.1, reporting interval defines averaging window size for the calculation of outcome value as defined in section 3.3.3, tax defines tax rate that is collected from the owners of the lots, market fee and protocol fee is fee that is collected from the users.

Market creation
The creation of a new HTAX prediction market can be done by anyone. There is no limit to the number of markets that can be created nor any limits regarding market duplicates.

Market operation
Market operation consists of several sub processes: • automatic contract creation enables creation of contracts that are basis for trading lots, • trading lots which enables users to exchange lots ownership, • tax collection which is responsible to collect tax from lot owners, • reporting on rate which enables extraction of rate for token pair from the DEX, • resolvement which defines winners and losers and calculate rewards, • settlement which enables winners to collect the rewards.

Automatic contract creation
The process of automatic contract creation begins with a discretization of the asset's rate timeline with a period (period) (e.g. 24 hours, 7 days...) as is it shown in Figure 3.

Figure 3: Automatic contract creation
Discretization breaks the asset's rate timeline into frames f i each belonging to one contract c i (Equation 8).
The state of the contract is depended on the current time. Looking at Figure 3, the contract c n−1 is matured in current time, which means that predicted event has occurred and asset's rate can be extracted from the DEX. Contract c n−1 can now be in reported, resolved or settled state. Contract c n is in closed state because it is not yet matured and it does allow lot trading. Contract c n+1 and any other subsequent contracts c n+1+m are in open state allowing lot trading.
Process of automatic contract creation creates new contract when user wants to purchase lot within a valid frame where no lot has been previously bought. A valid frame represents any frame that starts at time greater than the current time (Equation 9).

Trading lots and tax collection
The prediction market module enables the exchange of lot ownership between users. When a user decides to purchase a lot, it selects a lot within a valid frame. If the lot has no owner, the acquisition price for it is zero, otherwise the user has to pay acquisition price set by the current owner. Tax collection process is responsible to collect tax from owners of lots. It is presented together with trading process as they are interconnected as show on diagram on Figure 4. Lot purchase starts with step 1. In this step the maximum tax is calculated as if the owner will own lot until close time of lot's frame as shown in Equation 10.
tax max is equal to the product of rate and duration between current time t and close time t close . In step 2 funds are transferred in custody to contract. Funds represents cost of purchasing lot that consists of maximum tax (tax max ) and acquisition amount (amount aqu ) for the current owner of the lot if there is one as shown in Equation 11 cost = tax max + amount aqu (11) Figure 4: Process of lot trading and tax collection Step 4 transfer ownership of lot to new owner if transfer of funds was successful and in other case lot purchase process is rejected. In step 5 tax for owning lot is calculated and charged to the previous owner as shown in Equation 12.
tax charged is equal to the product of rate and span of ownership that is defined as difference between current time t and time of lot acquisition t acquisition . Tax is deducted from the contract custody fund and transferred to frame's pool (Equation 6) where it will be distributed as rewards to owners of the winning lot. The previous owner is now allowed to withdraw the acquisition amount paid by the new owner of the lot and difference between tax max and tax charged . in step 7, after the close time of the frame all current owners of lots are charged with tax as no new acquisitions can be performed. Figure 5: Example of purchased lots

Reporting on rate
The rate rate reported that is reported for the resolution of the contract is equal to the average rate of token pair that spans from close time k n + period of the frame n to the close time of the frame reduced by reporting interval t rep as show on Figure 6. The reporting interval is set by the market creator at the creation of the market. The platform relies on the usage of DEXs as rate oracle to provide accurate rate feeds for the contract resolutions. It utilizes a special type of DEX that uses Automated Market Maker (AMM) as rate discovery mechanism with integrated oracle for obtaining average rates. Examples of this type of DEX are Uniswap [5] deployed on Ethereum network or Honeyswap [20] deployed on XDAI network. Reporting on rate is done via this integrated oracle system that enables calculation of time weighted average rates (TWAP) of a token pair. TWAP is constructed by obtaining two snapshots of cumulative rates, first cumulative rate rate cum 1 of a token pair at the beginning t 1 and second cumulative rate rate cum 2 at the end t 2 of the observed interval. The difference in cumulative rates can then be divided by the length of the interval (t 2 − t 1 ) to create a TWAP for that time span as shown in Equation 13.
Using TWAP to calculate rate rep requires to change t 1 timing with k n + period − t reporting and t 2 with k n + period as shown in Equation 14.
The rate reporting can't be executed internally by smart contract as smart contract can't execute transaction by themselves it must be executed externally by users [4]. Since rate reporting is done by users of the platform the exact timing for rate reporting can't be guaranteed. A solution to this problem is a process that mitigate the exact timing and offers time windows for reporting on rate. The reporting process offers two windows one for each snapshot of oracle's cumulative rate. First window w n1 spans from k n to k n + period − t rep and second window w n2 spans from k n + period − t rep to k n + period. If user triggers reporting event at time that corresponds to any of the windows the snapshot values are stored by the platform for calculation of rate rep . In case of multiple reporting events the platform override old snapshot with new one. This process guarantees that average rate will take into account t rep interval as shown on Figure  7. Example on Figure 7 shows that TWAT was calculated from snapshot 3 and 5 as they were the last snapshots taken for each window. Users can trigger rate reporting event in two ways: • indirectly, with the purchase of a lot that belongs to some other frame in the future • directly, by invoking platforms function. This is an additional option that allows the user to trigger reporting event without trading process. Direct way of triggering reporting process is facilitated by the users which expect to win.

Resolvement
In the resolvement phase the owner of the winning lot is set and the reward is calculated as the amount collected in a pool (pool n ) minus fee as shown in Equation 15.
If an unsuspected event occur and this calculation is not possible, the contract goes into invalid state which means the funds will be returned to the users except the collected fees. Invalid state can occur if: • no lot was purchased from specific contract • there is no winning lot • an error has occurred in reporting process

Settlement
Once the resolvement process is completed, the winner can withdraw the reward by executing a settlement process. The reward funds of the user remains locked on the contract until a withdrawal is performed by the user. Also at this stage, users can withdraw funds from contract that are in invalid state.

Conclusion
We presented a decentralized platform named Unighedge with it's novel approach to prediction markets. Using HTAX economic policies a new type of prediction marketg, named HTAX prediction market, was built. HTAX prediction market offers: • an unlimited trading with infinite buy-in liquidity and for any preferred time horizon, • a novel incentive mechanism to support early information incorporation, • a protection against share readjustment for hedgers, • relieves market creators of complex setting of price function, • relieves participants of complex calculation of their payoff.