-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from CMTA/whitelist-improvement
Whitelist improvement
- Loading branch information
Showing
9 changed files
with
79 additions
and
99 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
pragma solidity ^0.8.20; | ||
|
||
import "./RuleAddressList/invariantStorage/RuleWhitelistInvariantStorage.sol"; | ||
import "./RuleValidateTransfer.sol"; | ||
|
||
abstract contract RuleWhitelistCommon is | ||
RuleValidateTransfer, | ||
RuleWhitelistInvariantStorage { | ||
/** | ||
* @notice To know if the restriction code is valid for this rule or not | ||
* @param _restrictionCode The target restriction code | ||
* @return true if the restriction code is known, false otherwise | ||
**/ | ||
function canReturnTransferRestrictionCode( | ||
uint8 _restrictionCode | ||
) external pure override returns (bool) { | ||
return | ||
_restrictionCode == CODE_ADDRESS_FROM_NOT_WHITELISTED || | ||
_restrictionCode == CODE_ADDRESS_TO_NOT_WHITELISTED; | ||
} | ||
|
||
/** | ||
* @notice Return the corresponding message | ||
* @param _restrictionCode The target restriction code | ||
* @return true if the transfer is valid, false otherwise | ||
**/ | ||
function messageForTransferRestriction( | ||
uint8 _restrictionCode | ||
) external pure override returns (string memory) { | ||
if (_restrictionCode == CODE_ADDRESS_FROM_NOT_WHITELISTED) { | ||
return TEXT_ADDRESS_FROM_NOT_WHITELISTED; | ||
} else if (_restrictionCode == CODE_ADDRESS_TO_NOT_WHITELISTED) { | ||
return TEXT_ADDRESS_TO_NOT_WHITELISTED; | ||
} else { | ||
return TEXT_CODE_NOT_FOUND; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters