feat: Add embed page
All checks were successful
Build Docker / BuildImage (push) Successful in 34s

This commit is contained in:
Nathan Woodburn 2024-12-13 14:58:10 +11:00
parent 423623202a
commit 3f6623b23e
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
20 changed files with 71 additions and 18 deletions

View File

@ -1 +1 @@
{"timestamp": 1733984571.397818, "result": 1.56} {"timestamp": 1734061996.4144263, "result": 1.56}

View File

@ -1 +1 @@
{"timestamp": 1733984393.209031, "result": 3919.82} {"timestamp": 1734061991.2298856, "result": 3937.58}

View File

@ -1 +1 @@
{"timestamp": 1733984459.9825835, "result": 1.16} {"timestamp": 1734061994.095057, "result": 1.11}

View File

@ -1 +1 @@
{"timestamp": 1733984455.7730536, "result": 4.26} {"timestamp": 1734061866.2958038, "result": 4.26}

View File

@ -1 +1 @@
{"timestamp": 1733984391.3738835, "result": 714.19} {"timestamp": 1734061865.2722552, "result": 708.68}

View File

@ -1 +1 @@
{"timestamp": 1733984394.8449333, "result": 244.6} {"timestamp": 1734061867.4224386, "result": 242.12}

View File

@ -1 +1 @@
{"timestamp": 1733984458.447024, "result": 4.81} {"timestamp": 1734061992.9661698, "result": 4.67}

View File

@ -1 +1 @@
{"timestamp": 1733984388.7021904, "result": 230.14} {"timestamp": 1734061861.964132, "result": 227.69}

View File

@ -1 +1 @@
{"timestamp": 1733984458.848101, "result": 4.99} {"timestamp": 1734061992.046795, "result": 4.84}

View File

@ -1 +1 @@
{"timestamp": 1733984508.6156387, "result": 555.700092455} {"timestamp": 1734062225.4190562, "result": 555.700092455}

View File

@ -1 +1 @@
{"timestamp": 1733984388.295368, "result": 0.055517624} {"timestamp": 1734061861.613021, "result": 0.055517624}

View File

@ -1 +1 @@
{"timestamp": 1733984394.028739, "result": 0.999406} {"timestamp": 1734061868.239039, "result": 1.001}

View File

@ -1 +1 @@
{"timestamp": 1733984457.517185, "result": 100311} {"timestamp": 1734061929.4794042, "result": 99633}

View File

