Skip to content

Commit 4891bf4

Browse files
feat: implement Operation Protocol Improvements (OPI) architecture
- Add OPI registry system for extensible operation processing - Implement IntermediateState and Context for secure state management - Add BaseProcessor abstract class for OPI implementations - Create test OPI processor as reference implementation - Integrate OPI system with existing BRC20 indexer - Add comprehensive test suite for OPI functionality - Fix code quality issues and ensure all tests pass - Update CI/CD pipeline configuration - Add decimal conversion utilities for precise amount handling - Implement marketplace transfer prioritization - Add performance monitoring and security scanning - Reorganize test structure for better maintainability This commit introduces a complete OPI (Operation Protocol Improvements) architecture that allows for extensible operation processing while maintaining backward compatibility with existing BRC20 functionality.
1 parent 6f7ead2 commit 4891bf4

31 files changed

+2617
-278
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ MANIFEST
2424

2525
# Environments
2626
.env
27+
.env.back
2728
.venv
2829
env/
2930
venv/
@@ -62,7 +63,10 @@ coverage.xml
6263
temp_docs/
6364
backups/
6465
dev/
66+
.rules/
67+
.cursor/
6568

6669
# Alembic
6770
# Ne pas ignorer les fichiers de migration
68-
!alembic/versions/
71+
!alembic/versions/
72+
.env.back
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
"""migrate_amounts_to_decimal
2+
3+
Revision ID: f0e124fbfbf0
4+
Revises: eb4d511e7c2a
5+
Create Date: 2025-08-31 22:31:40.423836
6+
7+
"""
8+
from typing import Sequence, Union
9+
from decimal import Decimal
10+
11+
from alembic import op
12+
import sqlalchemy as sa
13+
from sqlalchemy.dialects import postgresql
14+
15+
# revision identifiers, used by Alembic.
16+
revision: str = 'f0e124fbfbf0'
17+
down_revision: Union[str, Sequence[str], None] = 'eb4d511e7c2a'
18+
branch_labels: Union[str, Sequence[str], None] = None
19+
depends_on: Union[str, Sequence[str], None] = None
20+
21+
22+
def upgrade() -> None:
23+
"""Upgrade schema."""
24+
op.alter_column('balances', 'balance',
25+
existing_type=sa.String(),
26+
type_=sa.Numeric(precision=38, scale=8),
27+
postgresql_using="balance::numeric(38,8)",
28+
existing_nullable=False)
29+
30+
op.alter_column('brc20_operations', 'amount',
31+
existing_type=sa.String(),
32+
type_=sa.Numeric(precision=38, scale=8),
33+
postgresql_using="amount::numeric(38,8)",
34+
existing_nullable=True)
35+
36+
op.alter_column('deploys', 'max_supply',
37+
existing_type=sa.String(),
38+
type_=sa.Numeric(precision=38, scale=8),
39+
postgresql_using="max_supply::numeric(38,8)",
40+
existing_nullable=False)
41+
42+
op.alter_column('deploys', 'limit_per_op',
43+
existing_type=sa.String(),
44+
type_=sa.Numeric(precision=38, scale=8),
45+
postgresql_using="limit_per_op::numeric(38,8)",
46+
existing_nullable=True)
47+
48+
49+
def downgrade() -> None:
50+
"""Downgrade schema."""
51+
op.alter_column('balances', 'balance',
52+
existing_type=sa.Numeric(precision=38, scale=8),
53+
type_=sa.String(),
54+
existing_nullable=False)
55+
56+
op.alter_column('brc20_operations', 'amount',
57+
existing_type=sa.Numeric(precision=38, scale=8),
58+
type_=sa.String(),
59+
existing_nullable=True)
60+
61+
op.alter_column('deploys', 'max_supply',
62+
existing_type=sa.Numeric(precision=38, scale=8),
63+
type_=sa.String(),
64+
existing_nullable=False)
65+
66+
op.alter_column('deploys', 'limit_per_op',
67+
existing_type=sa.Numeric(precision=38, scale=8),
68+
type_=sa.String(),
69+
existing_nullable=True)

0 commit comments

Comments
 (0)