-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INFO: the settings `PAYMENT_RPC_API` has been renamed to `RPC_AVAX` Problem: Base chain isn't supported. Solutions: adding src/aleph/vm/orchestrator/chain.py to store Available Chains Display available_payments in status_public_config Adding checks that the chains sent is in the STREAM_CHAINS Fix: use chain_info.super_token instead of settings.PAYMENT_SUPER_TOKEN Update dependency superfluid to aleph-superfluid==0.2.1 Fix: wrong logic in monitor_payments for payg Co-authored-by: nesitor <[email protected]> Co-authored-by: Olivier Le Thanh Duong <[email protected]>
- Loading branch information
1 parent
91d6027
commit 02affa3
Showing
7 changed files
with
112 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import logging | ||
from typing import Dict, Optional, Union | ||
|
||
from aleph_message.models import Chain | ||
from pydantic import BaseModel, root_validator | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class ChainInfo(BaseModel): | ||
""" | ||
A chain information. | ||
""" | ||
|
||
chain_id: int | ||
rpc: str | ||
standard_token: Optional[str] = None | ||
super_token: Optional[str] = None | ||
testnet: bool = False | ||
active: bool = True | ||
|
||
@property | ||
def token(self) -> Optional[str]: | ||
return self.super_token or self.standard_token | ||
|
||
@root_validator(pre=True) | ||
def check_tokens(cls, values): | ||
if not values.get("standard_token") and not values.get("super_token"): | ||
raise ValueError("At least one of standard_token or super_token must be provided.") | ||
return values | ||
|
||
|
||
STREAM_CHAINS: Dict[Union[Chain, str], ChainInfo] = { | ||
# TESTNETS | ||
"SEPOLIA": ChainInfo( | ||
chain_id=11155111, | ||
rpc="https://eth-sepolia.public.blastapi.io", | ||
standard_token="0xc4bf5cbdabe595361438f8c6a187bdc330539c60", | ||
super_token="0x22064a21fee226d8ffb8818e7627d5ff6d0fc33a", | ||
active=False, | ||
testnet=True, | ||
), | ||
# MAINNETS | ||
Chain.ETH: ChainInfo( | ||
chain_id=1, | ||
rpc="https://eth-mainnet.public.blastapi.io", | ||
standard_token="0x27702a26126e0B3702af63Ee09aC4d1A084EF628", | ||
active=False, | ||
), | ||
Chain.AVAX: ChainInfo( | ||
chain_id=43114, | ||
rpc="https://api.avax.network/ext/bc/C/rpc", | ||
super_token="0xc0Fbc4967259786C743361a5885ef49380473dCF", | ||
), | ||
Chain.BASE: ChainInfo( | ||
chain_id=8453, | ||
rpc="https://base-mainnet.public.blastapi.io", | ||
super_token="0xc0Fbc4967259786C743361a5885ef49380473dCF", | ||
), | ||
} | ||
|
||
|
||
def get_chain(chain: str) -> ChainInfo: | ||
try: | ||
return STREAM_CHAINS[chain] | ||
except KeyError as error: | ||
raise ValueError(f"Unknown chain id for chain {chain}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters