|
|
@@ -81,7 +81,7 @@ fn integration_test() -> Result<()> {
|
|
|
const PROPOSAL_AMOUNT: u64 = 250_000_000;
|
|
|
|
|
|
// Block height to verify against
|
|
|
- let current_block_height = 0;
|
|
|
+ let mut current_block_height = 0;
|
|
|
|
|
|
// DAO parameters
|
|
|
let dao_keypair = th.holders.get(&Holder::Dao).unwrap().keypair;
|
|
|
@@ -95,35 +95,12 @@ fn integration_test() -> Result<()> {
|
|
|
bulla_blind: Blind::random(&mut OsRng),
|
|
|
};
|
|
|
|
|
|
- // ====================
|
|
|
- // Dao::Mint
|
|
|
- // Create the DAO bulla
|
|
|
- // ====================
|
|
|
- info!("Stage 1. Creating DAO bulla");
|
|
|
-
|
|
|
- info!("[Dao] Building DAO mint tx");
|
|
|
- let (dao_mint_tx, dao_mint_params, fee_params) =
|
|
|
- th.dao_mint(&Holder::Alice, &dao, &dao_keypair, current_block_height).await?;
|
|
|
-
|
|
|
- for holder in &HOLDERS {
|
|
|
- info!("[{holder:?}] Executing DAO Mint tx");
|
|
|
- th.execute_dao_mint_tx(
|
|
|
- holder,
|
|
|
- dao_mint_tx.clone(),
|
|
|
- &dao_mint_params,
|
|
|
- &fee_params,
|
|
|
- current_block_height,
|
|
|
- true,
|
|
|
- )
|
|
|
- .await?;
|
|
|
- }
|
|
|
-
|
|
|
- th.assert_trees(&HOLDERS);
|
|
|
-
|
|
|
// =======================================
|
|
|
// Airdrop some treasury tokens to the DAO
|
|
|
// =======================================
|
|
|
info!("[Dao] Building DAO airdrop tx");
|
|
|
+ assert_eq!(current_block_height, 0);
|
|
|
+
|
|
|
let spend_hook =
|
|
|
FuncRef { contract_id: *DAO_CONTRACT_ID, func_code: DaoFunction::Exec as u8 }
|
|
|
.to_func_id();
|
|
|
@@ -133,7 +110,7 @@ fn integration_test() -> Result<()> {
|
|
|
&Holder::Dao,
|
|
|
DRK_TOKEN_SUPPLY,
|
|
|
Some(spend_hook),
|
|
|
- Some(dao_mint_params.dao_bulla.inner()),
|
|
|
+ Some(dao.to_bulla().inner()),
|
|
|
)
|
|
|
.await?;
|
|
|
|
|
|
@@ -155,6 +132,35 @@ fn integration_test() -> Result<()> {
|
|
|
assert!(_dao_tokens[0].note.token_id == *DARK_TOKEN_ID);
|
|
|
assert!(_dao_tokens[0].note.value == DRK_TOKEN_SUPPLY);
|
|
|
|
|
|
+ current_block_height += 1;
|
|
|
+
|
|
|
+ // ====================
|
|
|
+ // Dao::Mint
|
|
|
+ // Create the DAO bulla
|
|
|
+ // ====================
|
|
|
+ info!("Stage 1. Creating DAO bulla");
|
|
|
+
|
|
|
+ info!("[Dao] Building DAO mint tx");
|
|
|
+ let (dao_mint_tx, dao_mint_params, fee_params) =
|
|
|
+ th.dao_mint(&Holder::Alice, &dao, &dao_keypair, current_block_height).await?;
|
|
|
+
|
|
|
+ for holder in &HOLDERS {
|
|
|
+ info!("[{holder:?}] Executing DAO Mint tx");
|
|
|
+ th.execute_dao_mint_tx(
|
|
|
+ holder,
|
|
|
+ dao_mint_tx.clone(),
|
|
|
+ &dao_mint_params,
|
|
|
+ &fee_params,
|
|
|
+ current_block_height,
|
|
|
+ true,
|
|
|
+ )
|
|
|
+ .await?;
|
|
|
+ }
|
|
|
+
|
|
|
+ th.assert_trees(&HOLDERS);
|
|
|
+
|
|
|
+ current_block_height += 1;
|
|
|
+
|
|
|
// ======================================
|
|
|
// Mint the governance token to 3 holders
|
|
|
// ======================================
|
|
|
@@ -262,6 +268,8 @@ fn integration_test() -> Result<()> {
|
|
|
assert!(_charlie_tokens[0].note.token_id == gov_token_id);
|
|
|
assert!(_charlie_tokens[0].note.value == CHARLIE_GOV_SUPPLY);
|
|
|
|
|
|
+ current_block_height += 1;
|
|
|
+
|
|
|
// ================
|
|
|
// Dao::Propose
|
|
|
// Propose the vote
|
|
|
@@ -312,6 +320,8 @@ fn integration_test() -> Result<()> {
|
|
|
|
|
|
th.assert_trees(&HOLDERS);
|
|
|
|
|
|
+ current_block_height += 1;
|
|
|
+
|
|
|
// =====================================
|
|
|
// Dao::Vote
|
|
|
// Proposal is accepted. Start the vote.
|
|
|
@@ -459,6 +469,8 @@ fn integration_test() -> Result<()> {
|
|
|
pedersen_commitment_u64(total_yes_vote_value, total_yes_vote_blind)
|
|
|
);
|
|
|
|
|
|
+ current_block_height += 1;
|
|
|
+
|
|
|
// ================
|
|
|
// Dao::Exec
|
|
|
// Execute the vote
|