Skip to content

Commit

Permalink
add peaq support (#43)
Browse files Browse the repository at this point in the history
* feat: define the needed env vars

* feat: define needed helper functions

* feat: update the create repo script to get the addresses from the env vars

* feat: modify the publish version script to be able to get the needed addreses from env vars

* feat: update the upgrade scripts to be able to get the addresses from the env vars

* ci: remove not needed log

* feat: store the plugin repo proxy in the deployments

* feat: remove the possibility of getting the addresses from commons config only env vars are allowed

* feat: add note in the env example files

* fix: find repo helper function

* fix: remove not needed logs

* feat: define the needed env vars in the workflow

* ci: add comments to the env variables to explain why and when they are used

* add peaq support

* use try in publish skip

* add peaq rpc

* Backporting env var settings from the Multisig PR

* Minor edit

* Updated verify network details

* remove comment

* Increasing the timeout of tests

* fix subdomain

* Update packages/contracts/deploy/20_new_version/23_publish.ts

Co-authored-by: Jør∂¡ <[email protected]>

---------

Co-authored-by: Claudia <[email protected]>
Co-authored-by: Jør∂¡ <[email protected]>
Co-authored-by: Jør∂¡ <[email protected]>
  • Loading branch information
4 people authored Feb 26, 2025
1 parent dc6c9c6 commit e9b37dc
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 57 deletions.
14 changes: 10 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GENERAL

## The network used for testing purposes
NETWORK_NAME="sepolia" # ["mainnet", "sepolia", "polygon"]
NETWORK_NAME="mainnet" # ["mainnet", "sepolia", "polygon"]

## To upload the metadata for deployed contracts
PUB_PINATA_JWT=
Expand All @@ -28,14 +28,20 @@ ARBISCAN_API_KEY="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
# Note that addresses will be also used for testing so ensure they are valid on the network you are running the forking tests on.

# optional, address if not provided will get it from the latest deployment on the network or from the ens registrar
# defined in the framework if it supports it. In case it is not found will create a new one.
# defined in the framework if it supports it. In case it is not found will create a new one.
# For example for mainnet:
# 0xA4371a239D08bfBA6E8894eccf8466C6323A52C3
PLUGIN_REPO_ADDRESS=0x0000000000000000000000000000000000000000
# not optional, if not provided will not be able to deploy the plugin or run the forking tests.
# not optional, if not provided will not be able to deploy the plugin or run the forking tests.
# For example for mainnet:
# 0xaac9E9cdb8C1eb42d881ADd59Ee9c53847a3a4f3
PLUGIN_REPO_FACTORY_ADDRESS=0x0000000000000000000000000000000000000000
# optional, only needed when a latest versions of the plugin are going to be deploy on a new network.
PLACEHOLDER_SETUP=0x0000000000000000000000000000000000000000
# not optional, if not provided will not be able to transfer the ownership of the plugin when deploying
# the plugin or running the forking tests.
# the plugin or running the forking tests, or when the plugin is going to be installed on the management dao.
# for example for mainnet:
# 0xf2d594F3C93C19D7B1a6F15B5489FFcE4B01f7dA
MANAGEMENT_DAO_ADDRESS=0x0000000000000000000000000000000000000000

## Subgraph
Expand Down
28 changes: 16 additions & 12 deletions packages/contracts/deploy/20_new_version/23_publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,24 @@ func.skip = async (hre: HardhatRuntimeEnvironment) => {
throw `PluginRepo '${pluginEnsDomain(hre)}' does not exist yet.`;
}

const pastVersions = await getPastVersionCreatedEvents(pluginRepo);
try {
const pastVersions = await getPastVersionCreatedEvents(pluginRepo);

// Check if the version was published already
const filteredLogs = pastVersions.filter(
items =>
items.event.args.release === VERSION.release &&
items.event.args.build === VERSION.build
);

if (filteredLogs.length !== 0) {
console.log(
`Build number ${VERSION.build} has already been published for release ${VERSION.release}. Skipping publication...`
// Check if the version was published already
const filteredLogs = pastVersions.filter(
items =>
items.event.args.release === VERSION.release &&
items.event.args.build === VERSION.build
);
return true;

if (filteredLogs.length !== 0) {
console.log(
`Build number ${VERSION.build} has already been published for release ${VERSION.release}. Skipping publication...`
);
return true;
}
} catch (error) {
console.log(`Error in getting the previous version ${error}.`);
}

return false;
Expand Down
31 changes: 28 additions & 3 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
SupportedNetworks,
} from '@aragon/osx-commons-configs';
import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-toolbox';
import '@nomiclabs/hardhat-etherscan';
import '@nomicfoundation/hardhat-network-helpers';
import '@nomicfoundation/hardhat-verify';
import '@openzeppelin/hardhat-upgrades';
import '@typechain/hardhat';
import {config as dotenvConfig} from 'dotenv';
Expand Down Expand Up @@ -88,7 +88,18 @@ function getHardhatNetworkAccountsConfig(
}

// Add the accounts specified in the `.env` file to the networks from osx-commons-configs
const networks: {[index: string]: NetworkUserConfig} = osxCommonsConfigNetworks;
const networks: {[index: string]: NetworkUserConfig} = {
...osxCommonsConfigNetworks,
agungTestnet: {
url: 'https://wss-async.agung.peaq.network',
chainId: 9990,
gasPrice: 25000000000,
},
peaq: {
url: 'https://erpc-mpfn1.peaq.network',
chainId: 3338,
},
};
for (const network of Object.keys(networks) as SupportedNetworks[]) {
networks[network].accounts = specifiedAccounts();
}
Expand Down Expand Up @@ -117,6 +128,10 @@ const config: HardhatUserConfig = {
namedAccounts,
networks: {
hardhat: {
forking: {
url: 'https://mpfn1.peaq.network',
blockNumber: 3936303,
},
throwOnTransactionFailures: true,
throwOnCallFailures: true,
blockGasLimit: BigNumber.from(10).pow(6).mul(30).toNumber(), // 30 million, really high to test some things that are only possible with a higher block gas limit
Expand All @@ -136,6 +151,7 @@ const config: HardhatUserConfig = {
polygon: process.env.POLYGONSCAN_API_KEY || '',
base: process.env.BASESCAN_API_KEY || '',
arbitrumOne: process.env.ARBISCAN_API_KEY || '',
peaq: '1',
},
customChains: [
{
Expand All @@ -154,6 +170,15 @@ const config: HardhatUserConfig = {
browserURL: 'https://basescan.org',
},
},
{
network: 'peaq',
chainId: 3338,
urls: {
apiURL:
'https://peaq.api.subscan.io/api/scan/evm/contract/verifysource',
browserURL: 'https://peaq.subscan.io/',
},
},
],
},

Expand Down
6 changes: 3 additions & 3 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/bytes": "5.7.0",
"@ethersproject/providers": "5.7.2",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
"@nomiclabs/hardhat-etherscan": "^3.1.8",
"@openzeppelin/hardhat-upgrades": "^1.28.0",
"@nomicfoundation/hardhat-verify": "^1.0.4",
"@typechain/ethers-v5": "^10.1.1",
"@typechain/hardhat": "^6.1.4",
"@types/chai": "^4.3.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ skipTestSuiteIfNetworkIsZkSync(
),
[]
);
});
}).timeout(60 * 1000);
}
);

