【发布时间】:2021-06-11 12:46:15
【问题描述】:
我正在尝试将函数转换为solidity 0.8.0,但不断收到类型错误,感谢任何帮助
TypeError:在 tuple() 中进行参数相关查找后,成员“sub”未找到或不可见。
function createViper(
uint256 matron,
uint256 sire,
address viperOwner
)
internal
returns (uint)
{
require(viperOwner != address(0));
uint8 newGenes = generateViperGenes(matron, sire);
Viper memory newViper = Viper({
genes: newGenes,
matronId: matron,
sireId: sire
});
uint256 newViperId = vipers.push(newViper).sub(1);
super._mint(viperOwner, newViperId);
emit Birth(
viperOwner,
newViperId,
newViper.matronId,
newViper.sireId,
newViper.genes
);
return newViperId;
}
【问题讨论】: