Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/new-blk-parser/src/blockchain/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,26 @@ impl Coin for DogecoinTestnet {
};
}

pub struct DogecoinEv;
impl Coin for DogecoinEv {
const NAME: &'static str = "DogecoinEV";
const CONFIG: EncoderConfig = EncoderConfig {
pubkey_address: 30,
script_address: 22,
bech32: "dev",
};
}

pub struct DogecoinEvTestnet;
impl Coin for DogecoinEvTestnet {
const NAME: &'static str = "DogecoinEV Testnet";
const CONFIG: EncoderConfig = EncoderConfig {
pubkey_address: 113,
script_address: 196,
bech32: "tdev",
};
}

pub struct Bellscoin;
impl Coin for Bellscoin {
const NAME: &'static str = "Bellscoin";
Expand Down Expand Up @@ -153,6 +173,8 @@ impl FromStr for CoinType {
"litecoin-testnet" => Ok(CoinType::from(LitecoinTestnet)),
"dogecoin" => Ok(CoinType::from(Dogecoin)),
"dogecoin-testnet" => Ok(CoinType::from(DogecoinTestnet)),
"dogecoinev" => Ok(CoinType::from(DogecoinEv)),
"dogecoinev-testnet" => Ok(CoinType::from(DogecoinEvTestnet)),
"bellscoin" => Ok(CoinType::from(Bellscoin)),
"bellscoin-testnet" => Ok(CoinType::from(BellscoinTestnet)),
"pepecoin" => Ok(CoinType::from(Pepecoin)),
Expand Down
4 changes: 4 additions & 0 deletions src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use std::str::FromStr;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Blockchain {
Dogecoin,
/// DogecoinEV (DEV) chain
DogecoinEv,
Bellscoin,
Pepecoin,
Litecoin,
Expand All @@ -20,6 +22,8 @@ impl FromStr for Blockchain {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_ascii_lowercase().as_str() {
"dogecoin" | "doge" => Ok(Blockchain::Dogecoin),
// DogecoinEV (DEV) aliases
"dogecoinev" | "dev" | "dev20" | "dev-20" | "doge-ev" => Ok(Blockchain::DogecoinEv),
"bellscoin" | "bells" => Ok(Blockchain::Bellscoin),
"pepecoin" | "pepe" => Ok(Blockchain::Pepecoin),
"litecoin" => Ok(Blockchain::Litecoin),
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ define_static! {
BLOCKCHAIN: Blockchain = Blockchain::from_str(&load_env!("BLOCKCHAIN")).unwrap();
INDEX_DIR: Option<String> = load_opt_env!("INDEX_DIR");
NETWORK: Network = load_opt_env!("NETWORK")
.map(|x| Network::from_str(&x).unwrap())
.map(|x| match x.to_ascii_lowercase().as_str() {
// treat common aliases as mainnet/testnet
"mainnet" | "prod" | "bellscoin" => Network::Bellscoin,
"testnet" | "test" => Network::Testnet,
_ => Network::from_str(&x).unwrap(),
})
.unwrap_or(Network::Bellscoin);
// multiple input inscription scan activation
JUBILEE_HEIGHT: usize = match (*NETWORK, *BLOCKCHAIN) {
Expand Down
2 changes: 2 additions & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ impl Server {
(Blockchain::Bellscoin, Network::Testnet) => "bellscoin-testnet",
(Blockchain::Dogecoin, Network::Bellscoin) => "dogecoin",
(Blockchain::Dogecoin, Network::Testnet) => "dogecoin-testnet",
(Blockchain::DogecoinEv, Network::Bellscoin) => "dogecoinev",
(Blockchain::DogecoinEv, Network::Testnet) => "dogecoinev-testnet",
(Blockchain::Pepecoin, Network::Bellscoin) => "pepecoin",
(Blockchain::Pepecoin, Network::Testnet) => "pepecoin-testnet",
_ => "bellscoin",
Expand Down
12 changes: 12 additions & 0 deletions src/tokens/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pub enum MintProto {
Bel20(MintProtoWrapper),
#[serde(rename = "drc-20")]
Drc20(MintProtoWrapper),
#[serde(rename = "dev-20")]
Dev20(MintProtoWrapper),
#[serde(rename = "prc-20")]
Prc20(MintProtoWrapper),
#[serde(rename = "ltc-20")]
Expand All @@ -105,6 +107,8 @@ impl MintProto {
match self {
MintProto::Bel20(v) if *BLOCKCHAIN == Blockchain::Bellscoin => Ok(*v),
MintProto::Drc20(v) if *BLOCKCHAIN == Blockchain::Dogecoin => Ok(*v),
// DEV-20 on DogecoinEV
MintProto::Dev20(v) if *BLOCKCHAIN == Blockchain::DogecoinEv => Ok(*v),
MintProto::Prc20(v) if *BLOCKCHAIN == Blockchain::Pepecoin => Ok(*v),
MintProto::Ltc20(v) if *BLOCKCHAIN == Blockchain::Litecoin => Ok(*v),
_ => anyhow::bail!("Unsupported type"),
Expand Down Expand Up @@ -133,6 +137,8 @@ pub enum DeployProto {
Bel20(DeployProtoWrapper),
#[serde(rename = "drc-20")]
Drc20(DeployProtoWrapper),
#[serde(rename = "dev-20")]
Dev20(DeployProtoWrapper),
#[serde(rename = "prc-20")]
Prc20(DeployProtoWrapper),
#[serde(rename = "ltc-20")]
Expand All @@ -144,6 +150,8 @@ impl DeployProto {
match self {
DeployProto::Bel20(v) if *BLOCKCHAIN == Blockchain::Bellscoin => Ok(*v),
DeployProto::Drc20(v) if *BLOCKCHAIN == Blockchain::Dogecoin => Ok(*v),
// DEV-20 on DogecoinEV
DeployProto::Dev20(v) if *BLOCKCHAIN == Blockchain::DogecoinEv => Ok(*v),
DeployProto::Prc20(v) if *BLOCKCHAIN == Blockchain::Pepecoin => Ok(*v),
DeployProto::Ltc20(v) if *BLOCKCHAIN == Blockchain::Litecoin => Ok(*v),
_ => anyhow::bail!("Unsupported type"),
Expand All @@ -167,6 +175,8 @@ pub enum TransferProto {
Bel20(MintProtoWrapper),
#[serde(rename = "drc-20")]
Drc20(MintProtoWrapper),
#[serde(rename = "dev-20")]
Dev20(MintProtoWrapper),
#[serde(rename = "prc-20")]
Prc20(MintProtoWrapper),
#[serde(rename = "ltc-20")]
Expand All @@ -178,6 +188,8 @@ impl TransferProto {
match self {
TransferProto::Bel20(v) if *BLOCKCHAIN == Blockchain::Bellscoin => Ok(*v),
TransferProto::Drc20(v) if *BLOCKCHAIN == Blockchain::Dogecoin => Ok(*v),
// DEV-20 on DogecoinEV
TransferProto::Dev20(v) if *BLOCKCHAIN == Blockchain::DogecoinEv => Ok(*v),
TransferProto::Prc20(v) if *BLOCKCHAIN == Blockchain::Pepecoin => Ok(*v),
TransferProto::Ltc20(v) if *BLOCKCHAIN == Blockchain::Litecoin => Ok(*v),
_ => anyhow::bail!("Unsupported type"),
Expand Down