Handling Abnormal Scenarios

Pika is designed to protect users by preventing the central point of failure. It has design in place to handle these three extremely rare scenarios: 1. orders are not being executed; 2. fast oracle is not providing accurate prices; 3. website is down.

Orders are not being executed

If you notice your market orders are not executed a minute after submission and you do not see any error notification, it might be because the keepers are down. Your submitted orders will appear in the Orders tab with the type as Market. If you are openning new market orders, you can click the Cancel button to cancel the order 3 minutes after sumission. If you are closing existing positions, you can choose either the execute the order with the latest price or cancel the order 3 minutes after sumission. This allows user to close positions or cancel orders even if keepers stops working in rare cases.

Fast oracle price is inaccurate

Pika uses a hybrid oracle of both Chainlink and fast oracle prices from other top exchanges. In the rare case where the fast oracle is reporting inaccurate prices which deviates from Chainlink oracle by a certain threshold, the Pika will uses Chainlink oracle as the backup with a wide bid/ask spread being enabled. This helps to protect both traders and liquidity providers in such unusual scenarios.

Website is down

Pika is a permissionless onchain protocol. In the case of website is down for some expected reasons, you can still manage positions and liquidity via Etherscan. Since the most important thing in volatile markets is the option to close positions, that will be the only thing we cover it in this guide.

Close a Position

To close a position on using Etherscan, you first need to check if you have existing position on Pika from PikaPerpV3 contract's getPosition function: https://optimistic.etherscan.io/address/0xD5A8f233CBdDb40368D55C3320644Fb36e597002#readContract.

If the values show up are not 0s, it means you have active positions. Below is the description of each parameters.

ParametersDescription

account

User wallet address

productId

The number represents the intended trading pair. 1: ETHUSD 2: BTCUSD 3: SOLUSD 4: AVAXUSD

5: MATICUSD 6: LINKUSD 7: SNXUSD 8: AAVEUSD 9: APEUSD 10: AXSUSD 11: UNIUSD 12: OPUSD 13: DOGEUSD 14: CRVUSD 15: NEARUSD 16: ATOMUSD 17: EURUSD 18: JPYUSD 19: GBPUSD 20: AUDUSD 21: CADUSD 22: BNBUSD 23: DYDXUSD 24: FTMUSD 25: SANDUSD

isLong

It is the direction for the position. If you want to long, the input is "true". If you want to short, the input is "false"

To close this position, you can open the PositionManager contract using the address link: https://optimistic.etherscan.io/address/0x8adD31BC901214A37f3bb676Cb90AD62B24fd9a5#writeContract and select the Write Contract button and then click Connect to connect with your wallet.

Then fill in the parameters for createClosePosition function. You can fill in the the parameters following the description below(the 1st input is always 0). After typing all the input parameters, you can click the Write button to confirm the transaction.

ParametersDescription

productId

The number represents the intended trading pair. 1: ETHUSD 2: BTCUSD 3: SOLUSD 4: AVAXUSD

5: MATICUSD 6: LINKUSD 7: SNXUSD 8: AAVEUSD 9: APEUSD 10: AXSUSD 11: UNIUSD 12: OPUSD 13: DOGEUSD 14: CRVUSD 15: NEARUSD 16: ATOMUSD 17: EURUSD 18: JPYUSD 19: GBPUSD 20: AUDUSD 21: CADUSD 22: BNBUSD 23: DYDXUSD 24: FTMUSD 25: SANDUSD

margin

It is the USDC margin for the position. Note the intended margin amount needs to multiply 1e8 for the input. For example: 50 USDC margin's input is 5000000000.

isLong

It is the direction for your current position. If you want to close a long position, the input is "true". If you want to close a short posiion, the input is "false"

acceptablePrice

It is the lowest acceptable price for close long order, and highest acceptable price for close short order. The order will be cancelled if the curent price does not satisfy the acceptable price.

executionFee

It is the execution fee paid to keepers to cover the gas fee of executing the order. The input amount should be 30000(representing 0.0003 ETH).

In around 10 seconds after submitting the order, you can check your position on PikaPerpV3 contract on Etherscan in the same way as 1st step: https://optimistic.etherscan.io/address/0xD5A8f233CBdDb40368D55C3320644Fb36e597002#readContract

If your order is executed suceessfully, your active position will show up as 0s.

If the order is not executed, the position info will be shown as unchanged. This may happen because your _acceptablePrice value is too tight. If you think that is the reason, you can try to update _acceptablePrice to a lower value for close long and higher value for close short, and then calling createClosePosition function again.

If that still does not close your position, it may be because the keepers stop working. you can wait for 3 minutes and then manually execute the order by calling executeClosePosition.

There are two steps to get the _key parameter:

  • Get index parameter by calling closePositionIndex function with your wallet address.

  • Use the index value from step 1 to call getRequestKey function with your wallet address.

Last updated