-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from gnosisguild/use-zodiac-core-v2
feat: improve hardhat task
- Loading branch information
Showing
12 changed files
with
249 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { EIP1193Provider } from "@gnosis-guild/zodiac-core"; | ||
import { Signer } from "ethers"; | ||
import { EthereumProvider } from "hardhat/types"; | ||
|
||
export function createEIP1193( | ||
provider: EthereumProvider, | ||
signer: Signer | ||
): EIP1193Provider { | ||
return { | ||
request: async ({ method, params }) => { | ||
if (method == "eth_sendTransaction") { | ||
const { hash } = await signer.sendTransaction((params as any[])[0]); | ||
return hash; | ||
} | ||
|
||
return provider.request({ method, params }); | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { task } from "hardhat/config"; | ||
|
||
import { readMastercopies, deployMastercopy } from "@gnosis-guild/zodiac-core"; | ||
import { createEIP1193 } from "./create-EIP1193"; | ||
|
||
task( | ||
"deploy:mastercopies", | ||
"For every version entry on the artifacts file, deploys a mastercopy into the current network" | ||
).setAction(async (_, hre) => { | ||
const [signer] = await hre.ethers.getSigners(); | ||
const provider = createEIP1193(hre.network.provider, signer); | ||
for (const mastercopy of readMastercopies()) { | ||
const { | ||
contractName, | ||
contractVersion, | ||
factory, | ||
bytecode, | ||
constructorArgs, | ||
salt, | ||
} = mastercopy; | ||
|
||
const { address, noop } = await deployMastercopy({ | ||
factory, | ||
bytecode, | ||
constructorArgs, | ||
salt, | ||
provider, | ||
onStart: () => { | ||
console.log( | ||
`⏳ ${contractName}@${contractVersion}: Deployment starting...` | ||
); | ||
}, | ||
}); | ||
if (noop) { | ||
console.log( | ||
`🔄 ${contractName}@${contractVersion}: Already deployed at ${address}` | ||
); | ||
} else { | ||
console.log( | ||
`🚀 ${contractName}@${contractVersion}: Successfully deployed at ${address}` | ||
); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { task, types } from "hardhat/config"; | ||
|
||
import { deployMastercopy, readMastercopies } from "@gnosis-guild/zodiac-core"; | ||
import { createEIP1193 } from "./create-EIP1193"; | ||
|
||
task( | ||
"deploy:mastercopy", | ||
"For every entry on the artifacts file, that corresponds to the provided entry, deploy the mastercopy into the current network" | ||
) | ||
.addOptionalParam( | ||
"contractVersion", | ||
"The specific version of the contract to deploy", | ||
"latest", // Default value | ||
types.string | ||
) | ||
.setAction(async ({ contractVersion }, hre) => { | ||
const [signer] = await hre.ethers.getSigners(); | ||
const provider = createEIP1193(hre.network.provider, signer); | ||
|
||
for (const mastercopy of readMastercopies({ contractVersion })) { | ||
const { | ||
contractName, | ||
contractVersion, | ||
factory, | ||
bytecode, | ||
constructorArgs, | ||
salt, | ||
} = mastercopy; | ||
const { address, noop } = await deployMastercopy({ | ||
factory, | ||
bytecode, | ||
constructorArgs, | ||
salt, | ||
provider, | ||
onStart: () => { | ||
console.log( | ||
`⏳ ${contractName}@${contractVersion}: Deployment starting...` | ||
); | ||
}, | ||
}); | ||
if (noop) { | ||
console.log( | ||
`🔄 ${contractName}@${contractVersion}: Already deployed at ${address}` | ||
); | ||
} else { | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.