def __init__(self, multisig_wallet: MultisigWallet, signer: CryptoManagerBase, dst_network: str, config: Config, **kwargs): self.config = config self.multisig_wallet = multisig_wallet self.erc20 = erc20_contract() self.pending_txs: List[str] = [] token_map = {} confirmer_token_map = {} pairs = TokenPairing.objects(dst_network=dst_network, src_network=self.network) for pair in pairs: token_map.update( {pair.dst_address: Token(pair.src_address, pair.src_coin)}) confirmer_token_map.update( {pair.src_address: Token(pair.dst_address, pair.dst_coin)}) self.signer = signer self.token_map = token_map self.logger = get_logger(db_name=config.db_name, loglevel=config.log_level, logger_name=config.logger_name or self.__class__.__name__) self.stop_event = Event() self.confirmer = EthConfirmer(self.multisig_wallet, confirmer_token_map, self.logger) self.event_listener = EthEventListener(self.multisig_wallet, config) self.stop_event = Event() super().__init__(group=None, name="EtherLeader", target=self.run, **kwargs)
def __init__(self, secret_multisig: SecretAccount, contract: MultisigWallet, src_network: str, config: Config, *args, **kwargs): super().__init__(*args, **kwargs) token_map = {} pairs = TokenPairing.objects(dst_network=self.network, src_network=src_network) for pair in pairs: token_map.update( {pair.src_address: Token(pair.dst_address, pair.dst_coin)}) self.multisig_name = secret_multisig.name self.config = config self.manager = SecretManager(contract, token_map, secret_multisig, config) self.logger = get_logger( db_name=self.config['db_name'], logger_name=config.get( 'logger_name', f"{self.__class__.__name__}-{self.multisig_name}")) self.stop_event = Event() super().__init__(group=None, name="SecretLeader", target=self.run, **kwargs)
def _refresh_token_map(self): token_map = {} pairs = TokenPairing.objects(src_network=self.network) for pair in pairs: token_map.update({pair.dst_address: Token(pair.src_address, pair.src_coin)}) self.token_map = token_map
def __init__(self, multisig_wallet: MultisigWallet, signer: CryptoManagerBase, dst_network: str, config: Config, **kwargs): self.config = config self.multisig_wallet = multisig_wallet self.erc20 = erc20_contract() token_map = {} pairs = TokenPairing.objects(dst_network=dst_network, src_network=self.network) for pair in pairs: token_map.update( {pair.dst_address: Token(pair.src_address, pair.src_coin)}) self.signer = signer # self.private_key = private_key # self.default_account = account self.token_map = token_map self.logger = get_logger(db_name=self.config['db_name'], logger_name=config.get( 'logger_name', self.__class__.__name__)) self.stop_event = Event() super().__init__(group=None, name="EtherLeader", target=self.run, **kwargs)
def scrt_leader(multisig_account: SecretAccount, event_listener, multisig_wallet, configuration: Config): # change_admin_q = f"docker exec secretdev secretcli tx compute execute " \ # f"{configuration['secret_contract_address']}" \ # f" '{change_admin(multisig_account.address)}' --from a -y" # _ = subprocess.run(change_admin_q, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) s20_contract = Token(configuration['secret_swap_contract_address'], configuration['secret_token_name']) leader = Secret20Leader(multisig_account, s20_contract, multisig_wallet, configuration) yield leader leader.stop()
def erc20_token(make_project): from brownie.project.IntegrationTests import TetherToken # solidity contract deploy params _initialAmount = 1000 _tokenName = 'Tether USD' _decimalUnits = 6 _tokenSymbol = 'USDT' erc20 = TetherToken.deploy(_initialAmount, _tokenName, _tokenSymbol, _decimalUnits, {'from': accounts[0]}) yield Token(erc20.address, _tokenSymbol)
def erc20_token(make_project): from brownie.project.IntegrationTests import EIP20 # solidity contract deploy params _initialAmount = 1000 _tokenName = 'TN' _decimalUnits = 18 _tokenSymbol = 'TS' erc20 = EIP20.deploy(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol, {'from': accounts[0]}) yield Token(erc20.address, _tokenSymbol)
def __init__(self, multisig_contract: MultisigWallet, signer: CryptoManagerBase, dst_network: str, config: Config): # todo: simplify this, pylint is right self.multisig_contract = multisig_contract self.account = signer.address self.signer = signer self.config = config self.logger = get_logger( db_name=config['db_name'], logger_name=config.get( 'logger_name', f"{self.__class__.__name__}-{self.account[0:5]}")) self.erc20 = erc20_contract() self.catch_up_complete = False self.token_map = {} pairs = TokenPairing.objects(dst_network=dst_network, src_network=self.network) for pair in pairs: self.token_map.update( {pair.src_address: Token(pair.dst_address, pair.dst_coin)}) self.tracked_tokens = self.token_map.keys()
def get_token(token_name: str, network: str): return Token(NETWORK_PARAMS[token_name][network]['address'], token_name)
def _get_s20(self, foreign_token_addr: str) -> Token: print(f"{list(self._coins.keys())} - {foreign_token_addr}") coin = self._coins.get(foreign_token_addr) return Token(address=coin.scrt_address, name=coin.name)
'seth': { 'type': 's20', 'mainnet': { 'address': 'secret1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'decimals': 6 }, 'holodeck': { 'address': 'secret1hx84ff3h4m8yuvey36g9590pw9mm2p55cwqnm6', 'code_hash': '', 'decimals': 6 } }, } tracked_tokens_eth = { "native": Token("secret1hx84ff3h4m8yuvey36g9590pw9mm2p55cwqnm6", "secret-eth") } tracked_tokens_scrt = { "secret1hx84ff3h4m8yuvey36g9590pw9mm2p55cwqnm6": Token("native", "eth") } def run_bridge(): # pylint: disable=too-many-statements runners = [] logger = get_logger(logger_name='runner') required_configs = ['MODE', 'secret_node', 'multisig_acc_addr', 'chain_id'] cfg = Config(required=required_configs) try: configure_secretcli(cfg) except RuntimeError: logger = get_logger(logger_name='runner')