Skip to content

Commit e733507

Browse files
committed
Add contract rule address in transfer error
1 parent fcf5d23 commit e733507

7 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/rules/validation/RuleBlacklist.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ contract RuleBlacklist is RuleValidateTransfer, RuleAddressSet, RuleBlacklistInv
102102

103103
function transferred(address from, address to, uint256 value) public view {
104104
uint8 code = this.detectTransferRestriction(from, to, value);
105-
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleBlacklist_InvalidTransfer(from, to, value, code));
105+
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleBlacklist_InvalidTransfer(address(this), from, to, value, code));
106106
}
107107

108108
function transferred(address spender, address from, address to, uint256 value) public view {
109109
uint8 code = this.detectTransferRestrictionFrom(spender, from, to, value);
110-
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleBlacklist_InvalidTransfer(from, to, value, code));
110+
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleBlacklist_InvalidTransfer(address(this), from, to, value, code));
111111
}
112112
}

src/rules/validation/RuleSanctionsList.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ contract RuleSanctionsList is
130130

131131
function transferred(address from, address to, uint256 value) public view {
132132
uint8 code = this.detectTransferRestriction(from, to, value);
133-
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleSanctionsList_InvalidTransfer(from, to, value, code));
133+
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleSanctionsList_InvalidTransfer(address(this), from, to, value, code));
134134
}
135135

136136
function transferred(address spender, address from, address to, uint256 value) public view {
137137
uint8 code = this.detectTransferRestrictionFrom(spender, from, to, value);
138-
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleSanctionsList_InvalidTransfer(from, to, value, code));
138+
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleSanctionsList_InvalidTransfer(address(this), from, to, value, code));
139139
}
140140

141141
/* ============ ACCESS CONTROL ============ */

src/rules/validation/RuleWhitelistWrapper.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ contract RuleWhitelistWrapper is RulesManagementModule, MetaTxModuleStandalone,
5151
targetAddress[1] = to;
5252

5353
bool[] memory result = _detectTransferRestriction(targetAddress);
54-
5554
if (!result[0]) {
5655
return CODE_ADDRESS_FROM_NOT_WHITELISTED;
5756
} else if (!result[1]) {

src/rules/validation/abstract/RuleAddressSet/invariantStorage/RuleBlacklistInvariantStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pragma solidity ^0.8.20;
55
import "../../RuleCommonInvariantStorage.sol";
66

77
abstract contract RuleBlacklistInvariantStorage is RuleCommonInvariantStorage {
8-
error RuleBlacklist_InvalidTransfer(address from, address to, uint256 value, uint8 code);
8+
error RuleBlacklist_InvalidTransfer(address rule, address from, address to, uint256 value, uint8 code);
99
/* ============ String message ============ */
1010

1111
string constant TEXT_ADDRESS_FROM_IS_BLACKLISTED = "The sender is blacklisted";

src/rules/validation/abstract/RuleAddressSet/invariantStorage/RuleWhitelistInvariantStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pragma solidity ^0.8.20;
55
import "../../RuleCommonInvariantStorage.sol";
66

77
abstract contract RuleWhitelistInvariantStorage is RuleCommonInvariantStorage {
8-
error RuleWhitelist_InvalidTransfer(address from, address to, uint256 value, uint8 code);
8+
error RuleWhitelist_InvalidTransfer(address rule, address from, address to, uint256 value, uint8 code);
99
/* ============ String message ============ */
1010

1111
string constant TEXT_ADDRESS_FROM_NOT_WHITELISTED = "The sender is not in the whitelist";

src/rules/validation/abstract/RuleSanctionsListInvariantStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import "./RuleCommonInvariantStorage.sol";
66
import {ISanctionsList} from "../../interfaces/ISanctionsList.sol";
77

88
abstract contract RuleSanctionsListInvariantStorage is RuleCommonInvariantStorage {
9-
error RuleSanctionsList_InvalidTransfer(address from, address to, uint256 value, uint8 code);
9+
error RuleSanctionsList_InvalidTransfer(address rule, address from, address to, uint256 value, uint8 code);
1010
/* ============ Event ============ */
1111

1212
event SetSanctionListOracle(ISanctionsList newOracle);

src/rules/validation/abstract/RuleWhitelistCommon.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract contract RuleWhitelistCommon is RuleValidateTransfer, RuleWhitelistInva
7070
*/
7171
function transferred(address from, address to, uint256 value) public view {
7272
uint8 code = this.detectTransferRestriction(from, to, value);
73-
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleWhitelist_InvalidTransfer(from, to, value, code));
73+
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleWhitelist_InvalidTransfer(address(this), from, to, value, code));
7474
}
7575

7676
/**
@@ -85,6 +85,6 @@ abstract contract RuleWhitelistCommon is RuleValidateTransfer, RuleWhitelistInva
8585
*/
8686
function transferred(address spender, address from, address to, uint256 value) public view {
8787
uint8 code = this.detectTransferRestrictionFrom(spender, from, to, value);
88-
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleWhitelist_InvalidTransfer(from, to, value, code));
88+
require(code == uint8(REJECTED_CODE_BASE.TRANSFER_OK), RuleWhitelist_InvalidTransfer(address(this), from, to, value, code));
8989
}
9090
}

0 commit comments

Comments
 (0)