Skip to content

Commit

Permalink
add DAO start date to config
Browse files Browse the repository at this point in the history
  • Loading branch information
hawthorne-abendsen committed Sep 24, 2024
1 parent 8ffba88 commit a05dc7f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "reflector-dao-contract"
version = "0.2.0"
version = "0.3.0"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl DAOContract {
// save the configuration
e.set_admin(&config.admin);
e.set_token(&config.token);
e.set_last_unlock(e.ledger().timestamp());
e.set_last_unlock(config.start_date);
//set deposit params
set_deposit(&e, config.deposit_params);
// transfer tokens to the DAO contract
Expand Down
16 changes: 15 additions & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ fn init_contract_with_admin<'a>() -> (Env, DAOContractClient<'a>, ContractConfig
(BallotCategory::AddPriceFeed, 100_000_0000000),
(BallotCategory::AddAsset, 5_000_0000000),
(BallotCategory::General, 10_000_0000000),
])
]),
start_date: 0,
};

//set admin
Expand Down Expand Up @@ -147,6 +148,19 @@ fn test() {
assert!(balance > 0);
});

env.as_contract(&client.address, || {
let last_unlock = env.get_last_unlock();
assert_eq!(last_unlock, UNLOCK_PERIOD as u64);
});

//unlock again
client.unlock(&developer, &operators);

env.as_contract(&client.address, || {
let last_unlock = env.get_last_unlock();
assert_eq!(last_unlock, (UNLOCK_PERIOD * 2) as u64);
});

let available = client.available(&developer);
assert!(available > 0);

Expand Down
4 changes: 3 additions & 1 deletion src/types/contract_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ pub struct ContractConfig {
/// Initial funding amount
pub amount: i128,
/// Initial deposit amounts for each ballot category
pub deposit_params: Map<BallotCategory, i128>
pub deposit_params: Map<BallotCategory, i128>,
/// DAO start date
pub start_date: u64
}

0 comments on commit a05dc7f

Please sign in to comment.