Files
smom-dbis-138/services/financial-tokenization/examples/tokenize_swift_fin.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

65 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""
Example: Tokenize SWIFT FIN 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.swift_fin_parser import SWIFTFINParser
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 SWIFT FIN MT103 message
SAMPLE_MT103 = """{1:F01BANKUS33AXXX1234567890}
{2:O1031200240101BANKUS33AXXX1234567890123456789012345678901234567890}
{3:{108:MT103}}
{4:
:20:REF123
:23B:CRED
:32A:240101USD1000,00
:50A:/US1234567890
BANK US
:59:/US9876543210
CREDITOR NAME
:70:Payment for services
:71A:SHA
-}
{5:{MAC:12345678}{CHK:ABCDEF123456}{TNG:}{PDE:}}
{S:{COP:P}}"""
def main():
"""Main function"""
print("Tokenizing SWIFT FIN message...")
# Initialize clients
firefly_client = FireflyClient(FIREFLY_API_URL, FIREFLY_API_KEY)
tokenization_service = FinancialTokenizationService(firefly_client)
# Tokenize message
try:
result = tokenization_service.tokenize_swift_fin(
SAMPLE_MT103,
"mt103_001.txt"
)
print(f"✅ Tokenization successful!")
print(f"Message Type: {result['messageType']}")
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()