Git Source

Inherits: [RulesEngineClient](/v2(/v2/reference/client/RulesEngineClient.sol/abstract.RulesEngineClient), Ownable

Author: @mpetersoCode55, @ShaneDuncan602, @TJ-Everett, @VoR0220

SPDX-License-Identifier: BUSL-1.1

This contract showcases the Rules Engine’s ability to enforce policies on external contract functions while leveraging ownership-based access control.

This contract demonstrates how to integrate the Rules Engine with an external contract that uses OpenZeppelin’s Ownable for access control. It provides a generic transfer function that interacts with the Rules Engine to enforce policies. This contract is intended for testing and demonstration purposes.

Functions

constructor

Constructor for the Example User Ownable Contract.

Initializes the contract with an initial owner.

constructor(address initialOwner) Ownable(initialOwner);

Parameters

NameTypeDescription
initialOwneraddressThe address to be set as the initial owner of the contract.

transfer

Demonstrates a generic transfer function integrated with the Rules Engine.

This function sends custom arguments to the Rules Engine for policy enforcement. The Rules Engine determines whether the transfer is allowed based on the provided arguments.

function transfer(address to, uint256 value) public returns (bool);

Parameters

NameTypeDescription
toaddressThe recipient address.
valueuint256The amount to transfer.

Returns

NameTypeDescription
<none>boolbool True if the transfer is allowed by the Rules Engine, false otherwise.