From 606d31ba17ec7ec1b329f5e9a42ad2623b502e14 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Tue, 10 Dec 2024 11:20:35 +1100 Subject: [PATCH] fix: Add tx signature verification --- cache/1981e30de11cf0845e8b5affb4dc75e0.json | 2 +- cache/1ccff5c6f117409fea0c861aa44b8e62.json | 2 +- cache/29409a8a40dd2d547a7a44b8f6758f54.json | 2 +- cache/4104ed0427efe63d4ca0dead970a4391.json | 2 +- cache/46c1ec7f5edb30c070003dc54e072f41.json | 2 +- cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json | 2 +- cache/6cc6c6a0b2d0654f551d33209c1fd824.json | 2 +- cache/6eec370e2713cfc84c84e1080b8a191a.json | 2 +- cache/790b28a9a21cf694ad9577ef1072ac9e.json | 2 +- cache/a071d7bdda25c22e42ad7840f17c4b0e.json | 2 +- cache/a099e7e540e16a185b0279b9494e5099.json | 2 +- cache/a0ee60913ba556f39d128e7d7249e788.json | 2 +- cache/c652e896f57f598d23e3dbebdb815ef6.json | 2 +- cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json | 2 +- cache/d4e81748ee91683b2c48adaa5cf95187.json | 2 +- server.py | 18 +++++++++++++++++- 16 files changed, 32 insertions(+), 16 deletions(-) diff --git a/cache/1981e30de11cf0845e8b5affb4dc75e0.json b/cache/1981e30de11cf0845e8b5affb4dc75e0.json index 9195fc3..6ba399e 100644 --- a/cache/1981e30de11cf0845e8b5affb4dc75e0.json +++ b/cache/1981e30de11cf0845e8b5affb4dc75e0.json @@ -1 +1 @@ -{"timestamp": 1733719019.8687048, "result": 3917.66} \ No newline at end of file +{"timestamp": 1733789918.4846652, "result": 3712.77} \ No newline at end of file diff --git a/cache/1ccff5c6f117409fea0c861aa44b8e62.json b/cache/1ccff5c6f117409fea0c861aa44b8e62.json index a2be1cf..ab66059 100644 --- a/cache/1ccff5c6f117409fea0c861aa44b8e62.json +++ b/cache/1ccff5c6f117409fea0c861aa44b8e62.json @@ -1 +1 @@ -{"timestamp": 1733718944.0457852, "result": 1.16} \ No newline at end of file +{"timestamp": 1733789921.2481468, "result": 0.98991} \ No newline at end of file diff --git a/cache/29409a8a40dd2d547a7a44b8f6758f54.json b/cache/29409a8a40dd2d547a7a44b8f6758f54.json index 4e557b9..3459e3e 100644 --- a/cache/29409a8a40dd2d547a7a44b8f6758f54.json +++ b/cache/29409a8a40dd2d547a7a44b8f6758f54.json @@ -1 +1 @@ -{"timestamp": 1733719021.134048, "result": 4.19} \ No newline at end of file +{"timestamp": 1733789854.0988004, "result": 4.19} \ No newline at end of file diff --git a/cache/4104ed0427efe63d4ca0dead970a4391.json b/cache/4104ed0427efe63d4ca0dead970a4391.json index 47f567c..d7bebc5 100644 --- a/cache/4104ed0427efe63d4ca0dead970a4391.json +++ b/cache/4104ed0427efe63d4ca0dead970a4391.json @@ -1 +1 @@ -{"timestamp": 1733719018.4388325, "result": 245.52} \ No newline at end of file +{"timestamp": 1733789856.5556242, "result": 227.89} \ No newline at end of file diff --git a/cache/46c1ec7f5edb30c070003dc54e072f41.json b/cache/46c1ec7f5edb30c070003dc54e072f41.json index a15298b..6de396f 100644 --- a/cache/46c1ec7f5edb30c070003dc54e072f41.json +++ b/cache/46c1ec7f5edb30c070003dc54e072f41.json @@ -1 +1 @@ -{"timestamp": 1733719082.3050148, "result": 4.18} \ No newline at end of file +{"timestamp": 1733789919.6086097, "result": 3.77} \ No newline at end of file diff --git a/cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json b/cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json index 54bb0dd..6e16ccc 100644 --- a/cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json +++ b/cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json @@ -1 +1 @@ -{"timestamp": 1733718865.254725, "result": 231.94} \ No newline at end of file +{"timestamp": 1733789851.6413863, "result": 215.13} \ No newline at end of file diff --git a/cache/6cc6c6a0b2d0654f551d33209c1fd824.json b/cache/6cc6c6a0b2d0654f551d33209c1fd824.json index 82546da..f55d44c 100644 --- a/cache/6cc6c6a0b2d0654f551d33209c1fd824.json +++ b/cache/6cc6c6a0b2d0654f551d33209c1fd824.json @@ -1 +1 @@ -{"timestamp": 1733719142.596215, "result": 4.32} \ No newline at end of file +{"timestamp": 1733789920.0200877, "result": 3.9} \ No newline at end of file diff --git a/cache/6eec370e2713cfc84c84e1080b8a191a.json b/cache/6eec370e2713cfc84c84e1080b8a191a.json index 6565b26..afcdcfa 100644 --- a/cache/6eec370e2713cfc84c84e1080b8a191a.json +++ b/cache/6eec370e2713cfc84c84e1080b8a191a.json @@ -1 +1 @@ -{"timestamp": 1733720614.112476, "result": 326.899783283} \ No newline at end of file +{"timestamp": 1733790003.498964, "result": 388.922873018} \ No newline at end of file diff --git a/cache/790b28a9a21cf694ad9577ef1072ac9e.json b/cache/790b28a9a21cf694ad9577ef1072ac9e.json index ccab599..92ebbe0 100644 --- a/cache/790b28a9a21cf694ad9577ef1072ac9e.json +++ b/cache/790b28a9a21cf694ad9577ef1072ac9e.json @@ -1 +1 @@ -{"timestamp": 1733718864.8976314, "result": 0.038218578} \ No newline at end of file +{"timestamp": 1733789851.2324705, "result": 0.034115021} \ No newline at end of file diff --git a/cache/a071d7bdda25c22e42ad7840f17c4b0e.json b/cache/a071d7bdda25c22e42ad7840f17c4b0e.json index 12c9397..4e87df9 100644 --- a/cache/a071d7bdda25c22e42ad7840f17c4b0e.json +++ b/cache/a071d7bdda25c22e42ad7840f17c4b0e.json @@ -1 +1 @@ -{"timestamp": 1733719021.178202, "result": 1.0} \ No newline at end of file +{"timestamp": 1733789854.9180405, "result": 1.0} \ No newline at end of file diff --git a/cache/a099e7e540e16a185b0279b9494e5099.json b/cache/a099e7e540e16a185b0279b9494e5099.json index 8a98d42..9564637 100644 --- a/cache/a099e7e540e16a185b0279b9494e5099.json +++ b/cache/a099e7e540e16a185b0279b9494e5099.json @@ -1 +1 @@ -{"timestamp": 1733719020.2031393, "result": 98929} \ No newline at end of file +{"timestamp": 1733789857.3777826, "result": 97129} \ No newline at end of file diff --git a/cache/a0ee60913ba556f39d128e7d7249e788.json b/cache/a0ee60913ba556f39d128e7d7249e788.json index 38db376..f93c07d 100644 --- a/cache/a0ee60913ba556f39d128e7d7249e788.json +++ b/cache/a0ee60913ba556f39d128e7d7249e788.json @@ -1 +1 @@ -{"timestamp": 1733720524.535053, "result": [{"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 19.88979, "price": 4.19, "value": 83.33822010000002, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}, {"mint": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "balance": 0.00035766, "price": 98929, "value": 35.38294614, "name": "Wrapped BTC (Wormhole)", "symbol": "wbtc"}, {"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.039815492, "price": 245.52, "value": 9.775499595840001, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3917.66, "value": 10.018827800999999, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 4.18, "value": 3.77391344726, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 9.658874002, "price": 4.32, "value": 41.72633568864, "name": "Volo Staked SUI", "symbol": "vsui"}]} \ No newline at end of file +{"timestamp": 1733789920.0303614, "result": [{"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 19.88979, "price": 4.19, "value": 83.33822010000002, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}, {"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.039815492, "price": 227.89, "value": 9.07355247188, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "balance": 0.00056828, "price": 97129, "value": 55.19646812, "name": "Wrapped BTC (Wormhole)", "symbol": "wbtc"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3712.77, "value": 9.4948523595, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 3.77, "value": 3.4037449033900002, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 9.658874002, "price": 3.9, "value": 37.669608607799994, "name": "Volo Staked SUI", "symbol": "vsui"}]} \ No newline at end of file diff --git a/cache/c652e896f57f598d23e3dbebdb815ef6.json b/cache/c652e896f57f598d23e3dbebdb815ef6.json index f1b6d41..a42da4e 100644 --- a/cache/c652e896f57f598d23e3dbebdb815ef6.json +++ b/cache/c652e896f57f598d23e3dbebdb815ef6.json @@ -1 +1 @@ -{"timestamp": 1733720524.479128, "result": [{"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 4.18, "value": 3.77391344726, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 9.658874002, "price": 4.32, "value": 41.72633568864, "name": "Volo Staked SUI", "symbol": "vsui"}]} \ No newline at end of file +{"timestamp": 1733789920.0300026, "result": [{"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 3.77, "value": 3.4037449033900002, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 9.658874002, "price": 3.9, "value": 37.669608607799994, "name": "Volo Staked SUI", "symbol": "vsui"}]} \ No newline at end of file diff --git a/cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json b/cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json index 606a4de..ae34113 100644 --- a/cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json +++ b/cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json @@ -1 +1 @@ -{"timestamp": 1733720521.0848057, "result": 82.815227} \ No newline at end of file +{"timestamp": 1733789920.8670247, "result": 82.815227} \ No newline at end of file diff --git a/cache/d4e81748ee91683b2c48adaa5cf95187.json b/cache/d4e81748ee91683b2c48adaa5cf95187.json index 654a624..ab5661f 100644 --- a/cache/d4e81748ee91683b2c48adaa5cf95187.json +++ b/cache/d4e81748ee91683b2c48adaa5cf95187.json @@ -1 +1 @@ -{"timestamp": 1733720598.8847191, "result": [{"name": "Kamino USDC Lending", "description": "Kamino USDC Lending", "apy": 26.85, "url": "https://app.kamino.finance/lending/reserve/DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek/Ga4rZytCpq1unD4DbEJ5bkHeUz9g3oh9AAFEi6vSauXp", "value": 20, "updated": "1733719659", "initial": 20, "bought": "1733717057", "type": "Lending"}, {"name": "dYdX MegaVault", "description": "dYdX MegaVault", "apy": 46, "url": "https://dydx.trade/vault", "value": 23.25, "updated": "1733719659", "initial": 23, "bought": "1733300000", "type": "Lending"}]} \ No newline at end of file +{"timestamp": 1733789922.7835755, "result": [{"name": "Kamino USDC Lending", "description": "Kamino USDC Lending", "apy": 26.85, "url": "https://app.kamino.finance/lending/reserve/DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek/Ga4rZytCpq1unD4DbEJ5bkHeUz9g3oh9AAFEi6vSauXp", "value": 20, "updated": "1733729835", "initial": 20, "bought": "1733717057", "type": "Lending"}, {"name": "dYdX MegaVault", "description": "dYdX MegaVault", "apy": 46, "url": "https://dydx.trade/vault", "value": 23.29, "updated": "1733729835", "initial": 23, "bought": "1733300000", "type": "Lending"}]} \ No newline at end of file diff --git a/server.py b/server.py index 09b676b..e6c351e 100644 --- a/server.py +++ b/server.py @@ -573,11 +573,27 @@ def parseDeposit(data): continue if 'tokenTransfers' not in tx: continue - + # Skip memo txs if 'Memo' in json.dumps(tx): print(f"Skipping deposit as it contains memo: {tx['description']}") continue + + signature = tx['signature'] + if not os.path.exists(f"cache/txs.json"): + with open(f"cache/txs.json", "w") as f: + json.dump([], f) + + with open(f"cache/txs.json") as f: + txs = json.load(f) + + if signature in txs: + print(f"Skipping duplicate tx: {signature}") + continue + + txs.append(signature) + with open(f"cache/txs.json", "w") as f: + json.dump(txs, f) for transfer in tx['nativeTransfers']: if transfer['toUserAccount'] != str(vault_sol_address):