provwasm-tutorial 0.1.2

A simple smart contract used for testing inside of the Provenance blockchain
Documentation
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use cosmwasm_std::{Addr, Decimal, Storage};
use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton};

pub static CONFIG_KEY: &[u8] = b"config";

/// Fields that comprise the smart contract state
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct State {
    // The required purchase denomination
    pub purchase_denom: String,
    // The merchant account
    pub merchant_address: Addr,
    // The fee collection account
    pub fee_collection_address: Addr,
    // The percentage to collect on transfers
    pub fee_percent: Decimal,
}

pub fn config(storage: &mut dyn Storage) -> Singleton<State> {
    singleton(storage, CONFIG_KEY)
}

pub fn config_read(storage: &dyn Storage) -> ReadonlySingleton<State> {
    singleton_read(storage, CONFIG_KEY)
}