简体   繁体   English

我可以根据我创建的智能合约阻止某人转移ERC-721令牌吗?

[英]Can I stop someone from transferring an ERC-721 token based on the smart contract I created?

I do not have much experience with Solidity programming. 我对Solidity编程没有太多经验。 I want to create a smart contract for a new digital asset, say Cryptodoggies. 我想为新的数字资产创建智能合约,Cryptodoggies说。 I want to know if there is a way to prevent users from being able to resell/transfer their cryptodoggies. 我想知道是否有一种方法可以防止用户转售/转让其加密狗。

You could have a variable (boolean I think would be more suitable) on your contract and use it in an access modifier for the transfer function so that the transfer function would require for this variable to be true. 您可能在合约上有一个变量(布尔型,我认为会更合适),并在传递函数的访问修饰符中使用它,以便传递函数要求此变量为true。 Then by making this variable false (by a function accessible only to you) you can stop users from transferring coins. 然后,通过将此变量设置为false(仅由您可访问的函数),可以阻止用户转移硬币。 Of course, this modifier would have to be used for every function that enables users to transfer tokens. 当然,该修饰符必须用于使用户能够传输令牌的每个功能。

It would be something like that pausable ERC-20 from openzeppelin. 就像openzeppelin的那种可怜的ERC-20。 You can find it here . 你可以在这里找到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM