The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/solidity/optics-core/test/utils.js

42 lines
1.1 KiB

const { provider, deployMockContract } = waffle;
const TestRecipient = require('../artifacts/contracts/test/TestRecipient.sol/TestRecipient.json');
const [opticsMessageSender] = provider.getWallets();
class MockRecipientObject {
constructor() {
const [opticsMessageRecipient] = provider.getWallets();
this.mockRecipient = deployMockContract(
opticsMessageRecipient,
TestRecipient.abi,
);
}
async getRecipient() {
return await this.mockRecipient;
}
}
const increaseTimestampBy = async (provider, increaseTime) => {
await provider.send('evm_increaseTime', [increaseTime]);
await provider.send('evm_mine');
};
function getUnusedSigner(provider, numUsedSigners) {
const wallets = provider.getWallets();
if (wallets.length == numUsedSigners) {
throw new Error('need more wallets to get an extra random signer');
}
return wallets[numUsedSigners];
}
const testUtils = {
increaseTimestampBy,
getUnusedSigner,
opticsMessageSender,
opticsMessageMockRecipient: new MockRecipientObject(),
};
module.exports = testUtils;