kopia lustrzana https://github.com/bugout-dev/moonstream
Add migration swith from proof_of_play to proofofplay.
rodzic
911f7e7ebe
commit
c64eec10f6
|
@ -79,6 +79,9 @@ from moonstreamdb.models import (
|
||||||
BlastSepoliaBlock,
|
BlastSepoliaBlock,
|
||||||
BlastSepoliaLabel,
|
BlastSepoliaLabel,
|
||||||
BlastSepoliaTransaction,
|
BlastSepoliaTransaction,
|
||||||
|
ProofOfPlayApexBlock,
|
||||||
|
ProofOfPlayApexLabel,
|
||||||
|
ProofOfPlayApexTransaction,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,6 +141,9 @@ def include_symbol(tablename, schema):
|
||||||
BlastSepoliaBlock.__tablename__,
|
BlastSepoliaBlock.__tablename__,
|
||||||
BlastSepoliaLabel.__tablename__,
|
BlastSepoliaLabel.__tablename__,
|
||||||
BlastSepoliaTransaction.__tablename__,
|
BlastSepoliaTransaction.__tablename__,
|
||||||
|
ProofOfPlayApexBlock.__tablename__,
|
||||||
|
ProofOfPlayApexLabel.__tablename__,
|
||||||
|
ProofOfPlayApexTransaction.__tablename__,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Plik diff jest za duży
Load Diff
|
@ -77,7 +77,7 @@ class AvailableBlockchainType(Enum):
|
||||||
AVALANCHE_FUJI = "avalanche_fuji"
|
AVALANCHE_FUJI = "avalanche_fuji"
|
||||||
BLAST = "blast"
|
BLAST = "blast"
|
||||||
BLAST_SEPOLIA = "blast_sepolia"
|
BLAST_SEPOLIA = "blast_sepolia"
|
||||||
PROOF_OF_PLAY_APEX = "proof_of_play_apex"
|
PROOFOFPLAY_APEX = "proofofplay_apex"
|
||||||
|
|
||||||
|
|
||||||
def get_block_model(
|
def get_block_model(
|
||||||
|
@ -163,7 +163,7 @@ def get_block_model(
|
||||||
block_model = BlastBlock
|
block_model = BlastBlock
|
||||||
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
||||||
block_model = BlastSepoliaBlock
|
block_model = BlastSepoliaBlock
|
||||||
elif blockchain_type == AvailableBlockchainType.PROOF_OF_PLAY_APEX:
|
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
|
||||||
block_model = ProofOfPlayApexBlock
|
block_model = ProofOfPlayApexBlock
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported blockchain type provided")
|
raise Exception("Unsupported blockchain type provided")
|
||||||
|
@ -254,7 +254,7 @@ def get_label_model(
|
||||||
label_model = BlastLabel
|
label_model = BlastLabel
|
||||||
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
||||||
label_model = BlastSepoliaLabel
|
label_model = BlastSepoliaLabel
|
||||||
elif blockchain_type == AvailableBlockchainType.PROOF_OF_PLAY_APEX:
|
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
|
||||||
label_model = ProofOfPlayApexLabel
|
label_model = ProofOfPlayApexLabel
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported blockchain type provided")
|
raise Exception("Unsupported blockchain type provided")
|
||||||
|
@ -345,7 +345,7 @@ def get_transaction_model(
|
||||||
transaction_model = BlastTransaction
|
transaction_model = BlastTransaction
|
||||||
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
||||||
transaction_model = BlastSepoliaTransaction
|
transaction_model = BlastSepoliaTransaction
|
||||||
elif blockchain_type == AvailableBlockchainType.PROOF_OF_PLAY_APEX:
|
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
|
||||||
transaction_model = ProofOfPlayApexTransaction
|
transaction_model = ProofOfPlayApexTransaction
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported blockchain type provided")
|
raise Exception("Unsupported blockchain type provided")
|
||||||
|
|
|
@ -1937,7 +1937,7 @@ class BlastSepoliaLabel(Base): # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class ProofOfPlayApexBlock(Base): # type: ignore
|
class ProofOfPlayApexBlock(Base): # type: ignore
|
||||||
__tablename__ = "proof_of_play_apex_blocks"
|
__tablename__ = "proofofplay_apex_blocks"
|
||||||
|
|
||||||
block_number = Column(
|
block_number = Column(
|
||||||
BigInteger, primary_key=True, unique=True, nullable=False, index=True
|
BigInteger, primary_key=True, unique=True, nullable=False, index=True
|
||||||
|
@ -1971,14 +1971,14 @@ class ProofOfPlayApexBlock(Base): # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class ProofOfPlayApexTransaction(Base): # type: ignore
|
class ProofOfPlayApexTransaction(Base): # type: ignore
|
||||||
__tablename__ = "proof_of_play_apex_transactions"
|
__tablename__ = "proofofplay_apex_transactions"
|
||||||
|
|
||||||
hash = Column(
|
hash = Column(
|
||||||
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
|
VARCHAR(256), primary_key=True, unique=True, nullable=False, index=True
|
||||||
)
|
)
|
||||||
block_number = Column(
|
block_number = Column(
|
||||||
BigInteger,
|
BigInteger,
|
||||||
ForeignKey("proof_of_play_apex_blocks.block_number", ondelete="CASCADE"),
|
ForeignKey("proofofplay_apex_blocks.block_number", ondelete="CASCADE"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
index=True,
|
index=True,
|
||||||
)
|
)
|
||||||
|
@ -2002,17 +2002,17 @@ class ProofOfPlayApexTransaction(Base): # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class ProofOfPlayApexLabel(Base): # type: ignore
|
class ProofOfPlayApexLabel(Base): # type: ignore
|
||||||
__tablename__ = "proof_of_play_apex_labels"
|
__tablename__ = "proofofplay_apex_labels"
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
Index(
|
Index(
|
||||||
"ix_proof_of_play_apex_labels_address_block_number",
|
"ix_proofofplay_apex_labels_address_block_number",
|
||||||
"address",
|
"address",
|
||||||
"block_number",
|
"block_number",
|
||||||
unique=False,
|
unique=False,
|
||||||
),
|
),
|
||||||
Index(
|
Index(
|
||||||
"ix_proof_of_play_apex_labels_address_block_timestamp",
|
"ix_proofofplay_apex_labels_address_block_timestamp",
|
||||||
"address",
|
"address",
|
||||||
"block_timestamp",
|
"block_timestamp",
|
||||||
unique=False,
|
unique=False,
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Network(Enum):
|
||||||
avalanche_fuji = "avalanche_fuji"
|
avalanche_fuji = "avalanche_fuji"
|
||||||
blast = "blast"
|
blast = "blast"
|
||||||
blast_sepolia = "blast_sepolia"
|
blast_sepolia = "blast_sepolia"
|
||||||
proof_of_play_apex = "proof_of_play_apex"
|
proofofplay_apex = "proofofplay_apex"
|
||||||
|
|
||||||
|
|
||||||
tx_raw_types = Union[
|
tx_raw_types = Union[
|
||||||
|
@ -189,7 +189,7 @@ MODELS: Dict[Network, Dict[str, Base]] = {
|
||||||
"labels": BlastSepoliaLabel,
|
"labels": BlastSepoliaLabel,
|
||||||
"transactions": BlastSepoliaTransaction,
|
"transactions": BlastSepoliaTransaction,
|
||||||
},
|
},
|
||||||
Network.proof_of_play_apex: {
|
Network.proofofplay_apex: {
|
||||||
"blocks": ProofOfPlayApexBlock,
|
"blocks": ProofOfPlayApexBlock,
|
||||||
"labels": ProofOfPlayApexLabel,
|
"labels": ProofOfPlayApexLabel,
|
||||||
"transactions": ProofOfPlayApexTransaction,
|
"transactions": ProofOfPlayApexTransaction,
|
||||||
|
@ -235,6 +235,6 @@ def blockchain_type_to_network_type(
|
||||||
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
||||||
return Network.blast_sepolia
|
return Network.blast_sepolia
|
||||||
elif blockchain_type == AvailableBlockchainType.PROOF_OF_PLAY_APEX:
|
elif blockchain_type == AvailableBlockchainType.PROOF_OF_PLAY_APEX:
|
||||||
return Network.proof_of_play_apex
|
return Network.proofofplay_apex
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SubscriptionTypes(Enum):
|
||||||
AVALANCHE_FUJI_BLOCKCHAIN = "avalanche_fuji_smartcontract"
|
AVALANCHE_FUJI_BLOCKCHAIN = "avalanche_fuji_smartcontract"
|
||||||
BLAST_BLOCKCHAIN = "blast_smartcontract"
|
BLAST_BLOCKCHAIN = "blast_smartcontract"
|
||||||
BLAST_SEPOLIA_BLOCKCHAIN = "blast_sepolia_smartcontract"
|
BLAST_SEPOLIA_BLOCKCHAIN = "blast_sepolia_smartcontract"
|
||||||
PROOF_OF_PLAY_APEX_BLOCKCHAIN = "proof_of_play_apex_smartcontract"
|
PROOFOFPLAY_APEX_BLOCKCHAIN = "proofofplay_apex_smartcontract"
|
||||||
|
|
||||||
|
|
||||||
def blockchain_type_to_subscription_type(
|
def blockchain_type_to_subscription_type(
|
||||||
|
@ -61,8 +61,8 @@ def blockchain_type_to_subscription_type(
|
||||||
return SubscriptionTypes.BLAST_BLOCKCHAIN
|
return SubscriptionTypes.BLAST_BLOCKCHAIN
|
||||||
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.BLAST_SEPOLIA:
|
||||||
return SubscriptionTypes.BLAST_SEPOLIA_BLOCKCHAIN
|
return SubscriptionTypes.BLAST_SEPOLIA_BLOCKCHAIN
|
||||||
elif blockchain_type == AvailableBlockchainType.PROOF_OF_PLAY_APEX:
|
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
|
||||||
return SubscriptionTypes.PROOF_OF_PLAY_APEX_BLOCKCHAIN
|
return SubscriptionTypes.PROOFOFPLAY_APEX_BLOCKCHAIN
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ subscription_id_by_blockchain = {
|
||||||
"avalanche_fuji": "avalanche_fuji_smartcontract",
|
"avalanche_fuji": "avalanche_fuji_smartcontract",
|
||||||
"blast": "blast_smartcontract",
|
"blast": "blast_smartcontract",
|
||||||
"blast_sepolia": "blast_sepolia_smartcontract",
|
"blast_sepolia": "blast_sepolia_smartcontract",
|
||||||
"proof_of_play_apex": "proof_of_play_apex_smartcontract",
|
"proofofplay_apex": "proofofplay_apex_smartcontract",
|
||||||
}
|
}
|
||||||
|
|
||||||
blockchain_by_subscription_id = {
|
blockchain_by_subscription_id = {
|
||||||
|
@ -106,7 +106,7 @@ blockchain_by_subscription_id = {
|
||||||
"avalanche_fuji_blockchain": "avalanche_fuji",
|
"avalanche_fuji_blockchain": "avalanche_fuji",
|
||||||
"blast_blockchain": "blast",
|
"blast_blockchain": "blast",
|
||||||
"blast_sepolia_blockchain": "blast_sepolia",
|
"blast_sepolia_blockchain": "blast_sepolia",
|
||||||
"proof_of_play_apex_blockchain": "proof_of_play_apex",
|
"proofofplay_apex_blockchain": "proofofplay_apex",
|
||||||
"ethereum_smartcontract": "ethereum",
|
"ethereum_smartcontract": "ethereum",
|
||||||
"polygon_smartcontract": "polygon",
|
"polygon_smartcontract": "polygon",
|
||||||
"mumbai_smartcontract": "mumbai",
|
"mumbai_smartcontract": "mumbai",
|
||||||
|
@ -124,5 +124,5 @@ blockchain_by_subscription_id = {
|
||||||
"avalanche_fuji_smartcontract": "avalanche_fuji",
|
"avalanche_fuji_smartcontract": "avalanche_fuji",
|
||||||
"blast_smartcontract": "blast",
|
"blast_smartcontract": "blast",
|
||||||
"blast_sepolia_smartcontract": "blast_sepolia",
|
"blast_sepolia_smartcontract": "blast_sepolia",
|
||||||
"proof_of_play_apex_smartcontract": "proof_of_play_apex",
|
"proofofplay_apex_smartcontract": "proofofplay_apex",
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue