Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predictions #2

Merged
merged 32 commits into from
Feb 4, 2025
Merged

Predictions #2

merged 32 commits into from
Feb 4, 2025

Conversation

nicky-ru
Copy link
Member

graph TD
    U[User]
    subgraph Eliza
        subgraph Prediction Plugin
            PE[Prediction Evaluator]
            CR[List Predictions Action]
            PB[Place Bets Action]
            PR[Prediction Resolver]
        end
    end

    DB[(Database)]
    BC[(Blockchain)]
    WD[QUICKSILVER]

    %% Connections with Comments
    U -->|Users discuss weather, ask for predictions and place bets| Eliza
    PE -->|Mints predictions onchain| BC
    CR -->|Stores new predictions| DB
    PR -->|Checks data & outcomes| WD
    PE -->|Analyzes context & formulates new predictions| DB
    PB -->|Places bets on behalf of user| BC
    PR -->|Resolves predictions & distributes rewards| BC
    PR -->|Updates final status| DB
Loading

…ionality

- Implemented `getReadyActivePredictions` method in the PostgresDatabaseAdapter to fetch open predictions nearing their deadline.
- Added `resolvePrediction` method to update the status and outcome of predictions in the database.
- Enhanced AutoClient to periodically check for active predictions and resolve them based on weather data.
- Updated package dependencies in client-auto to include new prediction plugins.
- Exported additional actions and helpers in the depin and prediction plugins for better integration.
…ployment

- Switch to using pre-built 'bino:latest' image instead of local build
- Expose container port dynamically using environment variable
- Add commented example for optional local directory mounting
- Increase Node.js memory allocation
- Comment out voice state update and user stream event listeners
- Temporarily remove voice-related event handling from Discord client initialization
- Simplify message handling logic by removing redundant comments and intermediate variables
- Update message ID generation to use room ID instead of agent ID for more consistent UUID creation
- Streamline reply-to message reference generation
- Minor code cleanup and readability improvements
- Update memory logging to use error level for duplicate memory entries
- Include memory ID and content details in the log message for better debugging
- Add retry count and maximum retry limit to generation functions
- Enhance logging with retry attempt details
- Throw specific error messages when maximum retries are exhausted
- Standardize retry logic across multiple generation functions
- Remove '@elizaos/plugin-prediction' from agent and client-auto package dependencies
- Update package.json files to remove unused plugin references
- Update pnpm-lock.yaml with latest dependency versions
- Add '@elizaos/plugin-evm' to plugin-depin dependencies
- Comment out Mistral-related code in generation and provider handling functions
- Disable Mistral model generation and object generation methods
- Remove unused Mistral-specific implementation details
…esolution

- Move prediction resolution logic from AutoClient to a dedicated PredictionResolver service
- Add new ServiceType.PREDICTION_RESOLVER to core types
- Implement interval-based prediction resolution with weather data retrieval and outcome determination
- Improve logging and error handling for prediction resolution process
…lugin

- Implement predictionEvaluator to extract and manage predictions from conversations
- Add PredictionResolver service for handling prediction lifecycle
- Create blockchain helpers for creating and resolving predictions on IoTeX
- Integrate prediction-related template and ABI for smart contract interactions
- Remove deprecated plugin-prediction package and consolidate prediction functionality
- Add support for both IoTeX mainnet and testnet networks
- Update validation and contract interaction methods to handle network selection
- Modify blockchain helpers to use correct network configuration
- Implement network validation in PredictionResolver and prediction evaluator
- Add comprehensive ERC20 ABI for token contract interactions
- Update prediction contract ABI with expanded function and event definitions
- Enhance contract interaction support for DePIN plugin
- Implement placeBet function to interact with binary prediction contract
- Add getBetAmount helper to validate and manage bet amount and allowance
- Support bet placement for specific prediction, outcome, and bettor
- Integrate ERC20 ABI for token allowance checks
- Handle network-specific contract interactions for IoTeX
… blockchain predictions

- Implement LIST_PREDICTIONS action to fetch and format open predictions
- Add support for displaying predictions with their statement and deadline
- Include user-friendly betting instructions in the response
- Handle cases with no active predictions
- Integrate with database adapter for prediction retrieval
…etting

- Implement PREPARE_BET action to generate token approval QR code and transaction
- Add PLACE_BET action to finalize bet placement on blockchain prediction contract
- Support token allowance generation, bet parameter extraction, and transaction handling
- Enhance blockchain helper functions to handle bet amount validation and network-specific interactions
- Integrate QR code generation for seamless token approval process
…esponse tag

- Modify handler to compose state before processing predictions
- Change parseTagContent to use "response" tag instead of "result"
- Ensure correct state initialization and prediction response parsing
- Remove QR code generation from prepareBet action
- Modify genTxDataForAllowance to return only encoded transaction data
- Update prepareBet response to use a simpler transaction instruction format
- Remove unnecessary network and wallet-specific transaction preparation logic
- Update messageCompletionFooter to emphasize valid JSON formatting with string handling
- Modify stringArrayFooter to use double quotes for consistent JSON formatting
- Ensure clear guidelines for JSON block response structure in parsing utilities
- Update DiscordJS opus package to latest commit
- Resolve minor dependency version changes
- Adjust package.json dependency order in plugin-depin
- Clean up redundant dependency configurations
- Change message generation model from SMALL to LARGE in Discord client
- Disable debug logging for local embedding model to reduce verbosity
- Add clarifying instruction to response formatting in parsing utilities
- Update listPredictions to improve prediction display with ID and formatting
- Modify prepareBet and placeBet actions to streamline bet preparation and placement
- Improve bet parameter extraction and transaction handling
- Enhance user instructions and response messages for betting process
- Adjust prediction resolver to handle errors more gracefully
- Refine prediction template to focus specifically on weather predictions
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nicky-ru! Welcome to the ai16z community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now a ai16z contributor!

- Add `getNetwork()` function to standardize network retrieval and validation
- Replace hardcoded network checks with centralized network resolution
- Update multiple files to use new `getNetwork()` method
- Improve type safety by using `SupportedChain` from EVM plugin
- Simplify network configuration across prediction-related actions and services
- Implement max ongoing predictions check in validate method
- Use configurable MAX_ONGOING_PREDICTIONS environment variable
- Retrieve open predictions from database to enforce limit
- Prevent creating new predictions when maximum is reached
…on market

- Introduce ERC20 ABI for token interactions
- Add prediction market contract ABI for blockchain interactions
- Include Solidity smart contract implementation for PredictionMarket
- Update blockchain helper imports to use new contract locations
- Prepare foundational smart contract infrastructure for decentralized prediction platform
…ver documentation

- Add detailed configuration instructions for prediction market setup
- Include environment variable examples for QuickSilver and prediction contracts
- Expand README with new sections on prediction actions, evaluators, and services
- Add mermaid diagram illustrating prediction workflow
- Provide usage examples for PREPARE_BET and PLACE_BET actions
- Explain prediction creation, validation, and resolution processes
…teractions

- Update prepareBet action to use PREDICTION_TOKEN environment variable
- Modify blockchain helper allowance retrieval to use new token contract
- Ensure consistent token contract reference across prediction market actions
@nicky-ru nicky-ru merged commit 14528bf into bino Feb 4, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant