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

Commit

Permalink
LlamaTokenVotingTestSetup
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrajath committed Dec 7, 2023
1 parent 912b830 commit 499dc3b
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ run-script script_name flags='' sig='' args='':
-vvvv {{flags}}
mv _test test

dry-run-deploy: (run-script 'DeployLlamaFactory')
dry-run-deploy: (run-script 'DeployLlamaTokenVotingFactory')

deploy: (run-script 'DeployLlamaFactory' '--broadcast --verify --build-info --build-info-path build_info')
deploy: (run-script 'DeployLlamaTokenVotingFactory' '--broadcast --verify --build-info --build-info-path build_info')

verify: (run-script 'DeployLlamaFactory' '--verify --resume')
verify: (run-script 'DeployLlamaTokenVotingFactory' '--verify --resume')
2 changes: 1 addition & 1 deletion script/DeployLlamaTokenVotingFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {ERC721TokenholderActionCreator} from "src/token-voting/ERC721Tokenholder
import {ERC721TokenholderCaster} from "src/token-voting/ERC721TokenholderCaster.sol";
import {LlamaTokenVotingFactory} from "src/token-voting/LlamaTokenVotingFactory.sol";

contract DeployLlamaFactory is Script {
contract DeployLlamaTokenVotingFactory is Script {
// Logic contracts.
ERC20TokenholderActionCreator erc20TokenholderActionCreatorLogic;
ERC20TokenholderCaster erc20TokenholderCasterLogic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import {Test, console2} from "forge-std/Test.sol";
import {Vm} from "forge-std/Vm.sol";

import {ILlamaAccount} from "src/interfaces/ILlamaAccount.sol";
import {ILlamaPolicyMetadata} from "src/interfaces/ILlamaPolicyMetadata.sol";
import {ILlamaStrategy} from "src/interfaces/ILlamaStrategy.sol";
import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
import {ILlamaExecutor} from "src/interfaces/ILlamaExecutor.sol";
import {ILlamaLens} from "src/interfaces/ILlamaLens.sol";
import {ILlamaPolicy} from "src/interfaces/ILlamaPolicy.sol";
import {ActionInfo, PermissionData, RoleHolderData} from "src/lib/Structs.sol";

contract PeripheryTestSetup is Test {
contract LlamaPeripheryTestSetup is Test {
string MAINNET_RPC_URL = vm.envString("MAINNET_RPC_URL"); // can't use constant here

// Llama's Llama instance.
Expand Down
4 changes: 2 additions & 2 deletions test/token-voting/ERC20TokenholderCaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.23;
import {Test, console2} from "forge-std/Test.sol";

import {MockERC20Votes} from "test/mock/MockERC20Votes.sol";
import {LlamaTokenVotingTestSetup} from "test/token-voting/LlamaTokenVotingTestSetup.sol";

import {Action, ActionInfo, PermissionData} from "src/lib/Structs.sol";
import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
Expand All @@ -14,9 +15,8 @@ import {RoleDescription} from "src/lib/UDVTs.sol";
import {ERC20Votes} from "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Votes.sol";
import {ERC20TokenholderCaster} from "src/token-voting/ERC20TokenholderCaster.sol";
import {TokenholderCaster} from "src/token-voting/TokenholderCaster.sol";
import {PeripheryTestSetup} from "test/PeripheryTestSetup.sol";

contract ERC20TokenholderCasterTest is PeripheryTestSetup {
contract ERC20TokenholderCasterTest is LlamaTokenVotingTestSetup {
uint256 constant DEFAULT_APPROVAL_THRESHOLD = 1000;
uint16 constant ONE_HUNDRED_IN_BPS = 10_000;
uint256 constant ONE_THIRD_IN_BPS = 3333;
Expand Down
4 changes: 2 additions & 2 deletions test/token-voting/ERC721TokenholderActionCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Test, console2} from "forge-std/Test.sol";

import {ERC721Votes} from "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Votes.sol";
import {MockERC721Votes} from "test/mock/MockERC721Votes.sol";
import {PeripheryTestSetup} from "test/PeripheryTestSetup.sol";
import {LlamaTokenVotingTestSetup} from "test/token-voting/LlamaTokenVotingTestSetup.sol";

import {Action, ActionInfo} from "src/lib/Structs.sol";
import {RoleDescription} from "src/lib/UDVTs.sol";
Expand All @@ -15,7 +15,7 @@ import {ILlamaStrategy} from "src/interfaces/ILlamaStrategy.sol";
import {ERC721TokenholderActionCreator} from "src/token-voting/ERC721TokenholderActionCreator.sol";
import {TokenholderActionCreator} from "src/token-voting/TokenholderActionCreator.sol";

contract ERC721TokenholderActionCreatorTest is PeripheryTestSetup {
contract ERC721TokenholderActionCreatorTest is LlamaTokenVotingTestSetup {
event ActionCreated(
uint256 id,
address indexed creator,
Expand Down
4 changes: 2 additions & 2 deletions test/token-voting/ERC721TokenholderCaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.23;
import {Test, console2} from "forge-std/Test.sol";

import {MockERC721Votes} from "test/mock/MockERC721Votes.sol";
import {LlamaTokenVotingTestSetup} from "test/token-voting/LlamaTokenVotingTestSetup.sol";

import {Action, ActionInfo, PermissionData} from "src/lib/Structs.sol";
import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
Expand All @@ -14,9 +15,8 @@ import {RoleDescription} from "src/lib/UDVTs.sol";
import {ERC721Votes} from "lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Votes.sol";
import {ERC721TokenholderCaster} from "src/token-voting/ERC721TokenholderCaster.sol";
import {TokenholderCaster} from "src/token-voting/TokenholderCaster.sol";
import {PeripheryTestSetup} from "test/PeripheryTestSetup.sol";

contract ERC721TokenholderCasterTest is PeripheryTestSetup {
contract ERC721TokenholderCasterTest is LlamaTokenVotingTestSetup {
uint256 constant DEFAULT_APPROVAL_THRESHOLD = 2;
uint16 constant ONE_HUNDRED_IN_BPS = 10_000;
uint256 constant ONE_THIRD_IN_BPS = 3333;
Expand Down
5 changes: 2 additions & 3 deletions test/token-voting/LlamaTokenVotingFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Test, console2} from "forge-std/Test.sol";

import {MockERC20Votes} from "test/mock/MockERC20Votes.sol";
import {MockERC721Votes} from "test/mock/MockERC721Votes.sol";
import {PeripheryTestSetup} from "test/PeripheryTestSetup.sol";
import {LlamaTokenVotingTestSetup} from "test/token-voting/LlamaTokenVotingTestSetup.sol";

import {Action, ActionInfo} from "src/lib/Structs.sol";
import {RoleDescription} from "src/lib/UDVTs.sol";
Expand All @@ -14,7 +14,7 @@ import {ERC721Votes} from "lib/openzeppelin-contracts/contracts/token/ERC721/ext
import {ILlamaPolicy} from "src/interfaces/ILlamaPolicy.sol";
import {LlamaTokenVotingFactory} from "src/token-voting/LlamaTokenVotingFactory.sol";

contract LlamaTokenVotingFactoryTest is PeripheryTestSetup {
contract LlamaTokenVotingFactoryTest is LlamaTokenVotingTestSetup {
event ERC20TokenholderActionCreatorCreated(address actionCreator, address indexed token);
event ERC721TokenholderActionCreatorCreated(address actionCreator, address indexed token);
event ERC20TokenholderCasterCreated(
Expand Down Expand Up @@ -118,4 +118,3 @@ contract DeployTokenVotingModule is LlamaTokenVotingFactoryTest {
CORE.executeAction(actionInfo);
}
}

19 changes: 19 additions & 0 deletions test/token-voting/LlamaTokenVotingTestSetup.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {Test, console2} from "forge-std/Test.sol";

import {Vm} from "forge-std/Vm.sol";

import {LlamaPeripheryTestSetup} from "test/LlamaPeripheryTestSetup.sol";

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

contract LlamaTokenVotingTestSetup is LlamaPeripheryTestSetup, DeployLlamaTokenVotingFactory {
function setUp() public virtual override {
LlamaPeripheryTestSetup.setUp();

// Deploy the Llama Token Voting factory and logic contracts
DeployLlamaTokenVotingFactory.run();
}
}

0 comments on commit 499dc3b

Please sign in to comment.