Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deployment scripts #191

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ This project utilizes a variety of NPM scripts to run various tasks and processe
- `compile:size`: Compiles the smart contracts and analyzes the size of the compiled contracts using the hardhat-contract-sizer plugin.
- `compile`: Compiles the smart contracts with specific configuration using `hardhat.node.config.ts`.
- `coverage`: Generates a code coverage report for the smart contracts with specific network and coverage settings.
- `deploy:v1:gno_chiado`, `deploy:v1:gno_mainnet`, `deploy:v1:localhost`, `deploy:v1:otp_alphanet`, `deploy:v1:otp_devnet`, `deploy:v1:otp_mainnet`, `deploy:v1:otp_testnet`, and `deploy:v1`: Deploy version 1 of the smart contracts to various networks including Gnosis Chiado, Hardhat, OriginTrail Parachain Alphanet, OriginTrail Parachain Devnet, OriginTrail Parachain Testnet, and OriginTrail Parachain Mainnet.
- `deploy:v2:gno_chiado`, `deploy:v2:gno_mainnet`, `deploy:v2:localhost`, `deploy:v2:otp_alphanet`, `deploy:v2:otp_devnet`, `deploy:v2:otp_mainnet`, `deploy:v2:otp_testnet`, and `deploy:v2`: Similar to the v1 deploy scripts, these deploy version 2 of the smart contracts to the respective networks.
- `deploy:v1:gnosis_chiado_dev`, `deploy:v1:gnosis_chiado_test`, `deploy:v1:gnosis_mainnet`, `deploy:v1:localhost`, `deploy:v1:otp_alphanet`, `deploy:v1:otp_devnet`, `deploy:v1:otp_mainnet`, `deploy:v1:otp_testnet`, and `deploy:v1`: Deploy version 1 of the smart contracts to various networks including Gnosis Chiado, Hardhat, OriginTrail Parachain Alphanet, OriginTrail Parachain Devnet, OriginTrail Parachain Testnet, and OriginTrail Parachain Mainnet.
- `deploy:v2:gnosis_chiado_dev`, `deploy:v2:gnosis_chiado_test`, `deploy:v2:gnosis_mainnet`, `deploy:v2:localhost`, `deploy:v2:otp_alphanet`, `deploy:v2:otp_devnet`, `deploy:v2:otp_mainnet`, `deploy:v2:otp_testnet`, and `deploy:v2`: Similar to the v1 deploy scripts, these deploy version 2 of the smart contracts to the respective networks.
- `dev:v1`, `dev:v2`, and `dev`: Run local development nodes with Hardhat for different versions of contracts.
- `export-abi`: Updates ABI files according to the current state of the smart contracts.
- `format:fix`: Automatically fixes code formatting issues for JSON, JavaScript, TypeScript, and Solidity files using Prettier.
Expand Down Expand Up @@ -128,24 +128,35 @@ npm run deploy:v2:otp_mainnet

<br/>

Gnosis Chiado (v1 contracts)
Gnosis Chiado Dev (v1 contracts)
```sh
npm run deploy:v1:gno_chiado
npm run deploy:v1:gnosis_chiado_dev
```
or (v2 contracts)
```sh
npm run deploy:v2:gno_chiado
npm run deploy:v2:gnosis_chiado_dev
```

<br/>

Gnosis Chiado Test (v1 contracts)
```sh
npm run deploy:v1:gnosis_chiado_test
```
or (v2 contracts)
```sh
npm run deploy:v2:gnosis_chiado_test
```

<br/>

Gnosis Mainnet (v1 contracts)
```sh
npm run deploy:v1:gno_mainnet
npm run deploy:v1:gnosis_mainnet
```
or (v2 contracts)
```sh
npm run deploy:v2:gno_mainnet
npm run deploy:v2:gnosis_mainnet
```

