Files
smom-dbis-138/services/financial-tokenization/examples/tokenize_iso20022.py
defiQUG 1fb7266469 Add Oracle Aggregator and CCIP Integration
- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control.
- Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities.
- Created .gitmodules to include OpenZeppelin contracts as a submodule.
- Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment.
- Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks.
- Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring.
- Created scripts for resource import and usage validation across non-US regions.
- Added tests for CCIP error handling and integration to ensure robust functionality.
- Included various new files and directories for the orchestration portal and deployment scripts.
2025-12-12 14:57:48 -08:00

75 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""
Example: Tokenize ISO-20022 message
"""
import os
import sys
import json
# Add parent directory to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from parsers.iso20022_parser import ISO20022Parser
from financial_tokenization_service import FireflyClient, FinancialTokenizationService
# Configuration
FIREFLY_API_URL = os.getenv('FIREFLY_API_URL', 'http://firefly-api:5000')
FIREFLY_API_KEY = os.getenv('FIREFLY_API_KEY', '')
# Sample ISO-20022 pacs.008 message
SAMPLE_PACS008 = """<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.10">
<FIToFICstmrCdtTrf>
<GrpHdr>
<MsgId>MSG001</MsgId>
<CreDtTm>2024-01-01T00:00:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>INSTR001</InstrId>
<EndToEndId>E2E001</EndToEndId>
<TxId>TX001</TxId>
</PmtId>
<Amt>
<InstdAmt Ccy="USD">1000.00</InstdAmt>
</Amt>
<Cdtr>
<Nm>Creditor Name</Nm>
</Cdtr>
<RmtInf>
<Ustrd>Payment for services</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</FIToFICstmrCdtTrf>
</Document>"""
def main():
"""Main function"""
print("Tokenizing ISO-20022 message...")
# Initialize clients
firefly_client = FireflyClient(FIREFLY_API_URL, FIREFLY_API_KEY)
tokenization_service = FinancialTokenizationService(firefly_client)
# Tokenize message
try:
result = tokenization_service.tokenize_iso20022(
SAMPLE_PACS008,
"pacs008_001.xml"
)
print(f"✅ Tokenization successful!")
print(f"Message ID: {result['messageId']}")
print(f"NFT ID: {result['nft']['id']}")
print(f"IPFS ID: {result['ipfsId']}")
print(f"Parsed data: {json.dumps(result['parsed'], indent=2)}")
except Exception as e:
print(f"❌ Tokenization failed: {e}")
sys.exit(1)
if __name__ == '__main__':
main()