RulesEngineClientERC20
Inherits: [RulesEngineClient](/v2(/v2/reference/client/RulesEngineClient.sol/abstract.RulesEngineClient)
Author: @mpetersoCode55, @ShaneDuncan602, @TJ-Everett, @VoR0220
This contract is intended to be inherited and implemented by ERC20 token contracts requiring Rules Engine integration.
Abstract contract containing modifiers and functions for integrating ERC20 token operations with the Rules Engine.
This contract provides policy checks for mint
, transfer
, and transferFrom
operations, both before and after execution.
Functions
checksPoliciesERC20TransferBefore
Modifier for checking policies before executing the transfer
function.
Calls the _checksPoliciesERC20Transfer
function to evaluate policies.
Parameters
Name | Type | Description |
---|---|---|
to | address | The receiving address. |
value | uint256 | The amount to transfer. |
balanceFrom | uint256 | The sender’s balance before the transfer. |
balanceTo | uint256 | The receiver’s balance before the transfer. |
blockTime | uint256 | The current block timestamp. |
checksPoliciesERC20TransferAfter
Modifier for checking policies after executing the transfer
function.
Calls the _checksPoliciesERC20Transfer
function to evaluate policies.
Parameters
Name | Type | Description |
---|---|---|
to | address | The receiving address. |
value | uint256 | The amount to transfer. |
balanceFrom | uint256 | The sender’s balance after the transfer. |
balanceTo | uint256 | The receiver’s balance after the transfer. |
blockTime | uint256 | The current block timestamp. |
checksPoliciesERC20TransferFromBefore
Modifier for checking policies before executing the transferFrom
function.
Calls the _checksPoliciesERC20TransferFrom
function to evaluate policies.
Parameters
Name | Type | Description |
---|---|---|
from | address | The sending address. |
to | address | The receiving address. |
value | uint256 | The amount to transfer. |
balanceFrom | uint256 | The sender’s balance before the transfer. |
balanceTo | uint256 | The receiver’s balance before the transfer. |
blockTime | uint256 | The current block timestamp. |
checksPoliciesERC20TransferFromAfter
Modifier for checking policies after executing the transferFrom
function.
Calls the _checksPoliciesERC20TransferFrom
function to evaluate policies.
Parameters
Name | Type | Description |
---|---|---|
from | address | The sending address. |
to | address | The receiving address. |
value | uint256 | The amount to transfer. |
balanceFrom | uint256 | The sender’s balance after the transfer. |
balanceTo | uint256 | The receiver’s balance after the transfer. |
blockTime | uint256 | The current block timestamp. |
checksPoliciesERC20MintBefore
Modifier for checking policies before executing the mint
function.
Calls the _checksPoliciesERC20Mint
function to evaluate policies.
Parameters
Name | Type | Description |
---|---|---|
to | address | The receiving address. |
amount | uint256 | The amount to mint. |
balanceFrom | uint256 | The sender’s balance before the mint. |
balanceTo | uint256 | The receiver’s balance before the mint. |
blockTime | uint256 | The current block timestamp. |
checksPoliciesERC20MintAfter
Modifier for checking policies after executing the mint
function.
Calls the _checksPoliciesERC20Mint
function to evaluate policies.
Parameters
Name | Type | Description |
---|---|---|
to | address | The receiving address. |
amount | uint256 | The amount to mint. |
balanceFrom | uint256 | The sender’s balance after the mint. |
balanceTo | uint256 | The receiver’s balance after the mint. |
blockTime | uint256 | The current block timestamp. |
_checksPoliciesERC20Transfer
Calls the Rules Engine to evaluate policies for an ERC20 transfer
operation.
Encodes the parameters and invokes the _invokeRulesEngine
function.
Parameters
Name | Type | Description |
---|---|---|
to | address | The receiving address. |
value | uint256 | The amount to transfer. |
balanceFrom | uint256 | The sender’s balance. |
balanceTo | uint256 | The receiver’s balance. |
blockTime | uint256 | The current block timestamp. |
_checksPoliciesERC20TransferFrom
Calls the Rules Engine to evaluate policies for an ERC20 transferFrom
operation.
Encodes the parameters and invokes the _invokeRulesEngine
function.
Parameters
Name | Type | Description |
---|---|---|
from | address | The sending address. |
to | address | The receiving address. |
value | uint256 | The amount to transfer. |
balanceFrom | uint256 | The sender’s balance. |
balanceTo | uint256 | The receiver’s balance. |
blockTime | uint256 | The current block timestamp. |
_checksPoliciesERC20Mint
Calls the Rules Engine to evaluate policies for an ERC20 mint
operation.
Encodes the parameters and invokes the _invokeRulesEngine
function.
Parameters
Name | Type | Description |
---|---|---|
to | address | The receiving address. |
amount | uint256 | The amount to mint. |
balanceFrom | uint256 | The sender’s balance. |
balanceTo | uint256 | The receiver’s balance. |
blockTime | uint256 | The current block timestamp. |