Skip to content

Unexpected Transfer transaction in swap (SwapExactAmountIn) #503

@Chralt98

Description

@Chralt98

Consider the following query:

query MyQuery {
  txs: historicalAccountBalances(limit: 100, orderBy: timestamp_ASC, where: {
    extrinsic: { hash_eq: "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33" }
    accountId_eq: "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
  }) {
    accountId
    assetId
    dBalance
    blockNumber
    event
    extrinsic {
      hash
      name
    }
    id
    timestamp
  }
  swaps: historicalSwaps(limit: 10, orderBy: timestamp_ASC, where: {
    extrinsic: { hash_eq: "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33"},
  }) {
    accountId
    assetAmountIn
    assetAmountOut
    assetIn
    assetOut
    blockNumber
    event
    extrinsic {
      name
      hash
    }
    id
    timestamp
  }
}

I get this output:

    "txs": [
      {
        "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
        "assetId": "Ztg",
        "dBalance": "-255840876",
        "blockNumber": 4316427,
        "event": "Withdraw",
        "extrinsic": {
          "hash": "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33",
          "name": "Swaps.swap_exact_amount_in"
        },
        "id": "0004316427-9e5fc-000003-6vQ7o",
        "timestamp": "2023-11-22T15:40:12.423000Z"
      },
      {
        "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
        "assetId": "{\"categoricalOutcome\":[317,3]}",
        "dBalance": "-840170",
        "blockNumber": 4316427,
        "event": "Transfer",
        "extrinsic": {
          "hash": "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33",
          "name": "Swaps.swap_exact_amount_in"
        },
        "id": "0004316427-9e5fc-000004-6vQ7o",
        "timestamp": "2023-11-22T15:40:12.423000Z"
      },
      {
        "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
        "assetId": "{\"categoricalOutcome\":[317,3]}",
        "dBalance": "-1765752000000",
        "blockNumber": 4316427,
        "event": "Transfer",
        "extrinsic": {
          "hash": "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33",
          "name": "Swaps.swap_exact_amount_in"
        },
        "id": "0004316427-9e5fc-000006-6vQ7o",
        "timestamp": "2023-11-22T15:40:12.423000Z"
      },
      {
        "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
        "assetId": "Ztg",
        "dBalance": "80008656190",
        "blockNumber": 4316427,
        "event": "Transfer",
        "extrinsic": {
          "hash": "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33",
          "name": "Swaps.swap_exact_amount_in"
        },
        "id": "0004316427-9e5fc-000007-6vQ7o",
        "timestamp": "2023-11-22T15:40:12.423000Z"
      },
      {
        "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
        "assetId": "Ztg",
        "dBalance": "-400043280",
        "blockNumber": 4316427,
        "event": "MarketCreatorFeesPaid",
        "extrinsic": {
          "hash": "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33",
          "name": "Swaps.swap_exact_amount_in"
        },
        "id": "0004316427-9e5fc-000010-6vQ7o",
        "timestamp": "2023-11-22T15:40:12.423000Z"
      }
    ],
    "swaps": [
      {
        "accountId": "dE17owFuqybtXatuqm4n4Qu1Gxjdatctj7SY224E19x86vQ7o",
        "assetAmountIn": "1765752000000",
        "assetAmountOut": "80008656190",
        "assetIn": "{\"categoricalOutcome\":[317,3]}",
        "assetOut": "Ztg",
        "blockNumber": 4316427,
        "event": "SwapExactAmountIn",
        "extrinsic": {
          "name": "Swaps.swap_exact_amount_in",
          "hash": "0x22cc65dd857ba6799d27a2ada8efb6496015638bd4c2c8da9d468c5f82cc8f33"
        },
        "id": "0004316427-9e5fc-000008",
        "timestamp": "2023-11-22T15:40:12.423000Z"
      }
    ],

I couldn't match the -840170 Transfer transaction. Why does this transaction appear? All other transactions are fine (expected) associated to the swap event.

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions