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

标签 nearprotocol

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

相关文章:

nearprotocol - 如何使用 Nearlib.js 获取某个帐户的余额

nearprotocol - 如何从对智能合约的调用中返回一个值?

nearprotocol - 如何在 NEAR 协议(protocol)中构建和部署多个合约

smartcontracts - 为什么像signer_account_id这样的Env变量会导致错误: ProhibitedInView?

nearprotocol - 如何使用cli获得帐户的接近余额?

nearprotocol - @mutateState 装饰器在 NEAR 智能合约(Web 程序集)中意味着什么?

nearprotocol - 在附近调用 changemethods 后尝试获取最终执行结果的交易详细信息

rust - 如何检查 NEAR 账户是否部署了智能合约并实现了所需的接口(interface)?

blockchain - 如何使用特定私钥创建帐户?

nearprotocol - 如何撤销函数调用访问 key ?