微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 BSC 智能合约代币铸造到 10 个不同的钱包

如何解决将 BSC 智能合约代币铸造到 10 个不同的钱包

我最近在另一个论坛上问了这个问题,但他们给出的答案有问题,这是智能合约中涉及薄荷功能的部分:

function mint(uint256 _amount,address[10] memory _receivers) external {
        // mint 50% of the _amount to one address
        balances[msg.sender] += _amount / 2;
        emit Transfer(address(0x0),msg.sender,_amount / 2);
        
        // mint the rest (another 50%) evenly to each receiver
        // i.e. each gets 5%
        for (uint i = 0; i < 10; i++) {
            balances[_receivers[i]] += _amount / 20;
            emit Transfer(address(0x0),_receivers[i],_amount / 20);
        }
    }

并且我试图通过生成 10 个单独的钱包地址并向每个钱包发送 X 数量的代币来从 python 调用 mint 函数。下面是涉及这部分的python代码

addresses = [];
i = 0
while i < 10:
    acct = Account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530')
    address = acct.address
    i += 1

contract.functions.mint(10000000000,addresses).call()

我得到的错误

Could not identify the intended function with name `mint`,positional argument(s) of type `(<class 'int'>,<class 'str'>)` and keyword argument(s) of type `{}`.
Found 1 function(s) with the name `mint`: ['mint(uint256,address[10])']
Function invocation Failed due to no matching argument types.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。