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

Payer contract implementation #615

Closed
wants to merge 25 commits into from
Closed
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
2 changes: 1 addition & 1 deletion contracts/pkg/nodes/Nodes.go

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions contracts/script/ComputeStorageSlot.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {Script, console} from "forge-std/src/Script.sol";

/*
* @dev Compute the storage slot for a given namespace.
* forge script script/ComputeStorageSlot.sol --sig "compute(string)" "xmtp.storage.Payer"
*/
contract ComputeStorageSlot is Script {
function compute(string calldata namespace) external view {
bytes32 namespaceHash = keccak256(bytes(namespace));
uint256 namespaceInt = uint256(namespaceHash);
bytes32 slot = bytes32((namespaceInt - 1) & ~uint256(0xff));

console.log("Namespace:", namespace);
console.logBytes32(namespaceHash);
console.log("Storage Slot:");
console.logBytes32(slot);
}

function run() external view {
this.compute("");
}
}
4 changes: 2 additions & 2 deletions contracts/src/Nodes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,14 @@ contract Nodes is INodes, AccessControlDefaultAdminRules, ERC721 {
emit ReplicationDisabled(nodeId);
}

/// @dev Override to support ERC721, IERC165, and AccessControlEnumerable.
/// @dev Override to support INodes, ERC721, IERC165, and AccessControlEnumerable.
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, IERC165, AccessControlDefaultAdminRules)
returns (bool supported)
{
return super.supportsInterface(interfaceId);
return interfaceId == type(INodes).interfaceId || super.supportsInterface(interfaceId);
}

/// @dev Reverts if the node does not exist.
Expand Down
Loading
Loading