-
Notifications
You must be signed in to change notification settings - Fork 235
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 #824 from ethereum-oasis-op/develop
SRI milestone 5
- Loading branch information
Showing
121 changed files
with
14,924 additions
and
4,381 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"solidity-va.diagnostics.cdili_json.import": true, | ||
"solidity.compileUsingRemoteVersion": "v0.8.20+commit.a1b79de6" | ||
} |
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,17 @@ | ||
node_modules | ||
.env | ||
|
||
# Hardhat files | ||
/cache | ||
/artifacts | ||
|
||
# TypeChain files | ||
/typechain | ||
/typechain-types | ||
|
||
# solidity-coverage files | ||
/coverage | ||
/coverage.json | ||
|
||
# Hardhat Ignition default folder for deployments against a local node | ||
ignition/deployments/chain-31337 |
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,12 @@ | ||
# Sample Hardhat Project | ||
|
||
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a Hardhat Ignition module that deploys that contract. | ||
|
||
Try running some of the following tasks: | ||
|
||
```shell | ||
npx hardhat help | ||
npx hardhat test | ||
REPORT_GAS=true npx hardhat test | ||
npx hardhat node | ||
``` |
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,56 @@ | ||
//SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.24; | ||
|
||
import '@openzeppelin/contracts/access/AccessControl.sol'; | ||
|
||
contract CcsmBpiStateAnchor is AccessControl { | ||
mapping(string => string) public anchorHashStore; | ||
event AnchorHashSet(string indexed workstepInstanceId, string anchorHash); | ||
|
||
bytes32 public constant ADMIN_ROLE = keccak256('ADMIN_ROLE'); | ||
|
||
constructor(address[] memory admins) { | ||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); // Grant deployer the default admin role | ||
|
||
for (uint i = 0; i < admins.length; i++) { | ||
_grantRole(ADMIN_ROLE, admins[i]); // Grant admin role to each address | ||
} | ||
} | ||
|
||
function setAnchorHash( | ||
string calldata _workstepInstanceId, | ||
string calldata _anchorHash | ||
) external onlyAdmin { | ||
require( | ||
bytes(_workstepInstanceId).length > 0, | ||
'WorkstepInstanceId cannot be empty' | ||
); | ||
require( | ||
bytes(_workstepInstanceId).length < 40, | ||
'WorkstepInstanceId cannot exceed 40 bytes' | ||
); | ||
require(bytes(_anchorHash).length > 0, 'AnchorHash cannot be empty'); | ||
require( | ||
bytes(_anchorHash).length <= 256, | ||
'AnchorHash cannot exceed 256 bytes' | ||
); | ||
|
||
anchorHashStore[_workstepInstanceId] = _anchorHash; | ||
|
||
emit AnchorHashSet(_workstepInstanceId, _anchorHash); | ||
} | ||
|
||
function getAnchorHash( | ||
string calldata _workstepInstanceId | ||
) external view returns (string memory) { | ||
return anchorHashStore[_workstepInstanceId]; | ||
} | ||
|
||
modifier onlyAdmin() { | ||
require( | ||
hasRole(ADMIN_ROLE, msg.sender), | ||
'Only admin can call this function' | ||
); | ||
_; | ||
} | ||
} |
Oops, something went wrong.