Skip to content

Commit

Permalink
extension folder
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Oct 29, 2024
1 parent 81bcc4c commit 2f6d3d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.8;

import {PowerfulCondition} from "../../../permission/condition/PowerfulCondition.sol";
import {DaoAuthorizableUpgradeable} from "../../../permission/auth/DaoAuthorizableUpgradeable.sol";
import {RuledCondition} from "../../../../permission/condition/extensions/RuledCondition.sol";
import {DaoAuthorizableUpgradeable} from "../../../../permission/auth/DaoAuthorizableUpgradeable.sol";

/// @notice A mock powerful condition to expose internal functions
/// @dev DO NOT USE IN PRODUCTION!
contract PowerfulConditionMock is DaoAuthorizableUpgradeable, PowerfulCondition {
contract RuledConditionMock is DaoAuthorizableUpgradeable, RuledCondition {
function updateRules(Rule[] memory _rules) public virtual {
_updateRules(_rules);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity ^0.8.8;

import {IPermissionCondition} from "./IPermissionCondition.sol";
import {PermissionConditionUpgradeable} from "./PermissionConditionUpgradeable.sol";
import {IPermissionCondition} from "../IPermissionCondition.sol";
import {PermissionConditionUpgradeable} from "../PermissionConditionUpgradeable.sol";

/// @title RuledCondition
/// @author Aragon X - 2024
Expand Down Expand Up @@ -218,7 +218,7 @@ abstract contract RuledCondition is PermissionConditionUpgradeable {
/// @param _permissionId The permission identifier.
/// @param _compareList A list of values used for comparison in evaluation.
/// @return Returns `true` if the external condition is granted.
function checkCondition(
function _checkCondition(
IPermissionCondition _condition,
address _where,
address _who,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import {
PowerfulConditionMock,
PowerfulConditionMock__factory,
RuledConditionMock,
RuledConditionMock__factory,
PermissionConditionMock,
PermissionConditionMock__factory,
DAOMock,
DAOMock__factory,
} from '../../../typechain';
} from '../../../../typechain';
import {
BLOCK_NUMBER_RULE_ID,
TIMESTAMP_RULE_ID,
CONDITION_RULE_ID,
LOGIC_OP_RULE_ID,
DUMMY_PERMISSION_ID,
Op,
} from '../../utils/condition/condition';
} from '../../../utils/condition/condition';
import {loadFixture} from '@nomicfoundation/hardhat-network-helpers';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ethers} from 'hardhat';

describe('PowerfulCondition', async () => {
describe('RuledCondition', async () => {
it('it should be able to update the condition rules', async () => {
const {conditionMock} = await loadFixture(fixture);

Expand Down Expand Up @@ -246,14 +246,14 @@ describe('PowerfulCondition', async () => {
type FixtureResult = {
deployer: SignerWithAddress;
daoMock: DAOMock;
conditionMock: PowerfulConditionMock;
conditionMock: RuledConditionMock;
subConditionA: PermissionConditionMock;
subConditionB: PermissionConditionMock;
subConditionC: PermissionConditionMock;
};

function C_or_B_and_A_Rule(
conditionMock: PowerfulConditionMock,
conditionMock: RuledConditionMock,
subConditionA: PermissionConditionMock,
subConditionB: PermissionConditionMock,
subConditionC: PermissionConditionMock
Expand Down Expand Up @@ -297,7 +297,7 @@ async function fixture(): Promise<FixtureResult> {

const daoMock = await new DAOMock__factory(deployer).deploy();

const conditionMock = await new PowerfulConditionMock__factory(
const conditionMock = await new RuledConditionMock__factory(
deployer
).deploy();

Expand Down

0 comments on commit 2f6d3d9

Please sign in to comment.