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

refactor: adaptations to use osx-commons in osx-plugin-template-hardhat #48

Merged
merged 10 commits into from
Jan 24, 2024
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"tmp-promise": "^3.0.3",
"ts-node": "^10.9.1",
"typechain": "^8.3.2",
"typescript": "5.0.4"
"typescript": "5.2.2"
},
"dependencies": {
"@openzeppelin/contracts": "4.9.5",
Expand Down
8 changes: 4 additions & 4 deletions contracts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5337,10 +5337,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==

typescript@5.0.4:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
typescript@5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==

typical@^4.0.0:
version "4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^3.6.2",
"solhint-plugin-prettier": "^0.0.5",
"typescript": "5.0.4"
"typescript": "5.2.2"
},
"scripts": {
"lint:configs:ts": "eslint --ext .js,.ts ./configs/",
Expand Down
1 change: 1 addition & 0 deletions sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Created `SingleTargetPermission` type.
- Copied files from [aragon/sdk commit 76b4fc](https://github.com/aragon/sdk/tree/76b4fc815cfacce60b7c983ef0ce53110761f23a)

- Classes `ClientCore`, `ContextCore`, `Context`, `GraphQLModule`, `Web3Module`, `IPFSModule`, `MultiUri`.
Expand Down
4 changes: 2 additions & 2 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aragon/osx-commons-sdk",
"author": "Aragon Association",
"version": "0.0.1-alpha.3",
"version": "0.0.1-alpha.4",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/osx-commons-sdk.esm.js",
Expand Down Expand Up @@ -49,7 +49,7 @@
"husky": "^7.0.4",
"size-limit": "^7.0.8",
"tslib": "^2.3.1",
"typescript": "5.0.4"
"typescript": "5.2.2"
},
"dependencies": {
"@aragon/osx-ethers": "^1.3.0-rc0.4",
Expand Down
66 changes: 55 additions & 11 deletions sdk/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,66 @@ export async function findEventTopicLog<T>(
}
return iface.parseLog(log) as LogDescription & (T | LogDescription);
}

export const CALLBACK_HANDLER_EVENTS = {
CallbackReceived: 'CallbackReceived',
};

export const DAO_EVENTS = {
NewURI: 'NewURI',
};

export const DAO_REGISTRY_EVENTS = {
DAORegistered: 'DAORegistered',
};

export const IPROPOSAL_EVENTS = {
PROPOSAL_CREATED: 'ProposalCreated',
PROPOSAL_EXECUTED: 'ProposalExecuted',
ProposalCreated: 'ProposalCreated',
ProposalExecuted: 'ProposalExecuted',
};

export const IDAO_EVENTS = {
METADATA_SET: 'MetadataSet',
EXECUTED: 'Executed',
DEPOSITED: 'Deposited',
STANDARD_CALLBACK_REGISTERED: 'StandardCallbackRegistered',
TRUSTED_FORWARDER_SET: 'TrustedForwarderSet',
NEW_URI: 'NewURI',
MetadataSet: 'MetadataSet',
Executed: 'Executed',
Deposited: 'Deposited',
StandardCallbackRegistered: 'StandardCallbackRegistered',
TrustedForwarderSet: 'TrustedForwarderSet',
NewURI: 'NewURI',
};

export const IMEMBERSHIP_EVENTS = {
MEMBERS_ADDED: 'MembersAdded',
MEMBERS_REMOVED: 'MembersRemoved',
MEMBERSHIP_CONTRACT_ANNOUNCED: 'MembershipContractAnnounced',
MembersAdded: 'MembersAdded',
MembersRemoved: 'MembersRemoved',
MembershipContractAnnounced: 'MembershipContractAnnounced',
};

export const INTERFACE_BASED_REGISTRY_EVENTS = {
Registered: 'Registered',
};

export const PERMISSION_MANAGER = {
Granted: 'Granted',
Revoked: 'Revoked',
};

export const PLUGIN_REPO_EVENTS = {
VersionCreated: 'VersionCreated',
};

export const PLUGIN_REPO_REGISTRY_EVENTS = {
PluginRepoRegistered: 'PluginRepoRegistered',
ReleaseMetadataUpdated: 'ReleaseMetadataUpdated',
};

export const PLUGIN_SETUP_PROCESSOR_EVENTS = {
InstallationPrepared: 'InstallationPrepared',
InstallationApplied: 'InstallationApplied',
UpdatePrepared: 'UpdatePrepared',
UpdateApplied: 'UpdateApplied',
UninstallationPrepared: 'UninstallationPrepared',
UninstallationApplied: 'UninstallationApplied',
};

export const UUPS_UPGRADEABLE_EVENTS = {
Upgraded: 'Upgraded',
};
1 change: 1 addition & 0 deletions sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from './utils';
export * from './schemas';
export * from './validation';
export * from './multiuri';
export * from './ipfs';
export * from './metadata';
export * from './interfaces';
export * from './encoding';
Expand Down
13 changes: 13 additions & 0 deletions sdk/src/permission.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {getAddress} from '@ethersproject/address';
import {id} from '@ethersproject/hash';

export enum Operation {
Expand All @@ -6,6 +7,18 @@ export enum Operation {
GrantWithCondition = 2,
}

export const ADDRESS_ZERO = getAddress(`0x${'0'.repeat(40)}`); // address(0)
export const ADDRESS_ONE = getAddress(`0x${'0'.repeat(39)}1`); // address(1)
export const ADDRESS_TWO = getAddress(`0x${'0'.repeat(39)}2`); // address(2)
export const ADDRESS_LAST = getAddress(`0x${'f'.repeat(40)}`); // address(-1)

export const PERMISSION_MANAGER_FLAGS = {
UNSET_FLAG: ADDRESS_ZERO,
ALLOW_FLAG: ADDRESS_TWO,
ANY_ADDR: ADDRESS_LAST,
NO_CONDITION: ADDRESS_ZERO,
};

export const DAO_PERMISSIONS = {
ROOT_PERMISSION_ID: id('ROOT_PERMISSION'),
EXECUTE_PERMISSION_ID: id('EXECUTE_PERMISSION'),
Expand Down
6 changes: 6 additions & 0 deletions sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ export enum PermissionOperationType {
GRANT_WITH_CONDITION = 2,
}

export type SingleTargetPermission = {
operation: PermissionOperationType;
who: string;
permissionId: string;
};

export type MultiTargetPermission = {
operation: PermissionOperationType;
where: string;
Expand Down
Loading