小编Ben*_*yam的帖子

如何通过安全帽调用采用 Enum 类型的合约方法?

在你的合约中,如果你有接收枚举类型的方法,你将如何从安全帽脚本传递参数?

contract SomeContract {

enum WinStatus {
    PENDING,
    LOST,
    WON
}

WinStatus status;

function updateWinStatus(WinStatus _status) public {
   status = _status;
}
}
Run Code Online (Sandbox Code Playgroud)
// in your hardhat script
...
await someContract.updateWinStatus() // how should i call it. bare in mind hardhat is setup using  javascript not typescript in my case. 

Run Code Online (Sandbox Code Playgroud)

我尝试传递一个数字,希望它能按顺序(索引)获取它。但我收到“无效的 BigNumber 值”。另外,我尝试传递像“PENDING”或“WinType.PENDING”这样的字符串:思考:

solidity hardhat

3
推荐指数
1
解决办法
1304
查看次数

标签 统计

hardhat ×1

solidity ×1