generated from nathanwoodburn/python-webserver-template
feat: Add async to minting
All checks were successful
Build Docker / BuildImage (push) Successful in 38s
All checks were successful
Build Docker / BuildImage (push) Successful in 38s
This commit is contained in:
parent
d447f4cb94
commit
d231d8b153
2
cache/1981e30de11cf0845e8b5affb4dc75e0.json
vendored
2
cache/1981e30de11cf0845e8b5affb4dc75e0.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733802901.543576, "result": 3686.92}
|
{"timestamp": 1733809035.843733, "result": 3685.0}
|
2
cache/1ccff5c6f117409fea0c861aa44b8e62.json
vendored
2
cache/1ccff5c6f117409fea0c861aa44b8e62.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803481.9402199, "result": 0.983585}
|
{"timestamp": 1733809157.2758396, "result": 1.007}
|
2
cache/29409a8a40dd2d547a7a44b8f6758f54.json
vendored
2
cache/29409a8a40dd2d547a7a44b8f6758f54.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733802965.079247, "result": 4.18}
|
{"timestamp": 1733809036.2606697, "result": 4.18}
|
2
cache/32fbffa989a7d6c0472092fc8982713b.json
vendored
2
cache/32fbffa989a7d6c0472092fc8982713b.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733801702.5651555, "result": 677.73}
|
{"timestamp": 1733808953.7016218, "result": 691.78}
|
2
cache/4104ed0427efe63d4ca0dead970a4391.json
vendored
2
cache/4104ed0427efe63d4ca0dead970a4391.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733802900.2143283, "result": 227.64}
|
{"timestamp": 1733809033.8840516, "result": 228.36}
|
2
cache/46c1ec7f5edb30c070003dc54e072f41.json
vendored
2
cache/46c1ec7f5edb30c070003dc54e072f41.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733802949.2840338, "result": 3.7}
|
{"timestamp": 1733809097.260591, "result": 3.76}
|
2
cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json
vendored
2
cache/598f5dbf97fb0d45cbc6e1a5b0a3b575.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803481.5865438, "result": 214.86}
|
{"timestamp": 1733809031.4238954, "result": 215.71}
|
2
cache/6cc6c6a0b2d0654f551d33209c1fd824.json
vendored
2
cache/6cc6c6a0b2d0654f551d33209c1fd824.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733802950.081187, "result": 3.81}
|
{"timestamp": 1733809097.0826066, "result": 3.9}
|
2
cache/6eec370e2713cfc84c84e1080b8a191a.json
vendored
2
cache/6eec370e2713cfc84c84e1080b8a191a.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803490.0428967, "result": 524.668701194}
|
{"timestamp": 1733809380.8129568, "result": 523.319974704}
|
2
cache/790b28a9a21cf694ad9577ef1072ac9e.json
vendored
2
cache/790b28a9a21cf694ad9577ef1072ac9e.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803481.1301713, "result": 0.055522424}
|
{"timestamp": 1733809031.4242568, "result": 0.055512624}
|
2
cache/a099e7e540e16a185b0279b9494e5099.json
vendored
2
cache/a099e7e540e16a185b0279b9494e5099.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733802902.292282, "result": 96653}
|
{"timestamp": 1733809036.7571216, "result": 96471}
|
2
cache/a0ee60913ba556f39d128e7d7249e788.json
vendored
2
cache/a0ee60913ba556f39d128e7d7249e788.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803478.87206, "result": [{"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 19.88979, "price": 4.18, "value": 83.1393222, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}, {"mint": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "balance": 0.00056828, "price": 96653, "value": 54.92596684, "name": "Wrapped BTC (Wormhole)", "symbol": "wbtc"}, {"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.239815492, "price": 227.64, "value": 54.59159859888, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa", "balance": 0.03683279, "price": 677.73, "value": 24.9626867667, "name": "Binance Coin (Wormhole)", "symbol": "bnb"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3686.92, "value": 9.428744862, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 3.7, "value": 3.3405453959, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 3.81, "value": 87.06962568768, "name": "Volo Staked SUI", "symbol": "vsui"}]}
|
{"timestamp": 1733809383.5021977, "result": [{"mint": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "balance": 0.00056828, "price": 96471, "value": 54.82253988, "name": "Wrapped BTC (Wormhole)", "symbol": "wbtc"}, {"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.239815492, "price": 228.36, "value": 54.76426575312, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3685.0, "value": 9.42383475, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa", "balance": 0.03683279, "price": 691.78, "value": 25.480187466199997, "name": "Binance Coin (Wormhole)", "symbol": "bnb"}, {"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 19.88979, "price": 4.18, "value": 83.1393222, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 3.76, "value": 3.39471640232, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 3.9, "value": 89.1263884992, "name": "Volo Staked SUI", "symbol": "vsui"}]}
|
2
cache/c652e896f57f598d23e3dbebdb815ef6.json
vendored
2
cache/c652e896f57f598d23e3dbebdb815ef6.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803493.5146375, "result": [{"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 3.7, "value": 3.3405453959, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 3.81, "value": 87.06962568768, "name": "Volo Staked SUI", "symbol": "vsui"}]}
|
{"timestamp": 1733809309.7510543, "result": [{"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 3.76, "value": 3.39471640232, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 3.9, "value": 89.1263884992, "name": "Volo Staked SUI", "symbol": "vsui"}]}
|
2
cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json
vendored
2
cache/ccf2a009e56f1b05d471a55d9c9ea8ea.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803490.063623, "result": 82.815227}
|
{"timestamp": 1733809208.7161782, "result": 82.815227}
|
2
cache/d4e81748ee91683b2c48adaa5cf95187.json
vendored
2
cache/d4e81748ee91683b2c48adaa5cf95187.json
vendored
@ -1 +1 @@
|
|||||||
{"timestamp": 1733803494.5449908, "result": [{"name": "Kamino USDC Lending", "description": "Kamino USDC Lending", "apy": 26.85, "url": "https://app.kamino.finance/lending/reserve/DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek/Ga4rZytCpq1unD4DbEJ5bkHeUz9g3oh9AAFEi6vSauXp", "value": 50.01, "updated": "1733790668", "initial": 50, "bought": "1733717057", "type": "Lending"}, {"name": "dYdX MegaVault", "description": "dYdX MegaVault", "apy": 55, "url": "https://dydx.trade/vault", "value": 44.45, "updated": "1733790645", "initial": 44, "bought": "1733300000", "type": "Lending"}]}
|
{"timestamp": 1733809381.9097087, "result": [{"name": "Kamino USDC Lending", "description": "Kamino USDC Lending", "apy": 26.85, "url": "https://app.kamino.finance/lending/reserve/DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek/Ga4rZytCpq1unD4DbEJ5bkHeUz9g3oh9AAFEi6vSauXp", "value": 50.01, "updated": "1733790668", "initial": 50, "bought": "1733717057", "type": "Lending"}, {"name": "dYdX MegaVault", "description": "dYdX MegaVault", "apy": 55, "url": "https://dydx.trade/vault", "value": 44.45, "updated": "1733790645", "initial": 44, "bought": "1733300000", "type": "Lending"}]}
|
@ -38,6 +38,7 @@ from solana.rpc.commitment import Confirmed
|
|||||||
from solana.rpc.api import Client
|
from solana.rpc.api import Client
|
||||||
from solana.rpc.types import TxOpts
|
from solana.rpc.types import TxOpts
|
||||||
from solana.transaction import Transaction
|
from solana.transaction import Transaction
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
@ -666,7 +667,7 @@ def parseDeposit(data):
|
|||||||
solValue = get_coin_price("solana") * solAmount
|
solValue = get_coin_price("solana") * solAmount
|
||||||
usd_amount = solValue
|
usd_amount = solValue
|
||||||
usd_amount = round(usd_amount, 9)
|
usd_amount = round(usd_amount, 9)
|
||||||
mint_stWDBRN(usd_amount, transfer['fromUserAccount'])
|
asyncio.run(mint_stWDBRN(usd_amount, transfer['fromUserAccount']))
|
||||||
|
|
||||||
for transfer in tx['tokenTransfers']:
|
for transfer in tx['tokenTransfers']:
|
||||||
if transfer['toUserAccount'] != str(vault_sol_address):
|
if transfer['toUserAccount'] != str(vault_sol_address):
|
||||||
@ -677,7 +678,7 @@ def parseDeposit(data):
|
|||||||
USDvalue = transfer['tokenAmount'] * token_price
|
USDvalue = transfer['tokenAmount'] * token_price
|
||||||
usd_amount = USDvalue
|
usd_amount = USDvalue
|
||||||
usd_amount = round(usd_amount, 9)
|
usd_amount = round(usd_amount, 9)
|
||||||
mint_stWDBRN(usd_amount, transfer['fromUserAccount'])
|
asyncio.run(mint_stWDBRN(usd_amount, transfer['fromUserAccount']))
|
||||||
|
|
||||||
|
|
||||||
def stWDBRN_nocache():
|
def stWDBRN_nocache():
|
||||||
@ -703,7 +704,7 @@ def stWDBRN_nocache():
|
|||||||
stWDBRN_price = vaultBalance/supply
|
stWDBRN_price = vaultBalance/supply
|
||||||
return stWDBRN_price
|
return stWDBRN_price
|
||||||
|
|
||||||
def mint_stWDBRN(USD_amount, to_user_account):
|
async def mint_stWDBRN(USD_amount, to_user_account):
|
||||||
if USD_amount < 0.5:
|
if USD_amount < 0.5:
|
||||||
print(f"Skipping minting of {USD_amount} USD to {to_user_account} as it is less than 0.5", flush=True)
|
print(f"Skipping minting of {USD_amount} USD to {to_user_account} as it is less than 0.5", flush=True)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user