Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrajath committed Dec 9, 2023
1 parent 6a97d1d commit 548fe31
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion test/token-voting/LlamaTokenVotingTestSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {LlamaPeripheryTestSetup} from "test/LlamaPeripheryTestSetup.sol";

import {DeployLlamaTokenVotingFactory} from "script/DeployLlamaTokenVotingFactory.s.sol";

import {Action, ActionInfo, PermissionData} from "src/lib/Structs.sol";
import {ILlamaPolicy} from "src/interfaces/ILlamaPolicy.sol";
import {ILlamaStrategy} from "src/interfaces/ILlamaStrategy.sol";
import {ILlamaRelativeStrategyBase} from "src/interfaces/ILlamaRelativeStrategyBase.sol";
import {RoleDescription} from "src/lib/UDVTs.sol";
import {ERC20TokenholderActionCreator} from "src/token-voting/ERC20TokenholderActionCreator.sol";
import {ERC20TokenholderCaster} from "src/token-voting/ERC20TokenholderCaster.sol";
Expand All @@ -19,7 +22,7 @@ import {ERC721TokenholderCaster} from "src/token-voting/ERC721TokenholderCaster.

contract LlamaTokenVotingTestSetup is LlamaPeripheryTestSetup, DeployLlamaTokenVotingFactory {
// Percentages
uint256 internal constant ONE_HUNDRED_IN_BPS = 10_000;
uint16 internal constant ONE_HUNDRED_IN_BPS = 10_000;
uint256 internal constant ONE_THIRD_IN_BPS = 3333;
uint256 internal constant TWO_THIRDS_IN_BPS = 6667;

Expand Down Expand Up @@ -149,4 +152,53 @@ contract LlamaTokenVotingTestSetup is LlamaPeripheryTestSetup, DeployLlamaTokenV
);
vm.stopPrank();
}

function _deployRelativeQuantityQuorumAndSetRolePermissionToCoreTeam(uint8 _tokenVotingCasterRole)
internal
returns (ILlamaStrategy newStrategy)
{
uint8[] memory forceRoles = new uint8[](0);

ILlamaRelativeStrategyBase.Config memory strategyConfig = ILlamaRelativeStrategyBase.Config({
approvalPeriod: 1 days,
queuingPeriod: 1 days,
expirationPeriod: 1 days,
isFixedLengthApprovalPeriod: false,
minApprovalPct: ONE_HUNDRED_IN_BPS,
minDisapprovalPct: ONE_HUNDRED_IN_BPS,
approvalRole: _tokenVotingCasterRole,
disapprovalRole: _tokenVotingCasterRole,
forceApprovalRoles: forceRoles,
forceDisapprovalRoles: forceRoles
});

ILlamaRelativeStrategyBase.Config[] memory strategyConfigs = new ILlamaRelativeStrategyBase.Config[](1);
strategyConfigs[0] = strategyConfig;

vm.prank(address(EXECUTOR));
CORE.createStrategies(RELATIVE_QUANTITY_QUORUM_LOGIC, encodeStrategyConfigs(strategyConfigs));

newStrategy = ILlamaStrategy(
LENS.computeLlamaStrategyAddress(
address(RELATIVE_QUANTITY_QUORUM_LOGIC), encodeStrategy(strategyConfig), address(CORE)
)
);

{
vm.prank(address(EXECUTOR));
POLICY.setRolePermission(
CORE_TEAM_ROLE, ILlamaPolicy.PermissionData(address(mockProtocol), PAUSE_SELECTOR, address(STRATEGY)), true
);
}
}

function _createActionWithTokenVotingStrategy(ILlamaStrategy _tokenVotingStrategy)
public
returns (ActionInfo memory _actionInfo)
{
bytes memory data = abi.encodeCall(mockProtocol.pause, (true));
vm.prank(coreTeam1);
uint256 actionId = CORE.createAction(CORE_TEAM_ROLE, _tokenVotingStrategy, address(mockProtocol), 0, data, "");
_actionInfo = ActionInfo(actionId, coreTeam1, CORE_TEAM_ROLE, _tokenVotingStrategy, address(mockProtocol), 0, data);
}
}

0 comments on commit 548fe31

Please sign in to comment.