将 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 (将#修改为@)