@ -1 +1 @@
{"timestamp": 1733984458.8509336, "result": [{"mint": "9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa", "balance": 0.03683279, "price": 714.19, "value": 26.3056102901, "name": "Binance Coin (Wormhole)", "symbol": "bnb"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3919.82, "value": 10.024351677, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "balance": 1.0, "price": 0.999406, "value": 0.999406, "name": "USDC", "symbol": "usdc"}, {"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.239815492, "price": 244.6, "value": 58.658869343199996, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 23.664735, "price": 4.26, "value": 100.8117711, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}, {"mint": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "balance": 0.00056828, "price": 100311, "value": 57.00473508, "name": "Wrapped BTC (Wormhole)", "symbol": "wbtc"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 4.81, "value": 4.34270901467, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 4.99, "value": 114.03607143872001, "name": "Volo Staked SUI", "symbol": "vsui"}]} {"timestamp": 1734062242.2106752, "result": [{"mint": "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v", "balance": 0.239815492, "price": 242.12, "value": 58.06412692304, "name": "Jupiter Staked SOL", "symbol": "jupsol"}, {"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "balance": 1.0, "price": 1.001, "value": 1.001, "name": "USDC", "symbol": "usdc"}, {"mint": "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4", "balance": 23.664735, "price": 4.26, "value": 100.8117711, "name": "Jupiter Perpetuals Liquidity Provider Token", "symbol": "jlp"}, {"mint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "balance": 0.00255735, "price": 3937.58, "value": 10.069770213, "name": "Ethereum (Wormhole)", "symbol": "eth"}, {"mint": "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh", "balance": 0.00056828, "price": 99633, "value": 56.61944124, "name": "Wrapped BTC (Wormhole)", "symbol": "wbtc"}, {"mint": "9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa", "balance": 0.03683279, "price": 708.68, "value": 26.102661617199995, "name": "Binance Coin (Wormhole)", "symbol": "bnb"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 4.84, "value": 110.60813341952, "name": "Volo Staked SUI", "symbol": "vsui"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 4.67, "value": 4.21630999969, "name": "Sui", "symbol": "sui"}]}

View File

@ -1 +1 @@
{"timestamp": 1733984458.8504496, "result": [{"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 4.81, "value": 4.34270901467, "name": "Sui", "symbol": "sui"}, {"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 4.99, "value": 114.03607143872001, "name": "Volo Staked SUI", "symbol": "vsui"}]} {"timestamp": 1734062233.5109293, "result": [{"mint": "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", "balance": 22.852920128, "price": 4.84, "value": 110.60813341952, "name": "Volo Staked SUI", "symbol": "vsui"}, {"mint": "0x2::sui::SUI", "balance": 0.902850107, "price": 4.67, "value": 4.21630999969, "name": "Sui", "symbol": "sui"}]}

View File

@ -1 +1 @@
{"timestamp": 1733984459.5628948, "result": 82.815227} {"timestamp": 1734061993.7895577, "result": 82.815227}

View File

@ -1 +1 @@
{"timestamp": 1733984522.6454546, "result": [{"name": "Kamino USDC Lending", "description": "Kamino USDC Lending", "apy": 16.49, "url": "https://app.kamino.finance/lending/reserve/DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek/Ga4rZytCpq1unD4DbEJ5bkHeUz9g3oh9AAFEi6vSauXp", "value": 50.05, "updated": "1733969728", "initial": 50, "bought": "1733717057", "type": "Lending"}, {"name": "dYdX MegaVault", "description": "dYdX MegaVault", "apy": 55, "url": "https://dydx.trade/vault", "value": 60.44, "updated": "1733966269", "initial": 60, "bought": "1733300000", "type": "Lending"}]} {"timestamp": 1734062239.760602, "result": [{"name": "Kamino USDC Lending", "description": "Kamino USDC Lending", "apy": 16.49, "url": "https://app.kamino.finance/lending/reserve/DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek/Ga4rZytCpq1unD4DbEJ5bkHeUz9g3oh9AAFEi6vSauXp", "value": 50.08, "updated": "1734049470", "initial": 50, "bought": "1733717057", "type": "Lending"}, {"name": "dYdX MegaVault", "description": "dYdX MegaVault", "apy": 55, "url": "https://dydx.trade/vault", "value": 60.56, "updated": "1733966269", "initial": 60, "bought": "1733300000", "type": "Lending"}]}

View File

@ -124,6 +124,13 @@ def index():
return render_template("index.html", value=tokenValue, supply=tokenSupply, vault=vaultBalance, vault_aud=usd_to_aud(vaultBalance), value_aud=usd_to_aud(tokenValue)) return render_template("index.html", value=tokenValue, supply=tokenSupply, vault=vaultBalance, vault_aud=usd_to_aud(vaultBalance), value_aud=usd_to_aud(tokenValue))
@app.route("/embed")
def embed():
tokenSupply = getTokenSupplyString()
tokenValue = getTokenPrice()
vaultBalance = getVaultBalance()
vaultBalance = "{:.2f}".format(vaultBalance)
return render_template("embed.html", value=tokenValue, supply=tokenSupply, vault=vaultBalance, vault_aud=usd_to_aud(vaultBalance), value_aud=usd_to_aud(tokenValue))
@app.route("/<path:path>") @app.route("/<path:path>")
def catch_all(path: str): def catch_all(path: str):
@ -631,7 +638,7 @@ def usd_to_aud(usd):
value = "{:.2f}".format(value) value = "{:.2f}".format(value)
return value return value
@cache.file_cache(1800) @cache.file_cache(21600)
def aud_to_usd_rate(): def aud_to_usd_rate():
api_key = os.getenv("API_LAYER") api_key = os.getenv("API_LAYER")
resp = requests.get(f"https://apilayer.net/api/live?access_key={api_key}&currencies=AUD&source=USD&format=1") resp = requests.get(f"https://apilayer.net/api/live?access_key={api_key}&currencies=AUD&source=USD&format=1")

Binary file not shown.

46
templates/embed.html Normal file
View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html data-bs-theme="dark" lang="en-au" style="height: 100%;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Vault | Woodburn</title>
<meta name="theme-color" content="#ffffff">
<meta name="twitter:description" content="Woodburn Vault">
<meta name="twitter:image" content="https://vault.woodburn.au/assets/img/favicon.png">
<meta property="og:description" content="Woodburn Vault">
<meta property="og:type" content="website">
<meta property="og:title" content="Vault | Woodburn">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Vault | Woodburn">
<meta name="description" content="Woodburn Vault">
<meta property="og:image" content="https://vault.woodburn.au/assets/img/favicon.png">
<link rel="icon" type="image/png" sizes="192x192" href="assets/img/favicon-192.png">
<link rel="icon" type="image/png" sizes="512x512" href="assets/img/favicon.png">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Catamaran:100,200,300,400,500,600,700,800,900&amp;display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i&amp;display=swap">
</head>
<body style="height: 100%;">
<header class="text-center text-white masthead" style="height: 100%;padding: 0px;">
<div class="masthead-content">
<div style="display: flex;justify-content: center;align-items: center;height: 100vh;">
<div class="container" style="width: fit-content;">
<h1 class="masthead-heading mb-0">stWDBRN</h1>
<p style="font-size: 20px;">Woodburn Vault Balance: {{vault}} USD ({{vault_aud}} AUD)<br>stWDBRN Token Supply: {{supply}}<br>Current Token Value: {{value}} USD ({{value_aud}} AUD)</p>
</div>
</div>
</div>
<div class="bg-circle-1 bg-circle"></div>
<div class="bg-circle-2 bg-circle"></div>
<div class="bg-circle-3 bg-circle"></div>
<div class="bg-circle-4 bg-circle"></div>
</header>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/bs-init.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
</body>
</html>