Skip to content

feat: Add comprehensive SolidML example contracts#2

Open
giwaov wants to merge 1 commit intoOpenGradient:mainfrom
giwaov:feat/comprehensive-examples
Open

feat: Add comprehensive SolidML example contracts#2
giwaov wants to merge 1 commit intoOpenGradient:mainfrom
giwaov:feat/comprehensive-examples

Conversation

@giwaov
Copy link

@giwaov giwaov commented Mar 21, 2026

Summary

This PR adds a comprehensive suite of production-ready example contracts demonstrating OpenGradient's on-chain AI capabilities with the SolidML library.

New Contracts

1. DynamicFeeAMM (contracts/defi/DynamicFeeAMM.sol)

An Automated Market Maker that uses ML-predicted volatility to dynamically adjust swap fees (1-100 bps).

  • Uses OGHistorical for 24-hour price history
  • Uses OGPreprocessing for statistical analysis
  • ZK-verified volatility model inference

2. LendingRiskAssessor (contracts/defi/LendingRiskAssessor.sol)

ML-powered lending protocol with personalized risk assessment.

  • Borrower profiling based on collateral, debt, and history
  • TEE-verified ML risk scoring (0-100 scale)
  • Dynamic interest rates (5-30%) and collateral ratios (150-300%)

3. SentimentGatedMint (contracts/nft/SentimentGatedMint.sol)

NFT collection where minting eligibility is determined by LLM sentiment analysis.

  • LLM-powered sentiment analysis of mint applications
  • TEE-secured inference for tamper-proof decisions
  • Configurable threshold with appeal mechanism

4. AIGovernance (contracts/governance/AIGovernance.sol)

DAO governance system with AI-powered proposal analysis.

  • Automatic proposal summarization
  • AI-generated impact analysis (benefits & risks)
  • Interactive Q&A about proposals
  • Standard voting mechanics

Documentation

Updated README.md with:

  • Detailed architecture diagrams for each contract
  • Use case descriptions
  • Quick start and deployment guides
  • Interface reference table
  • Best practices section

Testing

All contracts compile successfully and follow SolidML patterns from the official documentation and solid-ml repository.

Related

These examples complement the existing SDK examples and tee-gateway, providing Solidity developers with production-ready patterns for integrating OpenGradient's AI infrastructure.

- DynamicFeeAMM: AMM with ML-predicted volatility for dynamic swap fees
- LendingRiskAssessor: ML-based lending risk assessment with personalized rates
- SentimentGatedMint: NFT minting gated by LLM sentiment analysis
- AIGovernance: DAO governance with AI-powered proposal analysis and Q&A

All contracts demonstrate production-ready patterns for:
- TEE-secured ML inference
- LLM chat integration
- Historical data queries
- Statistical preprocessing

Updated README with detailed documentation, architecture diagrams, and usage guides.
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