-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acf0a26
commit 5b981fd
Showing
5 changed files
with
173 additions
and
11 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
Submodule forge-std
added at
155d54
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,84 @@ | ||
import { ethers, upgrades, run } from 'hardhat' | ||
import { getContract } from '../utils/deployment' | ||
import { StakingPool, PriorityPool, CommunityVCS } from '../../typechain-types' | ||
|
||
async function main() { | ||
const stakingPool = (await getContract('LINK_StakingPool')) as StakingPool | ||
const priorityPool = (await getContract('LINK_PriorityPool')) as PriorityPool | ||
const communityVCS = (await getContract('LINK_CommunityVCS')) as CommunityVCS | ||
const communityVaultAutomationFactory = await ethers.getContractFactory( | ||
'CommunityVaultAutomation' | ||
) | ||
|
||
const communityVCSAddress = '0xAc12290b097f6893322F5430627e472131fBC1B5' | ||
const minRewardsTotal = ethers.utils.parseUnits('650', 18) | ||
const minRewardsPerVault = ethers.utils.parseUnits('65', 18) | ||
|
||
const communityVaultAutomation = await communityVaultAutomationFactory.deploy( | ||
communityVCSAddress, | ||
minRewardsTotal, | ||
minRewardsPerVault | ||
) | ||
await communityVaultAutomation.deployed() | ||
await communityVaultAutomation.deployTransaction.wait(5) | ||
console.log('CommunityVaultAutomation deployed at:', communityVaultAutomation.address) | ||
await verifyContract(communityVaultAutomation.address, [ | ||
communityVCSAddress, | ||
minRewardsTotal, | ||
minRewardsPerVault, | ||
]) | ||
|
||
const stakingPoolImp = (await upgrades.prepareUpgrade( | ||
stakingPool.address, | ||
await ethers.getContractFactory('StakingPool'), | ||
{ | ||
kind: 'uups', | ||
unsafeAllowRenames: false, | ||
} | ||
)) as string | ||
console.log('StakingPool implementation deployed at: ', stakingPoolImp) | ||
|
||
await verifyContract(stakingPoolImp, []) | ||
|
||
const priorityPoolImp = (await upgrades.prepareUpgrade( | ||
priorityPool.address, | ||
await ethers.getContractFactory('PriorityPool'), | ||
{ | ||
kind: 'uups', | ||
unsafeAllowRenames: false, | ||
} | ||
)) as string | ||
console.log('PriorityPool implementation deployed at: ', priorityPoolImp) | ||
|
||
await verifyContract(priorityPoolImp, []) | ||
|
||
const communityVCSImp = (await upgrades.prepareUpgrade( | ||
communityVCS.address, | ||
await ethers.getContractFactory('CommunityVCS'), | ||
{ | ||
kind: 'uups', | ||
unsafeAllowRenames: false, | ||
} | ||
)) as string | ||
console.log('CommunityVCS implementation deployed at: ', communityVCSImp) | ||
await verifyContract(communityVCSImp, []) | ||
} | ||
|
||
async function verifyContract(contractAddress: string, constructorArguments: any[]) { | ||
try { | ||
await run('verify:verify', { | ||
address: contractAddress, | ||
constructorArguments: constructorArguments, | ||
}) | ||
console.log(`Contract verified: ${contractAddress}`) | ||
} catch (error: any) { | ||
console.error(`Verification failed for ${contractAddress}: ${error.message}`) | ||
} | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |
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,73 @@ | ||
import { ethers } from 'hardhat' | ||
import Safe, { EthersAdapter } from '@safe-global/protocol-kit' | ||
import SafeApiKit from '@safe-global/api-kit' | ||
import { MetaTransactionData } from '@safe-global/safe-core-sdk-types' | ||
import { PriorityPool, StakingPool, CommunityVCS } from '../../typechain-types' | ||
import { getContract } from '../utils/deployment' | ||
import { getAccounts } from '../utils/helpers' | ||
|
||
const multisigAddress = '0xB351EC0FEaF4B99FdFD36b484d9EC90D0422493D' | ||
|
||
// New implementation addresses for the contracts | ||
const priorityPoolNewImplementation = '0xYourNewPriorityPoolAddress' | ||
const stakingPoolNewImplementation = '0xYourNewStakingPoolAddress' | ||
const communityVCSNewImplementation = '0xYourNewCommunityVCSAddress' | ||
|
||
async function main() { | ||
const { signers } = await getAccounts() | ||
const ethAdapter = new EthersAdapter({ | ||
ethers, | ||
signerOrProvider: signers[0], | ||
}) | ||
const safeSdk = await Safe.create({ ethAdapter, safeAddress: multisigAddress }) | ||
const safeService = new SafeApiKit({ | ||
txServiceUrl: 'https://safe-transaction-mainnet.safe.global', | ||
ethAdapter, | ||
}) | ||
|
||
const priorityPool = (await getContract('PriorityPool')) as PriorityPool | ||
const stakingPool = (await getContract('StakingPool')) as StakingPool | ||
const communityVCS = (await getContract('CommunityVCS')) as CommunityVCS | ||
|
||
const safeTransactionData: MetaTransactionData[] = [ | ||
{ | ||
to: priorityPool.address, | ||
data: | ||
(await priorityPool.populateTransaction.upgradeTo(priorityPoolNewImplementation)).data || | ||
'', | ||
value: '0', | ||
}, | ||
{ | ||
to: stakingPool.address, | ||
data: | ||
(await stakingPool.populateTransaction.upgradeTo(stakingPoolNewImplementation)).data || '', | ||
value: '0', | ||
}, | ||
{ | ||
to: communityVCS.address, | ||
data: | ||
(await communityVCS.populateTransaction.upgradeTo(communityVCSNewImplementation)).data || | ||
'', | ||
value: '0', | ||
}, | ||
] | ||
|
||
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData }) | ||
const safeTxHash = await safeSdk.getTransactionHash(safeTransaction) | ||
const senderSignature = await safeSdk.signTransactionHash(safeTxHash) | ||
|
||
await safeService.proposeTransaction({ | ||
safeAddress: multisigAddress, | ||
safeTransactionData: safeTransaction.data, | ||
safeTxHash, | ||
senderAddress: signers[0].address, | ||
senderSignature: senderSignature.data, | ||
}) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) |