Maiar DEX: erdpy query to a smart contract response is empty

409 views Asked by At

I am trying to use erdpy to find the address of the pair EGLD-MEX on the testnet Maiar Exchange.

I am using this call:

erdpy --verbose contract query erd1qqqqqqqqqqqqqpgqum3tp4paqxt3snyfj3a5qj37tr9umv970n4s0kv06c --proxy https://testnet-gateway.elrond.com --function=getPair --arguments 0x5745474C442D663634336438 0x4D45582D633735316436

where

erd1qqqqqqqqqqqqqpgqum3tp4paqxt3snyfj3a5qj37tr9umv970n4s0kv06c is the address of the router smart contract on the testnet. I found it when performing a swap in https://testnet.maiar.exchange/ as shown in the picture UI when performing a swap on the exchange that displays the address of the router smart contract

0x5745474C442D663634336438 is WEGLD-f643d8 in hexadecimal

0x4D45582D633735316436 is MEX-c751d6 in hexadecimal

The response from this call is empty.

What did I do wrong?

1

There are 1 answers

4
Martin W On BEST ANSWER

The address you are using is not the router address as you assumed, but the address of the pair itself.

You can also easily check that via the graphql api. https://testnet-exchange-graph.elrond.com/graphql

With the following query:

{factory{address}, pairs{address, firstToken{identifier}, secondToken{identifier}}}

You will receive the following output:

{
  "data": {
    "factory": {
      "address": "erd1qqqqqqqqqqqqqpgq4axqc749vuqr27snr8d8qgvlmz44chsr0n4sm4a72g"
    },
    "pairs": [
      {
        "address": "erd1qqqqqqqqqqqqqpgqum3tp4paqxt3snyfj3a5qj37tr9umv970n4s0kv06c",
        "firstToken": {
          "identifier": "WEGLD-f643d8"
        },
        "secondToken": {
          "identifier": "MEX-c751d6"
        }
      },
      {
        "address": "erd1qqqqqqqqqqqqqpgqmzjpcyra47d0k8xualwcs6k2gzkdrdap0n4sdj0nu6",
        "firstToken": {
          "identifier": "WEGLD-f643d8"
        },
        "secondToken": {
          "identifier": "USDC-72a225"
        }
      },
      {
        "address": "erd1qqqqqqqqqqqqqpgq3cpwrvmextk986e6z6akeewq8feukuj90n4sf2aa2n",
        "firstToken": {
          "identifier": "WEGLD-f643d8"
        },
        "secondToken": {
          "identifier": "RIDE-ae50f0"
        }
      }
    ]
  }
}

Where the factory address is the proxy, and the pair addresses should be self explanatory.