// SPDX-License-Identifier: MIT pragma solidity >=0.8.24; /* Autogenerated file. Do not edit manually. */ import { AccessSystem } from "../../systems/access-system/AccessSystem.sol"; import { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; import { revertWithBytes } from "@latticexyz/world/src/revertWithBytes.sol"; import { IWorldCall } from "@latticexyz/world/src/IWorldKernel.sol"; import { SystemCall } from "@latticexyz/world/src/SystemCall.sol"; import { Systems } from "@latticexyz/world/src/codegen/tables/Systems.sol"; import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; type AccessSystemType is bytes32; // equivalent to WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: "evefrontier", name: "AccessSystem" })) AccessSystemType constant accessSystem = AccessSystemType.wrap( 0x737965766566726f6e7469657200000041636365737353797374656d00000000 ); struct CallWrapper { ResourceId systemId; address from; } struct RootCallWrapper { ResourceId systemId; address from; } /** * @title AccessSystemLib * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz) * @dev This library is automatically generated from the corresponding system contract. Do not edit manually. */ library AccessSystemLib { error AccessSystemLib_CallingFromRootSystem(); error Access_NotDirectAdmin(address caller); error Access_NotOwner(address caller, uint256 smartObjectId); error Access_NotDirectOwner(address caller, uint256 smartObjectId); error Access_NotAdminOrOwner(address caller, uint256 smartObjectId); error Access_NotAdminOrOwnerSupported(address caller, uint256 smartObjectId); error Access_NotDirectOwnerOrCanTransferToEphemeral(address caller, uint256 smartObjectId); error Access_CannotTransferFromEphemeral(address caller, uint256 smartObjectId); error Access_NotDirectEphemeralOwnerOrCanCrossTransferToEphemeral(address caller, uint256 smartObjectId); error Access_NotDirectOwnerOrCanTransferToInventory(address caller, uint256 smartObjectId); error Access_NotAdminSupportedOwnerOrCallAccess(address caller, uint256 smartObjectId); error Access_NotAdminOrCallAccess(address caller, uint256 smartObjectId); error Access_NotDirectAdminOrCallAccess(address caller, uint256 smartObjectId); error Access_NotOwnerWithAdminSupportAccess(address caller, uint256 smartObjectId); error Access_NotClassScoped(address caller, uint256 smartObjectId); error Access_NotCallAccess(address caller, uint256 smartObjectId); error Access_NotAdminSupported(address caller, uint256 smartObjectId); error Access_NotClassScopedAccess(address caller, uint256 smartObjectId); error Access_NotAdminOrClassScoped(address caller, uint256 smartObjectId); error Access_NotEphemeralOwnerOrCallAccess(address caller, uint256 smartObjectId); error Access_NotEphemeralOwnerOrCallAccessWithEphemeralOwner(address caller, uint256 smartObjectId); error Access_NotAdminSupportedOrDirectOwner(address caller, uint256 smartObjectId); error Access_NotAdminSupportedOrDirectOwnerGates(address caller, uint256 smartObjectId); function onlyOwnerOrEphemeralTransferRole( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyOwnerOrEphemeralTransferRole(smartObjectId, data); } function onlyOwnerOrEphemeralCrossTransferRole( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyOwnerOrEphemeralCrossTransferRole(smartObjectId, data); } function onlyEphemeralOwnerOrTransferRole( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyEphemeralOwnerOrTransferRole(smartObjectId, data); } function onlyOwnerOrInventoryTransferRole( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyOwnerOrInventoryTransferRole(smartObjectId, data); } function onlyOwner(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyOwner(smartObjectId, data); } function onlyDirectOwner(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyDirectOwner(smartObjectId, data); } function onlyDirectAdmin(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyDirectAdmin(smartObjectId, data); } function onlyAdminSupportedAccess(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminSupportedAccess(smartObjectId, data); } function adminSupportOrDirectOwner(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).adminSupportOrDirectOwner(smartObjectId, data); } function adminSupportOrDirectOwnerGates( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).adminSupportOrDirectOwnerGates(smartObjectId, data); } function onlyAdminOrOwner(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminOrOwner(smartObjectId, data); } function onlyAdminOrOwnerSupported(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminOrOwnerSupported(smartObjectId, data); } function onlyClassScopedOrCharAdminOrOwner( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyClassScopedOrCharAdminOrOwner(smartObjectId, data); } function onlyCallAccess(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyCallAccess(smartObjectId, data); } function onlyAdminSupportedOwnerOrCall( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminSupportedOwnerOrCall(smartObjectId, data); } function onlyDirectEphemeralOwnerOrCall( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyDirectEphemeralOwnerOrCall(smartObjectId, data); } function onlyCallAccessOrDirectEphemeralOwner( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyCallAccessOrDirectEphemeralOwner(smartObjectId, data); } function onlyAdminOrCallAccess(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminOrCallAccess(smartObjectId, data); } function onlyCallAccessWithScopeEnforced( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyCallAccessWithScopeEnforced(smartObjectId, data); } function onlyAdminOrScopeEnforcedCall(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminOrScopeEnforcedCall(smartObjectId, data); } function onlyDirectAdminOrCallAccess(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyDirectAdminOrCallAccess(smartObjectId, data); } function onlyOwnerWithAdminSupportAccess( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyOwnerWithAdminSupportAccess(smartObjectId, data); } function onlyClassScopedAccess(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyClassScopedAccess(smartObjectId, data); } function onlyAdminOrClassScopedAccess(AccessSystemType self, uint256 smartObjectId, bytes memory data) internal view { return CallWrapper(self.toResourceId(), address(0)).onlyAdminOrClassScopedAccess(smartObjectId, data); } function onlySmartAssemblyClassScopedAccess( AccessSystemType self, uint256 smartObjectId, bytes memory data ) internal view { return CallWrapper(self.toResourceId(), address(0)).onlySmartAssemblyClassScopedAccess(smartObjectId, data); } function isAdmin(AccessSystemType self, address caller) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).isAdmin(caller); } function isOwner(AccessSystemType self, uint256 smartObjectId, address caller) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).isOwner(smartObjectId, caller); } function isEphemeralOwner( AccessSystemType self, uint256 smartObjectId, address caller, bytes memory data ) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).isEphemeralOwner(smartObjectId, caller, data); } function isClassScoped(AccessSystemType self, uint256 classId, ResourceId systemId) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).isClassScoped(classId, systemId); } function isOwnerOfBothGates(AccessSystemType self, address caller, bytes memory data) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).isOwnerOfBothGates(caller, data); } function canTransferFromEphemeral( AccessSystemType self, uint256 smartObjectId, address caller ) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).canTransferFromEphemeral(smartObjectId, caller); } function canTransferToEphemeral( AccessSystemType self, uint256 smartObjectId, address caller ) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).canTransferToEphemeral(smartObjectId, caller); } function canTransferToInventory( AccessSystemType self, uint256 smartObjectId, address caller ) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).canTransferToInventory(smartObjectId, caller); } function canCrossTransferToEphemeral( AccessSystemType self, uint256 smartObjectId, address caller ) internal view returns (bool) { return CallWrapper(self.toResourceId(), address(0)).canCrossTransferToEphemeral(smartObjectId, caller); } function onlyOwnerOrEphemeralTransferRole( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyOwnerOrEphemeralTransferRole_uint256_bytes.onlyOwnerOrEphemeralTransferRole, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyOwnerOrEphemeralCrossTransferRole( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyOwnerOrEphemeralCrossTransferRole_uint256_bytes.onlyOwnerOrEphemeralCrossTransferRole, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyEphemeralOwnerOrTransferRole( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyEphemeralOwnerOrTransferRole_uint256_bytes.onlyEphemeralOwnerOrTransferRole, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyOwnerOrInventoryTransferRole( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyOwnerOrInventoryTransferRole_uint256_bytes.onlyOwnerOrInventoryTransferRole, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyOwner(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_onlyOwner_uint256_bytes.onlyOwner, (smartObjectId, data)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyDirectOwner(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_onlyDirectOwner_uint256_bytes.onlyDirectOwner, (smartObjectId, data)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyDirectAdmin(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_onlyDirectAdmin_uint256_bytes.onlyDirectAdmin, (smartObjectId, data)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminSupportedAccess(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyAdminSupportedAccess_uint256_bytes.onlyAdminSupportedAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function adminSupportOrDirectOwner(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _adminSupportOrDirectOwner_uint256_bytes.adminSupportOrDirectOwner, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function adminSupportOrDirectOwnerGates( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _adminSupportOrDirectOwnerGates_uint256_bytes.adminSupportOrDirectOwnerGates, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminOrOwner(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_onlyAdminOrOwner_uint256_bytes.onlyAdminOrOwner, (smartObjectId, data)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminOrOwnerSupported(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyAdminOrOwnerSupported_uint256_bytes.onlyAdminOrOwnerSupported, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyClassScopedOrCharAdminOrOwner( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyClassScopedOrCharAdminOrOwner_uint256_bytes.onlyClassScopedOrCharAdminOrOwner, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyCallAccess(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_onlyCallAccess_uint256_bytes.onlyCallAccess, (smartObjectId, data)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminSupportedOwnerOrCall( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyAdminSupportedOwnerOrCall_uint256_bytes.onlyAdminSupportedOwnerOrCall, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyDirectEphemeralOwnerOrCall( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyDirectEphemeralOwnerOrCall_uint256_bytes.onlyDirectEphemeralOwnerOrCall, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyCallAccessOrDirectEphemeralOwner( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyCallAccessOrDirectEphemeralOwner_uint256_bytes.onlyCallAccessOrDirectEphemeralOwner, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminOrCallAccess(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyAdminOrCallAccess_uint256_bytes.onlyAdminOrCallAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyCallAccessWithScopeEnforced( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyCallAccessWithScopeEnforced_uint256_bytes.onlyCallAccessWithScopeEnforced, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminOrScopeEnforcedCall( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyAdminOrScopeEnforcedCall_uint256_bytes.onlyAdminOrScopeEnforcedCall, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyDirectAdminOrCallAccess( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyDirectAdminOrCallAccess_uint256_bytes.onlyDirectAdminOrCallAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyOwnerWithAdminSupportAccess( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyOwnerWithAdminSupportAccess_uint256_bytes.onlyOwnerWithAdminSupportAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyClassScopedAccess(CallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyClassScopedAccess_uint256_bytes.onlyClassScopedAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlyAdminOrClassScopedAccess( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlyAdminOrClassScopedAccess_uint256_bytes.onlyAdminOrClassScopedAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function onlySmartAssemblyClassScopedAccess( CallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _onlySmartAssemblyClassScopedAccess_uint256_bytes.onlySmartAssemblyClassScopedAccess, (smartObjectId, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); abi.decode(returnData, (bytes)); } function isAdmin(CallWrapper memory self, address caller) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_isAdmin_address.isAdmin, (caller)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function isOwner(CallWrapper memory self, uint256 smartObjectId, address caller) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_isOwner_uint256_address.isOwner, (smartObjectId, caller)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function isEphemeralOwner( CallWrapper memory self, uint256 smartObjectId, address caller, bytes memory data ) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _isEphemeralOwner_uint256_address_bytes.isEphemeralOwner, (smartObjectId, caller, data) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function isClassScoped(CallWrapper memory self, uint256 classId, ResourceId systemId) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_isClassScoped_uint256_ResourceId.isClassScoped, (classId, systemId)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function isOwnerOfBothGates(CallWrapper memory self, address caller, bytes memory data) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall(_isOwnerOfBothGates_address_bytes.isOwnerOfBothGates, (caller, data)); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function canTransferFromEphemeral( CallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _canTransferFromEphemeral_uint256_address.canTransferFromEphemeral, (smartObjectId, caller) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function canTransferToEphemeral( CallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _canTransferToEphemeral_uint256_address.canTransferToEphemeral, (smartObjectId, caller) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function canTransferToInventory( CallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _canTransferToInventory_uint256_address.canTransferToInventory, (smartObjectId, caller) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function canCrossTransferToEphemeral( CallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert AccessSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _canCrossTransferToEphemeral_uint256_address.canCrossTransferToEphemeral, (smartObjectId, caller) ); bytes memory worldCall = self.from == address(0) ? abi.encodeCall(IWorldCall.call, (self.systemId, systemCall)) : abi.encodeCall(IWorldCall.callFrom, (self.from, self.systemId, systemCall)); (bool success, bytes memory returnData) = address(_world()).staticcall(worldCall); if (!success) revertWithBytes(returnData); bytes memory result = abi.decode(returnData, (bytes)); return abi.decode(result, (bool)); } function onlyOwnerOrEphemeralTransferRole( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyOwnerOrEphemeralTransferRole_uint256_bytes.onlyOwnerOrEphemeralTransferRole, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyOwnerOrEphemeralCrossTransferRole( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyOwnerOrEphemeralCrossTransferRole_uint256_bytes.onlyOwnerOrEphemeralCrossTransferRole, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyEphemeralOwnerOrTransferRole( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyEphemeralOwnerOrTransferRole_uint256_bytes.onlyEphemeralOwnerOrTransferRole, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyOwnerOrInventoryTransferRole( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyOwnerOrInventoryTransferRole_uint256_bytes.onlyOwnerOrInventoryTransferRole, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyOwner(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall(_onlyOwner_uint256_bytes.onlyOwner, (smartObjectId, data)); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyDirectOwner(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall(_onlyDirectOwner_uint256_bytes.onlyDirectOwner, (smartObjectId, data)); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyDirectAdmin(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall(_onlyDirectAdmin_uint256_bytes.onlyDirectAdmin, (smartObjectId, data)); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminSupportedAccess( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyAdminSupportedAccess_uint256_bytes.onlyAdminSupportedAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function adminSupportOrDirectOwner( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _adminSupportOrDirectOwner_uint256_bytes.adminSupportOrDirectOwner, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function adminSupportOrDirectOwnerGates( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _adminSupportOrDirectOwnerGates_uint256_bytes.adminSupportOrDirectOwnerGates, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminOrOwner(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall(_onlyAdminOrOwner_uint256_bytes.onlyAdminOrOwner, (smartObjectId, data)); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminOrOwnerSupported( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyAdminOrOwnerSupported_uint256_bytes.onlyAdminOrOwnerSupported, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyClassScopedOrCharAdminOrOwner( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyClassScopedOrCharAdminOrOwner_uint256_bytes.onlyClassScopedOrCharAdminOrOwner, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyCallAccess(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall(_onlyCallAccess_uint256_bytes.onlyCallAccess, (smartObjectId, data)); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminSupportedOwnerOrCall( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyAdminSupportedOwnerOrCall_uint256_bytes.onlyAdminSupportedOwnerOrCall, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyDirectEphemeralOwnerOrCall( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyDirectEphemeralOwnerOrCall_uint256_bytes.onlyDirectEphemeralOwnerOrCall, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyCallAccessOrDirectEphemeralOwner( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyCallAccessOrDirectEphemeralOwner_uint256_bytes.onlyCallAccessOrDirectEphemeralOwner, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminOrCallAccess(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall( _onlyAdminOrCallAccess_uint256_bytes.onlyAdminOrCallAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyCallAccessWithScopeEnforced( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyCallAccessWithScopeEnforced_uint256_bytes.onlyCallAccessWithScopeEnforced, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminOrScopeEnforcedCall( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyAdminOrScopeEnforcedCall_uint256_bytes.onlyAdminOrScopeEnforcedCall, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyDirectAdminOrCallAccess( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyDirectAdminOrCallAccess_uint256_bytes.onlyDirectAdminOrCallAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyOwnerWithAdminSupportAccess( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyOwnerWithAdminSupportAccess_uint256_bytes.onlyOwnerWithAdminSupportAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyClassScopedAccess(RootCallWrapper memory self, uint256 smartObjectId, bytes memory data) internal view { bytes memory systemCall = abi.encodeCall( _onlyClassScopedAccess_uint256_bytes.onlyClassScopedAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlyAdminOrClassScopedAccess( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlyAdminOrClassScopedAccess_uint256_bytes.onlyAdminOrClassScopedAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function onlySmartAssemblyClassScopedAccess( RootCallWrapper memory self, uint256 smartObjectId, bytes memory data ) internal view { bytes memory systemCall = abi.encodeCall( _onlySmartAssemblyClassScopedAccess_uint256_bytes.onlySmartAssemblyClassScopedAccess, (smartObjectId, data) ); SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); } function isAdmin(RootCallWrapper memory self, address caller) internal view returns (bool) { bytes memory systemCall = abi.encodeCall(_isAdmin_address.isAdmin, (caller)); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function isOwner(RootCallWrapper memory self, uint256 smartObjectId, address caller) internal view returns (bool) { bytes memory systemCall = abi.encodeCall(_isOwner_uint256_address.isOwner, (smartObjectId, caller)); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function isEphemeralOwner( RootCallWrapper memory self, uint256 smartObjectId, address caller, bytes memory data ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall( _isEphemeralOwner_uint256_address_bytes.isEphemeralOwner, (smartObjectId, caller, data) ); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function isClassScoped( RootCallWrapper memory self, uint256 classId, ResourceId systemId ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall(_isClassScoped_uint256_ResourceId.isClassScoped, (classId, systemId)); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function isOwnerOfBothGates( RootCallWrapper memory self, address caller, bytes memory data ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall(_isOwnerOfBothGates_address_bytes.isOwnerOfBothGates, (caller, data)); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function canTransferFromEphemeral( RootCallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall( _canTransferFromEphemeral_uint256_address.canTransferFromEphemeral, (smartObjectId, caller) ); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function canTransferToEphemeral( RootCallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall( _canTransferToEphemeral_uint256_address.canTransferToEphemeral, (smartObjectId, caller) ); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function canTransferToInventory( RootCallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall( _canTransferToInventory_uint256_address.canTransferToInventory, (smartObjectId, caller) ); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function canCrossTransferToEphemeral( RootCallWrapper memory self, uint256 smartObjectId, address caller ) internal view returns (bool) { bytes memory systemCall = abi.encodeCall( _canCrossTransferToEphemeral_uint256_address.canCrossTransferToEphemeral, (smartObjectId, caller) ); bytes memory result = SystemCall.staticcallOrRevert(self.from, self.systemId, systemCall); return abi.decode(result, (bool)); } function callFrom(AccessSystemType self, address from) internal pure returns (CallWrapper memory) { return CallWrapper(self.toResourceId(), from); } function callAsRoot(AccessSystemType self) internal view returns (RootCallWrapper memory) { return RootCallWrapper(self.toResourceId(), msg.sender); } function callAsRootFrom(AccessSystemType self, address from) internal pure returns (RootCallWrapper memory) { return RootCallWrapper(self.toResourceId(), from); } function toResourceId(AccessSystemType self) internal pure returns (ResourceId) { return ResourceId.wrap(AccessSystemType.unwrap(self)); } function fromResourceId(ResourceId resourceId) internal pure returns (AccessSystemType) { return AccessSystemType.wrap(resourceId.unwrap()); } function getAddress(AccessSystemType self) internal view returns (address) { return Systems.getSystem(self.toResourceId()); } function _world() private view returns (IWorldCall) { return IWorldCall(StoreSwitch.getStoreAddress()); } } /** * System Function Interfaces * * We generate an interface for each system function, which is then used for encoding system calls. * This is necessary to handle function overloading correctly (which abi.encodeCall cannot). * * Each interface is uniquely named based on the function name and parameters to prevent collisions. */ interface _onlyOwnerOrEphemeralTransferRole_uint256_bytes { function onlyOwnerOrEphemeralTransferRole(uint256 smartObjectId, bytes memory data) external; } interface _onlyOwnerOrEphemeralCrossTransferRole_uint256_bytes { function onlyOwnerOrEphemeralCrossTransferRole(uint256 smartObjectId, bytes memory data) external; } interface _onlyEphemeralOwnerOrTransferRole_uint256_bytes { function onlyEphemeralOwnerOrTransferRole(uint256 smartObjectId, bytes memory data) external; } interface _onlyOwnerOrInventoryTransferRole_uint256_bytes { function onlyOwnerOrInventoryTransferRole(uint256 smartObjectId, bytes memory data) external; } interface _onlyOwner_uint256_bytes { function onlyOwner(uint256 smartObjectId, bytes memory data) external; } interface _onlyDirectOwner_uint256_bytes { function onlyDirectOwner(uint256 smartObjectId, bytes memory data) external; } interface _onlyDirectAdmin_uint256_bytes { function onlyDirectAdmin(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminSupportedAccess_uint256_bytes { function onlyAdminSupportedAccess(uint256 smartObjectId, bytes memory data) external; } interface _adminSupportOrDirectOwner_uint256_bytes { function adminSupportOrDirectOwner(uint256 smartObjectId, bytes memory data) external; } interface _adminSupportOrDirectOwnerGates_uint256_bytes { function adminSupportOrDirectOwnerGates(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminOrOwner_uint256_bytes { function onlyAdminOrOwner(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminOrOwnerSupported_uint256_bytes { function onlyAdminOrOwnerSupported(uint256 smartObjectId, bytes memory data) external; } interface _onlyClassScopedOrCharAdminOrOwner_uint256_bytes { function onlyClassScopedOrCharAdminOrOwner(uint256 smartObjectId, bytes memory data) external; } interface _onlyCallAccess_uint256_bytes { function onlyCallAccess(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminSupportedOwnerOrCall_uint256_bytes { function onlyAdminSupportedOwnerOrCall(uint256 smartObjectId, bytes memory data) external; } interface _onlyDirectEphemeralOwnerOrCall_uint256_bytes { function onlyDirectEphemeralOwnerOrCall(uint256 smartObjectId, bytes memory data) external; } interface _onlyCallAccessOrDirectEphemeralOwner_uint256_bytes { function onlyCallAccessOrDirectEphemeralOwner(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminOrCallAccess_uint256_bytes { function onlyAdminOrCallAccess(uint256 smartObjectId, bytes memory data) external; } interface _onlyCallAccessWithScopeEnforced_uint256_bytes { function onlyCallAccessWithScopeEnforced(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminOrScopeEnforcedCall_uint256_bytes { function onlyAdminOrScopeEnforcedCall(uint256 smartObjectId, bytes memory data) external; } interface _onlyDirectAdminOrCallAccess_uint256_bytes { function onlyDirectAdminOrCallAccess(uint256 smartObjectId, bytes memory data) external; } interface _onlyOwnerWithAdminSupportAccess_uint256_bytes { function onlyOwnerWithAdminSupportAccess(uint256 smartObjectId, bytes memory data) external; } interface _onlyClassScopedAccess_uint256_bytes { function onlyClassScopedAccess(uint256 smartObjectId, bytes memory data) external; } interface _onlyAdminOrClassScopedAccess_uint256_bytes { function onlyAdminOrClassScopedAccess(uint256 smartObjectId, bytes memory data) external; } interface _onlySmartAssemblyClassScopedAccess_uint256_bytes { function onlySmartAssemblyClassScopedAccess(uint256 smartObjectId, bytes memory data) external; } interface _isAdmin_address { function isAdmin(address caller) external; } interface _isOwner_uint256_address { function isOwner(uint256 smartObjectId, address caller) external; } interface _isEphemeralOwner_uint256_address_bytes { function isEphemeralOwner(uint256 smartObjectId, address caller, bytes memory data) external; } interface _isClassScoped_uint256_ResourceId { function isClassScoped(uint256 classId, ResourceId systemId) external; } interface _isOwnerOfBothGates_address_bytes { function isOwnerOfBothGates(address caller, bytes memory data) external; } interface _canTransferFromEphemeral_uint256_address { function canTransferFromEphemeral(uint256 smartObjectId, address caller) external; } interface _canTransferToEphemeral_uint256_address { function canTransferToEphemeral(uint256 smartObjectId, address caller) external; } interface _canTransferToInventory_uint256_address { function canTransferToInventory(uint256 smartObjectId, address caller) external; } interface _canCrossTransferToEphemeral_uint256_address { function canCrossTransferToEphemeral(uint256 smartObjectId, address caller) external; } using AccessSystemLib for AccessSystemType global; using AccessSystemLib for CallWrapper global; using AccessSystemLib for RootCallWrapper global;