Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinCarabas committed Aug 19, 2024
1 parent f406d80 commit d7c4857
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
18 changes: 18 additions & 0 deletions contracts/potlock/interact-rs/src/potlock_interactor_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async fn main() {
"addAdmin" => interact.add_admin().await,
"removeAdmin" => interact.remove_admin().await,
"getAdmins" => interact.admins().await,
"getPotlocks" => interact.get_potlocks().await,
_ => panic!("unknown command: {}", &cmd),
}
}
Expand Down Expand Up @@ -515,4 +516,21 @@ impl ContractInteract {

println!("Result: {result_value:?}");
}

async fn get_potlocks(&mut self) {
let result_value = self
.interactor
.query()
.to(self.state.current_address())
.typed(proxy::PotlockProxy)
.potlocks()
.returns(ReturnsResultUnmanaged)
.prepare_async()
.run()
.await;

for pot in result_value.iter() {
println!("Result: {}", pot.name);
}
}
}
1 change: 0 additions & 1 deletion contracts/potlock/src/potlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub mod potlock_admin_interactions;
pub mod potlock_interactions;
pub mod potlock_storage;

/// An empty contract. To be used as a template when starting a new contract from scratch.
#[multiversx_sc::contract]
pub trait Potlock:
potlock_admin_interactions::PotlockAdminInteractions
Expand Down
2 changes: 1 addition & 1 deletion contracts/potlock/src/potlock_admin_interactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait PotlockAdminInteractions:
"Invalid token provided"
);
require!(
token_identifier.is_valid_esdt_identifier() && fee.ge(&BigUint::zero()),
token_identifier.is_valid_esdt_identifier() && fee.gt(&BigUint::zero()),
"Invalid token identifier or amount is 0"
);
self.fee_token_identifier().set(&token_identifier);
Expand Down

0 comments on commit d7c4857

Please sign in to comment.