Skip to content

M-Daeva/cw-simple-assets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cw-simple-assets

Helpers to work with native and cw20 tokens in CosmWasm contracts

Features

  • Types for native and cw20 tokens
  • Validation for native and cw20 tokens sent to a contract

Usage

use cosmwasm_std::{DepsMut, Env, MessageInfo, Response, StdResult, Uint128};
use cw_simple_assets::{Funds, InfoResp};

pub fn try_deposit(
    deps: DepsMut,
    env: Env,
    info: MessageInfo,
    sender: Option<String>,
    amount: Option<Uint128>,
) -> Result<Response, ContractError> {
    let InfoResp {
            sender,
            asset_amount,
            asset_token,
        } = Funds::single(sender, amount).check(&deps.api, &info)?;

    // ...
}

Licenses

This repo is licensed under Apache 2.0.

About

Helpers to work with native and CW20 tokens in CosmWasm contracts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages