Skip to content

Instantly share code, notes, and snippets.

@sarvagnakadiya
Last active April 2, 2024 12:57
Show Gist options
  • Save sarvagnakadiya/97a56817d7e8a52832cff567e0460c5c to your computer and use it in GitHub Desktop.
Save sarvagnakadiya/97a56817d7e8a52832cff567e0460c5c to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "https://github.com/ethereum-attestation-service/eas-contracts/blob/master/contracts/resolver/SchemaResolver.sol";
import "https://github.com/ethereum-attestation-service/eas-contracts/blob/master/contracts/IEAS.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
/// @title AttesterResolver
/// @notice A chora_club schema resolver that checks whether the attestation is from chora_club' address.
contract AttesterResolver is SchemaResolver, Ownable {
address public targetAttester;
constructor(
IEAS eas,
address _targetAttester,
address _initialOwner
) SchemaResolver(eas) Ownable(_initialOwner) {
targetAttester = _targetAttester;
}
function updateTargetAttester(address _newTargetAttester) public onlyOwner{
targetAttester = _newTargetAttester;
}
function onAttest(
Attestation calldata attestation,
uint256 /*value*/
) internal view override returns (bool) {
return attestation.attester == targetAttester;
}
function onRevoke(
Attestation calldata /*attestation*/,
uint256 /*value*/
) internal pure override returns (bool) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment