-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
363 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
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,16 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.26; | ||
|
||
interface IOIDPermissionManager { | ||
event PermissionUpdated(string hash, address account, bool granted); | ||
event PermissionDeleted(string hash, address account, bool granted); | ||
|
||
function grantPermission(string memory hash, address account) external; | ||
|
||
function revokePermission(string memory hash, address account) external; | ||
|
||
function hasPermission( | ||
string memory hash, | ||
address account | ||
) external view returns (bool); | ||
} |
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,28 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.26; | ||
|
||
import {IOIDPermissionManager} from "./IOIDPermissionManager.sol"; | ||
|
||
import "hardhat/console.sol"; | ||
|
||
contract OIDPermissionManager is IOIDPermissionManager { | ||
mapping(string => mapping(address => bool)) private permissions; | ||
|
||
function grantPermission(string memory hash, address account) external { | ||
permissions[hash][account] = true; | ||
} | ||
|
||
function revokePermission( | ||
string memory hash, | ||
address account | ||
) external override { | ||
permissions[hash][account] = false; | ||
} | ||
|
||
function hasPermission( | ||
string memory hash, | ||
address account | ||
) external view override returns (bool) { | ||
return permissions[hash][account]; | ||
} | ||
} |
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
Oops, something went wrong.