使用 Remix Ethereum 时出现错误 types/value 长度不匹配(以前 运行 没问题。)
When using Remix Ethereum get Error types/value length mismatch (previously run was ok.)
创建 meatFarm 出错:参数编码错误:错误:types/values 长度不匹配(计数={"types":2,"values":4},value={"types":["address ","地址"],"值":["0xd9145CCE52D386f254917e481eB44e9943F39138","0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8","",""]},代码=INVALID_ARGUMENT,版本=abi/5.5.0)[=.0) ]
我遇到上面的错误,它需要 4 个值,但类型只有 2 个。想知道我错过了什么。
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract meatFarm {
mapping(address => uint256[]) public stakingBalance;
mapping(address => bool) public isStaking;
mapping(address => uint256) public startTime;
mapping(address => uint256) public meatBalance;
string public name = "MeatFarm";
IERC721 public cdnoToken;
IERC20 public meatToken;
event Stake(address indexed from, uint256 indexed);
event Unstake(address indexed from, uint256 indexed);
event YieldWithdraw(address indexed to, uint256 amount);
constructor(
IERC721 _cdnoToken,
IERC20 _meatToken
) {
cdnoToken = _cdnoToken;
meatToken = _meatToken;
}
}
您似乎传递了两个空参数。
我可以使用您的代码和参数将其部署到 Remix 中:
"0xd9145CCE52D386f254917e481eB44e9943F39138","0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8"
不是代码问题,是 remix 版本更新有问题!
创建 meatFarm 出错:参数编码错误:错误:types/values 长度不匹配(计数={"types":2,"values":4},value={"types":["address ","地址"],"值":["0xd9145CCE52D386f254917e481eB44e9943F39138","0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8","",""]},代码=INVALID_ARGUMENT,版本=abi/5.5.0)[=.0) ]
我遇到上面的错误,它需要 4 个值,但类型只有 2 个。想知道我错过了什么。
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract meatFarm {
mapping(address => uint256[]) public stakingBalance;
mapping(address => bool) public isStaking;
mapping(address => uint256) public startTime;
mapping(address => uint256) public meatBalance;
string public name = "MeatFarm";
IERC721 public cdnoToken;
IERC20 public meatToken;
event Stake(address indexed from, uint256 indexed);
event Unstake(address indexed from, uint256 indexed);
event YieldWithdraw(address indexed to, uint256 amount);
constructor(
IERC721 _cdnoToken,
IERC20 _meatToken
) {
cdnoToken = _cdnoToken;
meatToken = _meatToken;
}
}
您似乎传递了两个空参数。 我可以使用您的代码和参数将其部署到 Remix 中:
"0xd9145CCE52D386f254917e481eB44e9943F39138","0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8"
不是代码问题,是 remix 版本更新有问题!