<br/>
Expand Down
6 changes: 5 additions & 1 deletion deploy/001_deploy_hub_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (hre.helpers.isDeployed('Hub') && hre.helpers.contractDeployments.contracts['Hub'].version.startsWith('1.')) {
if (
hre.helpers.isDeployed('Hub') &&
(hre.helpers.contractDeployments.contracts['Hub'].version === undefined ||
hre.helpers.contractDeployments.contracts['Hub'].version?.startsWith('1.'))
) {
return;
}

Expand Down
6 changes: 5 additions & 1 deletion deploy/002_deploy_hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { DeployFunction } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (hre.helpers.isDeployed('Hub') && hre.helpers.contractDeployments.contracts['Hub'].version.startsWith('2.')) {
if (
hre.helpers.isDeployed('Hub') &&
(hre.helpers.contractDeployments.contracts['Hub'].version === undefined ||
hre.helpers.contractDeployments.contracts['Hub'].version?.startsWith('2.'))
) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion deploy/011_deploy_identity_storage_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('IdentityStorage') &&
hre.helpers.contractDeployments.contracts['IdentityStorage'].version.startsWith('1.')
(hre.helpers.contractDeployments.contracts['IdentityStorage'].version === undefined ||
hre.helpers.contractDeployments.contracts['IdentityStorage'].version?.startsWith('1.'))
) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion deploy/012_deploy_identity_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('IdentityStorage') &&
hre.helpers.contractDeployments.contracts['IdentityStorage'].version.startsWith('2.')
(hre.helpers.contractDeployments.contracts['IdentityStorage'].version === undefined ||
hre.helpers.contractDeployments.contracts['IdentityStorage'].version?.startsWith('2.'))
) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion deploy/019_deploy_content_asset_storage_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('ContentAssetStorage') &&
hre.helpers.contractDeployments.contracts['ContentAssetStorage'].version.startsWith('1.')
(hre.helpers.contractDeployments.contracts['ContentAssetStorage'].version === undefined ||
hre.helpers.contractDeployments.contracts['ContentAssetStorage'].version?.startsWith('1.'))
) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion deploy/020_deploy_content_asset_storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
if (
hre.helpers.isDeployed('ContentAssetStorage') &&
hre.helpers.contractDeployments.contracts['ContentAssetStorage'].version.startsWith('2.')
(hre.helpers.contractDeployments.contracts['ContentAssetStorage'].version === undefined ||
hre.helpers.contractDeployments.contracts['ContentAssetStorage'].version?.startsWith('2.'))
) {
return;
}
Expand Down
19 changes: 13 additions & 6 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,24 @@ config.networks = {
accounts: accounts('otp_mainnet'),
saveDeployments: false,
},
gno_chiado: {
gnosis_chiado_dev: {
chainId: 10200,
url: rpc('gno_chiado'),
url: rpc('gnosis_chiado_dev'),
gasPrice: 1_000_000_000,
accounts: accounts('gno_chiado'),
accounts: accounts('gnosis_chiado_dev'),
saveDeployments: false,
},
gno_mainnet: {
gnosis_chiado_test: {
chainId: 10200,
url: rpc('gnosis_chiado_test'),
gasPrice: 1_000_000_000,
accounts: accounts('gnosis_chiado_test'),
saveDeployments: false,
},
gnosis_mainnet: {
chainId: 100,
url: rpc('gno_mainnet'),
accounts: accounts('gno_mainnet'),
url: rpc('gnosis_mainnet'),
accounts: accounts('gnosis_mainnet'),
saveDeployments: false,
},
};
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,18 @@
"compile:size": "hardhat size-contracts",
"compile": "hardhat compile --config hardhat.node.config.ts",
"coverage": "cross-env COVERAGE_REPORT=true HARDHAT_DEPLOY_FIXTURE=true hardhat coverage --network hardhat --solcoverjs ./.solcover.js --temp artifacts --testfiles './test/**/*.test.ts'",
"deploy:v1:gno_chiado": "hardhat deploy --network gno_chiado --tags v1",
"deploy:v1:gno_mainnet": "hardhat deploy --network gno_mainnet --tags v1",
"deploy:v1:gnosis_chiado_dev": "hardhat deploy --network gnosis_chiado_dev --tags v1",
"deploy:v1:gnosis_chiado_test": "hardhat deploy --network gnosis_chiado_test --tags v1",
"deploy:v1:gnosis_mainnet": "hardhat deploy --network gnosis_mainnet --tags v1",
"deploy:v1:localhost": "hardhat deploy --network hardhat --tags v1",
"deploy:v1:otp_alphanet": "hardhat deploy --network otp_alphanet --tags v1",
"deploy:v1:otp_devnet": "hardhat deploy --network otp_devnet --tags v1",
"deploy:v1:otp_mainnet": "hardhat deploy --network otp_mainnet --tags v1",
"deploy:v1:otp_testnet": "hardhat deploy --network otp_testnet --tags v1",
"deploy:v1": "hardhat deploy --tags v1",
"deploy:v2:gno_chiado": "hardhat deploy --network gno_chiado --tags v1,v2",
"deploy:v2:gno_mainnet": "hardhat deploy --network gno_mainnet --tags v1,v2",
"deploy:v2:gnosis_chiado_dev": "hardhat deploy --network gnosis_chiado_dev --tags v1,v2",
"deploy:v2:gnosis_chiado_test": "hardhat deploy --network gnosis_chiado_test --tags v1,v2",
"deploy:v2:gnosis_mainnet": "hardhat deploy --network gnosis_mainnet --tags v1,v2",
"deploy:v2:localhost": "hardhat deploy --network hardhat --tags v1,v2",
"deploy:v2:otp_alphanet": "hardhat deploy --network otp_alphanet --tags v1,v2",
"deploy:v2:otp_devnet": "hardhat deploy --network otp_devnet --tags v1,v2",
Expand Down