Defi Operations
The AI Agent SDK provides powerful DeFi-related features, enabling seamless access to essential data from the Crypto.com ecosystem. It allows developers to retrieve a list of whitelisted tokens for a specified DeFi protocol, fetch information about all available farms, and obtain detailed information about a specific farm identified by its symbol.
7.1 Get whitelisted tokens
Retrieve a list of whitelisted tokens for the specified DeFi protocol from the Crypto.com developer platform.
Arguments
protocol (str): The DeFi protocol name (e.g., "H2", "VVS").
Example Query
"Get whitelisted tokens of protocol <example-protocol>"
Example Code
from crypto_com_agent_client import Agent
agent = Agent.init(
llm_config={
"provider": "OpenAI",
"model": "gpt-4",
"provider-api-key": "sk-proj-example-key",
"temperature": "float-controlling-output-randomness",
},
blockchain_config={
"chainId": "chain-id",
"explorer-api-key": "your-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
},
)
response = agent.interact("Get whitelisted tokens of protocol <example-protocol>")
print(response)
7.2 Get all farms
Retrieve information about all available farms for the specified DeFi protocol from the Crypto.com developer platform.
Arguments
protocol (str): The DeFi protocol name (e.g., "H2", "VVS").
Example Query
"Get all farms of protocol <example-protocol>"
Example Code
from crypto_com_agent_client import Agent
agent = Agent.init(
llm_config={
"provider": "OpenAI",
"model": "gpt-4",
"provider-api-key": "sk-proj-example-key",
"temperature": "float-controlling-output-randomness",
},
blockchain_config={
"chainId": "chain-id",
"explorer-api-key": "your-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
},
)
response = agent.interact("Get all farms of protocol <example-protocol>")
print(response)
7.3 Get farm by symbol
Retrieve detailed information about a specific farm identified by its symbol for the specified DeFi protocol.
Arguments
protocol (str): The DeFi protocol name (e.g., "H2", "VVS"). symbol (str): The farm symbol (e.g., "zkCRO-MOON", "CRO-GOLD").
Example Query
"Get farm of protocol <example-protocol> symbol <example-symbol>"
Example Code
from crypto_com_agent_client import Agent
agent = Agent.init(
llm_config={
"provider": "OpenAI",
"model": "gpt-4",
"provider-api-key": "sk-proj-example-key",
"temperature": "float-controlling-output-randomness",
},
blockchain_config={
"chainId": "chain-id",
"explorer-api-key": "your-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
},
)
response = agent.interact("Get farm of protocol <example-protocol> symbol <example-symbol>")
print(response)
Last updated
Was this helpful?