Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erokhinav committed Sep 5, 2024
1 parent 69922ab commit 6cfcfd7
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 3 deletions.
29 changes: 27 additions & 2 deletions pkg/bath/bath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ func TestFindActions(t *testing.T) {
tongo.MustParseBlockID("(0,8000000000000000,38474426)"),
// dedust swap
tongo.MustParseBlockID("(0,8000000000000000,38293409)"),
// dedust swap from TON
tongo.MustParseBlockID("(0,a000000000000000,45489132)"),
tongo.MustParseBlockID("(0,d000000000000000,45499358)"),
tongo.MustParseBlockID("(0,a000000000000000,45489138)"),
tongo.MustParseBlockID("(0,6000000000000000,45501242)"),
tongo.MustParseBlockID("(0,f000000000000000,45499384)"),
tongo.MustParseBlockID("(0,2000000000000000,45500261)"),
tongo.MustParseBlockID("(0,a000000000000000,45489148)"),
// dedust swap to TON
tongo.MustParseBlockID("(0,2000000000000000,45500987)"),
tongo.MustParseBlockID("(0,d000000000000000,45500297)"),
tongo.MustParseBlockID("(0,2000000000000000,45500992)"),
tongo.MustParseBlockID("(0,9000000000000000,45489907)"),
tongo.MustParseBlockID("(0,d000000000000000,45500305)"),
tongo.MustParseBlockID("(0,2000000000000000,45500998)"),
// wton mint
tongo.MustParseBlockID("(0,8000000000000000,38493203)"),
// buy nft on fragment
Expand Down Expand Up @@ -282,9 +297,19 @@ func TestFindActions(t *testing.T) {
filenamePrefix: "tonstake-withdraw",
},
{
name: "dedust swap",
name: "dedust swap jettons",
hash: "831c7f1efaef9ac58fd39981468cea2bbd9c86a1bb72fc425cfc7734ae4a282f",
filenamePrefix: "dedust-swap",
filenamePrefix: "dedust-swap-jettons",
},
{
name: "dedust swap from TON",
hash: "05536d0c200ac0d02f93e369fe29571c13b734b7f741c9fb366786d8144f1430",
filenamePrefix: "dedust-swap-from-ton",
},
{
name: "dedust swap to TON",
hash: "d2249d07091e57c43bcc6978db643dc6af14755e115ac48f6630a315b5e53498",
filenamePrefix: "dedust-swap-to-ton",
},
{
name: "wton mint",
Expand Down
1 change: 0 additions & 1 deletion pkg/bath/dedust.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ var DedustSwapToTONStraw = Straw[BubbleJettonSwap]{
transfer := bubble.Info.(BubbleTx)
newAction.Out.IsTon = true
newAction.Out.Amount.SetInt64(transfer.inputAmount)
newAction.Out.JettonWallet = transfer.inputFrom.Address
return nil
},
},
Expand Down
82 changes: 82 additions & 0 deletions pkg/bath/testdata/dedust-swap-from-ton.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"Actions": [
{
"JettonSwap": {
"Dex": "dedust",
"UserWallet": "0:bbf975f899fa1eda3f233f0d3748e5cfa7ee2abd69033514373dad3f0286f625",
"Router": "0:82b093867547521aad1a99b245812a6d7477c33e469094a94b20a4eab5ace185",
"In": {
"Amount": 40300000000,
"IsTon": true,
"JettonMaster": "0:0000000000000000000000000000000000000000000000000000000000000000",
"JettonWallet": "0:0000000000000000000000000000000000000000000000000000000000000000"
},
"Out": {
"Amount": 5340025692789,
"IsTon": false,
"JettonMaster": "0:74d8327471d503e2240345b06fe1a606de1b5e3c70512b5b46791b429dab5eb1",
"JettonWallet": "0:32c573568c839e4309a5d69a5dd742ee33460a2f7d6ceba9336c294ea69ebdf9"
}
},
"Success": true,
"Type": "JettonSwap",
"BaseTransactions": [
"c85ebd3043603612af808ab874ac1d19d1a68725afc3c4a78589ed5e88372b21",
"bdef4c941f1f311c7de9badebc71464752c6599ae7cdcf514cd449726d750dd6",
"bd2a3aace72bd31cfc340e6e007cde55c56762de6c3e5c0140dfa9888cd14c78",
"31ce388c6c96285a1f9b879519a8a37901c328501e67d332accca09b78da3697",
"c165515aa665f4a9f828736ba86f067e44433b670d8f82502afb7026c00d4b44",
"e45386d6e4f8e5b6889c6035ef244976d6f467ca2b02d5443ebffd49d8e86761",
"eff450ffcaa225eceb6b9ee2232671ac7e671a5d1103ea25b9dcf986387553e5"
]
}
],
"Accounts": [
{
"Account": "0:32c573568c839e4309a5d69a5dd742ee33460a2f7d6ceba9336c294ea69ebdf9",
"Ton": 14397830,
"Fee": 5178203,
"Jettons": null
},
{
"Account": "0:7fd1999f57c6c5866fc9ff6b5c36f753b8e0864f68bfb7816b4c0ad9857cb18b",
"Ton": 66800,
"Fee": 4378960,
"Jettons": [
{
"Address": "0:74d8327471d503e2240345b06fe1a606de1b5e3c70512b5b46791b429dab5eb1",
"Quantity": -5340025692789
}
]
},
{
"Account": "0:82b093867547521aad1a99b245812a6d7477c33e469094a94b20a4eab5ace185",
"Ton": 0,
"Fee": 8334039,
"Jettons": null
},
{
"Account": "0:bbf975f899fa1eda3f233f0d3748e5cfa7ee2abd69033514373dad3f0286f625",
"Ton": -40046881588,
"Fee": 3857353,
"Jettons": [
{
"Address": "0:74d8327471d503e2240345b06fe1a606de1b5e3c70512b5b46791b429dab5eb1",
"Quantity": 5340025692789
}
]
},
{
"Account": "0:dae153a74d894bbc32748198cd626e4f5df4a69ad2fa56ce80fc2644b5708d20",
"Ton": 39999832000,
"Fee": 3151203,
"Jettons": null
},
{
"Account": "0:e5345c28217c39fe412761ae8a5d8149a88d1cffbba5eefd4458a75fd53dc9cb",
"Ton": -556,
"Fee": 7685756,
"Jettons": null
}
]
}
File renamed without changes.
82 changes: 82 additions & 0 deletions pkg/bath/testdata/dedust-swap-to-ton.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"Actions": [
{
"JettonSwap": {
"Dex": "dedust",
"UserWallet": "0:24dcbb2b93e27696c3ecf97c7aa46f9bf308dc67da12b04e7d413a99a4fe3b4d",
"Router": "0:948673a596fc6d2c3123dfff64d3231e4d0e16bfaac506d5ebdb09f32b3b9c65",
"In": {
"Amount": 4300989738,
"IsTon": false,
"JettonMaster": "0:2f956143c461769579baef2e32cc2d7bc18283f40d20bb03e432cd603ac33ffc",
"JettonWallet": "0:ce2dcf83c904e25ea4e92f253bd25d811f418450e37dd6fabafc46aa9ab7a1f4"
},
"Out": {
"Amount": 90997458,
"IsTon": true,
"JettonMaster": "0:0000000000000000000000000000000000000000000000000000000000000000",
"JettonWallet": "0:0000000000000000000000000000000000000000000000000000000000000000"
}
},
"Success": true,
"Type": "JettonSwap",
"BaseTransactions": [
"bba7985c6b547c2bce3a2979b41bf5b0c5bf5a399bcbee69a80572039147ce4d",
"93a65eccc2922a64274a090e52973ff9ddd26b86d6458ab2bed36ed3c051ec59",
"7b5190653d6c6aa0992a6382030cc4967d3a5a49f147e060c2c3f305739e4fc6",
"1d2278233670b2a1198d9dca1d88a2e6da50efd03466c5f77d890fd9a36b4bb1",
"25293707e72391b75d835b0d498a70279bb772259d8f33463ed89f9ab4e74751",
"8440c612cc62c2e77e05cd323938bfd37a1973a37c6cc6de200c792161ee7fac",
"0c8dfa6ffc53fcee21ef4a1402850b7a59d2b3a8c94836c67bc5016c7ff7eead"
]
}
],
"Accounts": [
{
"Account": "0:09c5b9b0870270f85a26165b75458ba475e4e5b620a65a5b2ead0b1031126165",
"Ton": 0,
"Fee": 4230411,
"Jettons": [
{
"Address": "0:2f956143c461769579baef2e32cc2d7bc18283f40d20bb03e432cd603ac33ffc",
"Quantity": 4300989738
}
]
},
{
"Account": "0:24dcbb2b93e27696c3ecf97c7aa46f9bf308dc67da12b04e7d413a99a4fe3b4d",
"Ton": -23549928,
"Fee": 4225786,
"Jettons": [
{
"Address": "0:2f956143c461769579baef2e32cc2d7bc18283f40d20bb03e432cd603ac33ffc",
"Quantity": -4300989738
}
]
},
{
"Account": "0:948673a596fc6d2c3123dfff64d3231e4d0e16bfaac506d5ebdb09f32b3b9c65",
"Ton": 0,
"Fee": 8425049,
"Jettons": null
},
{
"Account": "0:ce2dcf83c904e25ea4e92f253bd25d811f418450e37dd6fabafc46aa9ab7a1f4",
"Ton": -26,
"Fee": 5002426,
"Jettons": null
},
{
"Account": "0:d10fa4fa26903310e34d971e93dc7388135ca8b8a9e85b11c132445f6ce307a3",
"Ton": -4,
"Fee": 5319204,
"Jettons": null
},
{
"Account": "0:dae153a74d894bbc32748198cd626e4f5df4a69ad2fa56ce80fc2644b5708d20",
"Ton": -6924118,
"Fee": 3271200,
"Jettons": null
}
]
}

0 comments on commit 6cfcfd7

Please sign in to comment.