Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
56ca934
Remove result proxy address from sharing contract
zguesmi May 6, 2025
e1de79b
Add cleanup todos
zguesmi May 6, 2025
6696d42
Update changelog
zguesmi May 6, 2025
ca5bd50
Update abis
zguesmi May 6, 2025
a11ae61
Merge branch 'develop' into feature/deprecated-result-proxy-config
zguesmi May 6, 2025
08a92dd
Add upgrade unit test
zguesmi May 6, 2025
519e9c0
Format
zguesmi May 6, 2025
32028df
Fix linting error
zguesmi May 6, 2025
2813cc8
Clean
zguesmi May 6, 2025
826b1cd
Clean
zguesmi May 6, 2025
c501af8
Include review
zguesmi May 6, 2025
8dac743
Add PR number to changelog
zguesmi May 6, 2025
0c2f2e7
Fix tests on the CI
zguesmi May 6, 2025
32fd0e5
Run tests on hardhat network (forked)
zguesmi May 6, 2025
ad9ff43
Fix CI
zguesmi May 12, 2025
25ebadb
Debug CI
zguesmi May 12, 2025
14c94f1
Debug CI
zguesmi May 12, 2025
62f0d1e
Debug CI
zguesmi May 12, 2025
25f7d1f
Remove debugging flags
zguesmi May 12, 2025
74e1c91
Clean
zguesmi May 12, 2025
65e07fe
Debug upgrade tests on CI
zguesmi May 12, 2025
7afc0af
Debug upgrade tests on CI
zguesmi May 12, 2025
ae4f26e
Remove upgrade tests as it interferes with local-fork script
zguesmi May 12, 2025
e330b35
Revert naming changes
zguesmi May 12, 2025
af797bd
Run tests on hardhat fork
zguesmi May 12, 2025
2760952
Debug upgrade tests on CI
zguesmi May 12, 2025
c2e94d6
Merge branch 'develop' into feature/hardhat-ignition
zguesmi May 13, 2025
df06547
Install HH dep compiler
zguesmi May 13, 2025
64e5c1e
Compile transparent proxy to create artifact
zguesmi May 13, 2025
64822c9
Create ESM and Commonjs flavor of config and env files
zguesmi May 13, 2025
d9f50e3
Add ignition module to deploy contracts
zguesmi May 13, 2025
eaace5c
Remove old deployment file
zguesmi May 13, 2025
35307ba
Update README
zguesmi May 13, 2025
e7393c7
Add create2 strategy to ignition config
zguesmi May 13, 2025
c47f370
Add new chains config
zguesmi May 13, 2025
6c64506
Clean
zguesmi May 13, 2025
d7f31d6
Fix deployment
zguesmi May 14, 2025
5513328
Clean
zguesmi May 14, 2025
85e61c7
Merge branch 'develop' into feature/upgrades-import
zguesmi May 14, 2025
02737b5
Import deployments in OZ upgrades
zguesmi May 14, 2025
58c82ee
Clean deploy script
zguesmi May 14, 2025
a8306a4
Update changelog
zguesmi May 14, 2025
32e149a
Fix linter issues
zguesmi May 14, 2025
0d52e58
Fix CI
zguesmi May 14, 2025
7878105
Fix CI
zguesmi May 14, 2025
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
7 changes: 7 additions & 0 deletions .github/workflows/sharing-smart-contract-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ jobs:
working-directory: packages/sharing-smart-contract
run: npm run test -- --network local-bellecour-fork

- name: Test deployment script
working-directory: packages/sharing-smart-contract
run: |
POCO_ADDRESS=0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f \
DATASET_REGISTRY_ADDRESS=0x799DAa22654128d0C64d5b79eac9283008158730 \
npm run deploy -- --network local-bellecour-fork

- name: Set Directory Permissions
working-directory: packages/sharing-smart-contract
run: sudo chmod -R 777 .
Expand Down
2 changes: 2 additions & 0 deletions packages/sharing-smart-contract/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.

### Changed

