-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/dao-erc165-tests
- Loading branch information
Showing
19 changed files
with
828 additions
and
365 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
File renamed without changes.
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
File renamed without changes.
90 changes: 90 additions & 0 deletions
90
packages/contracts/deploy/update/to_v1.3.0/20_TokenVoting_Plugin.ts
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,90 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {PluginRepo__factory} from '../../../typechain'; | ||
import {getContractAddress, uploadToIPFS} from '../../helpers'; | ||
|
||
import tokenVotingSetupArtifact from '../../../artifacts/src/plugins/governance/majority-voting/token/TokenVotingSetup.sol/TokenVotingSetup.json'; | ||
import tokenVotingReleaseMetadata from '../../../src/plugins/governance/majority-voting/token/release-metadata.json'; | ||
import tokenVotingBuildMetadata from '../../../src/plugins/governance/majority-voting/token/build-metadata.json'; | ||
|
||
const TARGET_RELEASE = 1; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpdate TokenVoting Plugin'); | ||
const {deployments, ethers, network} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const deployResult = await deploy('TokenVotingSetup', { | ||
contract: tokenVotingSetupArtifact, | ||
from: deployer.address, | ||
args: [], | ||
log: true, | ||
}); | ||
|
||
const tokenVotingReleaseCIDPath = await uploadToIPFS( | ||
JSON.stringify(tokenVotingReleaseMetadata), | ||
network.name | ||
); | ||
const tokenVotingBuildCIDPath = await uploadToIPFS( | ||
JSON.stringify(tokenVotingBuildMetadata), | ||
network.name | ||
); | ||
|
||
const tokenVotingRepoAddress = await getContractAddress( | ||
'token-voting-repo', | ||
hre | ||
); | ||
const tokenVotingRepo = PluginRepo__factory.connect( | ||
tokenVotingRepoAddress, | ||
ethers.provider | ||
); | ||
if ( | ||
await tokenVotingRepo.callStatic.isGranted( | ||
tokenVotingRepoAddress, | ||
deployer.address, | ||
await tokenVotingRepo.MAINTAINER_PERMISSION_ID(), | ||
'0x00' | ||
) | ||
) { | ||
console.log(`Deployer has permission to install new TokenVoting version`); | ||
const tx = await tokenVotingRepo | ||
.connect(deployer) | ||
.createVersion( | ||
TARGET_RELEASE, | ||
deployResult.address, | ||
ethers.utils.toUtf8Bytes(`ipfs://${tokenVotingBuildCIDPath}`), | ||
ethers.utils.toUtf8Bytes(`ipfs://${tokenVotingReleaseCIDPath}`) | ||
); | ||
console.log(`Creating new TokenVoting build version with ${tx.hash}`); | ||
await tx.wait(); | ||
return; | ||
} | ||
|
||
const tx = await tokenVotingRepo | ||
.connect(deployer) | ||
.populateTransaction.createVersion( | ||
TARGET_RELEASE, | ||
deployResult.address, | ||
ethers.utils.toUtf8Bytes(`ipfs://${tokenVotingBuildCIDPath}`), | ||
ethers.utils.toUtf8Bytes(`ipfs://${tokenVotingReleaseCIDPath}`) | ||
); | ||
|
||
if (!tx.to || !tx.data) { | ||
throw new Error( | ||
`Failed to populate TokenVoting Repo createVersion transaction` | ||
); | ||
} | ||
|
||
console.log( | ||
`Deployer has no permission to create a new version. Adding managingDAO action` | ||
); | ||
hre.managingDAOActions.push({ | ||
to: tx.to, | ||
data: tx.data, | ||
value: 0, | ||
description: `Creates a new build for release 1 in the TokenVotingRepo (${tokenVotingRepoAddress}) with TokenVotingSetup (${deployResult.address})`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['Update', 'TokenVotingPlugin']; |
11 changes: 11 additions & 0 deletions
11
packages/contracts/deploy/update/to_v1.3.0/21_TokenVoting_Plugin_conclude.ts
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,11 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nConcluding TokenVoting Plugin Update'); | ||
|
||
hre.aragonToVerifyContracts.push( | ||
await hre.deployments.get('TokenVotingSetup') | ||
); | ||
}; | ||
export default func; | ||
func.tags = ['TokenVotingPlugin', 'Verify']; |
92 changes: 92 additions & 0 deletions
92
packages/contracts/deploy/update/to_v1.3.0/30_AddresslistVoting_Plugin.ts
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,92 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {PluginRepo__factory} from '../../../typechain'; | ||
import {getContractAddress, uploadToIPFS} from '../../helpers'; | ||
|
||
import addresslistVotingSetupArtifact from '../../../artifacts/src/plugins/governance/majority-voting/addresslist/AddresslistVotingSetup.sol/AddresslistVotingSetup.json'; | ||
import addresslistVotingReleaseMetadata from '../../../src/plugins/governance/majority-voting/addresslist/release-metadata.json'; | ||
import addresslistVotingBuildMetadata from '../../../src/plugins/governance/majority-voting/addresslist/build-metadata.json'; | ||
|
||
const TARGET_RELEASE = 1; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nUpdate AddresslistVoting Plugin'); | ||
const {deployments, ethers, network} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const deployResult = await deploy('AddresslistVotingSetup', { | ||
contract: addresslistVotingSetupArtifact, | ||
from: deployer.address, | ||
args: [], | ||
log: true, | ||
}); | ||
|
||
const addresslistVotingReleaseCIDPath = await uploadToIPFS( | ||
JSON.stringify(addresslistVotingReleaseMetadata), | ||
network.name | ||
); | ||
const addresslistVotingBuildCIDPath = await uploadToIPFS( | ||
JSON.stringify(addresslistVotingBuildMetadata), | ||
network.name | ||
); | ||
|
||
const addresslistVotingRepoAddress = await getContractAddress( | ||
'address-list-voting-repo', | ||
hre | ||
); | ||
const addresslistVotingRepo = PluginRepo__factory.connect( | ||
addresslistVotingRepoAddress, | ||
ethers.provider | ||
); | ||
if ( | ||
await addresslistVotingRepo.callStatic.isGranted( | ||
addresslistVotingRepoAddress, | ||
deployer.address, | ||
await addresslistVotingRepo.MAINTAINER_PERMISSION_ID(), | ||
'0x00' | ||
) | ||
) { | ||
console.log( | ||
`Deployer has permission to install new AddresslistVoting version` | ||
); | ||
const tx = await addresslistVotingRepo | ||
.connect(deployer) | ||
.createVersion( | ||
TARGET_RELEASE, | ||
deployResult.address, | ||
ethers.utils.toUtf8Bytes(`ipfs://${addresslistVotingBuildCIDPath}`), | ||
ethers.utils.toUtf8Bytes(`ipfs://${addresslistVotingReleaseCIDPath}`) | ||
); | ||
console.log(`Creating new AddresslistVoting build version with ${tx.hash}`); | ||
await tx.wait(); | ||
return; | ||
} | ||
|
||
const tx = await addresslistVotingRepo | ||
.connect(deployer) | ||
.populateTransaction.createVersion( | ||
TARGET_RELEASE, | ||
deployResult.address, | ||
ethers.utils.toUtf8Bytes(`ipfs://${addresslistVotingBuildCIDPath}`), | ||
ethers.utils.toUtf8Bytes(`ipfs://${addresslistVotingReleaseCIDPath}`) | ||
); | ||
|
||
if (!tx.to || !tx.data) { | ||
throw new Error( | ||
`Failed to populate AddresslistVoting Repo createVersion transaction` | ||
); | ||
} | ||
|
||
console.log( | ||
`Deployer has no permission to create a new version. Adding managingDAO action` | ||
); | ||
hre.managingDAOActions.push({ | ||
to: tx.to, | ||
data: tx.data, | ||
value: 0, | ||
description: `Creates a new build for release 1 in the AddresslistVotingRepo (${addresslistVotingRepoAddress}) with AddresslistVotingSetup (${deployResult.address})`, | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['Update', 'AddresslistVotingPlugin']; |
11 changes: 11 additions & 0 deletions
11
packages/contracts/deploy/update/to_v1.3.0/31_AddresslistVoting_Plugin_conclude.ts
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,11 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
console.log('\nConcluding AddresslistVoting Plugin Update'); | ||
|
||
hre.aragonToVerifyContracts.push( | ||
await hre.deployments.get('AddresslistVotingSetup') | ||
); | ||
}; | ||
export default func; | ||
func.tags = ['AddresslistVotingPlugin', 'Verify']; |
File renamed without changes.
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
12 changes: 12 additions & 0 deletions
12
packages/contracts/src/utils/protocol/IProtocolVersion.sol
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,12 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.8; | ||
|
||
/// @title IProtocolVersion | ||
/// @author Aragon Association - 2022-2023 | ||
/// @notice An interface defining the semantic OSx protocol version. | ||
interface IProtocolVersion { | ||
/// @notice Returns the protocol version at which the current contract was built. Use it to check for future upgrades that might be applicable. | ||
/// @return _version Returns the semantic OSx protocol version. | ||
function protocolVersion() external view returns (uint8[3] memory _version); | ||
} |
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,18 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity 0.8.17; | ||
|
||
import {IProtocolVersion} from "./IProtocolVersion.sol"; | ||
|
||
/// @title ProtocolVersion | ||
/// @author Aragon Association - 2023 | ||
/// @notice An abstract, stateless, non-upgradeable contract serves as a base for other contracts requiring awareness of the OSx protocol version. | ||
/// @dev Do not add any new variables to this contract that would shift down storage in the inheritance chain. | ||
abstract contract ProtocolVersion is IProtocolVersion { | ||
// IMPORTANT: Do not add any storage variable, see the above notice. | ||
|
||
/// @inheritdoc IProtocolVersion | ||
function protocolVersion() public pure returns (uint8[3] memory) { | ||
return [1, 3, 0]; | ||
} | ||
} |
Oops, something went wrong.