KRAV
Search
K
Links
Comment on page

Tech Stack

Oracle

The contract uses Chainlink as the price feed for BTC. This oracle service provides real-time and reliable price information.
Limit Order
Users can set limit orders in the contract and attach an execute fee. When the BTC price hits the limit order price, anyone can execute the limit order, earning the execute fee. Orders can be cancelled before execution. Both quoting and cancelling quotes are handled on-chain for transparency and security.
Liquidation
If a user's position value exceeds 90% of their collateral value, it triggers the liquidation condition. At this point, anyone can force a liquidation for that user, protecting the overall health of the platform.
Funding Fee
This is a risk adjustment mechanism. When there are more long positions than short positions on the platform, those on the short side receive a funding fee, and vice versa. This helps maintain balance and fair trading conditions on the platform.

Contract Structure

Storage

The central contract that keeps core data. Admins can use this contract to set the address of each module contract. It's upgradeable and also stores order info.

Vault(kDAI)

Where LP users mainly interact. It acts as a DAI asset custody contract and also handles user share settlement.

KRAVTrading

primarily for traders. It handles trader transactions and robot matchmaking transactions, assisting in executing limit orders, liquidations, and stop-loss and take-profit at suitable prices.

KRAVTradingCallbacks

Receives callbacks from the PriceAggregator. Triggered by Chainlink, it fetches the latest price of the target asset for opening and closing positions and liquidations.

KRAVPairInfos

Stores trading pair information. The Manager can set configurations through this contract. Dynamic opening fee (1% depth {above/below}) Funding fee Rollover fee Maximum slippage: During the opening of a position, the maximum slippage caused by waiting for a Chainlink callback, the transaction rolls back if the slippage exceeds this.

KRAVNftRewards

Robots get rewards when they successfully execute liquidation, stop-loss, take-profit, and limit orders. Each order has a protection period of 5 blocks post-execution. If the order fails, it cannot be repeatedly executed within these blocks.