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