πAgentManager
Overview
Contract Address
π Contract Architecture
contract AgentManager {
enum TaskStatus {
Pending, // 0 - Task created, waiting to be accepted
InProgress, // 1 - Task accepted and being worked on
Completed, // 2 - Task completed successfully
Cancelled // 3 - Task cancelled
}
struct Task {
uint256 agentId; // ID of the agent assigned to the task
address requester; // Address that created the task
string taskData; // JSON string with task details
uint256 payment; // Payment amount for the task
TaskStatus status; // Current status
uint256 createdAt; // Creation timestamp
uint256 completedAt; // Completion timestamp (0 if not completed)
string result; // Task result (empty until completed)
}
mapping(uint256 => Task) private tasks;
uint256 private taskCounter;
}Main Functions
Create Task
Get Task
Start Task
Complete Task
Fail Task
Cancel Task
Events
TaskCreated
TaskStarted
TaskCompleted
TaskFailed
TaskCancelled
Task Status
Complete Example
Best Practices
1. Structure Task Data
2. Handle Task Results
3. Monitor Task Progress
π Related Documentation
β οΈ Important Notes
Last updated

