Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mock combination component #77

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions test/mocks/MockCombination.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "src/external/IExternalResolver.sol";
import "src/external/IExternalSchemaValidator.sol";
import { IRegistry, SchemaUID, AttestationRequest } from "src/IRegistry.sol";

contract MockCombination is IExternalResolver, IExternalSchemaValidator {
bool immutable returnVal;

event AttestationCalled();
event RevokeCalled();
event ModuleCalled();

constructor(bool ret) {
returnVal = ret;
}

/*//////////////////////////////////////////////////////////////////////////
RESOLVER
//////////////////////////////////////////////////////////////////////////*/

function supportsInterface(bytes4 interfaceId) public pure override returns (bool) {
if (interfaceId == type(IExternalResolver).interfaceId || interfaceId == type(IExternalSchemaValidator).interfaceId) return true;
}

function resolveAttestation(AttestationRecord calldata attestation) external payable override returns (bool) {
emit AttestationCalled();
return returnVal;
}

function resolveAttestation(AttestationRecord[] calldata attestation) external payable override returns (bool) {
emit AttestationCalled();
return returnVal;
}

function resolveRevocation(AttestationRecord calldata attestation) external payable override returns (bool) {
emit RevokeCalled();
return returnVal;
}

function resolveRevocation(AttestationRecord[] calldata attestation) external payable override returns (bool) {
emit RevokeCalled();
return returnVal;
}

function resolveModuleRegistration(
address sender,
address moduleRecord,
ModuleRecord calldata record,
bytes calldata resolverContext
)
external
payable
override
returns (bool)
{
emit ModuleCalled();
return returnVal;
}

/*//////////////////////////////////////////////////////////////////////////
SCHEMA VALIDATOR
//////////////////////////////////////////////////////////////////////////*/

function validateSchema(AttestationRecord calldata attestation) external view override returns (bool) {
return returnVal;
}

function validateSchema(AttestationRecord[] calldata attestations) external view override returns (bool) {
return returnVal;
}

/*//////////////////////////////////////////////////////////////////////////
MOCK ATTESTER
//////////////////////////////////////////////////////////////////////////*/

function attest(IRegistry registry, SchemaUID schemaUID, AttestationRequest calldata request) external payable returns (bool) {
registry.attest(schemaUID, request);
}
}
Loading