Skip to content

Commit

Permalink
Add mint functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Oct 19, 2020
1 parent d60328b commit 205b63b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/cw0/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ pub trait Bank<S: Storage> {
fn handle(&self, storage: &mut S, sender: HumanAddr, msg: BankMsg) -> Result<(), String>;

fn query(&self, storage: &S, request: BankQuery) -> Result<Binary, String>;

// this is an "admin" function to let us adjust bank accounts
fn set_balance(
&self,
storage: &mut S,
account: HumanAddr,
amount: Vec<Coin>,
) -> Result<(), String>;
}

/// Interface to call into a Contract
Expand Down Expand Up @@ -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<Coin>) -> 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,
Expand Down

0 comments on commit 205b63b

Please sign in to comment.