Skip to content

Commit

Permalink
rename to _hook
Browse files Browse the repository at this point in the history
  • Loading branch information
amityadav0 committed Sep 20, 2023
1 parent f7ebf13 commit 33ec660
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions astra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl Contract {
/// Check for authorities and remove proposal
/// * `id`: proposal id
/// TODO: Add events for veto and dissolve
pub fn veto(&mut self, id: u64) {
pub fn veto_hook(&mut self, id: u64) {
let policy = self.assert_policy();
let res = policy.can_execute_hook(UserInfo {
amount: 0u128,
Expand All @@ -176,7 +176,7 @@ impl Contract {
/// Dissolves the DAO by removing all members, closing all active proposals and returning bonds.
/// Transfers all reminding funds to the trust.
/// Panics if policy doesn't exist or accound is not authorised to execute dissolve
pub fn dissolve(&mut self) {
pub fn dissolve_hook(&mut self) {
let mut policy = self.assert_policy();
let res = policy.can_execute_hook(UserInfo {
amount: 0u128,
Expand Down Expand Up @@ -497,7 +497,7 @@ mod tests {

context.predecessor_account_id = council_of_advisors();
testing_env!(context);
contract.veto(id);
contract.veto_hook(id);

contract.get_proposal(id);
// TODO: this should not panic, instead return NONE
Expand All @@ -508,7 +508,7 @@ mod tests {
fn test_veto_unauthorised() {
let (_, mut contract, id)= setup_ctr();
assert_eq!(contract.get_proposal(id).id, id);
contract.veto(id);
contract.veto_hook(id);
}

#[test]
Expand All @@ -522,7 +522,7 @@ mod tests {

context.predecessor_account_id = acc_voting_body();
testing_env!(context.clone());
contract.dissolve();
contract.dissolve_hook();
res = contract.policy.get().unwrap().to_policy();
assert!(res.roles.is_empty());

Expand Down Expand Up @@ -561,7 +561,7 @@ mod tests {
// Voting body vetos
context.predecessor_account_id = council_of_advisors();
testing_env!(context.clone());
contract.veto(id);
contract.veto_hook(id);

// no more members should be able to vote
context.predecessor_account_id = council(4);
Expand All @@ -580,7 +580,7 @@ mod tests {

context.predecessor_account_id = acc_voting_body();
testing_env!(context.clone());
contract.dissolve();
contract.dissolve_hook();
res = contract.policy.get().unwrap().to_policy();
assert!(res.roles.is_empty());

Expand Down

0 comments on commit 33ec660

Please sign in to comment.