Skip to content

Commit 205b63b

Browse files
committed
Add mint functionality
1 parent d60328b commit 205b63b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/cw0/src/handlers.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ pub trait Bank<S: Storage> {
2020
fn handle(&self, storage: &mut S, sender: HumanAddr, msg: BankMsg) -> Result<(), String>;
2121

2222
fn query(&self, storage: &S, request: BankQuery) -> Result<Binary, String>;
23+
24+
// this is an "admin" function to let us adjust bank accounts
25+
fn set_balance(
26+
&self,
27+
storage: &mut S,
28+
account: HumanAddr,
29+
amount: Vec<Coin>,
30+
) -> Result<(), String>;
2331
}
2432

2533
/// Interface to call into a Contract
@@ -373,6 +381,15 @@ where
373381
}
374382
}
375383

384+
// this is an "admin" function to let us adjust bank accounts
385+
pub fn set_bank_balance(&self, account: HumanAddr, amount: Vec<Coin>) -> Result<(), String> {
386+
let mut store = self
387+
.bank_store
388+
.try_borrow_mut()
389+
.map_err(|e| format!("Double-borrowing mutable storage - re-entrancy?: {}", e))?;
390+
self.bank.set_balance(&mut store, account, amount)
391+
}
392+
376393
pub fn execute(
377394
&mut self,
378395
sender: HumanAddr,

0 commit comments

Comments
 (0)