gpt4 book ai didi

nearprotocol - 我该如何收取仓储费?

转载 作者:行者123 更新时间:2023-12-04 03:27:49 24 4
gpt4 key购买 nike

从用户那里免费收取存储费用的最佳做法是什么?每次他们插入数据时,我都必须收取存储费吗?我可以在不制作函数 [payable] 的情况下收取存储费吗?

最佳答案

What are the best practices of charging storage frees from user?

有一个为这个用例设计的标准:

您可以在 this implementation 的 Rust 中使用此标准的接口(interface)在 near-sdk-rs 中。

一个特别有用的例子是 implementation of this trait for FungibleToken .此函数使用 this macro 公开.

Will I have to charge the storage fees every time they insert the data?

如果清楚单个用户需要多少数据,他们只需调用一次storage_deposit,并提供所需的存款。他们可以选择调用 storage_withdraw/storage_unregister 以获得退款并删除他们的数据。

Can I charge storage fees without making a function [payable]?

没有。但是如果你按照以前的标准,只有 storage_deposit 需要是 #[payable] 而不是你合约中的其他功能。

关于nearprotocol - 我该如何收取仓储费?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67315676/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com