Skip to content

Commit

Permalink
Hotfix transfers amount
Browse files Browse the repository at this point in the history
  • Loading branch information
pshenmic committed Nov 14, 2023
1 parent be3222a commit f373c76
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
32 changes: 16 additions & 16 deletions packages/indexer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions packages/indexer/src/entities/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use dpp::dashcore::Transaction;
use dpp::identifier::Identifier;
use dpp::identity::state_transition::AssetLockProved;
use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0;
Expand All @@ -21,17 +22,23 @@ impl From<IdentityTopUpTransition> for Transfer {
let asset_lock = state_transition.asset_lock_proof().clone();
let vout_index = asset_lock.output_index();

let tx_out = asset_lock
.transaction()
.unwrap().clone()
.output.get(vout_index as usize).cloned().unwrap();
let amount = tx_out.value * 1000;
let tx = asset_lock.transaction().cloned();

// todo why assetlock transaction could not have tx?
let amount = match tx {
None => 0,
Some(tx) => {
let tx_out = tx.output.get(vout_index as usize).cloned().unwrap();

tx_out.value * 1000
}
};

return Transfer {
id: None,
sender:None,
sender: None,
recipient: Some(identifier),
amount
amount,
};
}
}
Expand All @@ -45,7 +52,7 @@ impl From<IdentityCreditWithdrawalTransition> for Transfer {
id: None,
sender: Some(identifier),
recipient: None,
amount
amount,
};
}
}
Expand All @@ -60,7 +67,7 @@ impl From<IdentityCreditTransferTransition> for Transfer {
id: None,
sender: Some(sender),
recipient: Some(recipient),
amount
amount,
};
}
}
Expand Down

0 comments on commit f373c76

Please sign in to comment.