Expand Down
53 changes: 19 additions & 34 deletions packages/contracts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@
"@nomicfoundation/ethereumjs-rlp" "5.0.4"
ethereum-cryptography "0.1.3"

"@nomicfoundation/hardhat-chai-matchers@^1.0.6":
"@nomicfoundation/hardhat-chai-matchers@^1.0.5":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-1.0.6.tgz#72a2e312e1504ee5dd73fe302932736432ba96bc"
integrity sha512-f5ZMNmabZeZegEfuxn/0kW+mm7+yV7VNDxLpMOMGXWFJ2l/Ct3QShujzDRF9cOkK9Ui/hbDeOWGZqyQALDXVCQ==
Expand All @@ -953,10 +953,20 @@
dependencies:
ethereumjs-util "^7.1.4"

"@nomicfoundation/hardhat-toolbox@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-toolbox/-/hardhat-toolbox-2.0.2.tgz#ec95f23b53cb4e71a1a7091380fa223aad18f156"
integrity sha512-vnN1AzxbvpSx9pfdRHbUzTRIXpMLPXnUlkW855VaDk6N1pwRaQ2gNzEmFAABk4lWf11E00PKwFd/q27HuwYrYg==
"@nomicfoundation/hardhat-verify@^1.0.4":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-verify/-/hardhat-verify-1.1.1.tgz#6a433d777ce0172d1f0edf7f2d3e1df14b3ecfc1"
integrity sha512-9QsTYD7pcZaQFEA3tBb/D/oCStYDiEVDN7Dxeo/4SCyHRSm86APypxxdOMEPlGmXsAvd+p1j/dTODcpxb8aztA==
dependencies:
"@ethersproject/abi" "^5.1.2"
"@ethersproject/address" "^5.0.2"
cbor "^8.1.0"
chalk "^2.4.2"
debug "^4.1.1"
lodash.clonedeep "^4.5.0"
semver "^6.3.0"
table "^6.8.0"
undici "^5.14.0"

"@nomicfoundation/hardhat-verify@^2.0.8":
version "2.0.12"
Expand Down Expand Up @@ -1048,7 +1058,7 @@
fs-extra "^7.0.1"
node-fetch "^2.6.0"

"@nomiclabs/hardhat-ethers@^2.2.3":
"@nomiclabs/hardhat-ethers@^2.2.1":
version "2.2.3"
resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz#b41053e360c31a32c2640c9a45ee981a7e603fe0"
integrity sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg==
Expand Down Expand Up @@ -7814,7 +7824,7 @@ string-format@^2.0.0:
resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b"
integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA==

"string-width-cjs@npm:string-width@^4.2.0":
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -7840,15 +7850,6 @@ string-width@^2.1.1:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^5.0.1, string-width@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
Expand Down Expand Up @@ -7905,7 +7906,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -7926,13 +7927,6 @@ strip-ansi@^4.0.0:
dependencies:
ansi-regex "^3.0.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -9227,7 +9221,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -9244,15 +9238,6 @@ wrap-ansi@^2.0.0:
string-width "^1.0.1"
strip-ansi "^3.0.1"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit e9b37dc

Please sign in to comment.