💻For Developers

Orders execution

The order execution bot is public for anyone that wants to run it and earn rewards (binary options execution bot will soon be available).

https://github.com/Tigris-Trade/jsbot

To run it, you need to create a .env file and type in the variables as shown in .env.example. You will need MATIC/ETH to pay for gas fees. For more info and help on how to run the bot check out the #bot-runners channel in our Discord server. An execution bot can also be coded by anyone to earn rewards for executing specific orders for traders.

executeLimitOrder() will reward you with 0.01% of the position size. limitClose() will reward you with 0.01% of the position size. liquidatePosition() will reward you with 0.01% of the position size.

There is a maximum gas price variable to "randomize" which bot gets an order execution and thus prevent gas wars from happening.

None of these functions require a callback, because the inputs contain PriceData and oracle signatures. To get valid price data, the bots need to connect to a Tigris oracle node.

Tigris Is Built To Be Built Upon

Tigris contracts support meta transactions, allowing off-chain apps to relay transactions on behalf of users. Tigris also makes life easier by supporting the permit function by inheriting ERC20Permit in the Tigris Stablecoin contract and supporting the function to be used in the StableVault and Trading contracts. Meta transactions should be sent to the deployed Forwarder contract. EIP712. Plenty of opportunities for referrals :) Contracts that support meta transactions:

  • Trading contract

  • Open positions NFT contract

  • Governance NFT contract

  • StableVault contracts

  • Tigris stablecoin contracts

Trading contract input guide

These are the main input parameters for interacting with the Tigris trading contract:

  1. TradeInfo struct

  2. PriceData struct array

  3. Signature bytes array

  4. ERC20PermitData struct

struct TradeInfo {
    uint256 margin;        Margin amount with 1e18 decimals.
    address marginAsset;   Address of the asset used as margin.
    address stableVault;   Address of the StableVault the margin asset will be deposited into. Only needed if marginAsset != tigAsset.
    uint256 leverage;      Leverage used with 1e18 decimals.
    uint256 asset;         ID of the asset being traded. Refer to PairsContract.
    bool direction;        True for long, false for short.
    uint256 tpPrice;       Take profit price with 1e18 decimals.
    uint256 slPrice;       Stop loss price with 1e18 decimals.
    address referrer;      Address of the referrer.
}
struct PriceData {         This is the price data received from the oracle node.
    address provider;      Address of the node providing the data.
    bool isClosed;         True if market is closed, false if market is open.
    uint256 asset;         ID of the asset being traded. Refer to PairsContract.
    uint256 price;         Price of the asset being traded with 1e18 decimals.
    uint256 spread;        Price spread percent with 1e10 precision.
    uint256 timestamp;     Timestamp of when the price was provided.
}
bytes signature;           Oracel node's signature.   
struct ERC20PermitData {
    uint256 deadline;      Expiration deadline of the signature.
    uint256 amount;        Amount being approved for spending.
    uint8 v;               First byte of the signature as uint8.
    bytes32 r;             Bytes 2-33 of the signature.
    bytes32 s;             Bytes 34-65 of the signature.
    bool usePermit;        True if permit is used, false if not. If false, the above parameters can be left empty.
}

API to query historic oracle data:

https://db.tigrisoracle.net/pair/0/1691753400 https://db.tigrisoracle.net/timestamp/1691753400

Last updated