We are working on deploy a simple TokenTimelock contract
The contract looks like :
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/utils/TokenTimelock.sol";
contract AskjaTokenTimelock is TokenTimelock {
constructor(
IERC20 token,
address beneficiary,
uint256 releaseTime
) TokenTimelock(token, beneficiary, releaseTime) {}
}
While running the tests through hardhat we get a error that is difficult to interpret.
We test transfert
it("transfert 100 COIN to timeVault", async () => {
var amount = ethers.utils.parseEther("100.0");
const accounts = await hre.ethers.getSigners();
await askjaCoin.connect(accounts[0]).transfer(timeVault.address, amount);
//Time vault balance
let balance = await getBalance(askjaCoin, timeVault.address);
// no taxes on the vault
expect(balance).to.equal("100.0");
});
We want to test release
it("does allows release after time", async () => {
let balance = await getBalance(coinAdress, timeVault.address);
const second = 100 ;
await ethers.provider.send("evm_increaseTime", [second]);
await ethers.provider.send("evm_mine");
await timeVault.release();
});
The error:
Error: VM Exception while processing transaction: reverted with reason string '1000000000000000000000000000'
at AskjaTokenTimelock.verifyCallResult (@openzeppelin/contracts/utils/Address.sol:215)
at AskjaTokenTimelock.functionCallWithValue (@openzeppelin/contracts/utils/Address.sol:138)
at AskjaTokenTimelock.functionCall (@openzeppelin/contracts/utils/Address.sol:100)
at AskjaTokenTimelock._callOptionalReturn (@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol:93)
at AskjaTokenTimelock.safeTransfer (@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol:26)
at AskjaTokenTimelock.release (@openzeppelin/contracts/token/ERC20/utils/TokenTimelock.sol:79)
at HardhatNode._mineBlockWithPendingTxs (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:1772:23)
at HardhatNode.mineBlock (node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:466:16)
at EthModule._sendTransactionAndReturnHash (node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:1496:18)
at HardhatNetworkProvider.request (node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:118:18)
at EthersProviderWrapper.send (node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
What is the origin of the error ?
Environment
Hardhat ^2.9.3
@openzeppelin/contracts ^4.5.0