#cosmwasm #blockchain #cw-simple-assets

cw-simple-assets

Helpers to work with native and cw20 tokens in CosmWasm contracts

3 stable releases

new 1.0.2 Apr 15, 2025
1.0.1 Apr 10, 2025

#685 in Magic Beans

Download history 248/week @ 2025-04-08

248 downloads per month

Apache-2.0

12KB
267 lines

cw-simple-assets

Helpers to work with native and cw20 tokens in CosmWasm contracts

Features

Usage

use cosmwasm_std::{DepsMut, Env, MessageInfo, Response, StdResult, Uint128};
use cw_simple_assets::{check_funds, FundsType};

pub fn try_deposit(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    sender: Option<String>,
    amount: Option<Uint128>,
) -> Result<Response, ContractError> {
    let (sender_address, asset_amount, asset_info) =
        check_funds(deps.as_ref(), &info, FundsType::Single { sender, amount })?;

    // ...
}

Licenses

This repo is licensed under Apache 2.0.

Dependencies

~4–7.5MB
~159K SLoC