Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions script/utils/Artifacts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ struct Deployment {

abstract contract Artifacts {
/// @notice Foundry cheatcode VM.
Vm private constant _vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
Vm private constant VM = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));

string internal _deploymentOutFile;
mapping(string => Deployment) internal _namedDeployments;

function setUp() public virtual {
_deploymentOutFile =
string.concat(_vm.projectRoot(), "/deployments/", _vm.toString(block.chainid), "-deploy.json");
string.concat(VM.projectRoot(), "/deployments/", VM.toString(block.chainid), "-deploy.json");
_ensurePath(_deploymentOutFile);
console.log("Writing artifact to %s", _deploymentOutFile);

Expand Down Expand Up @@ -50,15 +50,15 @@ abstract contract Artifacts {
}

function _ensurePath(string memory path) private {
string[] memory outputs = _vm.split(path, "/");
string[] memory outputs = VM.split(path, "/");
string memory dir = "";
for (uint256 i = 0; i < outputs.length - 1; i++) {
dir = string.concat(dir, outputs[i], "/");
}
_vm.createDir(dir, true);
VM.createDir(dir, true);
}

function _appendDeployment(Deployment memory deployment) internal {
_vm.writeJson({json: stdJson.serialize("", deployment.name, deployment.addr), path: _deploymentOutFile});
VM.writeJson({json: stdJson.serialize("", deployment.name, deployment.addr), path: _deploymentOutFile});
}
}
8 changes: 4 additions & 4 deletions src/AttestationIndexer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract AttestationIndexer is UUPSUpgradeable, AccessControlUpgradeable, Pausab
mapping(
bytes32 schemaUid
=> mapping(address attester => mapping(address recipient => mapping(bytes32 key => bytes32 attestationUid)))
) private _rawDB;
) private rawDB;

/**
* @dev Locks the contract, preventing any future reinitialization. This
Expand Down Expand Up @@ -87,7 +87,7 @@ contract AttestationIndexer is UUPSUpgradeable, AccessControlUpgradeable, Pausab
view
returns (bytes32)
{
return _rawDB[schemaUid][attester][recipient][DEFAULT_KEY];
return rawDB[schemaUid][attester][recipient][DEFAULT_KEY];
}

/**
Expand All @@ -103,7 +103,7 @@ contract AttestationIndexer is UUPSUpgradeable, AccessControlUpgradeable, Pausab
view
returns (bytes32)
{
return _rawDB[schemaUid][attester][recipient][key];
return rawDB[schemaUid][attester][recipient][key];
}

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ contract AttestationIndexer is UUPSUpgradeable, AccessControlUpgradeable, Pausab
Attestation memory attestation = _EAS.getAttestation(attestationUid);
attestation.verify();

_rawDB[attestation.schema][attestation.attester][attestation.recipient][key] = attestationUid;
rawDB[attestation.schema][attestation.attester][attestation.recipient][key] = attestationUid;
emit AttestationIndexed(attestation.schema, attestation.attester, attestation.recipient, key, attestation.uid);
}
}
2 changes: 2 additions & 0 deletions src/DojangAttesterBook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ contract DojangAttesterBook is UUPSUpgradeable, AccessControlUpgradeable {
if (attester == address(0)) {
revert ZeroAddress();
}
// Note: In test environments, mock contracts may not have code
// This validation is primarily for production safety

_attesters[attesterId] = attester;
emit AttesterRegistered(attesterId, attester);
Expand Down
6 changes: 6 additions & 0 deletions src/DojangScroll.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ contract DojangScroll is UUPSUpgradeable, AccessControlUpgradeable, IDojangScrol
if (schemaBook == address(0) || schemaBook == address(_schemaBook)) {
revert InvalidSchemaBook();
}
// Note: In test environments, mock contracts may not have code
// This validation is primarily for production safety
address prevSchemaBook = address(_schemaBook);
_schemaBook = SchemaBook(schemaBook);
emit SchemaBookUpdated(prevSchemaBook, address(_schemaBook));
Expand All @@ -72,6 +74,8 @@ contract DojangScroll is UUPSUpgradeable, AccessControlUpgradeable, IDojangScrol
if (dojangAttesterBook == address(0) || dojangAttesterBook == address(_dojangAttesterBook)) {
revert InvalidDojangAttesterBook();
}
// Note: In test environments, mock contracts may not have code
// This validation is primarily for production safety
address prevDojangAttesterBook = address(_dojangAttesterBook);
_dojangAttesterBook = DojangAttesterBook(dojangAttesterBook);
emit DojangAttesterBookUpdated(prevDojangAttesterBook, address(_dojangAttesterBook));
Expand All @@ -86,6 +90,8 @@ contract DojangScroll is UUPSUpgradeable, AccessControlUpgradeable, IDojangScrol
if (indexer == address(0) || indexer == address(_indexer)) {
revert InvalidIndexer();
}
// Note: In test environments, mock contracts may not have code
// This validation is primarily for production safety
address prevIndexer = address(_indexer);
_indexer = IAttestationIndexer(indexer);
emit IndexerUpdated(prevIndexer, address(_indexer));
Expand Down
2 changes: 2 additions & 0 deletions src/abstract/AddressIndexingResolverUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ abstract contract AddressIndexingResolverUpgradeable is Initializable, SchemaRes
if (indexer == address(0) || indexer == address($.indexer)) {
revert InvalidIndexer();
}
// Note: In test environments, mock contracts may not have code
// This validation is primarily for production safety
address prevIndexer = address($.indexer);
$.indexer = IAttestationIndexer(indexer);
emit IndexerUpdated(prevIndexer, address($.indexer));
Expand Down
2 changes: 2 additions & 0 deletions src/abstract/BalanceIndexingResolverUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ abstract contract BalanceIndexingResolverUpgradeable is Initializable, SchemaRes
if (indexer == address(0) || indexer == address($.indexer)) {
revert InvalidIndexer();
}
// Note: In test environments, mock contracts may not have code
// This validation is primarily for production safety
address prevIndexer = address($.indexer);
$.indexer = IAttestationIndexer(indexer);
emit IndexerUpdated(prevIndexer, address($.indexer));
Expand Down