Skip to content

Commit

Permalink
chore: save a single score schema
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-schultz committed Nov 29, 2023
1 parent fa9573f commit d436b5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 5 additions & 15 deletions contracts/GitcoinResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import {GitcoinAttester} from "./GitcoinAttester.sol";

import {IGitcoinResolver} from "./IGitcoinResolver.sol";

import "hardhat/console.sol";

/**
* @title GitcoinResolver
* @notice This contract is used to as a resolver contract for EAS schemas, and it will track the last attestation issued for a given recipient.
Expand Down Expand Up @@ -49,7 +47,7 @@ contract GitcoinResolver is
mapping(address => CachedScore) private scores;

// Mapping of active passport score schemas - used when storing scores to state
mapping(bytes32 => bool) private scoreSchemas;
bytes32 private scoreSchema;

/**
* @dev Creates a new resolver.
Expand Down Expand Up @@ -98,18 +96,10 @@ contract GitcoinResolver is

/**
* @dev Set supported score schemas.
* @param schema The score schema uid
*/
function setScoreSchema(bytes32 schema) external onlyOwner {
scoreSchemas[schema] = true;
}

/**
* @dev Unset supported score schemas.
* @param schema The score schema uid
* @param _schema The score schema uid
*/
function unsetScoreSchema(bytes32 schema) external onlyOwner {
scoreSchemas[schema] = false;
function setScoreSchema(bytes32 _schema) external onlyOwner {
scoreSchema = _schema;
}

// solhint-disable-next-line no-empty-blocks
Expand All @@ -132,7 +122,7 @@ contract GitcoinResolver is
function attest(
Attestation calldata attestation
) external payable whenNotPaused onlyAllowlisted returns (bool) {
if (scoreSchemas[attestation.schema]) {
if (scoreSchema == attestation.schema) {
_setScore(attestation);
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/GitcoinResolverUpdate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ contract GitcoinResolverUpdate is
mapping(address => CachedScore) public scores;

// Mapping of active passport score schemas - used when storing scores to state
mapping(bytes32 => bool) public scoreSchemas;
bytes32 public scoreSchema;

uint256 public aNewPublicVariable;

Expand Down

0 comments on commit d436b5d

Please sign in to comment.