OrderBook Agent
OrderBook Agent runs user-set buy and sell orders and supports order matching. This use case includes the following operations:
Create an OrderBook Agent.
Deposit tokens into the Agent, and the user creates a limit order.
Place a limit order and obtain the NoteID of the order.
Use the Agent from the Basic use case to take the order and complete the order matching and transaction.
Create
Execute the following command to create two OrderBook Agents:
Example output:
Configure ORDERBOOKAGENT1 and ORDERBOOKAGENT2 in the .env.local file and load:
Deposit Token into Agent
Check balance:
Create a limit order
Use the following command to create a limit order:
Example output:
Query the order:
Set the NoteID as an environment variable:
Take order
Use Basic Agent1 to take the order:
After the transaction is completed, check the balance of both Agents:
Last updated
Was this helpful?