CAFECA-IO / TideBit-DeFi

TideBit Decentralize Finance Version
https://tidebit-defi.vercel.app
GNU General Public License v3.0
1 stars 0 forks source link

[BUG] 無法關倉、Position的 instId 跟 targetAsset 不一致 #1480

Closed arealclimber closed 6 months ago

arealclimber commented 9 months ago

未知

Current Result

  1. 今天打開交易畫面時, margin 為 393.18 USDT,在 ETH-USDT 的 open position,總共有三個 倉位,看到第一個 倉位 icon 跟 target asset 為 BTC,並且快到期
  2. 關掉第二個 倉位 之後,margin 為 115.48 USDT,再也關不了 ETH-USDT 跟 BTC-USDT 的獲利倉位,會出現“保證金餘額不足”的錯誤訊息。

關掉第二個 倉位之前的畫面 Screenshot 2023-12-12 at 15 32 40

再也關不了 ETH-USDT 跟 BTC-USDT 的獲利倉位,會出現“保證金餘額不足”的錯誤訊息的影片

https://github.com/CAFECA-IO/TideBit-DeFi/assets/20677913/6ef3504b-c574-4001-ac8d-67ebd9c8f76a

target asset 有誤的 CFD: 0x0823b51d8b30b361e8a8723ae8c5047b Screenshot 2023-12-12 at 16 05 54

        {
            "id": "0x2dbe90539825b3874f5f571c06b83493",
            "userAddress": "0x06F0f78F33513521e4270Ca5C66eE371B76e346c",
            "orderType": "CFD",
            "sequence": 985481,
            "txhash": "0x2dbe90539825b3874f5f571c06b83493",
            "applyData": {
                "orderType": "CFD",
                "operation": "CREATE",
                "instId": "ETH-USDT",
                "quotation": {
                    "instId": "ETH-USDT",
                    "targetAsset": "ETH",
                    "unitAsset": "USDT",
                    "typeOfPosition": "SELL",
                    "price": "2200.33",
                    "spotPrice": "2208.98",
                    "spreadFee": "-8.65",
                    "deadline": 1701761586,
                    "signature": "0xc52bc2fcf688109ea4aa41745f40130f"
                },
                "typeOfPosition": "SELL",
                "price": "2200.33",
                "amount": "0.25",
                "targetAsset": "BTC",
                "unitAsset": "USDT",
                "margin": {
                    "asset": "USDT",
                    "amount": "110.06"
                },
                "leverage": 5,
                "liquidationPrice": "2420.37",
                "liquidationTime": 1702366386,
                "guaranteedStop": false,
                "guaranteedStopFee": "0",
                "createTimestamp": 1701761529,
                "fee": "0"
            },
            "receipt": {
                "txhash": "0x2dbe90539825b3874f5f571c06b83493",
                "sequence": 985481,
                "balanceSnapshot": [
                    {
                        "id": "64794f26d79cf2950a20e626",
                        "userAddress": "0x06F0f78F33513521e4270Ca5C66eE371B76e346c",
                        "currency": "USDT",
                        "available": "4762.7247582",
                        "locked": "283.09",
                        "blockNumber": 0,
                        "createdAt": 1685671719,
                        "updatedAt": 1701761507
                    }
                ],
                "orderSnapshot": {
                    "orderType": "CFD",
                    "id": "0x0823b51d8b30b361e8a8723ae8c5047b",
                    "txhash": "0x2dbe90539825b3874f5f571c06b83493",
                    "orderStatus": "PROCESSING",
                    "state": "OPENING",
                    "instId": "ETH-USDT",
                    "userAddress": "0x06F0f78F33513521e4270Ca5C66eE371B76e346c",
                    "targetAsset": "BTC",
                    "unitAsset": "USDT",
                    "margin": {
                        "amount": "110.06",
                        "asset": "USDT"
                    },
                    "openPrice": "2200.33",
                    "openSpotPrice": "2208.98",
                    "openSpreadFee": "-8.65",
                    "amount": "0.25",
                    "fee": "0",
                    "typeOfPosition": "SELL",
                    "leverage": 5,
                    "guaranteedStop": false,
                    "liquidationPrice": "2420.37",
                    "liquidationTime": 1702366386,
                    "share": false,
                    "updatedTimestamp": 1701761533,
                    "createTimestamp": 1701761533,
                    "guaranteedStopFee": "0",
                    "pnl": {
                        "type": "EQUAL"
                    }
                }
            },
            "userSignature": "0x268ed141fe31e79c4afdded1d6279e52b40e43eed72392b293f71cd044b2aa346d452d31b45693887a9920fff9b91ddbb1f2dc8dd10dd658c00c69d1e35d5e971c",
            "droneSignature": "0xf50f1d34f80813c0030a48dc75043b74",
            "locutusSignature": "0xb8d6300fb733a134a4eb1b81258c27aa",
            "createTimestamp": 1701761533,
            "updateTimestamp": 1701761533
        },

Expect Result

在 ETH-USDT 的倉位, target asset 跟 icon 都應該是 ETH。

關有獲利的倉位,不應該出現“保證金餘額不足”的錯誤訊息

arealclimber commented 9 months ago
arealclimber commented 8 months ago

另一個 BTC-USDT 的 open position 混有 targetAsset 為 ETH 的例子

image

arealclimber commented 8 months ago

2024/1/1 確認餘額不一致的 bug 依然存在

image