Files
openzeppelin-contracts/test/helpers/random.js
Renan Souza 78d5708340 Migrate utils to ethersjs v6 (#4736)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: ernestognw <ernestognw@gmail.com>
2023-11-24 01:32:30 +00:00

16 lines
447 B
JavaScript

const { ethers } = require('hardhat');
const randomArray = (generator, arrayLength = 3) => Array(arrayLength).fill().map(generator);
const generators = {
address: () => ethers.Wallet.createRandom().address,
bytes32: () => ethers.hexlify(ethers.randomBytes(32)),
uint256: () => ethers.toBigInt(ethers.randomBytes(32)),
hexBytes: length => ethers.hexlify(ethers.randomBytes(length)),
};
module.exports = {
randomArray,
generators,
};