-
Notifications
You must be signed in to change notification settings - Fork 19
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 #29 from gnosisguild/use-zodiac-core
Feat: Migration to Zodiac Core and Task Improvements in Delay Module
- Loading branch information
Showing
16 changed files
with
4,571 additions
and
2,350 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity >=0.8.0; | ||
|
||
import {ModuleProxyFactory} from "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol"; | ||
import {ModuleProxyFactory} from "@gnosis-guild/zodiac-core/contracts/factory/ModuleProxyFactory.sol"; | ||
|
||
contract TestFactory is ModuleProxyFactory {} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,38 +1,47 @@ | ||
import { AbiCoder, ZeroHash } from 'ethers' | ||
import { task } from 'hardhat/config' | ||
import { task, types } from 'hardhat/config' | ||
|
||
import { deployViaFactory } from './eip2470' | ||
import { deployMastercopy, readMastercopies } from '@gnosis-guild/zodiac-core' | ||
import { createEIP1193 } from './create-EIP1193' | ||
|
||
const AddressOne = '0x0000000000000000000000000000000000000001' | ||
|
||
task('deploy:mastercopy', 'Deploys and verifies Delay mastercopy').setAction( | ||
async (_, hre) => { | ||
const [deployer] = await hre.ethers.getSigners() | ||
|
||
const Delay = await hre.ethers.getContractFactory('Delay') | ||
|
||
const args = AbiCoder.defaultAbiCoder().encode( | ||
['address', 'address', 'address', 'uint256', 'uint256'], | ||
[AddressOne, AddressOne, AddressOne, 0, 0] | ||
) | ||
|
||
const creationBytecode = `${Delay.bytecode}${args.substring(2)}` | ||
const salt = ZeroHash | ||
const address = await deployViaFactory(creationBytecode, salt, deployer) | ||
|
||
if (hre.network.name == 'hardhat') { | ||
return | ||
} | ||
|
||
console.log('Waiting 1 minute before etherscan verification start...') | ||
// Etherscan needs some time to process before trying to verify. | ||
await new Promise((resolve) => setTimeout(resolve, 60000)) | ||
|
||
await hre.run('verify:verify', { | ||
address, | ||
constructorArguments: [AddressOne, AddressOne, AddressOne, 0, 0], | ||
}) | ||
} | ||
task( | ||
'deploy:mastercopy', | ||
'For every version entry on the artifacts file, deploys a mastercopy into the current network' | ||
) | ||
|
||
export {} | ||
.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}` | ||
) | ||
} | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.