小编sto*_* TV的帖子

安全帽测试:<functionName> 不是函数

我正在使用 BSC 分叉在安全帽网络上测试我的合约。

我正在部署具有铸币功能的代币合约:

// @dev Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
    _mint(_to, _amount);
    _moveDelegates(address(0), _delegates[_to], _amount);
}
Run Code Online (Sandbox Code Playgroud)

然后我将其部署到测试中> npx hardhat test,它将运行此代码的测试:

...
it("Should deploy", async () => {
        token = await Token.deploy();
        await token.deployed();
        console.debug(`\t\t\tToken Contract Address: ${cyan}`, token.address);
        const supply = await token.totalSupply()
        console.debug(`\t\t\tToken totalSupply: ${yellow}`, supply);
        await token.mint(owner.address, web3.utils.toWei("1000", 'ether'))
        console.debug(`\t\t\tToken owner balance: ${cyan}`, token.balanceOf(owner.address));
 });
 ...
Run Code Online (Sandbox Code Playgroud)

测试正确打印前 2 …

blockchain solidity hardhat

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

标签 统计

blockchain ×1

hardhat ×1

solidity ×1