Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Builddddder committed Oct 24, 2023
1 parent 68aa16d commit 227fad1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 14 additions & 3 deletions contracts/src/examples/modules/SchemaCheckerModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,34 @@ pragma solidity 0.8.21;
import { AbstractModule } from "../../interface/AbstractModule.sol";
import { AttestationPayload } from "../../types/Structs.sol";

/**
* @title Schema checker Module
* @notice This contract illustrates a valid Module that is used to check the schema that an attestation is based on
*/
contract SchemaCheckerModule is AbstractModule {

error InvalidSchemaId();
struct Profile {
address issuer;
bytes32 schemaId;
uint64 issueDate;
}

/**
* @notice This method is used to run the module's validation logic
* @param attestationPayload - AttestationPayload containing the user address as `subject` and nonce as `attestationData`
* @param validationPayload - Payload encoded with abi.encode(uint256).toEthSignedMessageHash().sign(signer)
*/
function run(
AttestationPayload memory attestationPayload,
bytes memory /*validationPayload*/,
address /*txSender*/,
uint256 /*value*/
) public view override {
Profile memory issuerProfile;
(issuerProfile.issuer, issuerProfile.schemaId, issuerProfile.issueDate) =
abi.decode(attestationPayload.attestationData, (address, bytes32, uint64));
(issuerProfile.issuer, issuerProfile.schemaId, issuerProfile.issueDate) = abi.decode(
attestationPayload.attestationData,
(address, bytes32, uint64)
);
if (issuerProfile.schemaId != attestationPayload.schemaId) {
revert InvalidSchemaId();
}
Expand Down
3 changes: 1 addition & 2 deletions contracts/test/example/SchemaCheckerModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ contract SchemaCheckerModuleTest is Test {
abi.encode(user),
abi.encode(issuer, schemaId, issueDate)
);

schemaCheckerModule.run(attestationPayload, bytes("0000"), user, 0);
}

Expand All @@ -45,7 +45,6 @@ contract SchemaCheckerModuleTest is Test {

vm.expectRevert(SchemaCheckerModule.InvalidSchemaId.selector);
schemaCheckerModule.run(attestationPayload, bytes("0000"), user, 0);

}

function test_EcRecoverModule_supportsInterface() public {
Expand Down

0 comments on commit 227fad1

Please sign in to comment.