- Import Ignition deployment in OZ upgrades plugin (#441)
- Deploy contracts using Hardhat Ignition (#440)
- [BREAKING] Remove result proxy url from contract config and deal params (#438).
- Fix Sharing contract constructor arguments order (#433)
- Update blockscout url
Expand Down
2 changes: 2 additions & 0 deletions packages/sharing-smart-contract/config/config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Hardhat Ignition does not support ESM modules, so we use CommonJS syntax.
// TODO refactor this to use ESM syntax when Hardhat Ignition supports it.

// TODO define addresses by network.

module.exports = {
POCO_ADDRESS: '0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f',
DATASET_REGISTRY_ADDRESS: '0x799DAa22654128d0C64d5b79eac9283008158730',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/extensions */
const { buildModule } = require('@nomicfoundation/hardhat-ignition/modules');

const {
Expand Down
2 changes: 1 addition & 1 deletion packages/sharing-smart-contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"clean": "hardhat clean",
"compile": "hardhat clean && hardhat compile && npm run artifact-to-abis",
"verify": "hardhat verify",
"deploy": "hardhat ignition deploy ignition/modules/DataProtectorSharingModule.cts --strategy create2",
"deploy": "hardhat run scripts/deploy.js",
"update-env": "hardhat run ./scripts/updateEnv.js",
"upgrade": "hardhat run ./scripts/upgrade.js",
"upgrade-local-fork": "mkdir -p .openzeppelin/local-fork && cp -r .openzeppelin/prod/. .openzeppelin/local-fork && MANIFEST_DEFAULT_DIR=.openzeppelin/local-fork ENV=prod hardhat run ./scripts/upgrade-local-fork.js",
Expand Down
68 changes: 68 additions & 0 deletions packages/sharing-smart-contract/scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import hre from 'hardhat';
import { env } from '../config/env.js';
import DataProtectorSharingModule from '../ignition/modules/DataProtectorSharingModule.cjs';

const { ethers, upgrades } = hre;

/**
* This script deploys DataProtectorSharing contract and its dependencies using
* Hardhat Ignition and createX factory if supported.
* It also imports the deployed contracts into the OpenZeppelin upgrades plugin.
*/

async function main() {
const pocoAddress = env.POCO_ADDRESS;
const datasetRegistryAddress = env.DATASET_REGISTRY_ADDRESS;
if (!pocoAddress || !datasetRegistryAddress) {
throw new Error('POCO_ADDRESS and DATASET_REGISTRY_ADDRESS are required.');
}
console.log('Deploying DataProtectorSharingModule...');
console.log('PoCo address:', pocoAddress);
console.log('DatasetRegistry address:', datasetRegistryAddress);
// Check if the CreateX factory is supported on the current network.
const isCreatexSupported = await isCreatexFactorySupported();
if (isCreatexSupported) {
console.log('CreateX factory is supported.');
} else {
console.log('⚠️ CreateX factory is NOT supported.');
}
// Deploy contracts using Ignition module.
const { addOnlyAppWhitelistRegistry, dataProtectorSharing } = await hre.ignition.deploy(
DataProtectorSharingModule,
{
...(isCreatexSupported && {
strategy: 'create2',
strategyConfig: hre.userConfig.ignition.strategyConfig.create2,
}),
displayUi: true, // for logs.
},
);
// Import proxies in OZ `upgrades` plugin for future upgrades.
console.log(`Importing proxy contracts in OZ upgrades...`);
const whitelistProxyAddress = await addOnlyAppWhitelistRegistry.getAddress();
await upgrades.forceImport(
whitelistProxyAddress,
await ethers.getContractFactory('AddOnlyAppWhitelistRegistry'),
{
kind: 'transparent',
},
);
await upgrades.forceImport(
await dataProtectorSharing.getAddress(),
await ethers.getContractFactory('DataProtectorSharing'),
{
kind: 'transparent',
constructorArgs: [pocoAddress, datasetRegistryAddress, whitelistProxyAddress],
},
);
}

async function isCreatexFactorySupported() {
const code = await ethers.provider.getCode('0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed');
return code !== '0x';
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
10 changes: 0 additions & 10 deletions packages/sharing-smart-contract/tsconfig.json

This file was deleted.

Loading