Auto-exercise bot

When a bet's period ends and it should be resolved in the taker's favor, it needs to be exercised. Exercising is done by calling the bet's smart contract. It is only possible during the exercise window - a short timeframe at the end of the period. If a bet is not exercised, it is always resolved in favor of the issuer. That is why it is crucial that bets are exercised reliably and in a timely manner. To make sure they are, we built the auto-exercise bot, a program that continuously monitors the Ethereum network for exercisable bets and performs exercise transactions when needed.

The auto-exercise bot is Logium's proprietary software and its source code is not publicly available. However, this page outlines how it works to help advanced users better understand the platform.

Relevant Web3 Events

The auto-exercise bot listens to 2 classes of events to get the information it needs:

  • Uniswap v3 swap events - provides information about asset price, which is needed to decide whether a bet is eligible to be exercised;

  • Logium contracts' events:

    • LogiumCoreContracts.BetEmitted events, which signal that a ticket was taken and a new bet was created;

    • LogiumBinaryBet.Exercise events, which signal that a bet was exercised;

Auto-exercise eligibility

In order to make the system resilient to attackers impersonating UniswapV3 pools, the auto-exercise bot only exercises bets made on pre-approved pools, which our team has verified. The bot will not exercise any bets made on pools outside this collection.

All tickets and bets available through our website and API are eligible for being auto-exercised. Tickets created and taken manually, bypassing our API, might not be exercised.


Once the bot recognizes an opportunity for exercising, it calls theLogiumBinaryBet.exercise method. To make sure the transaction goes through, it waits for a specified amount of time and retries if aLogiumBinaryBet.Exercise event was not emitted.

Redundancy and reliability

The auto-exercise bot is a critical component of Logium. It has been designed and implemented with reliability in mind.

Reliability measures:

  • Multiple Auto Exercise Bot instances are running at any given time;

  • We rely on multiple Web3 providers so the bot is not strictly dependent on other systems' availability;

  • Multiple transaction delivery instances:

    • A transaction delivery instance is Logium’s distributed transaction execution engine that coordinates the bot's transactions requests;

    • Bot instances delegate transaction execution to a transaction delivery instance;

    • This way, multiple bot instances do not generate unnecessary duplicate transactions (e.g. trying to exercise a single bet multiple times).

Last updated