Skip to content

Commit

Permalink
Peaq support (#644)
Browse files Browse the repository at this point in the history
* running test against Agung Testnet

* fix typo

* testing deployment

* create standard json

* deploy against localhost fork of peaq

* uncoment test fork

* add batches

* add placeholder

* add peaq rpc

* move place holder to framework

* Clean up hardhat configs and networks

* keep Root permision for the deployer

* add peaq verification api

* remove batches used for Agung

* remove fork testing

* Clean up and comments
  • Loading branch information
Rekard0 authored Feb 26, 2025
1 parent 7451e8f commit fb613d9
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 190 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import placeholderSetupArtifact from '../../../artifacts/src/framework/plugin/repo/placeholder/PlaceholderSetup.sol/PlaceholderSetup.json';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, ethers} = hre;
const {deploy} = deployments;
const [deployer] = await ethers.getSigners();

await deploy('PlaceholderSetup', {
contract: placeholderSetupArtifact,
from: deployer.address,
args: [],
log: true,
});

hre.aragonToVerifyContracts.push({
...(await deployments.get('PlaceholderSetup')),
});
};
export default func;
func.tags = ['New', 'PlaceholderSetup'];
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
);

// Revoke `REGISTER_DAO_PERMISSION` from `Deployer`.
// Revoke `ROOT_PERMISSION` from `Deployer`.
// Revoke `SET_METADATA_PERMISSION` from `Deployer`.
// Revoke `EXECUTE_PERMISSION` from `Deployer`.
// Note: `ROOT_PERMISSION` is not revoked from `Deployer`
// because it is needed for installing multisig, and it will be revoked on that repo
const revokePermissions = [
{
operation: Operation.Revoke,
Expand All @@ -50,13 +52,13 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
operation: Operation.Revoke,
where: {name: 'ManagementDAOProxy', address: managementDAOAddress},
who: {name: 'Deployer', address: deployer.address},
permission: 'ROOT_PERMISSION',
permission: 'SET_METADATA_PERMISSION',
},
{
operation: Operation.Revoke,
where: {name: 'ManagementDAOProxy', address: managementDAOAddress},
who: {name: 'Deployer', address: deployer.address},
permission: 'SET_METADATA_PERMISSION',
permission: 'EXECUTE_PERMISSION',
},
];
await managePermissions(managementDaoContract, revokePermissions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

// On some chains - such as holesky - wait so
// previous permission txs are fully applied and verified.
await delay(5000);
await delay(20000);

// Check revoked permission.
await checkPermission(managementDaoContract, {
Expand All @@ -54,14 +54,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
});

await checkPermission(managementDaoContract, {
operation: Operation.Revoke,
operation: Operation.Grant,
where: {name: 'ManagementDAOProxy', address: managementDAOAddress},
who: {name: 'Deployer', address: deployer.address},
permission: 'ROOT_PERMISSION',
});

await checkPermission(managementDaoContract, {
operation: Operation.Grant,
operation: Operation.Revoke,
where: {name: 'ManagementDAOProxy', address: managementDAOAddress},
who: {name: 'Deployer', address: deployer.address},
permission: 'EXECUTE_PERMISSION',
Expand Down
182 changes: 0 additions & 182 deletions packages/contracts/deployed_contracts_detailed.json

This file was deleted.

27 changes: 25 additions & 2 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,20 @@ if (process.env.ALCHEMY_API_KEY) {
}

// add accounts to network configs
const hardhatNetworks: {[index: string]: NetworkUserConfig} =
commonNetworkConfigs;
const hardhatNetworks: {[index: string]: NetworkUserConfig} = {
...commonNetworkConfigs,
agungTestnet: {
url: 'https://wss-async.agung.peaq.network',
chainId: 9990,
gasPrice: 40000000000,
},
peaq: {
url: 'https://erpc-mpfn1.peaq.network',
chainId: 3338,
gasPrice: 25000000000,
},
};

for (const network of Object.keys(hardhatNetworks) as SupportedNetworks[]) {
if (network === SupportedNetworks.LOCAL) {
continue;
Expand Down Expand Up @@ -95,6 +107,7 @@ const config: HardhatUserConfig = {
},
},
},

defaultNetwork: 'hardhat',
networks: {
hardhat: {
Expand Down Expand Up @@ -135,6 +148,7 @@ const config: HardhatUserConfig = {
arbitrumSepolia: process.env.ARBISCAN_KEY || '',
modeTestnet: 'modeTestnet',
modeMainnet: 'modeMainnet',
peaq: '1', // It can be set to null. date: 26/Feb/2025
},
customChains: [
{
Expand Down Expand Up @@ -195,6 +209,15 @@ const config: HardhatUserConfig = {
browserURL: 'https://modescan.io',
},
},
{
network: 'peaq',
chainId: 3338,
urls: {
apiURL:
'https://peaq.api.subscan.io/api/scan/evm/contract/verifysource',
browserURL: 'https://peaq.subscan.io/',
},
},
],
},
namedAccounts: {
Expand Down
10 changes: 10 additions & 0 deletions packages/contracts/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,14 @@ export const networkExtensions: {[index: string]: NetworkExtension} = {
zksyncSepolia: {
deploy: ['./deploy'],
},
agungTestnet: {
explorer: 'subscan',
deploy: ['./deploy/new', './deploy/verification'],
},
peaq: {
deploy: ['./deploy/new', './deploy/verification'],
},
localhost: {
deploy: ['./deploy/new'],
},
};

0 comments on commit fb613d9

Please sign in to comment.