Integrate your Dapp/Wallet
Protocols or projects may directly forward orders to the Hiding Book from a web3 interface through a simple integration.
To interface with the Hiding Book you will need the following:
- Ability to format, sign, and manipulate the 0xv4 order format
- Ability to interface with a wallet provider of your choice e.g. MetaMask, Ledger, etc
- UX to gather the following user input:
tokenIn
- the units of tokens to be paidtokenOut
- the units of tokens to be received- order expiration
- price
- UX for displaying orders
- view open orders
- cancel orders
- view historic orders
User arrives at the trading interface
- Make a call to the
GET /info
endpoint to get the information you need to initialize the trading screen. The response contains useful information like supported tokens and data needed to sign orders.
User is ready to sign an order
- Combine the user inputted information along with the properties from the
GET /info
endpoint to create a valid 0xv4 order.
It's time to submit the signed order
- Make a call to the
POST /orders
endpoint to post the order to the Hiding Book for validation. The server will alert you of any errors, insufficient balances, or insufficient allowances.
User is asked to approve allowances
- Allowances are to be made where the spender is the 0xv4
verifyingContract
provided in theGET /info
endpoint.
User wants to view orders
- Make a call to the
GET /orders
endpoint to get the user's orders. Specify the user's address as the maker. From there you can display them on the screen, present state and fill % information, and give the user the option to cancel an order. The order's status corresponds with 0x'senum OrderStatus
. https://0xprotocol.readthedocs.io/en/latest/basics/functions.html?highlight=fill%20state#getrfqorderinfo
User wants to cancel an order
- The user needs to sign and broadcast a cancel transaction to the blockchain. There are a variety of ways to cancel orders, including cancel one order, batch cancel many orders, etc. https://0xprotocol.readthedocs.io/en/latest/basics/functions.html?highlight=registerAllowedRfqOrigins#cancelrfqorder
Calculating an Order's Fill %
- Use the order data and make a simple calculation:
fillPercentage = filledAmount_takerToken / takerAmount
Determine order status
- Use the order data's
status
and refer to 0x's OrderStatus enum https://0xprotocol.readthedocs.io/en/latest/basics/functions.html?highlight=fill%20state#getrfqorderinfo
We have 4 reward programs, the claiming logic is the same for all rewards programs.
Step 1. Call
Indibo API
with your address.- Open your terminal and run following command or use your browser to get the response.
curl https://indibo.herokuapp.com/rewards?address={address_of_trader}
Step 2. Go to etherscan and connect your wallet.
- Open your browser and copy the following link.
# for HidingGame (ACT 2 1st half) (hiding)
https://etherscan.io/address/0xd81e97075Dbda444eF65Db3a96706c679b5311fD#writeContract
# for HidingGame (ACT 2 2nd half) (hiding2)
https://etherscan.io/address/0x8d5541dB390a394d01a5eB03FC8160Ba66df184c#writeContract
# for HidingGame (ACT 3 1st half) (hiding3)
https://etherscan.io/address/0xc45bdd7e82cd72f4cb138aeeb175599e6e12be17#writeContract
# for HidingGame (ACT 3 2nd half) (hiding4)
https://etherscan.io/address/0x25d27d026ab896fad8c8080f5b0e3fbd6667b139#writeContract
# for HidingGame (ACT 4 1st half) (hiding5)
https://etherscan.io/address/0xC00ba24eBcB6FB4aecBe5b78431Ea49D608f5565#writeContract
# for HidingGame (ACT 4 2nd half) (hiding6)
https://etherscan.io/address/0x4b26b5820aa3bac65636036e1434128a308a271e#writeContract
# for LiquidityPool-PreMining (lp-pre)
https://etherscan.io/address/lp-pre-distributor.rook.eth#writeContract
# for LiquidityPool-Act1 (lp)
https://etherscan.io/address/0xcadF6735144D1d7f1A875a5561555cBa5df2f75C#writeContract
# for LiquidityPool-Act2 (lpq2)
https://etherscan.io/address/0x2777b798fdfb906d42b89cf8f9de541db05dd6a1#writeContract
# for LiquidityPool-Act3 (lpq3)
https://etherscan.io/address/0x59ff8975c813c1e70bdf2bcb8c02886928e4ea2d#writeContract
# for LiquidityPool-Act4 (lpq4)
https://etherscan.io/address/0x9Bc9BDfe0843f44cF0878700501bB9142CDad2B8#writeContract
# for Lender-Act3 (lender)
https://etherscan.io/address/0xa8F76e3Ef9960A0A8256A43D1F7Af685e5014a4E#writeContract
# for Lender-Act4 (lender2)
https://etherscan.io/address/0xAe7b93a591c37eA37Ed8Bc7B6B999C85f2eD2405#writeContract
- Click
Connect to Web3
to connect your MetaMask or WalletConnect.
Step 3. Claim your rewards.
- Expand the
claim
function.
You will see 4 input fields:
_to (address)
, _earningsToDate (uint256)
, _nonce (uint256)
, _signature (bytes)
- Fill in the inputs with the
Indibo API
response.
owner
--> _to (address)
earnings_to_date
--> _earningsToDate (uint256)
nonce
--> _nonce (uint256)
signature
--> _signature (bytes)
- Click
Write
and approve the claim in your wallet.
Step 4. Success! You will receive your rewards
Last modified 1yr ago