没有ERC20所有者批准方法,有一种方法可以转移 /薄荷令牌吗?
我试图了解Crowdsale是如何以这种购买代币的方式工作的。
将以太发送到合同的一部分还可以,但是令我转移的一部分对我来说仍然是黑暗的。
我在最新版本的Openzeppelin中有一个可ERC20固有的令牌。
我的众包合同将有成千上万的买家。在大多数教程中,他们会教授转移的代币,但这需要ERC20所有者的批准正确吗?是大多数教程显示的内容。我也可以铸造,可能是因为只有所有者可以铸造令牌。 我的问题是:用户可以在无需ERC20所有者采取任何行动的情况下购买令牌吗?
谢谢!
I trying to understand how crowdsale work in this way of buying tokens.
The part of send ether to a contract is ok, but the part of token transfer is still dark for me.
I have a ERC20Mintable token, in the latest version of openzeppelin.
My crowdsale contract will have thousands and thousands of buyers. In most tutorials, they teach transfering tokens with transferFrom, but that requires the approval of ERC20 owner correct ? Is what most of tutorials show. I can mint either, probably because only owner can mint tokens.
My question is: there is a method that users can buy tokens without any action of the ERC20 owner?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
需要
传输
功能的所有者批准。因为使用此功能,您允许第三方帐户从您的帐户转移给某人。假设我想将令牌从您的帐户转移到我兄弟的帐户。为了能够做到这一点,您必须先授予许可,并将此权限存储在映射中。如果您允许我从您的帐户中转移特定金额,请首先
使用
批准
函数将我的帐户添加到此映射中。这是所有者批准使用的地方。如果要将货币从您的帐户转到另一个帐户,则使用
Transfer
函数:Owner approval is needed for
transferFrom
function. Because with this function you are allowing third-party account transfer from your account to someone.Let's say I want to transfer token from your account to my brother's account. To be able to do this, you have to give permission first and this permission is stored in a mapping. If you allow me to transfer a specific amount from your account, you first add my account into this mapping
with
approve
function.This where owner approval used. If you want to transfer money from your account to another account, you use the
transfer
function:我还为我找到了这个解决方案,但没有找到任何适当的解决方案。
但是现在找到一个解决方案。
创建一个应付付款的函数并通过金额(买家购买多少),并使用(发件人,价值和金额)制作Keccak Hash,然后存储在地图中,然后发送传输接收ETH到_ADMIN地址。
然后创建API(发送者,金额,合同所有者),并与Contract'snersigner致电另一个功能,
我知道这是有风险的,但我没有找到任何解决方案。如果找到任何解决方案,请描述解决方案。
I also finding this solution for me but didn't find any proper solution.
however find a solution for now.
create a function that is payable and pass amount(how much buyer buy) and make a keccak hash with (sender , value and amount) and store in a map and send transfer receive eth to _admin address.
then create api that take (sender , amount ,contractOwner) and call another function with contractOwnerSigner
I know this is risky but i didn't found any solution. if you found any solution please describe solution.