Skip to content

Commit

Permalink
fix: imports and determine current protocol version from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Jan 4, 2024
1 parent 3301197 commit ab48d9f
Show file tree
Hide file tree
Showing 35 changed files with 590 additions and 143 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {IMPLICIT_INITIAL_PROTOCOL_VERSION} from '../../../test/test-utils/protocol-version';
import {DAOFactory__factory, DAO__factory} from '../../../typechain';
import {getContractAddress} from '../../helpers';
import {IMPLICIT_INITIAL_PROTOCOL_VERSION} from '@aragon/osx-commons-contracts/protocol-version';
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

Expand Down
4 changes: 3 additions & 1 deletion packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
},
"homepage": "https://github.com/aragon/osx#readme",
"dependencies": {
"@aragon/osx-commons-contracts": "^1.4.0-alpha.1",
"@aragon/osx-commons-sdk": "0.0.1-alpha.2",
"@ensdomains/ens-contracts": "0.0.11",
"@openzeppelin/contracts": "4.9.5",
"@openzeppelin/contracts-upgradeable": "4.9.5"
Expand All @@ -48,8 +50,8 @@
"@aragon/osx-v1.3.0": "npm:@aragon/[email protected]",
"@defi-wonderland/smock": "^2.3.4",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.5",
"@nomicfoundation/hardhat-verify": "^1.0.4",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-verify": "^1.0.4",
"@nomiclabs/hardhat-ethers": "^2.2.1",
"@openzeppelin/hardhat-upgrades": "^1.23.1",
"@rollup/plugin-json": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
},
"homepage": "https://github.com/aragon/osx#readme",
"dependencies": {
"@aragon/osx-commons-contracts": "0.0.1-alpha.2",
"@aragon/osx-commons-contracts": "1.4.0-alpha.1",
"@ensdomains/ens-contracts": "0.0.11",
"@openzeppelin/contracts": "4.9.5",
"@openzeppelin/contracts-upgradeable": "4.9.5"
},
"devDependencies": {
"@aragon/osx-commons-sdk": "0.0.1-alpha.0"
"@aragon/osx-commons-sdk": "0.0.1-alpha.2"
}
}
11 changes: 11 additions & 0 deletions packages/contracts/src/test/ProtocolVersionMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {ProtocolVersion} from "@aragon/osx-commons-contracts/src/utils/versioning/ProtocolVersion.sol";

