@@ -10,7 +10,7 @@ import { ModeCode } from "../utils/Types.sol";
1010 * @title ERC1155BalanceChangeEnforcer
1111 * @dev This contract allows setting up some guardrails around balance changes. By specifying an amount and a direction
1212 * (decrease/increase), one can enforce a maximum decrease or minimum increase in after-execution balance.
13- * The change can be either a decrease or increase based on the `isDecrease ` flag.
13+ * The change can be either a decrease or increase based on the `enforceDecrease ` flag.
1414 * @dev This contract has no enforcement of how the balance changes. It's meant to be used alongside additional enforcers to
1515 * create granular permissions.
1616 * @dev This enforcer operates only in default execution mode.
@@ -61,7 +61,7 @@ contract ERC1155BalanceChangeEnforcer is CaveatEnforcer {
6161 * - next 20 bytes: address of the recipient
6262 * - next 32 bytes: token ID
6363 * - next 32 bytes: balance change guardrail amount (i.e., minimum increase OR maximum decrease, depending on
64- * isDecrease )
64+ * enforceDecrease )
6565 * @param _mode The execution mode. (Must be Default execType)
6666 * @param _delegationHash The hash of the delegation.
6767 */
@@ -94,7 +94,7 @@ contract ERC1155BalanceChangeEnforcer is CaveatEnforcer {
9494 * - next 20 bytes: address of the recipient
9595 * - next 32 bytes: token ID
9696 * - next 32 bytes: balance change guardrail amount (i.e., minimum increase OR maximum decrease, depending on
97- * isDecrease )
97+ * enforceDecrease )
9898 * @param _delegationHash The hash of the delegation.
9999 */
100100 function afterHook (
@@ -109,11 +109,11 @@ contract ERC1155BalanceChangeEnforcer is CaveatEnforcer {
109109 public
110110 override
111111 {
112- (bool isDecrease_ , address token_ , address recipient_ , uint256 tokenId_ , uint256 amount_ ) = getTermsInfo (_terms);
112+ (bool enforceDecrease_ , address token_ , address recipient_ , uint256 tokenId_ , uint256 amount_ ) = getTermsInfo (_terms);
113113 bytes32 hashKey_ = _getHashKey (msg .sender , token_, recipient_, tokenId_, _delegationHash);
114114 delete isLocked[hashKey_];
115115 uint256 balance_ = IERC1155 (token_).balanceOf (recipient_, tokenId_);
116- if (isDecrease_ ) {
116+ if (enforceDecrease_ ) {
117117 require (balance_ >= balanceCache[hashKey_] - amount_, "ERC1155BalanceChangeEnforcer:exceeded-balance-decrease " );
118118 } else {
119119 require (balance_ >= balanceCache[hashKey_] + amount_, "ERC1155BalanceChangeEnforcer:insufficient-balance-increase " );
@@ -123,20 +123,20 @@ contract ERC1155BalanceChangeEnforcer is CaveatEnforcer {
123123 /**
124124 * @notice Decodes the terms used in this CaveatEnforcer.
125125 * @param _terms Encoded data that is used during the execution hooks.
126- * @return isDecrease_ Boolean indicating if the balance should decrease (true | 0x01) or increase (false | 0x00).
126+ * @return enforceDecrease_ Boolean indicating if the balance should decrease (true | 0x01) or increase (false | 0x00).
127127 * @return token_ The address of the ERC1155 token.
128128 * @return recipient_ The address of the recipient of the token.
129129 * @return tokenId_ The ID of the ERC1155 token.
130130 * @return amount_ Balance change guardrail amount (i.e., minimum increase OR maximum decrease, depending on
131- * isDecrease )
131+ * enforceDecrease )
132132 */
133133 function getTermsInfo (bytes calldata _terms )
134134 public
135135 pure
136- returns (bool isDecrease_ , address token_ , address recipient_ , uint256 tokenId_ , uint256 amount_ )
136+ returns (bool enforceDecrease_ , address token_ , address recipient_ , uint256 tokenId_ , uint256 amount_ )
137137 {
138138 require (_terms.length == 105 , "ERC1155BalanceChangeEnforcer:invalid-terms-length " );
139- isDecrease_ = _terms[0 ] != 0 ;
139+ enforceDecrease_ = _terms[0 ] != 0 ;
140140 token_ = address (bytes20 (_terms[1 :21 ]));
141141 recipient_ = address (bytes20 (_terms[21 :41 ]));
142142 tokenId_ = uint256 (bytes32 (_terms[41 :73 ]));
0 commit comments