Skip to content

SushiSwap support #62

Closed
Closed

Description

@albertwh1te

Due to the similarity of SushiSwap and UniSwap, may I ask will SushiSwap be supported?

Activity

  1. ErikBjare commented on Jan 20, 2021

    @ErikBjare
    Member

    It could be if you add support for it. Should only need to modify the router and factory contract addresses. The best way would probably be to add the ability to override the contract addresses using constructor arguments.

    See for example #58 which adds support for Honeyswap (on xDai).

  2. albertwh1te commented on Jan 21, 2021

    @albertwh1te
    Author

    The best way would probably be to add the ability to override the contract addresses using constructor arguments.

    I think this approach will work! I am going to test this idea.

  3. changed the title [-]Will SushiSwap be supported? [/-] [+]SushiSwap support[/+] on Mar 20, 2021
  4. ErikBjare commented on May 4, 2021

    @ErikBjare
    Member

    Should be possible now in the latest commit on master, see #90 (comment).

  5. cjlutterloh commented on Sep 19, 2021

    @cjlutterloh

    Does it work with v2?

    I have working Uniswap code, but get errors when using the SushiSwap Factory and Router address.
    sushiswap = Uniswap(address=address, private_key=private_key, version=version, provider=provider, factory_contract_addr="0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac", router_contract_addr="0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F")

    See the error info:

         26 
         27 def sushiswap_fetch(stable_coin, other_coin):
    ---> 28     ask = float(sushiswap.get_price_output(uniswap_tokens[stable_coin][0], uniswap_tokens[other_coin][0], int(1*uniswap_tokens[other_coin][1]))) / uniswap_tokens[stable_coin][1]
         29     bid = float(sushiswap.get_price_input(uniswap_tokens[other_coin][0], uniswap_tokens[stable_coin][0], int(1*uniswap_tokens[other_coin][1]))) / uniswap_tokens[stable_coin][1]
         30     return Datapoint("sushiswap", datetime.datetime.now(), ask, bid, other_coin, stable_coin)
    
    /usr/local/lib/python3.7/dist-packages/uniswap/uniswap.py in get_price_output(self, token0, token1, qty, fee, route)
        195             return self._get_token_eth_output_price(token0, Wei(qty), fee)
        196         else:
    --> 197             return self._get_token_token_output_price(token0, token1, qty, fee, route)
        198 
        199     def _get_eth_token_input_price(self, token: AddressLike, qty: Wei, fee: int) -> Wei:
    
    /usr/local/lib/python3.7/dist-packages/uniswap/uniswap.py in _get_token_token_output_price(self, token0, token1, qty, fee, route)
        335 
        336         if self.version == 2:
    --> 337             price: int = self.router.functions.getAmountsIn(qty, route).call()[0]
        338         elif self.version == 3:
        339             if not fee:
    
    /usr/local/lib/python3.7/dist-packages/web3/contract.py in call(self, transaction, block_identifier, state_override)
        966             state_override,
        967             *self.args,
    --> 968             **self.kwargs
        969         )
        970 
    
    /usr/local/lib/python3.7/dist-packages/web3/contract.py in call_contract_function(web3, address, normalizers, function_identifier, transaction, block_id, contract_abi, fn_abi, state_override, *args, **kwargs)
       1502         call_transaction,
       1503         block_identifier=block_id,
    -> 1504         state_override=state_override,
       1505     )
       1506 
    
    /usr/local/lib/python3.7/dist-packages/web3/module.py in caller(*args, **kwargs)
         58                                              params,
         59                                              error_formatters,
    ---> 60                                              null_result_formatters)
         61         return apply_result_formatters(result_formatters, result)
         62     return caller
    
    /usr/local/lib/python3.7/dist-packages/web3/manager.py in request_blocking(self, method, params, error_formatters, null_result_formatters)
        188                                        params,
        189                                        error_formatters,
    --> 190                                        null_result_formatters)
        191 
        192     async def coro_request(
    
    /usr/local/lib/python3.7/dist-packages/web3/manager.py in formatted_response(self, response, params, error_formatters, null_result_formatters)
        165     ) -> Any:
        166         if "error" in response:
    --> 167             apply_error_formatters(error_formatters, response)
        168             raise ValueError(response["error"])
        169         elif response['result'] in NULL_RESPONSES:
    
    /usr/local/lib/python3.7/dist-packages/web3/manager.py in apply_error_formatters(error_formatters, response)
         65 ) -> RPCResponse:
         66     if error_formatters:
    ---> 67         formatted_resp = pipe(response, error_formatters)
         68         return formatted_resp
         69     else:
    
    /usr/local/lib/python3.7/dist-packages/cytoolz/functoolz.pyx in cytoolz.functoolz.pipe()
    
    /usr/local/lib/python3.7/dist-packages/cytoolz/functoolz.pyx in cytoolz.functoolz.c_pipe()
    
    /usr/local/lib/python3.7/dist-packages/web3/_utils/method_formatters.py in raise_solidity_error_on_revert(response)
        568     # Geth Revert without error message case:
        569     if 'execution reverted' in response['error'].get('message'):
    --> 570         raise ContractLogicError('execution reverted')
        571 
        572     return response
    
    ContractLogicError: execution reverted```
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions