Skip to content

Commit

Permalink
Add whitelisting base files
Browse files Browse the repository at this point in the history
  • Loading branch information
fdemiramon committed Feb 18, 2025
1 parent 13d0c3f commit f22c95a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
15 changes: 15 additions & 0 deletions contracts/WhiteListing/IKeyringChecker.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT

pragma solidity =0.8.19;

/// @title Keyring Checker Interface
/// @notice Interface for a contract that checks credentials against a Keyring contract.
interface IKeyringChecker {
/**
* @notice Checks if an entity has a valid credential and supports legacy interface.
* @param policyId The ID of the policy.
* @param entity The address of the entity to check.
* @return True if the entity has a valid credential, false otherwise.
*/
function checkCredential(uint256 policyId, address entity) external view returns (bool);
}
27 changes: 27 additions & 0 deletions contracts/WhiteListing/mocks/MockedKeyringChecker.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT

pragma solidity =0.8.19;

import { IKeyringChecker } from "../interfaces/IKeyringChecker.sol";

/// @title Mocked Keyring Checker
/// @notice A mock implementation of IKeyringChecker for testing purposes
contract MockedKeyringChecker is IKeyringChecker {
/// @notice Whether to allow the user or not.
bool public allow = false;

/// @notice Sets the allow flag.
/// @param _allow Whether to allow the user or not.
function setAllow(bool _allow) external {
allow = _allow;
}

/// @notice Checks if the user satisfies the policy.
/// @param policyId The policy ID to check against (unused in mock).
/// @param entity The address to check.
/// @return result True if the user satisfies the policy, false otherwise.
/* solhint-disable-next-line no-unused-vars */
function checkCredential(uint256 policyId, address entity) external view returns (bool) {
return allow;
}
}

0 comments on commit f22c95a

Please sign in to comment.