Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): Promise => {
// Find the provider object. See comments for `findBaseHardhatProvider`
const provider = findBaseHardhatProvider(hre)
// Sometimes the VM hasn't been initialized by the time we get here, depending on what the user
// is doing with hardhat (e.g., sending a transaction before calling this function will
// initialize the vm). Initialize it here if it hasn't been already.
if ((provider as any)._node === undefined) {
await (provider as any)._init()
}
// Pull out a reference to the vm's state manager.
const pStateManager = (provider as any)._node._vm.pStateManager
const layout = await getStorageLayout(name)
const factory = (await hre.ethers.getContractFactory(
name,
signer
)) as ModifiableContractFactory
const originalDeployFn = factory.deploy.bind(factory)
factory.deploy = async (...args: any[]): Promise => {
const contract: ModifiableContract = await originalDeployFn(...args)
contract._smodded = {}
const put = async (storage: any) => {
if (!storage) {
return
}
const slots = getStorageSlots(layout, storage)
for (const slot of slots) {