tari-project / tari-dan

BSD 3-Clause "New" or "Revised" License
7 stars 19 forks source link

feat(template_lib)!: new access rules macro #1176

Closed mrnaveira closed 1 month ago

mrnaveira commented 1 month ago

Description

Motivation and Context

We want a better way of constructing AccessRules. For example, to restrict a resource to be minted only by a specific component, we need something like:

ResourceBuilder::fungible()
                .mintable(AccessRule::Restricted(RestrictedAccessRule::Require(
                    RequireRule::Require(address.into()),
                )))

Instead, we want a new macro that allows us to build access rules in simpler and more readable way:

ResourceBuilder::fungible()
                .mintable(rule!(component(address)))

This PR adds a new macro rule! for this purpose. All variants of rules can be build as follows:

How Has This Been Tested?

What process can a PR reviewer use to test or verify this change?

See previous section

Breaking Changes

github-actions[bot] commented 1 month ago

Test Results (CI)

571 tests  +1   570 :white_check_mark: +1   3h 15m 47s :stopwatch: - 2m 28s  64 suites ±0     0 :zzz: ±0    2 files   ±0     1 :x: ±0 

For more details on these failures, see this check.

Results for commit 352baae3. ± Comparison against base commit 39c638bc.

:recycle: This comment has been updated with latest results.