Exemple #1
0
    def __init__(self):
        if chain.id not in addresses:
            raise UnsupportedNetwork(
                "synthetix is not supported on this network")

        self.synths = self.load_synths()
        logger.info(f'loaded {len(self.synths)} synths')
Exemple #2
0
    def __init__(self):
        if chain.id not in registries:
            raise UnsupportedNetwork(
                'chainlink is not supported on this network')

        self.registry = contract(registries[chain.id])
        self.load_feeds()
Exemple #3
0
    def __init__(self):
        if chain.id not in addresses:
            raise UnsupportedNetwork("fixed forex is not supported on this network")

        self.registry = contract(addresses[chain.id])
        self.registry_deploy_block = contract_creation_block(addresses[chain.id])
        self.markets = self.registry.forex()
        logger.info(f'loaded {len(self.markets)} fixed forex markets')
Exemple #4
0
 def __init__(self):
     if chain.id not in addresses:
         raise UnsupportedNetwork(
             'uniswap v2 is not supported on this network')
     self.uniswaps = [
         UniswapV2(conf['name'], conf['factory'], conf['router'])
         for conf in addresses[chain.id]
     ]
Exemple #5
0
    def __init__(self):
        if chain.id not in addresses:
            raise UnsupportedNetwork(
                'compound is not supported on this network')

        conf = addresses[chain.id]
        self.factory = contract(conf['factory'])
        self.quoter = contract(conf['quoter'])
        self.fee_tiers = conf['fee_tiers']
Exemple #6
0
 def load_registry(self):
     if chain.id == Network.Mainnet:
         return self.load_from_ens()
     elif chain.id == Network.Fantom:
         return [contract('0x727fe1759430df13655ddb0731dE0D0FDE929b04')]
     elif chain.id == Network.Arbitrum:
         return [contract('0xC8f17f8E15900b6D6079680b15Da3cE5263f62AA')]
     else:
         raise UnsupportedNetwork(
             'yearn v2 is not available on this network')
Exemple #7
0
    def __init__(self):
        if chain.id not in curve_contracts:
            raise UnsupportedNetwork("curve is not supported on this network")

        addrs = curve_contracts[chain.id]
        if chain.id == Network.Mainnet:
            self.crv = contract(addrs['crv'])
            self.voting_escrow = contract(addrs['voting_escrow'])
            self.gauge_controller = contract(addrs['gauge_controller'])

        self.pools = set()
        self.identifiers = defaultdict(list)
        self.addres_provider = contract(addrs['address_provider'])
        self.watch_events()
Exemple #8
0
def get_price(token, block=None):
    token = str(token)
    logger.debug("unwrapping %s", token)

    if token in constants.stablecoins:
        logger.debug("stablecoin -> %s", 1)
        return 1

    if chain.id == Network.Mainnet:
        return get_price_eth(token, block)
    elif chain.id == Network.Fantom:
        return get_price_ftm(token, block)
    elif chain.id == Network.Arbitrum:
        return get_price_arbi(token, block)
    else:
        raise UnsupportedNetwork(
            'magic price oracle is not supported on this network')
Exemple #9
0
    def __init__(self,
                 load_strategies=True,
                 load_harvests=False,
                 watch_events_forever=True) -> None:
        start = time()
        if chain.id == Network.Mainnet:
            self.registries = {
                "earn":
                yearn.iearn.Registry(),
                "v1":
                yearn.v1.registry.Registry(),
                "v2":
                yearn.v2.registry.Registry(
                    watch_events_forever=watch_events_forever),
                "ib":
                yearn.ironbank.Registry(),
                "special":
                yearn.special.Registry(),
            }
        elif chain.id == Network.Fantom:
            self.registries = {
                "v2": yearn.v2.registry.Registry(),
                "ib": yearn.ironbank.Registry(),
            }
        elif chain.id == Network.Arbitrum:
            self.registries = {
                "v2": yearn.v2.registry.Registry(),
                "ib": yearn.ironbank.Registry(),
            }
        else:
            raise UnsupportedNetwork('yearn is not supported on this network')

        if load_strategies:
            self.registries["v2"].load_strategies()
        if load_harvests:
            self.registries["v2"].load_harvests()
        logger.info('loaded yearn in %.3fs', time() - start)
Exemple #10
0
 def __init__(self):
     if chain.id not in address_providers:
         raise UnsupportedNetwork("aave is not supported on this network")
Exemple #11
0
    def __init__(self):
        if chain.id not in addresses:
            raise UnsupportedNetwork(
                'uniswap v1 is not supported on this network')

        self.factory = contract(addresses[chain.id])
Exemple #12
0
 def __init__(self):
     if chain.id not in addresses:
         raise UnsupportedNetwork(
             'iron bank is not supported on this network')
     self.vaults  # load the markets on init
Exemple #13
0
 def __init__(self):
     if chain.id not in addresses:
         raise UnsupportedNetwork('band is not supported on this network')
     self.oracle = contract(addresses[chain.id])
Exemple #14
0
 def __init__(self):
     if chain.id not in addresses:
         raise UnsupportedNetwork('yearn is not supported on this network')
     self.markets