10.3 订单模板谓词 (Order template predicate)
https://github.com/compolabs/spark/tree/master/services/predicate-orders-builder/order-template
This system uses a predicate to represent an order that can be filled by anyone. To create an order, the maker sends a coin to the predicate root, which can be unlocked by any transaction that meets the order's conditions. These conditions, such as transferring a specific amount of an asset to a receiver, are hard-coded into the predicate bytecode, making them specific to that order.
本系统使用一个谓词,来代表一个可以由任何人完成的订单。要创建一个订单,挂单方向谓词根发送一个代币,它可以被任何符合订单条件的交易解锁。这些条件,如将特定数量的资产转移给接收者,被硬编码到谓词字节码中,使其成为该订单的特定(属性)。
The order owner can then execute the order by spending the predicate coin in a transaction that meets the order's conditions. The owner can use the predicate coin in any way they wish, as long as the output of the transaction satisfies the order's conditions and is the first output in the output set.
然后,订单所有者可以通过在满足订单条件的交易中,花费谓词(相关的)代币来执行订单。只要交易的输出满足订单的条件,并且是输出集中的第一个输出,所有者可用以任何方式使用谓词代币。
To cancel an order, the maker can spend the predicate coin in a transaction that includes a single coin input signed by the receiver, with two inputs: the signed coin and the predicate coin.
为了取消订单,挂单方可以在交易中花费谓词相关的代币,包括由接收者签名的单一代币输入,其中有两个输入:签名代币和谓词代币。
Partially filled development in progress: that means an order can not be partially filled - the taker must pay the entire ask amount.
正在进行的部分替代开发:这意味着一个订单不能被部分满足--接受者必须支付整个要价金额。
After updating to version 0.37.0 of the forc tool, the constants in the
forc.toml
file are now deprecated, which means we are required to insert the order data by modifying themain.sw
file. The development team is currently working on a solution for this issue, and you can stay updated by following the forum topic dedicated to it: https://forum.fuel.network/t/how-to-provide-constants-on-forc-v0-37-0-forc-toml-constants-outdated-on-forc-v0-37-0/2279/1在更新到 forc工具的0.37.0版本后,
forc.toml
文件中的常量现在被废弃了,这意味着我们需要通过修改main.sw
文件来插入订单数据。开发团队目前正在努力解决这个问题,你可以通过关注论坛中专门的主题来了解最新情况: https://forum.fuel.network/t/how-to-provide-constants-on-forc-v0-37-0-forc-toml-constants-outdated-on-forc-v0-37-0/2279/1
During the development of this predicate, we were inspired by OTC-swap-predicate
在这个谓词的开发过程中,我们受到了OTC-交换-谓词的启发。
Last updated