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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ reqwest = { version = "0.11", default-features = false, features = [
http = "0.2.6"
toml = "0.5.9"
base64 = "0.21.4"
diesel = { version = "2.0.0", features = [
diesel = { version = "2.1.3", features = [
"postgres",
"numeric",
"chrono",
"64-column-tables",
"r2d2",
"serde_json",
] }
diesel-derive-enum = { version = "2.0.0", features = ["postgres"] }
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
bigdecimal = { version = "0.4.0", features = ["serde"] }
chrono = { version = "0.4.19", features = ["serde"] }
config = { version = "0.13.0", default-features = false, features = [
Expand Down
1 change: 1 addition & 0 deletions diesel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

[print_schema]
file = "src/dbsync/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"]
1 change: 1 addition & 0 deletions src/bin/server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![recursion_limit = "256"]
pub type Error = Box<dyn std::error::Error + Send + Sync>;
pub type Result<T> = std::result::Result<T, cdp::provider::error::DataProviderError>;

Expand Down
18 changes: 16 additions & 2 deletions src/blockfrost/mod.rs → src/blockfrost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ impl super::provider::CardanoDataProvider for BlockfrostProvider {
Ok(api::pool_delegations(self, pool, epoch)?)
}

async fn deligations_per_pool_epoch_intervall(
async fn delegations_per_pool_epoch_intervall(
&self,
pool: &str,
start_epoch: i64,
end_epoch: i64,
) -> Result<Vec<DelegationView>, DataProviderError> {
Ok(api::deligations_per_pool_for_epochs(
Ok(api::delegations_per_pool_for_epochs(
self,
pool,
start_epoch,
Expand Down Expand Up @@ -290,6 +290,20 @@ impl super::provider::CardanoDataProvider for BlockfrostProvider {
Ok(api::pool_blocks_current_epoch(self, pool_hash)?)
}

async fn pool_reward_recipients(
&self,
pool_hash: &str,
) -> Result<i64, DataProviderError> {
Ok(api::pool_reward_recipients(self, pool_hash)?)
}

async fn pool_last_reward_earned_epoch(
&self,
pool_hash: &str,
) -> Result<i64, DataProviderError> {
Ok(api::pool_last_reward_earned_epoch(self, pool_hash)?)
}

async fn pool_declared_pledge(
&self,
pool_hash: &str,
Expand Down
51 changes: 26 additions & 25 deletions src/blockfrost/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn select_addr_of_first_transaction(
bfp: &BlockfrostProvider,
stake_address_in: &str,
) -> Result<String, DataProviderBlockfrostError> {
Ok("".to_owned())
todo!()
}

/// get all utxos of an address
Expand All @@ -33,9 +33,7 @@ pub fn utxo_by_dataumhash(
addr: &str,
datumhash: &Vec<u8>,
) -> Result<dcslc::TransactionUnspentOutput, DataProviderBlockfrostError> {
Err(DataProviderBlockfrostError::Custom(
"not implemented".to_string(),
))
todo!()
}

/// returns Utxo of a certain datumhash on an address
Expand All @@ -44,9 +42,7 @@ pub fn utxo_by_txid(
txhash: &Vec<u8>,
index: i16,
) -> Result<dcslc::TransactionUnspentOutput, DataProviderBlockfrostError> {
Err(DataProviderBlockfrostError::Custom(
"not implemented".to_string(),
))
todo!()
}

/// get all utxos of an address
Expand Down Expand Up @@ -137,7 +133,7 @@ pub fn pool_delegations(
todo!();
}

pub fn deligations_per_pool_for_epochs(
pub fn delegations_per_pool_for_epochs(
bfp: &BlockfrostProvider,
pool: &str,
start_epoch: i64,
Expand All @@ -151,7 +147,7 @@ pub fn pool_total_stake(
pool: &str,
epoch: i32,
) -> Result<u64, DataProviderBlockfrostError> {
Ok(0)
todo!()
}

pub async fn current_epoch(bfp: &BlockfrostProvider) -> Result<i32, DataProviderBlockfrostError> {
Expand All @@ -164,7 +160,7 @@ pub fn fingerprint(
policy: &str,
tokenname: &str,
) -> Result<String, DataProviderBlockfrostError> {
Ok("".to_owned())
todo!()
}

pub fn token_info(
Expand Down Expand Up @@ -193,7 +189,7 @@ pub fn check_stakeaddr_registered(
bfp: &BlockfrostProvider,
stake_addr_in: &str,
) -> Result<bool, DataProviderBlockfrostError> {
Ok(false)
todo!()
}

pub fn lookup_token_holders(
Expand All @@ -215,23 +211,14 @@ pub fn mint_metadata(
bfp: &BlockfrostProvider,
fingerprint_in: &str,
) -> Result<TokenInfoView, DataProviderBlockfrostError> {
Ok(TokenInfoView {
fingerprint: "".to_owned(),
policy: hex::encode(""),
tokenname: "".to_string(),
meta_key: None,
json: None,
txhash: None,
quantity: None,
mint_slot: None,
})
todo!()
}

pub fn pool_valid(
bfp: &BlockfrostProvider,
pool_id: &str,
) -> Result<bool, DataProviderBlockfrostError> {
Ok(true)
todo!()
}

pub fn txhash_spent(
Expand All @@ -240,22 +227,22 @@ pub fn txhash_spent(
) -> Result<bool, DataProviderBlockfrostError> {
let txh_b = hex::decode(txhash)?;

Ok(false)
todo!()
}

pub fn retrieve_staked_amount (
bfp: &BlockfrostProvider,
epoch: i32,
stake_addr: &str,
) -> Result<BigDecimal, DataProviderError> {
Ok(BigDecimal::from(0))
todo!()
}

pub fn retrieve_generated_rewards (
bfp: &BlockfrostProvider,
stake_addr: &str,
) -> Result<Vec<RewardView>, DataProviderError> {
Ok(vec![])
todo!()
}


Expand All @@ -280,6 +267,20 @@ pub fn pool_blocks_current_epoch(
todo!()
}

pub fn pool_reward_recipients(
bfp: &BlockfrostProvider,
pool_hash: &str,
) -> Result<i64, DataProviderError> {
todo!()
}

pub fn pool_last_reward_earned_epoch(
bfp: &BlockfrostProvider,
pool_hash: &str,
) -> Result<i64, DataProviderError> {
todo!()
}

pub fn pool_declared_pledge(
bfp: &BlockfrostProvider,
pool_hash: &str,
Expand Down
18 changes: 16 additions & 2 deletions src/carb/mod.rs → src/carb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ impl super::provider::CardanoDataProvider for CarbProvider {
Ok(api::stakers_on_pool(self, pool, epoch)?)
}

async fn deligations_per_pool_epoch_intervall(
async fn delegations_per_pool_epoch_intervall(
&self,
pool: &str,
start_epoch: i64,
end_epoch: i64,
) -> Result<Vec<DelegationView>, DataProviderError> {
Ok(api::deligations_per_pool_for_epochs(
Ok(api::delegations_per_pool_for_epochs(
self,
pool,
start_epoch,
Expand Down Expand Up @@ -278,6 +278,20 @@ impl super::provider::CardanoDataProvider for CarbProvider {
Ok(api::pool_blocks_current_epoch(self, pool_hash)?)
}

async fn pool_reward_recipients(
&self,
pool_hash: &str,
) -> Result<i64, DataProviderError> {
Ok(api::pool_reward_recipients(self, pool_hash)?)
}

async fn pool_last_reward_earned_epoch(
&self,
pool_hash: &str,
) -> Result<i64, DataProviderError> {
Ok(api::pool_last_reward_earned_epoch(self, pool_hash)?)
}

async fn pool_declared_pledge(
&self,
pool_hash: &str,
Expand Down
Loading