Struct abstract_sdk::apis::bank::Bank

source ·
pub struct Bank<'a, T: TransferInterface> { /* private fields */ }

Implementations§

Transfer the provided funds from the OS’ vault to the recipient. The caller must be a whitelisted module or trader.

use cosmwasm_std::{Addr, Response, StdResult, Deps, DepsMut, Env, MessageInfo};
use abstract_os::objects::AnsAsset;
use abstract_sdk::{
    TransferInterface
};


fn transfer_asset_to_sender(app: MockModule, deps: DepsMut, info: MessageInfo, requested_asset: AnsAsset) -> StdResult<Response> {
    // check that the caller has the rights to the asset
    // ...
    let bank = app.bank(deps.as_ref());

    let transfer_msg = bank.transfer(vec![requested_asset.clone()], &info.sender)?;

    Ok(Response::new()
        .add_message(transfer_msg)
        .add_attribute("recipient", info.sender)
        .add_attribute("asset_sent", requested_asset.to_string()))
}

Transfer coins from the OS’ vault to the recipient. The caller must be a whitelisted module or trader.

Transfer the funds (deposit) into the OS from the current contract.

Deposit coins into the OS

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.