improved homepage text

This commit is contained in:
ghe0 2024-09-30 00:26:06 +03:00
parent 64e9479092
commit a4b141dbde
Signed by: ghe0
GPG Key ID: 451028EE56A0FBB4
2 changed files with 26 additions and 20 deletions

@ -67,6 +67,10 @@ impl Store {
self.sol_client.token_address()
}
pub fn get_pubkey_base58(&self) -> String {
self.sol_client.wallet_address()
}
pub fn get_keypair_base58(&self) -> String {
self.sol_client.get_keypair_base58()
}

@ -1,6 +1,5 @@
#![allow(dead_code)]
use crate::datastore;
use crate::datastore::Store;
use crate::{datastore, datastore::Store};
use actix_web::{
// http::StatusCode, error::ResponseError, Result,
get,
@ -15,31 +14,37 @@ use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
const HOMEPAGE: &str = r#"Welcome, beloved hacker!
const HOMEPAGE: &str = r#"Welcome, b3L0v3D h4ck3r!
This node is part of the DeTEE hacker-challenge network. This network allows you
to mint the token {token_address},
and owns the mint address {mint_address}.
This node is part of the DeTEE hacker-challenge, a decentralized wallet that mints the HCKT Token.
The private key of the mint authority was generated within the network. The challenge is easy:
Hack the network to get the private key, and all the SOL is yours. We also offer other rewards, including:
- a unique NFT
- token rewards at after release of the DeTEE token
- a seat on the Advisory Board of DeTEE
- possible employment at DeTEE
To be able to mint, you will need to send SOL to {mint_address}, however:
The mint address of the token is: TOKEN_ADDRESS
The mint authority is: MINT_AUTHORITY
BE AWARE THAT THE ONLY WAY TO GET THE SOL OUT IS BY HACKING THIS NETWORK!
DeTEE REPRESENTATIVES DON'T KNOW HOW TO HACK IT! THAT'S ACTUALLY WHY THIS GOT CREATED...
In order to mint, the mint authority will need some SOL. Before sending SOL, the take into consideration that
DeTEE REPRESENTATIVES DON'T KNOW HOW TO GET THE SOL OUT OF THE NETWORK!
Allowed operations:
/nodes <- information about nodes and counters of network activity
/mint (address) <- mint DHCT tokens to the address; the wallet needs sol for this operation
Feel free to use this as a faucet for HCKT tokens, that you can use for testing in any dApp.
The objective of the hacker challenge is to get the SOL out of {mint_address}.
If you hack it, contact us at https://detee.cloud cause we have lots of rewards.
If you are able to get the SOL out of the wallet, please contact us at https://detee.ltd
The code of the challenge can be found at https://gitea.detee.cloud/ghe0/hacker-challenge
"#;
#[get("/")]
async fn homepage() -> impl Responder {
HttpResponse::Ok().body(HOMEPAGE)
async fn homepage(ds: web::Data<Arc<Store>>) -> impl Responder {
let text = HOMEPAGE
.to_string()
.replace("TOKEN_ADDRESS", &ds.get_token_address())
.replace("MINT_AUTHORITY", &ds.get_pubkey_base58());
HttpResponse::Ok().body(text)
}
#[derive(Serialize)]
@ -76,10 +81,7 @@ impl From<(String, datastore::NodeInfo)> for NodesResp {
#[get("/nodes")]
async fn get_nodes(ds: web::Data<Arc<Store>>) -> HttpResponse {
HttpResponse::Ok().json(
ds.get_node_list()
.into_iter()
.map(Into::<NodesResp>::into)
.collect::<Vec<NodesResp>>(),
ds.get_node_list().into_iter().map(Into::<NodesResp>::into).collect::<Vec<NodesResp>>(),
)
}