diff --git a/packages/cw0/src/handlers.rs b/packages/cw0/src/handlers.rs index 79408eac7..27c6cfcdd 100644 --- a/packages/cw0/src/handlers.rs +++ b/packages/cw0/src/handlers.rs @@ -20,6 +20,14 @@ pub trait Bank { fn handle(&self, storage: &mut S, sender: HumanAddr, msg: BankMsg) -> Result<(), String>; fn query(&self, storage: &S, request: BankQuery) -> Result; + + // this is an "admin" function to let us adjust bank accounts + fn set_balance( + &self, + storage: &mut S, + account: HumanAddr, + amount: Vec, + ) -> Result<(), String>; } /// Interface to call into a Contract @@ -373,6 +381,15 @@ where } } + // this is an "admin" function to let us adjust bank accounts + pub fn set_bank_balance(&self, account: HumanAddr, amount: Vec) -> Result<(), String> { + let mut store = self + .bank_store + .try_borrow_mut() + .map_err(|e| format!("Double-borrowing mutable storage - re-entrancy?: {}", e))?; + self.bank.set_balance(&mut store, account, amount) + } + pub fn execute( &mut self, sender: HumanAddr,