Skip to content

Commit

Permalink
fix mock dapp contract
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhiran committed Jan 7, 2025
1 parent 47daf2f commit 75452bf
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e/services/contractdeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
mockProjectRe = regexp.MustCompile(`MockProject deployed to (\S+)`)
wsProjectRe = regexp.MustCompile(`W3bstreamProject deployed to (\S+)`)
routerRe = regexp.MustCompile(`W3bstreamRouter deployed to (\S+)`)
mockDappRe = regexp.MustCompile(`MockProcessor deployed to (\S+)`)
mockDappRe = regexp.MustCompile(`MockDapp deployed to (\S+)`)
projectRewardRe = regexp.MustCompile(`W3bstreamProjectReward deployed to (\S+)`)
debitsRe = regexp.MustCompile(`W3bstreamDebits deployed to (\S+)`)
ioIDRe = regexp.MustCompile(`MockIoID deployed to (\S+)`)
Expand Down
26 changes: 26 additions & 0 deletions smartcontracts/contracts/test/MockDapp.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

contract MockProcessor {
error CustomError();

uint8 public errorType;

function setErrorType(uint8 _errorType) external {
errorType = _errorType;
}

function process(
uint256 _projectId,
bytes32 _taskId,
address _prover,
address _deviceId,
bytes calldata _data
) external view {
if (errorType == 1) {
require(false, "Normal Error");
} else if (errorType == 2) {
revert CustomError();
}
}
}
10 changes: 7 additions & 3 deletions smartcontracts/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ async function main() {
} else {
const gnarkVerifier = await ethers.deployContract('Verifier', []);
await gnarkVerifier.waitForDeployment();
const MockProcessor = await ethers.deployContract('MockProcessor', [gnarkVerifier.target]);
await MockProcessor.waitForDeployment();
console.log(`MockProcessor deployed to ${MockProcessor.target}`);
const MockDappLiveness = await ethers.deployContract('MockDappLiveness', [gnarkVerifier.target]);
await MockDappLiveness.waitForDeployment();
console.log(`MockDappLiveness deployed to ${MockDappLiveness.target}`);

const MockDapp = await ethers.deployContract('MockDapp', []);
await MockDapp.waitForDeployment();
console.log(`MockDapp deployed to ${MockDapp.target}`);
}
if (process.env.PROJECT_REGISTRATION_FEE) {
projectRegistrationFee = process.env.PROJECT_REGISTRATION_FEE
Expand Down

0 comments on commit 75452bf

Please sign in to comment.