#rules #condition #tasks #contract #cosmwasm #status #cron-cat

cw-rules-core

CronCat rules logic for tasks that require conditions

3 releases

0.1.2 Dec 12, 2022
0.1.1 Oct 18, 2022
0.1.0 Oct 17, 2022

#15 in #cron-cat


Used in cw-croncat-core

MIT/Apache

12KB
93 lines

CwRules core

This CosmWasm based library provides types and messages for rules contract. It is used in both CronCat Manager contract and CronCat Agent for checking the status of tasks with rules. Tasks with rules are executed only if all rules succeed, hence agents and manager contract must query rules contract.

QueryMsg defines several option for rules conditions.

RuleResponse<T> = (bool, T) allows to return boolean result for the query together with some optional specification about the rule failure/success.

Queries

GetBalance queries balance of the address.

GetCw20Balance queries cw20 balance of the address for the specified cw20_contract.

HasBalanceGte checks whether the address has at least required_balance (might be both native and cw20)

CheckOwnerOfNft checks whether the address owns the NFT.

CheckProposalStatus checks whether DAO DAO proposal has passed.

QueryConstruct checks a vector of rules, in case of failure returns false and the index of the failed rule.

GenericQuery is used for creating queries with generic rules, see generic-query crate for details.

Dependencies

~3.5–5.5MB
~117K SLoC