Pika Protocol
Trading from Etherscan
Pika Protocol is a fully decentralized and permission-less exchange, operated not by team, but by unstoppable code. In the rare case when the website server is down, you can always trade directly with the smart contract from block explorers like Etherscan.

Approve Pika Contract for USDC

If you have previously approved the contract in Pika UI, you can skip this step.
To approve the contract, you first open the USDC contract on Etherscan: https://optimistic.etherscan.io/token/0x7f5c764cbc14f9669b88837ca1490cca17c31607#writeContract
Then clicks Connect to Web" to connect to your Metamask wallet.
In the Approve function, input the Pika contract address(0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698) and the your intended trade amount. If you want to trade 100 USDC, the input amount should be 10000000000(100*1e8).
Finally, click the Write button and confirm the transaction in Metamask.

Open a Position

To trade on Pika Protocol using Etherscan, you first need to open the contract using the address link: https://optimistic.etherscan.io/address/0x2FaE8C7Edd26213cA1A88fC57B65352dbe353698
Then select the Write Contract button and then click Connect to connect with your Metamask wallet.
After scrolling down, you can see the function name openPosition.
Below is the descriptionof the input parameters:
The number represents the intended trading pair. 1: ETHUSD 2: BTCUSD 3: LINKUSD 4: SNXUSD
It is the USDC margin for the position. Note the intended margin amount needs to multiply 1e8 for the input. For example: 100 USDC margin's input is 10000000000.
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"
It is the leverage for the position. Note the intended leverage amount needs to multiply 1e8 for the input. For example: if you want to do 10x leverage, input is 1000000000.
The following example is for opening a 10x ETHUSD long position with 100 USDC as margin(1000 as position size). After filling the parameters, you can click the "Write" button the send the transaction.

View Current Positions

To view your current positions in Etherscan, you can first choose the Read Contract tab, and then input your wallet address, productId(refer to the Open a Position section) and direction in to thegetPosition function.
The example below shows the ETHUSD long position of the wallet address. The query result represents these values in sequence: productId, leverage, entryPrice, entryOraclePrice, margin, owner address, open timestamp, direction. The margin of this position is 10000000000, representing 100 USDC(10000000000/1e8).

Close a Position

To close a position, you can first switch back to Write Contract tab, and make sure your wallet is connected. Then input the productId, margin and the direction of the position you want to close into the function closePosition. The example below shows closing a ETHUSD long position with 100 USDC margin.
After clicking "Write" button and confirming your transaction on Metamask, the position will be closed.

Add Margin to Your Position

To add margin to a position, you firstly need to know your positionId. You can switch to Read Contract tab and enter your wallet address, the productId and the position direction into the getPositionId function. After clicking the query button, your positionId will show up.
Then switch to Write Contract tab and input your positionId and the margin amount to add, before clicking Write button and confirm the transaction via Metamask. Below is an example of adding 100(10000000000/1e8) USDC margin to a position.
Last modified 1d ago