Crate cw_utils

Source
Expand description

This is a collection of common types shared among many specs. For example Expiration, which is embedded in many places.

Types should only be added here after they are duplicated in a second contract, not “because we might need it”

Structs§

MsgExecuteContractResponse
MsgInstantiateContractResponse
NativeBalance

Enums§

Duration
Duration is a delta of time. You can add it to a BlockInfo or Expiration to move that further in the future. Note that an height-based Duration and a time-based Expiration cannot be combined
Expiration
Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)
ParseReplyError
PaymentError
Scheduled
Scheduled represents a point in time when an event happens. It can compare with a BlockInfo and will return is_triggered() == true once the condition is hit (and for every block in the future)
Threshold
This defines the different ways tallies can happen.
ThresholdError
ThresholdResponse
This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.

Constants§

DAY
HOUR
WEEK

Functions§

calc_range_end
calc_range_start
calc_range_start_string
may_pay
Similar to must_pay, but it any payment is optional. Returns an error if a different denom was sent. Otherwise, returns the amount of denom sent, or 0 if nothing sent.
maybe_addr
maybe_canonical
must_pay
Requires exactly one denom sent, which matches the requested denom. Returns the amount if only one denom and non-zero amount. Errors otherwise.
nonpayable
returns an error if any coins were sent
one_coin
If exactly one coin was sent, returns it regardless of denom. Returns error if 0 or 2+ coins were sent
parse_execute_response_data
parse_instantiate_response_data