pragmasolidity^0.8.0;interfaceIERC7518isIERC1155,IERC165{eventTokensLocked(addressindexedaccount,uintindexedid,uint256amount,uint256releaseTime);eventTokenUnlocked(addressindexedaccount,uintindexedid);eventTokensForceTransferred(addressindexedfrom,addressindexedto,uintindexedid,uint256amount);eventAddressFrozen(addressindexedaccount,bytesdata);eventAddressUnfrozen(addressindexedaccount,bytesdata);// Emitted when the transferability of tokens with a specific ID is restricted.
// 当具有特定 ID 的代币的转移性受到限制时发出。
eventTransferRestricted(uintindexedid);// Emitted when the transferability restriction of tokens with a specific ID is removed.
// 当移除具有特定 ID 的代币的转移性限制时发出。
eventTransferRestrictionRemoved(uintindexedid);eventPayoutDelivered(addressindexedfrom,addressindexedto,uint256amount);/**
* @dev Retrieves the transferable balance of tokens for the specified account and ID.
* @dev 检索指定帐户和 ID 的代币的可转移余额。
* @param account The address of the account.
* @param id The token ID.
* @param id 代币 ID。
* @return The transferable balance of tokens.
* @return 代币的可转移余额。
*/functiontransferableBalance(addressaccount,uintid)externalviewreturns(uint);/**
* @dev Retrieves the locked balance of tokens for the specified account and ID.
* @dev 检索指定帐户和 ID 的代币的锁定余额。
* @param account The address of the account.
* @param id The token ID.
* @param id 代币 ID。
* @return The locked balance of tokens.
* @return 代币的锁定余额。
*/functionlockedBalanceOf(addressaccount,uint256id)externalviewreturns(uint256);/**
* @dev Restricts the transferability of tokens with the specified ID.
* @dev 限制具有指定 ID 的代币的转移性。
* @param id The token ID.
* @param id 代币 ID。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionrestrictTransfer(uintid)externalreturns(bool);/**
* @dev Removes the transferability restriction of tokens with the specified ID.
* @dev 移除具有指定 ID 的代币的转移性限制。
* @param id The token ID.
* @param id 代币 ID。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionremoveRestriction(uintid)externalreturns(bool);/**
* @notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
* @notice 将指定数量的 `_value` 个 `_id` 从 `_from` 地址转移到 `_to` 地址(带有安全调用)。
* @dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
* @dev 调用者必须获得批准才能管理从 `_from` 帐户转移出去的代币(请参阅标准的“批准”部分)。
* After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
* 满足上述条件后,此函数必须检查 `_to` 是否为智能合约(例如,代码大小 > 0)。如果是,则必须在 `_to` 上调用 `onERC1155Received` 并采取适当的措施(请参阅标准的“安全转移规则”部分)。
* @param _from Source address
* @param _from 源地址
* @param _to Target address
* @param _to 目标地址
* @param _id ID of the token type
* @param _id 代币类型的 ID
* @param _value Transfer amount
* @param _value 转移数量
* @param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
* @param _data 其他数据,没有指定格式,必须在调用 `_to` 上的 `onERC1155Received` 时保持不变
*/functionsafeTransferFrom(address_from,address_to,uint256_id,uint256_value,bytescalldata_data)overrideexternal;/**
* @dev Checks if a transfer is allowed.
* @dev 检查是否允许转移。
* @param from The address to transfer tokens from.
* @param from 从中转移代币的地址。
* @param to The address to transfer tokens to.
* @param to 将代币转移到的地址。
* @param id The token ID.
* @param id 代币 ID。
* @param amount The amount of tokens to transfer.
* @param amount 要转移的代币数量。
* @param data Additional data related to the transfer.
* @param data 与转移相关的其他数据。
* @return status A boolean value indicating whether the transfer is allowed.
* @return status 一个布尔值,指示是否允许转移。
*/functioncanTransfer(addressfrom,addressto,uintid,uintamount,bytescalldatadata)externalviewreturns(boolstatus);/**
* @dev lock token till a particular block time.
* @dev 锁定代币直到特定区块时间。
* @param account The address of the account for which tokens will be locked.
* @param account 将锁定代币的帐户地址。
* @param id The token ID.
* @param id 代币 ID。
* @param amount The amount of tokens to be locked for the account.
* @param amount 要为帐户锁定的代币数量。
* @param releaseTime The timestamp indicating when the locked tokens can be released.
* @param releaseTime 指示何时可以释放锁定代币的时间戳。
* @return bool Returns true if the tokens are successfully locked, otherwise false.
* @return bool 如果代币已成功锁定,则返回 true,否则返回 false。
*/functionlockTokens(addressaccount,uintid,uint256amount,uint256releaseTime)externalreturns(bool);/**
* @dev Unlocks tokens that have crossed the release time for a specific account and id.
* @dev 解锁已超过特定帐户和 id 的释放时间的代币。
* @param account The address of the account to unlock tokens for.
* @param account 要为其解锁代币的帐户地址。
* @param id The token ID.
* @param id 代币 ID。
*/functionunlockToken(addressaccount,uint256id)external;/**
* @dev Force transfer in cases like recovery of tokens.
* @dev 在代币恢复等情况下强制转移。
* @param from The address to transfer tokens from.
* @param from 从中转移代币的地址。
* @param to The address to transfer tokens to.
* @param to 将代币转移到的地址。
* @param id The token ID.
* @param id 代币 ID。
* @param amount The amount of tokens to transfer.
* @param amount 要转移的代币数量。
* @param data Additional data related to the transfer.
* @param data 与转移相关的其他数据。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionforceTransfer(addressfrom,addressto,uint256id,uint256amount,bytesmemorydata)externalreturns(bool);/**
* @dev Freezes specified address.
* @dev 冻结指定的地址。
* @param account The address to be frozen.
* @param account 要冻结的地址。
* @param data Additional data related to the freeze operation.
* @param data 与冻结操作相关的其他数据。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionfreezeAddress(addressaccount,bytescalldatadata)externalreturns(bool);/**
* @dev Unfreezes specified address.
* @dev 解冻指定的地址。
* @param account The address to be unfrozen.
* @param account 要解冻的地址。
* @param data Additional data related to the unfreeze operation.
* @param data 与解冻操作相关的其他数据。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionunFreeze(addressaccount,bytesmemorydata)externalreturns(bool);/**
* @dev Sends payout to single address with corresponding amounts.
* @dev 将支付发送到具有相应金额的单个地址。
* @param to address to send the payouts to.
* @param to 发送支付的地址。
* @param amount amount representing the payouts to be sent.
* @param amount 表示要发送的支付的金额。
* @return A boolean indicating whether the batch payouts were successful.
* @return 一个布尔值,指示批量支付是否成功。
*/*functionpayout(addresscalldatato,uint256calldataamount)publicreturns(bool);/**
* @dev Sends batch payouts to multiple addresses with corresponding amounts.
* @dev 将批量支付发送到具有相应金额的多个地址。
* @param to An array of addresses to send the payouts to.
* @param to 一个用于发送支付的地址数组。
* @param amount An array of amounts representing the payouts to be sent.
* @param amount 一个表示要发送的支付的金额数组。
* @return A boolean indicating whether the batch payouts were successful.
* @return 一个布尔值,指示批量支付是否成功。
*/functionbatchPayout(address[]calldatato,uint256[]calldataamount)publicreturns(bool);}
interfaceIERC1155WrapperisIERC7518{/**
@dev Emitted when a new wrapped token address is added to the set.
@dev 当新的包装代币地址被添加到集合中时发出。
@param wrappedTokenAddress The address of the wrapped token that was added.
@param wrappedTokenAddress 添加的包装代币的地址。
*/eventWrappedTokenAddressSet(addresswrappedTokenAddress);/**
@dev Emitted when tokens are wrapped.
@dev 当代币被包装时发出。
@param The ERC1155 token ID of the wrapped tokens.
@param The 包装代币的 ERC1155 代币 ID。
@param amount The amount of tokens that were wrapped.
@param amount 包装的代币数量。
*/eventTokensWrapped(uintindexedid,uint256amount);/**
@dev Emitted when tokens are unwrapped.
@dev 当代币被解包时发出。
@param wrappedTokenId Is the ERC1155 token ID of the wrapped tokens.
@param wrappedTokenId 是包装代币的 ERC1155 代币 ID。
@param amount The amount of tokens that were unwrapped.
@param amount 解包的代币数量。
*/eventTokensUnwrapped(uintindexedwrappedTokenId,uint256amount);/**
* @dev Sets the wrapped token address and logic for deciding partitions.
* @dev 设置包装代币地址和用于决定分区的逻辑。
* @param wrappedTokenAddress The address of the wrapped token contract.
* @param wrappedTokenAddress 包装代币合约的地址。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionsetWrappedToken(addresstoken)externalreturns(bool);/**
* @dev Wraps the specified amount of tokens by depositing the original tokens and receiving new standard tokens.
* @dev 通过存入原始代币并接收新的标准代币来包装指定数量的代币。
* @param amount The amount of tokens to wrap.
* @param amount 要包装的代币数量。
* @param data Additional data for partition.
* @param data 分区的其他数据。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionwrapToken(uint256amount,bytescalldatadata)externalreturns(bool);/**
* @notice Wraps a specified amount of tokens from a given partition into the main balance.
* @notice 将指定数量的代币从给定的分区包装到主余额中。
* @dev This function allows users to convert tokens from a specific partition back to the main balance,making them fungible with tokens from other partitions.
* @dev 此函数允许用户将代币从特定分区转换回主余额,使其与其他分区的代币具有同质性。
* @param partitionId The unique identifier of the partition from which tokens will be wrapped.
* @param partitionId 要从中包装代币的分区的唯一标识符。
* @param id The unique identifier of the token.
* @param id 代币的唯一标识符。
* @param amount The amount of tokens to be wrapped from the specified partition.
* @param amount 要从指定分区包装的代币数量。
* @param data Additional data that may be used to handle the wrap process (optional).
* @param data 可能用于处理包装过程的附加数据(可选)。
* @return success A boolean indicating whether the wrapping operation was successful or not.
* @return success 一个布尔值,指示包装操作是否成功。
*/functionwrapTokenFromPartition(bytes32partitionId,uint256id,uint256amount,bytescalldatadata)externalreturns(bool);/**
* @dev Unwraps the specified amount of wrapped tokens by depositing the current tokens and receiving the original tokens.
* @dev 通过存入当前代币并接收原始代币来解包指定数量的包装代币。
* @param wrappedTokenId internal partition id.
* @param wrappedTokenId 内部分区 ID。
* @param amount The amount of wrapped tokens to unwrap.
* @param amount 要解包的包装代币数量。
* @param data Additional data for partition.
* @param data 分区的其他数据。
* @return A boolean value indicating whether the operation was successful.
* @return 一个布尔值,指示操作是否成功。
*/functionunwrapToken(uint256wrappedTokenId,uint256amount,bytescalldatadata)externalreturns(bool);/**
* @dev Retrieves the balance of wrapped tokens for the specified account and ID.
* @dev 检索指定帐户和 ID 的包装代币的余额。
* @param account The address of the account.
* @param account 帐户的地址。
* @param id The token ID.
* @param id 代币 ID。
* @param data Additional data for partition.
* @param data 分区的其他数据。
* @return The balance of wrapped tokens.
* @return 包装代币的余额。
*/functionwrappedBalanceOf(addressaccount,uint256id,bytescalldatadata)externalviewreturns(uint256);/**
* @dev Retrieves the balance of original tokens for the specified account and ID.
* @dev 检索指定帐户和 ID 的原始代币的余额。
* @param account The address of the account.
* @param account 帐户的地址。
* @param id The token ID.
* @param id 代币 ID。
* @param data Additional data for partition.
* @param data 分区的其他数据。
* @return The balance of original tokens.
* @return 原始代币的余额。
*/functionoriginalBalanceOf(addressaccount,uint256id,bytescalldatadata)externalviewreturns(uint256);}