/// @title ProtocolVersionMock
// solhint-disable-next-line no-empty-blocks
contract ProtocolVersionMock is ProtocolVersion {

}
19 changes: 11 additions & 8 deletions packages/contracts/test/core/dao/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ import {
TOKEN_INTERFACE_IDS,
} from '../../test-utils/dao';
import {ZERO_BYTES32, daoExampleURI} from '../../test-utils/dao';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '../../test-utils/protocol-version';
import {deployWithProxy} from '../../test-utils/proxy';
import {
getProtocolVersion,
deployAndUpgradeFromToCheck,
Expand All @@ -37,14 +42,12 @@ import {
import {ANY_ADDR} from '../permission/permission-manager';
import {UNREGISTERED_INTERFACE_RETURN} from './callback-handler';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '@aragon/osx-commons-contracts/protocol-version';
import {deployWithProxy} from '@aragon/osx-commons-contracts/utils/proxy';
import {IDAO_EVENTS, findEvent} from '@aragon/osx-commons-sdk';
import {DAO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {flipBit} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
IDAO_EVENTS,
findEvent,
flipBit,
getInterfaceId,
DAO_PERMISSIONS,
} from '@aragon/osx-commons-sdk';
import {smock} from '@defi-wonderland/smock';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import chai, {expect} from 'chai';
Expand Down
9 changes: 4 additions & 5 deletions packages/contracts/test/framework/dao/dao-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import {InstallationPreparedEvent} from '../../../typechain/PluginSetupProcessor
import {daoExampleURI, deployNewDAO} from '../../test-utils/dao';
import {deployENSSubdomainRegistrar} from '../../test-utils/ens';
import {deployPluginSetupProcessor} from '../../test-utils/plugin-setup-processor';
import {CURRENT_PROTOCOL_VERSION} from '../../test-utils/protocol-version';
import {deployWithProxy} from '../../test-utils/proxy';
import {
createApplyInstallationParams,
createApplyUninstallationParams,
Expand All @@ -47,17 +49,14 @@ import {
deployPluginRepoFactory,
deployPluginRepoRegistry,
} from '../../test-utils/repo';
import {CURRENT_PROTOCOL_VERSION} from '@aragon/osx-commons-contracts/protocol-version';
import {deployWithProxy} from '@aragon/osx-commons-contracts/utils/proxy';
import {findEventTopicLog} from '@aragon/osx-commons-sdk';
import {
findEventTopicLog,
DAO_PERMISSIONS,
DAO_REGISTRY_PERMISSIONS,
PLUGIN_REGISTRY_PERMISSIONS,
PLUGIN_REPO_PERMISSIONS,
PLUGIN_SETUP_PROCESSOR_PERMISSIONS,
getInterfaceId,
} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {anyValue} from '@nomicfoundation/hardhat-chai-matchers/withArgs';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
Expand Down
18 changes: 7 additions & 11 deletions packages/contracts/test/framework/dao/dao-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import {DAORegistry__factory as DAORegistry_V1_3_0__factory} from '../../../type
import {ensDomainHash, ensLabelHash} from '../../../utils/ens';
import {deployNewDAO} from '../../test-utils/dao';
import {deployENSSubdomainRegistrar} from '../../test-utils/ens';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '../../test-utils/protocol-version';
import {deployWithProxy} from '../../test-utils/proxy';
import {
getProtocolVersion,
deployAndUpgradeFromToCheck,
deployAndUpgradeSelfCheck,
} from '../../test-utils/uups-upgradeable';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '@aragon/osx-commons-contracts/protocol-version';
import {deployWithProxy} from '@aragon/osx-commons-contracts/utils/proxy';
import {
DAO_REGISTRY_PERMISSIONS,
ENS_REGISTRAR_PERMISSIONS,
Expand Down Expand Up @@ -310,9 +310,7 @@ describe('DAORegistry', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});

Expand Down Expand Up @@ -340,9 +338,7 @@ describe('DAORegistry', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
} from '../../../typechain';
import {deployNewDAO} from '../../test-utils/dao';
import {deployENSSubdomainRegistrar} from '../../test-utils/ens';
import {CURRENT_PROTOCOL_VERSION} from '../../test-utils/protocol-version';
import {
deployMockPluginSetup,
deployPluginRepoRegistry,
} from '../../test-utils/repo';
import {CURRENT_PROTOCOL_VERSION} from '@aragon/osx-commons-contracts/protocol-version';
import {PLUGIN_REGISTRY_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {
PLUGIN_REGISTRY_PERMISSIONS,
getInterfaceId,
} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ethers} from 'hardhat';
Expand Down
18 changes: 7 additions & 11 deletions packages/contracts/test/framework/plugin/plugin-repo-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import {PluginRepoRegistry__factory as PluginRepoRegistry_V1_3_0__factory} from
import {ensDomainHash} from '../../../utils/ens';
import {deployNewDAO} from '../../test-utils/dao';
import {deployENSSubdomainRegistrar} from '../../test-utils/ens';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '../../test-utils/protocol-version';
import {deployWithProxy} from '../../test-utils/proxy';
import {deployNewPluginRepo} from '../../test-utils/repo';
import {
getProtocolVersion,
deployAndUpgradeFromToCheck,
deployAndUpgradeSelfCheck,
} from '../../test-utils/uups-upgradeable';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '@aragon/osx-commons-contracts/protocol-version';
import {deployWithProxy} from '@aragon/osx-commons-contracts/utils/proxy';
import {PLUGIN_REGISTRY_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
Expand Down Expand Up @@ -316,9 +316,7 @@ describe('PluginRepoRegistry', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});

Expand Down Expand Up @@ -348,9 +346,7 @@ describe('PluginRepoRegistry', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});
});
Expand Down
15 changes: 6 additions & 9 deletions packages/contracts/test/framework/plugin/plugin-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import {
import {PluginRepo__factory as PluginRepo_V1_0_0__factory} from '../../../typechain/@aragon/osx-v1.0.1/framework/plugin/repo/PluginRepo.sol';
import {PluginRepo__factory as PluginRepo_V1_3_0__factory} from '../../../typechain/@aragon/osx-v1.3.0/framework/plugin/repo/PluginRepo.sol';
import {ZERO_BYTES32} from '../../test-utils/dao';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '../../test-utils/protocol-version';
import {tagHash} from '../../test-utils/psp/hash-helpers';
import {
deployMockPluginSetup,
Expand All @@ -23,12 +27,7 @@ import {
deployAndUpgradeFromToCheck,
deployAndUpgradeSelfCheck,
} from '../../test-utils/uups-upgradeable';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '@aragon/osx-commons-contracts/protocol-version';
import {PLUGIN_REPO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {PLUGIN_REPO_PERMISSIONS, getInterfaceId} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ContractFactory} from 'ethers';
Expand Down Expand Up @@ -125,9 +124,7 @@ describe('PluginRepo', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {PluginRepoRegisteredEvent} from '../../../typechain/PluginRepoRegistry';
import {deployNewDAO, ZERO_BYTES32} from '../../test-utils/dao';
import {deployENSSubdomainRegistrar} from '../../test-utils/ens';
import {deployPluginSetupProcessor} from '../../test-utils/plugin-setup-processor';
import {CURRENT_PROTOCOL_VERSION} from '../../test-utils/protocol-version';
import {
installPlugin,
updatePlugin,
Expand Down Expand Up @@ -71,7 +72,6 @@ import {
deployPluginRepoFactory,
deployPluginRepoRegistry,
} from '../../test-utils/repo';
import {CURRENT_PROTOCOL_VERSION} from '@aragon/osx-commons-contracts/protocol-version';
import {findEventTopicLog} from '@aragon/osx-commons-sdk';
import {Operation} from '@aragon/osx-commons-sdk';
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/test/framework/plugin/plugin-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
PluginCloneableSetupV1Mock,
PluginCloneableSetupV1Mock__factory,
} from '../../../typechain';
import {CURRENT_PROTOCOL_VERSION} from '@aragon/osx-commons-contracts/protocol-version';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {CURRENT_PROTOCOL_VERSION} from '../../test-utils/protocol-version';
import {getInterfaceId} from '@aragon/osx-commons-sdk';
import {expect} from 'chai';
import {ethers} from 'hardhat';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ import {ENSSubdomainRegistrar__factory as ENSSubdomainRegistrar_V1_3_0__factory}
import {ensDomainHash, ensLabelHash} from '../../../../utils/ens';
import {deployNewDAO} from '../../../test-utils/dao';
import {setupResolver} from '../../../test-utils/ens';
import {CURRENT_PROTOCOL_VERSION} from '../../../test-utils/protocol-version';
import {deployWithProxy} from '../../../test-utils/proxy';
import {
getProtocolVersion,
deployAndUpgradeFromToCheck,
deployAndUpgradeSelfCheck,
} from '../../../test-utils/uups-upgradeable';
import {
CURRENT_PROTOCOL_VERSION,
IMPLICIT_INITIAL_PROTOCOL_VERSION,
} from '@aragon/osx-commons-contracts/protocol-version';
import {deployWithProxy} from '@aragon/osx-commons-contracts/utils/proxy';
import {ENS_REGISTRAR_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
Expand Down Expand Up @@ -340,9 +337,7 @@ describe('ENSSubdomainRegistrar', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});

Expand Down Expand Up @@ -372,9 +367,7 @@ describe('ENSSubdomainRegistrar', function () {
);

expect(fromProtocolVersion).to.not.deep.equal(toProtocolVersion);
expect(fromProtocolVersion).to.deep.equal(
IMPLICIT_INITIAL_PROTOCOL_VERSION
);
expect(fromProtocolVersion).to.deep.equal([1, 0, 0]);
expect(toProtocolVersion).to.deep.equal(CURRENT_PROTOCOL_VERSION);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
PluginRepo__factory,
} from '../../../typechain';
import {deployNewDAO} from '../../test-utils/dao';
import {deployWithProxy} from '@aragon/osx-commons-contracts/utils/proxy';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {deployWithProxy} from '../../test-utils/proxy';
import {getInterfaceId} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ethers} from 'hardhat';
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {IMultisig__factory as IMultisig_V1_0_0__factory} from '../typechain/@ara
import {IERC20MintableUpgradeable__factory as IERC20MintableUpgradeable_V1_0_0__factory} from '../typechain/@aragon/osx-v1.0.1/token/ERC20/IERC20MintableUpgradeable.sol';
import {IGovernanceWrappedERC20__factory as IGovernanceWrappedERC20_V1_0_0__factory} from '../typechain/@aragon/osx-v1.0.1/token/ERC20/governance/IGovernanceWrappedERC20.sol';
import {IProtocolVersion__factory as IProtocolVersion_V1_3_0__factory} from '../typechain/@aragon/osx-v1.3.0/utils/protocol/IProtocolVersion.sol';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {getInterfaceId} from '@aragon/osx-commons-sdk';
import {expect} from 'chai';

describe('Interfaces', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import {Operation} from '@aragon/osx-commons-sdk';
import {DAO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {getNamedTypesFromMetadata} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {getInterfaceId} from '@aragon/osx-commons-sdk';
import {expect} from 'chai';
import {ethers} from 'hardhat';

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/plugins/governance/admin/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from '@aragon/osx-commons-sdk';
import {DAO_PERMISSIONS} from '@aragon/osx-commons-sdk';
import {proposalIdToBytes32} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {getInterfaceId} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ethers} from 'hardhat';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {ADDRESSLIST_VOTING_INTERFACE} from './addresslist-voting-constants';
import {Operation} from '@aragon/osx-commons-sdk';
import {getNamedTypesFromMetadata} from '@aragon/osx-commons-sdk';
import {TIME} from '@aragon/osx-commons-sdk';
import {getInterfaceId} from '@aragon/osx-commons-sdk/src/interfaces';
import {pctToRatio} from '@aragon/osx-commons-sdk/src/math';
import {getInterfaceId} from '@aragon/osx-commons-sdk';
import {pctToRatio} from '@aragon/osx-commons-sdk';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ethers} from 'hardhat';
Expand Down
Loading

0 comments on commit ab48d9f

Please sign in to comment.