Skip to content

Commit

Permalink
refactor: populate penumbra-num, penumbra-asset
Browse files Browse the repository at this point in the history
Towards #2765
  • Loading branch information
redshiftzero committed Jul 2, 2023
1 parent 20231f7 commit b15059d
Show file tree
Hide file tree
Showing 157 changed files with 499 additions and 370 deletions.
34 changes: 34 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions crates/bin/pcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ parallel = ["penumbra-proof-params/parallel", "decaf377/parallel", "penumbra-cry
penumbra-proto = { path = "../../proto", features = ["rpc"] }
penumbra-tct = { path = "../../crypto/tct" }
penumbra-crypto = { path = "../../core/crypto", features = ["parallel"] }
penumbra-num = { path = "../../core/num", default-features=false }
penumbra-asset = { path = "../../core/asset", default-features=false }
penumbra-chain = { path = "../../core/component/chain", default-features = false }
penumbra-shielded-pool = { path = "../../core/component/shielded-pool", default-features = false }
penumbra-stake = { path = "../../core/component/stake", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion crates/bin/pcli/src/command/query/dao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use futures::TryStreamExt;
//use penumbra_app::dao;
use penumbra_dao::component::state_key;

use penumbra_crypto::{asset, Amount, Value};
use penumbra_asset::{asset, Value};
use penumbra_num::Amount;
use penumbra_view::ViewClient;

use crate::{command::query::dao, App};
Expand Down
5 changes: 1 addition & 4 deletions crates/bin/pcli/src/command/query/dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use comfy_table::{presets, Table};
use futures::{Stream, StreamExt, TryStreamExt};
use std::pin::Pin;

use penumbra_crypto::{
asset::{self, DenomMetadata},
Value,
};
use penumbra_asset::{asset, asset::DenomMetadata, Value};
use penumbra_dex::{
lp::position::{self, Position},
BatchSwapOutputData, DirectedTradingPair, SwapExecution, TradingPair,
Expand Down
8 changes: 3 additions & 5 deletions crates/bin/pcli/src/command/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ use anyhow::{anyhow, Context, Result};
use ark_ff::UniformRand;
use decaf377::{Fq, Fr};
use ibc_types2::core::channel::{ChannelId, PortId};
use penumbra_crypto::{
asset::{self, DenomMetadata},
keys::AddressIndex,
Amount, Value, STAKING_TOKEN_ASSET_ID,
};
use penumbra_asset::{asset, asset::DenomMetadata, Value, STAKING_TOKEN_ASSET_ID};
use penumbra_crypto::keys::AddressIndex;
use penumbra_dex::{lp::position, swap_claim::SwapClaimPlan};
use penumbra_fee::Fee;
use penumbra_ibc::Ics20Withdrawal;
use penumbra_num::Amount;
use penumbra_proto::{
client::v1alpha1::{
EpochByHeightRequest, LiquidityPositionByIdRequest, ProposalInfoRequest,
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pcli/src/command/tx/liquidity_position.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Result;

use penumbra_crypto::asset;
use penumbra_asset::asset;
use penumbra_dex::lp::{
position::{self, Position},
BuyOrder, SellOrder,
Expand Down
4 changes: 2 additions & 2 deletions crates/bin/pcli/src/command/tx/replicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use crate::dex_utils;
use crate::dex_utils::replicate::debug;
use anyhow::{anyhow, bail, Result};
use dialoguer::Confirm;
use penumbra_crypto::fixpoint::U128x128;
use penumbra_asset::Value;
use penumbra_crypto::keys::AddressIndex;
use penumbra_crypto::{Amount, Value};
use penumbra_dex::{lp::position::Position, DirectedUnitPair};
use penumbra_num::{fixpoint::U128x128, Amount};
use penumbra_proto::client::v1alpha1::SpreadRequest;
use penumbra_view::{Planner, ViewClient};
use rand_core::OsRng;
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pcli/src/command/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use comfy_table::{presets, Table};
use penumbra_crypto::{asset, Value};
use penumbra_asset::{asset, Value};
use penumbra_dex::lp::position::Position;

pub(crate) fn render_positions(asset_cache: &asset::Cache, positions: &[Position]) -> String {
Expand Down
3 changes: 2 additions & 1 deletion crates/bin/pcli/src/command/view/balance.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::Result;
use comfy_table::{presets, Table};
use penumbra_crypto::{asset::Cache, keys::AddressIndex, FullViewingKey, Value};
use penumbra_asset::{asset::Cache, Value};
use penumbra_crypto::{keys::AddressIndex, FullViewingKey};
use penumbra_view::ViewClient;
#[derive(Debug, clap::Args)]
pub struct BalanceCmd {
Expand Down
3 changes: 2 additions & 1 deletion crates/bin/pcli/src/command/view/staked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use std::collections::BTreeMap;
use anyhow::Result;
use comfy_table::{presets, Table};
use futures::TryStreamExt;
use penumbra_crypto::{FullViewingKey, Value, STAKING_TOKEN_ASSET_ID};
use penumbra_asset::{Value, STAKING_TOKEN_ASSET_ID};
use penumbra_crypto::FullViewingKey;
use penumbra_proto::client::v1alpha1::{
oblivious_query_service_client::ObliviousQueryServiceClient, ValidatorInfoRequest,
};
Expand Down
3 changes: 2 additions & 1 deletion crates/bin/pcli/src/command/view/tx.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use comfy_table::{presets, Table};
use penumbra_crypto::{asset::Cache, keys::IncomingViewingKey, Address, Note, NoteView, Value};
use penumbra_asset::{asset::Cache, Value};
use penumbra_crypto::{keys::IncomingViewingKey, Address, Note, NoteView};
use penumbra_dex::{
lp::position::Position,
swap::SwapPlaintext,
Expand Down
2 changes: 1 addition & 1 deletion crates/bin/pcli/src/dex_utils/replicate/debug.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use penumbra_crypto::fixpoint::U128x128;
use penumbra_dex::lp::position::Position;
use penumbra_dex::DirectedUnitPair;
use penumbra_num::fixpoint::U128x128;
use serde::Serialize;

#[derive(Serialize)]
Expand Down
3 changes: 2 additions & 1 deletion crates/bin/pcli/src/dex_utils/replicate/xyk.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::dex_utils::replicate::math_utils;
use ndarray::Array;
use penumbra_crypto::{fixpoint::U128x128, Amount, Value};
use penumbra_asset::Value;
use penumbra_dex::{
lp::{position::Position, Reserves},
DirectedUnitPair,
};
use penumbra_num::{fixpoint::U128x128, Amount};
use rand_core::OsRng;
use tracing::field;

Expand Down
5 changes: 3 additions & 2 deletions crates/bin/pcli/tests/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@

use ark_ff::UniformRand;
use decaf377::Fr;
use penumbra_asset::{asset, Balance, Value};
use penumbra_crypto::{
asset,
keys::{SeedPhrase, SpendKey},
proofs::groth16::{DelegatorVoteProof, NullifierDerivationProof, OutputProof, SpendProof},
rdsa::{self, SpendAuth, VerificationKey},
Amount, Balance, Fq, Note, Value,
Fq, Note,
};
use penumbra_dex::{
swap::proof::SwapProof, swap::SwapPlaintext, swap_claim::proof::SwapClaimProof,
BatchSwapOutputData, TradingPair,
};
use penumbra_fee::Fee;
use penumbra_num::Amount;
use penumbra_proof_params::{
DELEGATOR_VOTE_PROOF_PROVING_KEY, DELEGATOR_VOTE_PROOF_VERIFICATION_KEY,
NULLIFIER_DERIVATION_PROOF_PROVING_KEY, NULLIFIER_DERIVATION_PROOF_VERIFICATION_KEY,
Expand Down
1 change: 1 addition & 0 deletions crates/bin/pclientd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parallel = ["penumbra-crypto/parallel"]
penumbra-proto = { path = "../../proto", features = ["rpc"] }
penumbra-tct = { path = "../../crypto/tct" }
penumbra-crypto = { path = "../../core/crypto", features = ["parallel"] }
penumbra-asset = { path = "../../core/asset" }
penumbra-chain = { path = "../../core/component/chain" }
penumbra-transaction = { path = "../../core/transaction" }
penumbra-app = { path = "../../core/app" }
Expand Down
Loading

0 comments on commit b15059d

Please sign in to comment.