-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
403 additions
and
236 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use sea_orm::entity::prelude::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize)] | ||
#[sea_orm(table_name = "ProjectedNFT")] | ||
pub struct Model { | ||
#[sea_orm(primary_key, column_type = "BigInteger")] | ||
pub id: i64, | ||
#[sea_orm(column_type = "BigInteger")] | ||
pub utxo_id: i64, | ||
#[sea_orm(column_type = "BigInteger")] | ||
pub tx_id: i64, | ||
pub operation: i32, // lock / unlock / claim | ||
// address_id here is useful for fast pagination without joining w/ txoutput table | ||
#[sea_orm(column_type = "BigInteger", nullable)] | ||
pub asset_id: Option<i64>, | ||
pub amount: u64, | ||
pub plutus_datum: Vec<u8>, | ||
} | ||
|
||
#[derive(Copy, Clone, Debug, DeriveRelation, EnumIter)] | ||
pub enum Relation { | ||
#[sea_orm( | ||
belongs_to = "super::transaction_output::Entity", | ||
from = "Column::UtxoId", | ||
to = "super::transaction_output::Column::Id" | ||
)] | ||
TransactionOutput, | ||
#[sea_orm( | ||
belongs_to = "super::transaction::Entity", | ||
from = "Column::TxId", | ||
to = "super::transaction::Column::Id" | ||
)] | ||
Transaction, | ||
#[sea_orm( | ||
belongs_to = "super::native_asset::Entity", | ||
from = "Column::AssetId", | ||
to = "super::native_asset::Column::Id" | ||
)] | ||
Asset, | ||
} | ||
|
||
// TODO: figure out why this isn't automatically handle by the macros above | ||
impl Related<super::native_asset::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Asset.def() | ||
} | ||
} | ||
|
||
// TODO: figure out why this isn't automatically handle by the macros above | ||
impl Related<super::transaction_output::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::TransactionOutput.def() | ||
} | ||
} | ||
|
||
// TODO: figure out why this isn't automatically handle by the macros above | ||
impl Related<super::transaction::Entity> for Entity { | ||
fn to() -> RelationDef { | ||
Relation::Transaction.def() | ||
} | ||
} | ||
|
||
impl ActiveModelBehavior for ActiveModel {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use pallas::ledger::addresses::Address; | ||
use pallas::ledger::primitives::alonzo::PlutusScript; | ||
use pallas::ledger::primitives::babbage::PlutusV2Script; | ||
|
||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] | ||
pub struct PayloadAndReadonlyConfig { | ||
pub address: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use std::collections::BTreeSet; | ||
|
||
use crate::config::ReadonlyConfig::ReadonlyConfig; | ||
use crate::types::AddressCredentialRelationValue; | ||
use entity::sea_orm::Condition; | ||
use entity::{ | ||
prelude::*, | ||
sea_orm::{prelude::*, DatabaseTransaction, Set}, | ||
}; | ||
|
||
use crate::dsl::task_macro::*; | ||
|
||
use super::{ | ||
multiera_stake_credentials::MultieraStakeCredentialTask, | ||
}; | ||
|
||
use crate::config::AddressConfig; | ||
|
||
carp_task! { | ||
name MultiEraProjectedNftTask; | ||
configuration AddressConfig; | ||
doc "Parses projected NFT contract data"; | ||
era multiera; | ||
dependencies [MultieraStakeCredentialTask]; | ||
read [multiera_txs, multiera_stake_credential]; | ||
write []; | ||
should_add_task |block, _properties| { | ||
!block.1.is_empty() | ||
}; | ||
execute |previous_data, task| handle_projeced_nft( | ||
task.db_tx, | ||
task.block, | ||
&previous_data.multiera_txs, | ||
&previous_data.multiera_stake_credential, | ||
task.config.address | ||
); | ||
merge_result |previous_data, _result| { | ||
}; | ||
} | ||
|
||
async fn handle_projected_nft( | ||
db_tx: &DatabaseTransaction, | ||
block: BlockInfo<'_, MultiEraBlock<'_>, BlockGlobalInfo>, | ||
multiera_txs: &[TransactionModel], | ||
multiera_stake_credential: &BTreeMap<Vec<u8>, StakeCredentialModel>, | ||
address: String, | ||
) -> Result<(), DbErr> { | ||
Ok(()) | ||
} |