从用户那里免费收取存储费用的最佳做法是什么?每次他们插入数据时,我都必须收取存储费吗?
我可以在不制作函数 [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/