python - 将 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.
解决方案
推荐阅读
- machine-learning - 岭回归与套索回归
- nativescript - 带有 NativeScript 的文档扫描仪
- php - 需要帮助使用 PHP Preg_match 的正则表达式来验证表单上的数字字段
- python - 在使用 h5py 创建数据集时,是否建议在 gzip 或 lzf 旁边同时使用“shuffle”和“fletcher32”过滤器?
- traefik - 我如何在 docker swarm 中使用 traefik2.0,我不知道应该使用哪些标签
- javascript - 如何使用 preact 进行手动代码拆分?
- r - getRetweeters() 返回一个 id 而 getRetweetCount() 返回 2 -- 在 twitteR 包中
- javascript - JavaScript 传单地图未加载
- php - PHP Post 没有正确接收变量
- php - 如果使用 htacess 重复帖子,如何将用户重定向到最旧的发布帖子