mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 22:57:59 -05:00
move TokenId from SDK to money contract
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2081,6 +2081,7 @@ dependencies = [
|
||||
"darkfi-serial",
|
||||
"getrandom 0.2.12",
|
||||
"halo2_proofs",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"rand 0.8.5",
|
||||
"simplelog",
|
||||
@@ -8184,6 +8185,7 @@ dependencies = [
|
||||
"ctrlc",
|
||||
"darkfi",
|
||||
"darkfi-sdk",
|
||||
"darkfi_money_contract",
|
||||
"rand 0.8.5",
|
||||
"rayon",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ use rodio::{source::Source, Decoder, OutputStream};
|
||||
use structopt_toml::clap::{App, Arg, Shell, SubCommand};
|
||||
|
||||
use darkfi::{cli_desc, system::sleep, util::parse::decode_base10, Error, Result};
|
||||
use darkfi_sdk::crypto::TokenId;
|
||||
use darkfi_money_contract::model::TokenId;
|
||||
|
||||
use crate::{money::BALANCE_BASE10_DECIMALS, Drk};
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ use darkfi_dao_contract::{
|
||||
DAO_CONTRACT_ZKAS_DAO_PROPOSE_MAIN_NS, DAO_CONTRACT_ZKAS_DAO_VOTE_INPUT_NS,
|
||||
DAO_CONTRACT_ZKAS_DAO_VOTE_MAIN_NS,
|
||||
};
|
||||
use darkfi_money_contract::{client::OwnCoin, MoneyFunction};
|
||||
use darkfi_money_contract::{client::OwnCoin, model::TokenId, MoneyFunction};
|
||||
use darkfi_sdk::{
|
||||
bridgetree,
|
||||
crypto::{
|
||||
poseidon_hash,
|
||||
util::{fp_mod_fv, fp_to_u64},
|
||||
FuncId, FuncRef, Keypair, MerkleNode, MerkleTree, PublicKey, SecretKey, TokenId,
|
||||
DAO_CONTRACT_ID, MONEY_CONTRACT_ID,
|
||||
FuncId, FuncRef, Keypair, MerkleNode, MerkleTree, PublicKey, SecretKey, DAO_CONTRACT_ID,
|
||||
MONEY_CONTRACT_ID,
|
||||
},
|
||||
pasta::pallas,
|
||||
ContractCall,
|
||||
|
||||
@@ -42,9 +42,9 @@ use darkfi::{
|
||||
zk::halo2::Field,
|
||||
Result,
|
||||
};
|
||||
use darkfi_money_contract::model::Coin;
|
||||
use darkfi_money_contract::model::{Coin, TokenId};
|
||||
use darkfi_sdk::{
|
||||
crypto::{FuncId, PublicKey, SecretKey, TokenId},
|
||||
crypto::{FuncId, PublicKey, SecretKey},
|
||||
pasta::{group::ff::PrimeField, pallas},
|
||||
};
|
||||
use darkfi_serial::{deserialize, serialize};
|
||||
|
||||
@@ -25,14 +25,16 @@ use rusqlite::types::Value;
|
||||
use darkfi::{tx::Transaction, zk::halo2::Field, Error, Result};
|
||||
use darkfi_money_contract::{
|
||||
client::{MoneyNote, OwnCoin},
|
||||
model::{Coin, MoneyTokenFreezeParamsV1, MoneyTokenMintParamsV1, MoneyTransferParamsV1},
|
||||
model::{
|
||||
Coin, MoneyTokenFreezeParamsV1, MoneyTokenMintParamsV1, MoneyTransferParamsV1, TokenId,
|
||||
},
|
||||
MoneyFunction,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
bridgetree,
|
||||
crypto::{
|
||||
note::AeadEncryptedNote, poseidon_hash, FuncId, Keypair, MerkleNode, MerkleTree, Nullifier,
|
||||
PublicKey, SecretKey, TokenId, MONEY_CONTRACT_ID,
|
||||
PublicKey, SecretKey, MONEY_CONTRACT_ID,
|
||||
},
|
||||
pasta::pallas,
|
||||
};
|
||||
|
||||
@@ -28,13 +28,13 @@ use darkfi::{
|
||||
};
|
||||
use darkfi_money_contract::{
|
||||
client::{swap_v1::SwapCallBuilder, MoneyNote},
|
||||
model::{Coin, MoneyTransferParamsV1},
|
||||
model::{Coin, MoneyTransferParamsV1, TokenId},
|
||||
MoneyFunction, MONEY_CONTRACT_ZKAS_BURN_NS_V1, MONEY_CONTRACT_ZKAS_MINT_NS_V1,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
contract_id::MONEY_CONTRACT_ID, pedersen::pedersen_commitment_u64, poseidon_hash, FuncId,
|
||||
PublicKey, SecretKey, TokenId,
|
||||
PublicKey, SecretKey,
|
||||
},
|
||||
pasta::pallas,
|
||||
tx::ContractCall,
|
||||
|
||||
@@ -31,14 +31,14 @@ use darkfi_money_contract::{
|
||||
auth_token_mint_v1::AuthTokenMintCallBuilder, token_freeze_v1::TokenFreezeCallBuilder,
|
||||
token_mint_v1::TokenMintCallBuilder,
|
||||
},
|
||||
model::{CoinAttributes, TokenAttributes},
|
||||
model::{CoinAttributes, TokenAttributes, TokenId},
|
||||
MoneyFunction, MONEY_CONTRACT_ZKAS_AUTH_TOKEN_MINT_NS_V1, MONEY_CONTRACT_ZKAS_TOKEN_FRZ_NS_V1,
|
||||
MONEY_CONTRACT_ZKAS_TOKEN_MINT_NS_V1,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
contract_id::MONEY_CONTRACT_ID, pasta_prelude::*, FuncId, FuncRef, Keypair, PublicKey,
|
||||
SecretKey, TokenId,
|
||||
SecretKey,
|
||||
},
|
||||
dark_tree::DarkLeaf,
|
||||
pasta::pallas,
|
||||
|
||||
@@ -27,10 +27,11 @@ use darkfi::{
|
||||
};
|
||||
use darkfi_money_contract::{
|
||||
client::{transfer_v1::make_transfer_call, OwnCoin},
|
||||
model::TokenId,
|
||||
MoneyFunction, MONEY_CONTRACT_ZKAS_BURN_NS_V1, MONEY_CONTRACT_ZKAS_MINT_NS_V1,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{contract_id::MONEY_CONTRACT_ID, FuncId, Keypair, PublicKey, TokenId},
|
||||
crypto::{contract_id::MONEY_CONTRACT_ID, FuncId, Keypair, PublicKey},
|
||||
tx::ContractCall,
|
||||
};
|
||||
use darkfi_serial::Encodable;
|
||||
|
||||
@@ -14,5 +14,6 @@ bs58 = "0.5.0"
|
||||
ctrlc = "3.4.2"
|
||||
darkfi = {path = "../../", features = ["util"]}
|
||||
darkfi-sdk = {path = "../../src/sdk"}
|
||||
darkfi_money_contract = {path = "../../src/contract/money", features = ["no-entrypoint", "client"]}
|
||||
rand = "0.8.5"
|
||||
rayon = "1.8.0"
|
||||
|
||||
@@ -24,7 +24,8 @@ use std::{
|
||||
|
||||
use arg::Args;
|
||||
use darkfi::{util::cli::ProgressInc, ANSI_LOGO};
|
||||
use darkfi_sdk::crypto::{ContractId, PublicKey, SecretKey, TokenId};
|
||||
use darkfi_money_contract::model::TokenId;
|
||||
use darkfi_sdk::crypto::{ContractId, PublicKey, SecretKey};
|
||||
use rand::rngs::OsRng;
|
||||
use rayon::iter::ParallelIterator;
|
||||
|
||||
|
||||
@@ -22,12 +22,14 @@ use darkfi::{
|
||||
Result,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{PublicKey, SecretKey, TokenId},
|
||||
crypto::{PublicKey, SecretKey},
|
||||
pasta::pallas,
|
||||
};
|
||||
use log::debug;
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
use darkfi_money_contract::model::TokenId;
|
||||
|
||||
use crate::model::{Dao, DaoMintParams};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
|
||||
use core::str::FromStr;
|
||||
|
||||
use darkfi_money_contract::model::TokenId;
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
note::{AeadEncryptedNote, ElGamalEncryptedNote},
|
||||
pasta_prelude::*,
|
||||
poseidon_hash, MerkleNode, Nullifier, PublicKey, TokenId,
|
||||
poseidon_hash, MerkleNode, Nullifier, PublicKey,
|
||||
},
|
||||
error::ContractError,
|
||||
pasta::pallas,
|
||||
|
||||
@@ -23,7 +23,7 @@ use darkfi_dao_contract::{
|
||||
DaoFunction,
|
||||
};
|
||||
use darkfi_money_contract::{
|
||||
model::{CoinAttributes, TokenAttributes},
|
||||
model::{CoinAttributes, TokenAttributes, DARK_TOKEN_ID},
|
||||
MoneyFunction,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
@@ -31,7 +31,7 @@ use darkfi_sdk::{
|
||||
pasta_prelude::*,
|
||||
pedersen_commitment_u64, poseidon_hash,
|
||||
util::{fp_mod_fv, fp_to_u64},
|
||||
FuncId, FuncRef, DAO_CONTRACT_ID, DARK_TOKEN_ID, MONEY_CONTRACT_ID,
|
||||
FuncId, FuncRef, DAO_CONTRACT_ID, MONEY_CONTRACT_ID,
|
||||
},
|
||||
pasta::pallas,
|
||||
};
|
||||
|
||||
@@ -23,6 +23,9 @@ halo2_proofs = { version = "0.3.0", optional = true }
|
||||
log = { version = "0.4.20", optional = true }
|
||||
rand = { version = "0.8.5", optional = true }
|
||||
|
||||
# Misc
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
# These are used just for the integration tests
|
||||
[dev-dependencies]
|
||||
smol = "1.3.0"
|
||||
|
||||
@@ -32,7 +32,7 @@ use darkfi_sdk::{
|
||||
note::AeadEncryptedNote,
|
||||
pasta_prelude::{Curve, CurveAffine, Field},
|
||||
pedersen_commitment_u64, poseidon_hash, FuncId, Keypair, MerkleNode, MerkleTree, Nullifier,
|
||||
PublicKey, SecretKey, DARK_TOKEN_ID,
|
||||
PublicKey, SecretKey,
|
||||
},
|
||||
pasta::pallas,
|
||||
};
|
||||
@@ -41,7 +41,7 @@ use rand::rngs::OsRng;
|
||||
|
||||
use crate::{
|
||||
client::{compute_remainder_blind, Coin, MoneyNote, OwnCoin},
|
||||
model::{CoinAttributes, Input, MoneyFeeParamsV1, NullifierAttributes, Output},
|
||||
model::{CoinAttributes, Input, MoneyFeeParamsV1, NullifierAttributes, Output, DARK_TOKEN_ID},
|
||||
};
|
||||
|
||||
/// Append a fee-paying call to the given `TransactionBuilder`.
|
||||
|
||||
@@ -22,9 +22,7 @@ use darkfi::{
|
||||
Result,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
note::AeadEncryptedNote, pasta_prelude::*, FuncId, Keypair, PublicKey, DARK_TOKEN_ID,
|
||||
},
|
||||
crypto::{note::AeadEncryptedNote, pasta_prelude::*, FuncId, Keypair, PublicKey},
|
||||
pasta::pallas,
|
||||
};
|
||||
use log::{debug, info};
|
||||
@@ -37,7 +35,7 @@ use crate::{
|
||||
},
|
||||
MoneyNote,
|
||||
},
|
||||
model::{ClearInput, Coin, MoneyGenesisMintParamsV1, Output},
|
||||
model::{ClearInput, Coin, MoneyGenesisMintParamsV1, Output, DARK_TOKEN_ID},
|
||||
};
|
||||
|
||||
pub struct GenesisMintCallDebris {
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
|
||||
use darkfi_sdk::{
|
||||
bridgetree,
|
||||
crypto::{FuncId, Nullifier, SecretKey, TokenId},
|
||||
crypto::{FuncId, Nullifier, SecretKey},
|
||||
pasta::pallas,
|
||||
};
|
||||
use darkfi_serial::{async_trait, SerialDecodable, SerialEncodable};
|
||||
|
||||
use crate::model::Coin;
|
||||
use crate::model::{Coin, TokenId};
|
||||
|
||||
/// `Money::FeeV1` API
|
||||
pub mod fee_v1;
|
||||
|
||||
@@ -25,7 +25,6 @@ use darkfi_sdk::{
|
||||
blockchain::expected_reward,
|
||||
crypto::{
|
||||
ecvrf::VrfProof, note::AeadEncryptedNote, pasta_prelude::*, FuncId, PublicKey, SecretKey,
|
||||
DARK_TOKEN_ID,
|
||||
},
|
||||
pasta::pallas,
|
||||
};
|
||||
@@ -39,7 +38,7 @@ use crate::{
|
||||
},
|
||||
MoneyNote,
|
||||
},
|
||||
model::{ClearInput, Coin, MoneyPoWRewardParamsV1, Output},
|
||||
model::{ClearInput, Coin, MoneyPoWRewardParamsV1, Output, DARK_TOKEN_ID},
|
||||
};
|
||||
|
||||
pub struct PoWRewardCallDebris {
|
||||
|
||||
@@ -24,10 +24,7 @@ use darkfi::{
|
||||
ClientFailed, Result,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
note::AeadEncryptedNote, pasta_prelude::*, FuncId, MerkleTree, PublicKey, SecretKey,
|
||||
TokenId,
|
||||
},
|
||||
crypto::{note::AeadEncryptedNote, pasta_prelude::*, FuncId, MerkleTree, PublicKey, SecretKey},
|
||||
pasta::pallas,
|
||||
};
|
||||
use darkfi_serial::serialize;
|
||||
@@ -42,7 +39,7 @@ use crate::{
|
||||
},
|
||||
MoneyNote, OwnCoin,
|
||||
},
|
||||
model::{Input, MoneyTransferParamsV1, Output},
|
||||
model::{Input, MoneyTransferParamsV1, Output, TokenId},
|
||||
};
|
||||
|
||||
pub struct SwapCallDebris {
|
||||
|
||||
@@ -24,7 +24,6 @@ use darkfi_sdk::{
|
||||
bridgetree,
|
||||
crypto::{
|
||||
note::AeadEncryptedNote, pasta_prelude::*, MerkleNode, Nullifier, PublicKey, SecretKey,
|
||||
TokenId,
|
||||
},
|
||||
pasta::pallas,
|
||||
};
|
||||
@@ -34,7 +33,7 @@ use rand::rngs::OsRng;
|
||||
use super::proof::{create_transfer_burn_proof, create_transfer_mint_proof};
|
||||
use crate::{
|
||||
client::{compute_remainder_blind, MoneyNote, OwnCoin},
|
||||
model::{ClearInput, CoinAttributes, Input, MoneyTransferParamsV1, Output},
|
||||
model::{ClearInput, CoinAttributes, Input, MoneyTransferParamsV1, Output, TokenId},
|
||||
};
|
||||
|
||||
/// Struct holding necessary information to build a `Money::TransferV1` contract call.
|
||||
|
||||
@@ -17,13 +17,16 @@
|
||||
*/
|
||||
use darkfi::{zk::ProvingKey, zkas::ZkBinary, ClientFailed, Result};
|
||||
use darkfi_sdk::{
|
||||
crypto::{pasta_prelude::*, FuncId, Keypair, MerkleTree, PublicKey, TokenId},
|
||||
crypto::{pasta_prelude::*, FuncId, Keypair, MerkleTree, PublicKey},
|
||||
pasta::pallas,
|
||||
};
|
||||
use log::{debug, error};
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
use crate::{client::OwnCoin, model::MoneyTransferParamsV1};
|
||||
use crate::{
|
||||
client::OwnCoin,
|
||||
model::{MoneyTransferParamsV1, TokenId},
|
||||
};
|
||||
|
||||
mod builder;
|
||||
pub use builder::{
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, MerkleNode,
|
||||
PublicKey, DARK_TOKEN_ID,
|
||||
pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, MerkleNode, PublicKey,
|
||||
},
|
||||
dark_tree::DarkLeaf,
|
||||
db::{db_contains_key, db_get, db_lookup, db_set},
|
||||
@@ -32,7 +31,7 @@ use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
|
||||
|
||||
use crate::{
|
||||
error::MoneyError,
|
||||
model::{MoneyFeeParamsV1, MoneyFeeUpdateV1},
|
||||
model::{MoneyFeeParamsV1, MoneyFeeUpdateV1, DARK_TOKEN_ID},
|
||||
MoneyFunction, MONEY_CONTRACT_COINS_TREE, MONEY_CONTRACT_COIN_MERKLE_TREE,
|
||||
MONEY_CONTRACT_COIN_ROOTS_TREE, MONEY_CONTRACT_INFO_TREE, MONEY_CONTRACT_LATEST_COIN_ROOT,
|
||||
MONEY_CONTRACT_NULLIFIERS_TREE, MONEY_CONTRACT_TOTAL_FEES_PAID, MONEY_CONTRACT_ZKAS_FEE_NS_V1,
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
*/
|
||||
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, MerkleNode,
|
||||
DARK_TOKEN_ID,
|
||||
},
|
||||
crypto::{pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, MerkleNode},
|
||||
dark_tree::DarkLeaf,
|
||||
db::{db_contains_key, db_lookup, db_set},
|
||||
error::{ContractError, ContractResult},
|
||||
@@ -33,7 +30,7 @@ use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
|
||||
|
||||
use crate::{
|
||||
error::MoneyError,
|
||||
model::{MoneyGenesisMintParamsV1, MoneyGenesisMintUpdateV1},
|
||||
model::{MoneyGenesisMintParamsV1, MoneyGenesisMintUpdateV1, DARK_TOKEN_ID},
|
||||
MoneyFunction, MONEY_CONTRACT_COINS_TREE, MONEY_CONTRACT_COIN_MERKLE_TREE,
|
||||
MONEY_CONTRACT_COIN_ROOTS_TREE, MONEY_CONTRACT_INFO_TREE, MONEY_CONTRACT_LATEST_COIN_ROOT,
|
||||
MONEY_CONTRACT_ZKAS_MINT_NS_V1,
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
|
||||
use darkfi_sdk::{
|
||||
blockchain::expected_reward,
|
||||
crypto::{
|
||||
pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, MerkleNode,
|
||||
DARK_TOKEN_ID,
|
||||
},
|
||||
crypto::{pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, MerkleNode},
|
||||
dark_tree::DarkLeaf,
|
||||
db::{db_contains_key, db_lookup, db_set},
|
||||
error::{ContractError, ContractResult},
|
||||
@@ -34,7 +31,7 @@ use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
|
||||
|
||||
use crate::{
|
||||
error::MoneyError,
|
||||
model::{MoneyPoWRewardParamsV1, MoneyPoWRewardUpdateV1},
|
||||
model::{MoneyPoWRewardParamsV1, MoneyPoWRewardUpdateV1, DARK_TOKEN_ID},
|
||||
MoneyFunction, MONEY_CONTRACT_COINS_TREE, MONEY_CONTRACT_COIN_MERKLE_TREE,
|
||||
MONEY_CONTRACT_COIN_ROOTS_TREE, MONEY_CONTRACT_INFO_TREE, MONEY_CONTRACT_LATEST_COIN_ROOT,
|
||||
MONEY_CONTRACT_ZKAS_MINT_NS_V1,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
pasta_prelude::*, pedersen_commitment_u64, poseidon_hash, ContractId, FuncId, FuncRef,
|
||||
MerkleNode, PublicKey, DARK_TOKEN_ID,
|
||||
MerkleNode, PublicKey,
|
||||
},
|
||||
dark_tree::DarkLeaf,
|
||||
db::{db_contains_key, db_get, db_lookup, db_set},
|
||||
@@ -32,7 +32,7 @@ use darkfi_serial::{deserialize, serialize, Encodable, WriteExt};
|
||||
|
||||
use crate::{
|
||||
error::MoneyError,
|
||||
model::{MoneyTransferParamsV1, MoneyTransferUpdateV1},
|
||||
model::{MoneyTransferParamsV1, MoneyTransferUpdateV1, DARK_TOKEN_ID},
|
||||
MoneyFunction, MONEY_CONTRACT_COINS_TREE, MONEY_CONTRACT_COIN_MERKLE_TREE,
|
||||
MONEY_CONTRACT_COIN_ROOTS_TREE, MONEY_CONTRACT_FAUCET_PUBKEYS, MONEY_CONTRACT_INFO_TREE,
|
||||
MONEY_CONTRACT_LATEST_COIN_ROOT, MONEY_CONTRACT_NULLIFIERS_TREE,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use darkfi_sdk::{
|
||||
crypto::{
|
||||
ecvrf::VrfProof, note::AeadEncryptedNote, pasta_prelude::PrimeField, poseidon_hash, FuncId,
|
||||
MerkleNode, Nullifier, PublicKey, SecretKey, TokenId,
|
||||
MerkleNode, Nullifier, PublicKey, SecretKey,
|
||||
},
|
||||
error::ContractError,
|
||||
pasta::pallas,
|
||||
@@ -29,6 +29,10 @@ use darkfi_serial::{SerialDecodable, SerialEncodable};
|
||||
#[cfg(feature = "client")]
|
||||
use darkfi_serial::async_trait;
|
||||
|
||||
/// Token ID definitions and methods
|
||||
pub mod token_id;
|
||||
pub use token_id::{TokenId, DARK_TOKEN_ID};
|
||||
|
||||
/// A `Coin` represented in the Money state
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq, SerialEncodable, SerialDecodable)]
|
||||
pub struct Coin(pallas::Base);
|
||||
@@ -16,14 +16,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#[cfg(feature = "async")]
|
||||
use darkfi_serial::async_trait;
|
||||
use darkfi_sdk::{crypto::pasta_prelude::PrimeField, error::ContractError, pasta::pallas};
|
||||
use darkfi_serial::{SerialDecodable, SerialEncodable};
|
||||
use lazy_static::lazy_static;
|
||||
use pasta_curves::{group::ff::PrimeField, pallas};
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
use darkfi_serial::async_trait;
|
||||
|
||||
use super::{poseidon_hash, PublicKey, SecretKey};
|
||||
use crate::error::ContractError;
|
||||
|
||||
lazy_static! {
|
||||
// The idea here is that 0 is not a valid x coordinate for any pallas point,
|
||||
@@ -93,6 +93,6 @@ impl TokenId {
|
||||
}
|
||||
|
||||
use core::str::FromStr;
|
||||
crate::fp_from_bs58!(TokenId);
|
||||
crate::fp_to_bs58!(TokenId);
|
||||
crate::ty_from_fp!(TokenId);
|
||||
darkfi_sdk::fp_from_bs58!(TokenId);
|
||||
darkfi_sdk::fp_to_bs58!(TokenId);
|
||||
darkfi_sdk::ty_from_fp!(TokenId);
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
use darkfi::Result;
|
||||
use darkfi_contract_test_harness::{init_logger, Holder, TestHarness, TxAction};
|
||||
use darkfi_sdk::crypto::DARK_TOKEN_ID;
|
||||
use darkfi_money_contract::model::DARK_TOKEN_ID;
|
||||
use log::info;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
|
||||
use darkfi::Result;
|
||||
use darkfi_contract_test_harness::{init_logger, Holder, TestHarness};
|
||||
use darkfi_sdk::{blockchain::expected_reward, crypto::DARK_TOKEN_ID};
|
||||
use darkfi_money_contract::model::DARK_TOKEN_ID;
|
||||
use darkfi_sdk::blockchain::expected_reward;
|
||||
use log::info;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -25,11 +25,11 @@ use darkfi::{
|
||||
};
|
||||
use darkfi_money_contract::{
|
||||
client::{transfer_v1 as xfer, OwnCoin},
|
||||
model::MoneyTransferParamsV1,
|
||||
model::{MoneyTransferParamsV1, DARK_TOKEN_ID},
|
||||
MoneyFunction, MONEY_CONTRACT_ZKAS_BURN_NS_V1, MONEY_CONTRACT_ZKAS_MINT_NS_V1,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{FuncId, MerkleNode, DARK_TOKEN_ID, MONEY_CONTRACT_ID},
|
||||
crypto::{FuncId, MerkleNode, MONEY_CONTRACT_ID},
|
||||
pasta::pallas,
|
||||
ContractCall,
|
||||
};
|
||||
|
||||
@@ -24,11 +24,11 @@ use darkfi::{
|
||||
};
|
||||
use darkfi_money_contract::{
|
||||
client::{transfer_v1::make_transfer_call, OwnCoin},
|
||||
model::MoneyTransferParamsV1,
|
||||
model::{MoneyTransferParamsV1, TokenId},
|
||||
MoneyFunction, MONEY_CONTRACT_ZKAS_BURN_NS_V1, MONEY_CONTRACT_ZKAS_MINT_NS_V1,
|
||||
};
|
||||
use darkfi_sdk::{
|
||||
crypto::{MerkleNode, TokenId, MONEY_CONTRACT_ID},
|
||||
crypto::{MerkleNode, MONEY_CONTRACT_ID},
|
||||
ContractCall,
|
||||
};
|
||||
use darkfi_serial::{serialize, Encodable};
|
||||
|
||||
@@ -38,10 +38,6 @@ pub use contract_id::{ContractId, DAO_CONTRACT_ID, DEPLOYOOOR_CONTRACT_ID, MONEY
|
||||
pub mod func_ref;
|
||||
pub use func_ref::{FuncId, FuncRef};
|
||||
|
||||
/// Token ID definitions and methods
|
||||
pub mod token_id;
|
||||
pub use token_id::{TokenId, DARK_TOKEN_ID};
|
||||
|
||||
/// Merkle node definitions
|
||||
pub mod merkle_node;
|
||||
pub use merkle_node::{MerkleNode, MerkleTree};
|
||||
|
||||
Reference in New Issue
Block a user