generated from aragon/osx-plugin-template-hardhat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
501 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
name: 00-JS-Test | ||
# name: 00-JS-Test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
run: | ||
description: 'Forces a run if true' | ||
required: false | ||
type: boolean | ||
secrets: | ||
IPFS_API_KEY: | ||
description: 'IPFS API Key' | ||
required: true | ||
push: | ||
branches-ignore: | ||
- develop | ||
- main | ||
paths: | ||
- 'packages/js-client/**' | ||
- '.github/workflows/js-client-*.yml' | ||
# on: | ||
# workflow_call: | ||
# inputs: | ||
# run: | ||
# description: 'Forces a run if true' | ||
# required: false | ||
# type: boolean | ||
# secrets: | ||
# IPFS_API_KEY: | ||
# description: 'IPFS API Key' | ||
# required: true | ||
# push: | ||
# branches-ignore: | ||
# - develop | ||
# - main | ||
# paths: | ||
# - 'packages/js-client/**' | ||
# - '.github/workflows/js-client-*.yml' | ||
|
||
jobs: | ||
build-js: | ||
if: ${{ github.actor != 'arabot-1' || inputs.run }} | ||
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} | ||
# jobs: | ||
# build-js: | ||
# if: ${{ github.actor != 'arabot-1' || inputs.run }} | ||
# name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node: ['16.x'] | ||
os: [ubuntu-latest] | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# matrix: | ||
# node: ['16.x'] | ||
# os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
# steps: | ||
# - name: Checkout repo | ||
# uses: actions/checkout@v3 | ||
|
||
- name: Use Node ${{ matrix.node }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: 'yarn' | ||
node-version: ${{ matrix.node }} | ||
# - name: Use Node ${{ matrix.node }} | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# cache: 'yarn' | ||
# node-version: ${{ matrix.node }} | ||
|
||
- name: Install deps | ||
run: yarn install --frozen-lockfile | ||
working-directory: packages/js-client | ||
# - name: Install deps | ||
# run: yarn install --frozen-lockfile | ||
# working-directory: packages/js-client | ||
|
||
- name: Build Contracts Ethers typings | ||
run: yarn run build | ||
working-directory: packages/contracts-ethers | ||
# - name: Build Contracts Ethers typings | ||
# run: yarn run build | ||
# working-directory: packages/contracts-ethers | ||
|
||
- name: Build Contracts Ethers package | ||
run: yarn run build:npm | ||
working-directory: packages/contracts-ethers | ||
# - name: Build Contracts Ethers package | ||
# run: yarn run build:npm | ||
# working-directory: packages/contracts-ethers | ||
|
||
- name: Build JS Client | ||
run: yarn run build | ||
working-directory: packages/js-client | ||
# - name: Build JS Client | ||
# run: yarn run build | ||
# working-directory: packages/js-client | ||
|
||
- name: Integration test | ||
run: yarn test integration --ci --coverage --passWithNoTests | ||
working-directory: packages/js-client | ||
env: | ||
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }} | ||
# - name: Integration test | ||
# run: yarn test integration --ci --coverage --passWithNoTests | ||
# working-directory: packages/js-client | ||
# env: | ||
# IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }} | ||
|
||
- name: Run unit tests | ||
run: yarn test --testPathIgnorePatterns=/integration --ci --coverage --passWithNoTests | ||
working-directory: packages/js-client | ||
env: | ||
IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }} | ||
# - name: Run unit tests | ||
# run: yarn test --testPathIgnorePatterns=/integration --ci --coverage --passWithNoTests | ||
# working-directory: packages/js-client | ||
# env: | ||
# IPFS_API_KEY: ${{ secrets.IPFS_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,44 @@ | ||
# 🚧 UNDER CONSTRUCTION 🚧 | ||
# Geo Browser - Aragon OSx | ||
|
||
## License | ||
The following project contains the plugin smart contracts providing the foundation of the Geo Browser project. See `packages/contracts` and `packages/contracts-ethers`. | ||
|
||
This project is licensed under AGPL-3.0-or-later. | ||
A template for a future JS client and a Subgraph indexer is also provided. | ||
|
||
## Contracts | ||
|
||
### SpacePlugin | ||
|
||
Acts as the source of truth regarding the Space associated to the DAO. It is in charge of emitting the events that notify new content being approved and it also emits events accepting a certain DAO as a Subpspace. | ||
|
||
- SpacePlugin | ||
- SpacePluginSetup | ||
|
||
### MemberAccess | ||
|
||
Provides a simple way for any address to request membership on a space. Editors can approve it. | ||
|
||
- MemberAccessPlugin | ||
- MemberAccessPluginSetup | ||
|
||
### SpaceVotingPlugin | ||
|
||
Default governance plugin for spaces, where all proposals are voted by editors. | ||
|
||
- SpaceVotingPlugin | ||
- SpaceVotingPlugin | ||
|
||
### PersonalSpaceVotingPlugin | ||
|
||
Governance plugin providing the default implementation for personal spaces, where addresses with editor permissioin can apply proposals right away. | ||
|
||
- PersonalSpaceVotingPlugin | ||
- PersonalSpaceVotingPlugin | ||
|
||
## Getting started | ||
|
||
``` | ||
yarn | ||
cd packages/contracts | ||
yarn build | ||
yarn test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.8; | ||
|
||
import {IDAO, PluginUUPSUpgradeable} from "@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol"; | ||
|
||
/// @title MemberAccessPlugin | ||
/// @dev Release 1, Build 1 | ||
contract MemberAccessPlugin is PluginUUPSUpgradeable { | ||
bytes32 public constant STORE_PERMISSION_ID = keccak256("STORE_PERMISSION"); | ||
|
||
uint256 public number; // added in build 1 | ||
|
||
/// @notice Emitted when a number is stored. | ||
/// @param number The number. | ||
event NumberStored(uint256 number); | ||
|
||
constructor() { | ||
_disableInitializers(); | ||
} | ||
|
||
/// @notice Initializes the plugin when build 1 is installed. | ||
/// @param _number The number to be stored. | ||
function initialize(IDAO _dao, uint256 _number) external initializer { | ||
__PluginUUPSUpgradeable_init(_dao); | ||
number = _number; | ||
|
||
emit NumberStored({number: _number}); | ||
} | ||
|
||
/// @notice Stores a new number to storage. Caller needs STORE_PERMISSION. | ||
/// @param _number The number to be stored. | ||
function storeNumber(uint256 _number) external auth(STORE_PERMISSION_ID) { | ||
number = _number; | ||
|
||
emit NumberStored({number: _number}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.8; | ||
|
||
import {PermissionLib} from "@aragon/osx/core/permission/PermissionLib.sol"; | ||
import {PluginSetup, IPluginSetup} from "@aragon/osx/framework/plugin/setup/PluginSetup.sol"; | ||
import {MemberAccessPlugin} from "./MemberAccessPlugin.sol"; | ||
|
||
/// @title MemberAccessPluginSetup | ||
/// @dev Release 1, Build 1 | ||
contract MemberAccessPluginSetup is PluginSetup { | ||
address private immutable pluginImplementation; | ||
bytes32 public constant STORE_PERMISSION_ID = keccak256("STORE_PERMISSION"); | ||
|
||
constructor() { | ||
pluginImplementation = address(new MemberAccessPlugin()); | ||
} | ||
|
||
/// @inheritdoc IPluginSetup | ||
function prepareInstallation( | ||
address _dao, | ||
bytes memory _data | ||
) external returns (address plugin, PreparedSetupData memory preparedSetupData) { | ||
uint256 number = abi.decode(_data, (uint256)); | ||
|
||
plugin = createERC1967Proxy( | ||
pluginImplementation, | ||
abi.encodeWithSelector(MemberAccessPlugin.initialize.selector, _dao, number) | ||
); | ||
|
||
PermissionLib.MultiTargetPermission[] | ||
memory permissions = new PermissionLib.MultiTargetPermission[](1); | ||
|
||
permissions[0] = PermissionLib.MultiTargetPermission({ | ||
operation: PermissionLib.Operation.Grant, | ||
where: plugin, | ||
who: _dao, | ||
condition: PermissionLib.NO_CONDITION, | ||
permissionId: STORE_PERMISSION_ID | ||
}); | ||
|
||
preparedSetupData.permissions = permissions; | ||
} | ||
|
||
/// @inheritdoc IPluginSetup | ||
function prepareUninstallation( | ||
address _dao, | ||
SetupPayload calldata _payload | ||
) external pure returns (PermissionLib.MultiTargetPermission[] memory permissions) { | ||
permissions = new PermissionLib.MultiTargetPermission[](1); | ||
|
||
permissions[0] = PermissionLib.MultiTargetPermission({ | ||
operation: PermissionLib.Operation.Revoke, | ||
where: _payload.plugin, | ||
who: _dao, | ||
condition: PermissionLib.NO_CONDITION, | ||
permissionId: STORE_PERMISSION_ID | ||
}); | ||
} | ||
|
||
/// @inheritdoc IPluginSetup | ||
function implementation() external view returns (address) { | ||
return pluginImplementation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity 0.8.17; | ||
pragma solidity ^0.8.8; | ||
|
||
// Import all contracts from other repositories to make the openzeppelin-upgrades package work to deploy things. | ||
// See related issue here https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/86 | ||
|
||
import {DAOFactory} from "@aragon/osx/framework/dao/DAOFactory.sol"; | ||
import {PluginSetupProcessor} from "@aragon/osx/framework/plugin/setup/PluginSetupProcessor.sol"; | ||
import {PluginRepoFactory} from "@aragon/osx/framework/plugin/repo/PluginRepoFactory.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
pragma solidity ^0.8.8; | ||
|
||
import {IDAO, PluginUUPSUpgradeable} from "@aragon/osx/core/plugin/PluginUUPSUpgradeable.sol"; | ||
|
||
/// @title PersonalSpaceVotingPlugin | ||
/// @dev Release 1, Build 1 | ||
contract PersonalSpaceVotingPlugin is PluginUUPSUpgradeable { | ||
bytes32 public constant STORE_PERMISSION_ID = keccak256("STORE_PERMISSION"); | ||
|
||
uint256 public number; // added in build 1 | ||
|
||
/// @notice Emitted when a number is stored. | ||
/// @param number The number. | ||
event NumberStored(uint256 number); | ||
|
||
constructor() { | ||
_disableInitializers(); | ||
} | ||
|
||
/// @notice Initializes the plugin when build 1 is installed. | ||
/// @param _number The number to be stored. | ||
function initialize(IDAO _dao, uint256 _number) external initializer { | ||
__PluginUUPSUpgradeable_init(_dao); | ||
number = _number; | ||
|
||
emit NumberStored({number: _number}); | ||
} | ||
|
||
/// @notice Stores a new number to storage. Caller needs STORE_PERMISSION. | ||
/// @param _number The number to be stored. | ||
function storeNumber(uint256 _number) external auth(STORE_PERMISSION_ID) { | ||
number = _number; | ||
|
||
emit NumberStored({number: _number}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.8; | ||
|
||
import {PermissionLib} from "@aragon/osx/core/permission/PermissionLib.sol"; | ||
import {PluginSetup, IPluginSetup} from "@aragon/osx/framework/plugin/setup/PluginSetup.sol"; | ||
import {PersonalSpaceVotingPlugin} from "./PersonalSpaceVotingPlugin.sol"; | ||
|
||
/// @title PersonalSpaceVotingPluginSetup | ||
/// @dev Release 1, Build 1 | ||
contract PersonalSpaceVotingPluginSetup is PluginSetup { | ||
address private immutable pluginImplementation; | ||
bytes32 public constant STORE_PERMISSION_ID = keccak256("STORE_PERMISSION"); | ||
|
||
constructor() { | ||
pluginImplementation = address(new PersonalSpaceVotingPlugin()); | ||
} | ||
|
||
/// @inheritdoc IPluginSetup | ||
function prepareInstallation( | ||
address _dao, | ||
bytes memory _data | ||
) external returns (address plugin, PreparedSetupData memory preparedSetupData) { | ||
uint256 number = abi.decode(_data, (uint256)); | ||
|
||
plugin = createERC1967Proxy( | ||
pluginImplementation, | ||
abi.encodeWithSelector(PersonalSpaceVotingPlugin.initialize.selector, _dao, number) | ||
); | ||
|
||
PermissionLib.MultiTargetPermission[] | ||
memory permissions = new PermissionLib.MultiTargetPermission[](1); | ||
|
||
permissions[0] = PermissionLib.MultiTargetPermission({ | ||
operation: PermissionLib.Operation.Grant, | ||
where: plugin, | ||
who: _dao, | ||
condition: PermissionLib.NO_CONDITION, | ||
permissionId: STORE_PERMISSION_ID | ||
}); | ||
|
||
preparedSetupData.permissions = permissions; | ||
} | ||
|
||
/// @inheritdoc IPluginSetup | ||
function prepareUninstallation( | ||
address _dao, | ||
SetupPayload calldata _payload | ||
) external pure returns (PermissionLib.MultiTargetPermission[] memory permissions) { | ||
permissions = new PermissionLib.MultiTargetPermission[](1); | ||
|
||
permissions[0] = PermissionLib.MultiTargetPermission({ | ||
operation: PermissionLib.Operation.Revoke, | ||
where: _payload.plugin, | ||
who: _dao, | ||
condition: PermissionLib.NO_CONDITION, | ||
permissionId: STORE_PERMISSION_ID | ||
}); | ||
} | ||
|
||
/// @inheritdoc IPluginSetup | ||
function implementation() external view returns (address) { | ||
return pluginImplementation; | ||
} | ||
} |
Oops, something went wrong.