// SPDX-License-Identifier: MIT pragma solidity >=0.8.24; /* Autogenerated file. Do not edit manually. */ import { EphemeralInteractSystem } from "../../systems/inventory/EphemeralInteractSystem.sol"; import { InventoryItemParams } from "../../systems/inventory/types.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 { ResourceId } from "@latticexyz/store/src/ResourceId.sol"; import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; type EphemeralInteractSystemType is bytes32; // equivalent to WorldResourceIdLib.encode({ typeId: RESOURCE_SYSTEM, namespace: "evefrontier", name: "EphemeralInterac" })) EphemeralInteractSystemType constant ephemeralInteractSystem = EphemeralInteractSystemType.wrap( 0x737965766566726f6e74696572000000457068656d6572616c496e7465726163 ); struct CallWrapper { ResourceId systemId; address from; } struct RootCallWrapper { ResourceId systemId; address from; } /** * @title EphemeralInteractSystemLib * @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 EphemeralInteractSystemLib { error EphemeralInteractSystemLib_CallingFromRootSystem(); function transferFromEphemeral( EphemeralInteractSystemType self, uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) internal { return CallWrapper(self.toResourceId(), address(0)).transferFromEphemeral(smartObjectId, ephemeralOwner, items); } function transferToEphemeral( EphemeralInteractSystemType self, uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) internal { return CallWrapper(self.toResourceId(), address(0)).transferToEphemeral(smartObjectId, ephemeralOwner, items); } function crossTransferToEphemeral( EphemeralInteractSystemType self, uint256 smartObjectId, address fromEphemeralOwner, address toEphemeralOwner, InventoryItemParams[] memory items ) internal { return CallWrapper(self.toResourceId(), address(0)).crossTransferToEphemeral( smartObjectId, fromEphemeralOwner, toEphemeralOwner, items ); } function setTransferFromEphemeralAccess( EphemeralInteractSystemType self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { return CallWrapper(self.toResourceId(), address(0)).setTransferFromEphemeralAccess( smartObjectId, accessAddress, isAllowed ); } function setTransferToEphemeralAccess( EphemeralInteractSystemType self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { return CallWrapper(self.toResourceId(), address(0)).setTransferToEphemeralAccess( smartObjectId, accessAddress, isAllowed ); } function setCrossTransferToEphemeralAccess( EphemeralInteractSystemType self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { return CallWrapper(self.toResourceId(), address(0)).setCrossTransferToEphemeralAccess( smartObjectId, accessAddress, isAllowed ); } function transferFromEphemeral( CallWrapper memory self, uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert EphemeralInteractSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _transferFromEphemeral_uint256_address_InventoryItemParamsArray.transferFromEphemeral, (smartObjectId, ephemeralOwner, items) ); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function transferToEphemeral( CallWrapper memory self, uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert EphemeralInteractSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _transferToEphemeral_uint256_address_InventoryItemParamsArray.transferToEphemeral, (smartObjectId, ephemeralOwner, items) ); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function crossTransferToEphemeral( CallWrapper memory self, uint256 smartObjectId, address fromEphemeralOwner, address toEphemeralOwner, InventoryItemParams[] memory items ) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert EphemeralInteractSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _crossTransferToEphemeral_uint256_address_address_InventoryItemParamsArray.crossTransferToEphemeral, (smartObjectId, fromEphemeralOwner, toEphemeralOwner, items) ); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function setTransferFromEphemeralAccess( CallWrapper memory self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert EphemeralInteractSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _setTransferFromEphemeralAccess_uint256_address_bool.setTransferFromEphemeralAccess, (smartObjectId, accessAddress, isAllowed) ); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function setTransferToEphemeralAccess( CallWrapper memory self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert EphemeralInteractSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _setTransferToEphemeralAccess_uint256_address_bool.setTransferToEphemeralAccess, (smartObjectId, accessAddress, isAllowed) ); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function setCrossTransferToEphemeralAccess( CallWrapper memory self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { // if the contract calling this function is a root system, it should use `callAsRoot` if (address(_world()) == address(this)) revert EphemeralInteractSystemLib_CallingFromRootSystem(); bytes memory systemCall = abi.encodeCall( _setCrossTransferToEphemeralAccess_uint256_address_bool.setCrossTransferToEphemeralAccess, (smartObjectId, accessAddress, isAllowed) ); self.from == address(0) ? _world().call(self.systemId, systemCall) : _world().callFrom(self.from, self.systemId, systemCall); } function transferFromEphemeral( RootCallWrapper memory self, uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) internal { bytes memory systemCall = abi.encodeCall( _transferFromEphemeral_uint256_address_InventoryItemParamsArray.transferFromEphemeral, (smartObjectId, ephemeralOwner, items) ); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function transferToEphemeral( RootCallWrapper memory self, uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) internal { bytes memory systemCall = abi.encodeCall( _transferToEphemeral_uint256_address_InventoryItemParamsArray.transferToEphemeral, (smartObjectId, ephemeralOwner, items) ); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function crossTransferToEphemeral( RootCallWrapper memory self, uint256 smartObjectId, address fromEphemeralOwner, address toEphemeralOwner, InventoryItemParams[] memory items ) internal { bytes memory systemCall = abi.encodeCall( _crossTransferToEphemeral_uint256_address_address_InventoryItemParamsArray.crossTransferToEphemeral, (smartObjectId, fromEphemeralOwner, toEphemeralOwner, items) ); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function setTransferFromEphemeralAccess( RootCallWrapper memory self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { bytes memory systemCall = abi.encodeCall( _setTransferFromEphemeralAccess_uint256_address_bool.setTransferFromEphemeralAccess, (smartObjectId, accessAddress, isAllowed) ); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function setTransferToEphemeralAccess( RootCallWrapper memory self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { bytes memory systemCall = abi.encodeCall( _setTransferToEphemeralAccess_uint256_address_bool.setTransferToEphemeralAccess, (smartObjectId, accessAddress, isAllowed) ); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function setCrossTransferToEphemeralAccess( RootCallWrapper memory self, uint256 smartObjectId, address accessAddress, bool isAllowed ) internal { bytes memory systemCall = abi.encodeCall( _setCrossTransferToEphemeralAccess_uint256_address_bool.setCrossTransferToEphemeralAccess, (smartObjectId, accessAddress, isAllowed) ); SystemCall.callWithHooksOrRevert(self.from, self.systemId, systemCall, msg.value); } function callFrom(EphemeralInteractSystemType self, address from) internal pure returns (CallWrapper memory) { return CallWrapper(self.toResourceId(), from); } function callAsRoot(EphemeralInteractSystemType self) internal view returns (RootCallWrapper memory) { return RootCallWrapper(self.toResourceId(), msg.sender); } function callAsRootFrom( EphemeralInteractSystemType self, address from ) internal pure returns (RootCallWrapper memory) { return RootCallWrapper(self.toResourceId(), from); } function toResourceId(EphemeralInteractSystemType self) internal pure returns (ResourceId) { return ResourceId.wrap(EphemeralInteractSystemType.unwrap(self)); } function fromResourceId(ResourceId resourceId) internal pure returns (EphemeralInteractSystemType) { return EphemeralInteractSystemType.wrap(resourceId.unwrap()); } function getAddress(EphemeralInteractSystemType 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 _transferFromEphemeral_uint256_address_InventoryItemParamsArray { function transferFromEphemeral( uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) external; } interface _transferToEphemeral_uint256_address_InventoryItemParamsArray { function transferToEphemeral( uint256 smartObjectId, address ephemeralOwner, InventoryItemParams[] memory items ) external; } interface _crossTransferToEphemeral_uint256_address_address_InventoryItemParamsArray { function crossTransferToEphemeral( uint256 smartObjectId, address fromEphemeralOwner, address toEphemeralOwner, InventoryItemParams[] memory items ) external; } interface _setTransferFromEphemeralAccess_uint256_address_bool { function setTransferFromEphemeralAccess(uint256 smartObjectId, address accessAddress, bool isAllowed) external; } interface _setTransferToEphemeralAccess_uint256_address_bool { function setTransferToEphemeralAccess(uint256 smartObjectId, address accessAddress, bool isAllowed) external; } interface _setCrossTransferToEphemeralAccess_uint256_address_bool { function setCrossTransferToEphemeralAccess(uint256 smartObjectId, address accessAddress, bool isAllowed) external; } using EphemeralInteractSystemLib for EphemeralInteractSystemType global; using EphemeralInteractSystemLib for CallWrapper global; using EphemeralInteractSystemLib for RootCallWrapper global;