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

Commit

Permalink
renamed stuff to use llama prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
dd0sxx committed Dec 8, 2023
1 parent cdf0e47 commit 7284881
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 88 deletions.
42 changes: 22 additions & 20 deletions script/DeployLlamaTokenVotingFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ pragma solidity 0.8.23;
import {Script} from "forge-std/Script.sol";

import {DeployUtils} from "script/DeployUtils.sol";
import {ERC20TokenholderActionCreator} from "src/token-voting/ERC20TokenholderActionCreator.sol";
import {ERC20TokenholderCaster} from "src/token-voting/ERC20TokenholderCaster.sol";
import {ERC721TokenholderActionCreator} from "src/token-voting/ERC721TokenholderActionCreator.sol";
import {ERC721TokenholderCaster} from "src/token-voting/ERC721TokenholderCaster.sol";
import {LlamaERC20TokenHolderActionCreator} from "src/token-voting/LlamaERC20TokenHolderActionCreator.sol";
import {LlamaERC20TokenHolderCaster} from "src/token-voting/LlamaERC20TokenHolderCaster.sol";
import {LlamaERC721TokenHolderActionCreator} from "src/token-voting/LlamaERC721TokenHolderActionCreator.sol";
import {LlamaERC721TokenHolderCaster} from "src/token-voting/LlamaERC721TokenHolderCaster.sol";
import {LlamaTokenVotingFactory} from "src/token-voting/LlamaTokenVotingFactory.sol";

contract DeployLlamaTokenVotingFactory is Script {
// Logic contracts.
ERC20TokenholderActionCreator erc20TokenholderActionCreatorLogic;
ERC20TokenholderCaster erc20TokenholderCasterLogic;
ERC721TokenholderActionCreator erc721TokenholderActionCreatorLogic;
ERC721TokenholderCaster erc721TokenholderCasterLogic;
LlamaERC20TokenHolderActionCreator erc20LlamaTokenHolderActionCreatorLogic;
LlamaERC20TokenHolderCaster erc20LlamaTokenHolderCasterLogic;
LlamaERC721TokenHolderActionCreator erc721LlamaTokenHolderActionCreatorLogic;
LlamaERC721TokenHolderCaster erc721LlamaTokenHolderCasterLogic;

// Factory contracts.
LlamaTokenVotingFactory tokenVotingFactory;
Expand All @@ -26,37 +26,39 @@ contract DeployLlamaTokenVotingFactory is Script {
);

vm.broadcast();
erc20TokenholderActionCreatorLogic = new ERC20TokenholderActionCreator();
erc20LlamaTokenHolderActionCreatorLogic = new LlamaERC20TokenHolderActionCreator();
DeployUtils.print(
string.concat(" ERC20TokenholderActionCreatorLogic: ", vm.toString(address(erc20TokenholderActionCreatorLogic)))
string.concat(
" LlamaERC20TokenHolderActionCreatorLogic: ", vm.toString(address(erc20LlamaTokenHolderActionCreatorLogic))
)
);

vm.broadcast();
erc20TokenholderCasterLogic = new ERC20TokenholderCaster();
erc20LlamaTokenHolderCasterLogic = new LlamaERC20TokenHolderCaster();
DeployUtils.print(
string.concat(" ERC20TokenholderCasterLogic: ", vm.toString(address(erc20TokenholderCasterLogic)))
string.concat(" LlamaERC20TokenHolderCasterLogic: ", vm.toString(address(erc20LlamaTokenHolderCasterLogic)))
);

vm.broadcast();
erc721TokenholderActionCreatorLogic = new ERC721TokenholderActionCreator();
erc721LlamaTokenHolderActionCreatorLogic = new LlamaERC721TokenHolderActionCreator();
DeployUtils.print(
string.concat(
" ERC721TokenholderActionCreatorLogic: ", vm.toString(address(erc721TokenholderActionCreatorLogic))
" LlamaERC721TokenHolderActionCreatorLogic: ", vm.toString(address(erc721LlamaTokenHolderActionCreatorLogic))
)
);

vm.broadcast();
erc721TokenholderCasterLogic = new ERC721TokenholderCaster();
erc721LlamaTokenHolderCasterLogic = new LlamaERC721TokenHolderCaster();
DeployUtils.print(
string.concat(" ERC721TokenholderCasterLogic: ", vm.toString(address(erc721TokenholderCasterLogic)))
string.concat(" LlamaERC721TokenHolderCasterLogic: ", vm.toString(address(erc721LlamaTokenHolderCasterLogic)))
);

vm.broadcast();
tokenVotingFactory = new LlamaTokenVotingFactory(
erc20TokenholderActionCreatorLogic,
erc20TokenholderCasterLogic,
erc721TokenholderActionCreatorLogic,
erc721TokenholderCasterLogic
erc20LlamaTokenHolderActionCreatorLogic,
erc20LlamaTokenHolderCasterLogic,
erc721LlamaTokenHolderActionCreatorLogic,
erc721LlamaTokenHolderCasterLogic
);
DeployUtils.print(string.concat(" LlamaTokenVotingFactory: ", vm.toString(address(tokenVotingFactory))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
pragma solidity ^0.8.23;

import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
import {TokenholderActionCreator} from "src/token-voting/TokenholderActionCreator.sol";
import {LlamaTokenHolderActionCreator} from "src/token-voting/LlamaTokenHolderActionCreator.sol";
import {ERC20Votes} from "@openzeppelin/token/ERC20/extensions/ERC20Votes.sol";

/// @title ERC20TokenholderActionCreator
/// @title LlamaERC20TokenHolderActionCreator
/// @author Llama ([email protected])
/// @notice This contract lets holders of a specified `ERC20Votes` token create actions on a llama instance if their
/// token balance is greater than or equal to the creation threshold.
contract ERC20TokenholderActionCreator is TokenholderActionCreator {
contract LlamaERC20TokenHolderActionCreator is LlamaTokenHolderActionCreator {
ERC20Votes public token;

/// @dev This contract is deployed as a minimal proxy from the factory's `deployTokenVotingModule` function. The
Expand All @@ -18,7 +18,7 @@ contract ERC20TokenholderActionCreator is TokenholderActionCreator {
_disableInitializers();
}

/// @notice Initializes a new `ERC20TokenholderActionCreator` clone.
/// @notice Initializes a new `LlamaERC20TokenHolderActionCreator` clone.
/// @dev This function is called by the `deployTokenVotingModule` function in the `LlamaTokenVotingFactory` contract.
/// The `initializer` modifier ensures that this function can be invoked at most once.
/// @param _token The ERC20 token to be used for voting.
Expand All @@ -27,7 +27,7 @@ contract ERC20TokenholderActionCreator is TokenholderActionCreator {
/// be in the same decimals as the token. For example, if the token has 18 decimals and you want a
/// creation threshold of 1000 tokens, pass in 1000e18.
function initialize(ERC20Votes _token, ILlamaCore _llamaCore, uint256 _creationThreshold) external initializer {
__initializeTokenholderActionCreatorMinimalProxy(_llamaCore, _creationThreshold);
__initializeLlamaTokenHolderActionCreatorMinimalProxy(_llamaCore, _creationThreshold);
token = _token;
uint256 totalSupply = token.totalSupply();
if (totalSupply == 0) revert InvalidTokenAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
pragma solidity ^0.8.23;

import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
import {TokenholderCaster} from "src/token-voting/TokenholderCaster.sol";
import {LlamaTokenHolderCaster} from "src/token-voting/LlamaTokenHolderCaster.sol";
import {ERC20Votes} from "@openzeppelin/token/ERC20/extensions/ERC20Votes.sol";

/// @title ERC20TokenholderCaster
/// @title LlamaERC20TokenHolderCaster
/// @author Llama ([email protected])
/// @notice This contract lets holders of a given governance ERC20Votes token cast approvals and disapprovals
/// on created actions.
contract ERC20TokenholderCaster is TokenholderCaster {
contract LlamaERC20TokenHolderCaster is LlamaTokenHolderCaster {
ERC20Votes public token;

/// @dev This contract is deployed as a minimal proxy from the factory's `deployTokenVotingModule` function. The
Expand All @@ -18,7 +18,7 @@ contract ERC20TokenholderCaster is TokenholderCaster {
_disableInitializers();
}

/// @notice Initializes a new `ERC20TokenholderCaster` clone.
/// @notice Initializes a new `LlamaERC20TokenHolderCaster` clone.
/// @dev This function is called by the `deployTokenVotingModule` function in the `LlamaTokenVotingFactory` contract.
/// The `initializer` modifier ensures that this function can be invoked at most once.
/// @param _token The ERC20 token to be used for voting.
Expand All @@ -33,7 +33,7 @@ contract ERC20TokenholderCaster is TokenholderCaster {
uint256 _minApprovalPct,
uint256 _minDisapprovalPct
) external initializer {
__initializeTokenholderCasterMinimalProxy(_llamaCore, _role, _minApprovalPct, _minDisapprovalPct);
__initializeLlamaTokenHolderCasterMinimalProxy(_llamaCore, _role, _minApprovalPct, _minDisapprovalPct);
token = _token;
uint256 totalSupply = token.totalSupply();
if (totalSupply == 0) revert InvalidTokenAddress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
pragma solidity ^0.8.23;

import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
import {TokenholderActionCreator} from "src/token-voting/TokenholderActionCreator.sol";
import {LlamaTokenHolderActionCreator} from "src/token-voting/LlamaTokenHolderActionCreator.sol";
import {ERC721Votes} from "@openzeppelin/token/ERC721/extensions/ERC721Votes.sol";
import {IERC721} from "@openzeppelin/token/ERC721/IERC721.sol";

/// @title ERC721TokenholderActionCreator
/// @title LlamaERC721TokenHolderActionCreator
/// @author Llama ([email protected])
/// @notice This contract lets holders of a given governance ERC721Votes token create actions on the llama instance if
/// they hold enough tokens.
contract ERC721TokenholderActionCreator is TokenholderActionCreator {
contract LlamaERC721TokenHolderActionCreator is LlamaTokenHolderActionCreator {
ERC721Votes public token;

/// @dev This contract is deployed as a minimal proxy from the factory's `deployTokenVotingModule` function. The
Expand All @@ -19,7 +19,7 @@ contract ERC721TokenholderActionCreator is TokenholderActionCreator {
_disableInitializers();
}

/// @notice Initializes a new `ERC721TokenholderActionCreator` clone.
/// @notice Initializes a new `LlamaERC721TokenHolderActionCreator` clone.
/// @dev This function is called by the `deployTokenVotingModule` function in the `LlamaTokenVotingFactory` contract.
/// The `initializer` modifier ensures that this function can be invoked at most once.
/// @param _token The ERC721 token to be used for voting.
Expand All @@ -28,7 +28,7 @@ contract ERC721TokenholderActionCreator is TokenholderActionCreator {
/// be in the same decimals as the token. For example, if the token has 18 decimals and you want a
/// creation threshold of 1000 tokens, pass in 1000e18.
function initialize(ERC721Votes _token, ILlamaCore _llamaCore, uint256 _creationThreshold) external initializer {
__initializeTokenholderActionCreatorMinimalProxy(_llamaCore, _creationThreshold);
__initializeLlamaTokenHolderActionCreatorMinimalProxy(_llamaCore, _creationThreshold);
token = _token;
if (!token.supportsInterface(type(IERC721).interfaceId)) revert InvalidTokenAddress();
uint256 totalSupply = token.getPastTotalSupply(block.timestamp - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
pragma solidity ^0.8.23;

import {ILlamaCore} from "src/interfaces/ILlamaCore.sol";
import {TokenholderCaster} from "src/token-voting/TokenholderCaster.sol";
import {LlamaTokenHolderCaster} from "src/token-voting/LlamaTokenHolderCaster.sol";
import {ERC721Votes} from "@openzeppelin/token/ERC721/extensions/ERC721Votes.sol";
import {IERC721} from "@openzeppelin/token/ERC721/IERC721.sol";

/// @title ERC721TokenholderCaster
/// @title LlamaERC721TokenHolderCaster
/// @author Llama ([email protected])
/// @notice This contract lets holders of a given governance ERC721Votes token cast approvals and disapprovals
/// on created actions.
contract ERC721TokenholderCaster is TokenholderCaster {
contract LlamaERC721TokenHolderCaster is LlamaTokenHolderCaster {
ERC721Votes public token;

/// @dev This contract is deployed as a minimal proxy from the factory's `deployTokenVotingModule` function. The
Expand All @@ -19,7 +19,7 @@ contract ERC721TokenholderCaster is TokenholderCaster {
_disableInitializers();
}

/// @notice Initializes a new `ERC721TokenholderCaster` clone.
/// @notice Initializes a new `LlamaERC721TokenHolderCaster` clone.
/// @dev This function is called by the `deployTokenVotingModule` function in the `LlamaTokenVotingFactory` contract.
/// The `initializer` modifier ensures that this function can be invoked at most once.
/// @param _token The ERC721 token to be used for voting.
Expand All @@ -34,7 +34,7 @@ contract ERC721TokenholderCaster is TokenholderCaster {
uint256 _minApprovalPct,
uint256 _minDisapprovalPct
) external initializer {
__initializeTokenholderCasterMinimalProxy(_llamaCore, _role, _minApprovalPct, _minDisapprovalPct);
__initializeLlamaTokenHolderCasterMinimalProxy(_llamaCore, _role, _minApprovalPct, _minDisapprovalPct);
token = _token;
if (!token.supportsInterface(type(IERC721).interfaceId)) revert InvalidTokenAddress();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {LlamaUtils} from "src/lib/LlamaUtils.sol";
import {Action, ActionInfo} from "src/lib/Structs.sol";
import {ILlamaRelativeStrategyBase} from "src/interfaces/ILlamaRelativeStrategyBase.sol";

/// @title TokenholderCaster
/// @title LlamaTokenHolderCaster
/// @author Llama ([email protected])
/// @notice This contract lets holders of a given governance token cast approvals and disapprovals
/// on created actions.
/// @dev This contract is deployed by `LlamaTokenVotingFactory`. Anyone can deploy this contract using the factory, but
/// it must hold a Policy from the specified `LlamaCore` instance to actually be able to cast on an action. This
/// contract does not verify that it holds the correct policy when voting and relies on `LlamaCore` to
/// verify that during submission.
abstract contract TokenholderCaster is Initializable {
abstract contract LlamaTokenHolderCaster is Initializable {
// =========================
// ======== Structs ========
// =========================
Expand Down Expand Up @@ -188,7 +188,7 @@ abstract contract TokenholderCaster is Initializable {
/// @param _role The role used by this contract to cast approvals and disapprovals.
/// @param _minApprovalPct The minimum % of approvals required to submit approvals to `LlamaCore`.
/// @param _minDisapprovalPct The minimum % of disapprovals required to submit disapprovals to `LlamaCore`.
function __initializeTokenholderCasterMinimalProxy(
function __initializeLlamaTokenHolderCasterMinimalProxy(
ILlamaCore _llamaCore,
uint8 _role,
uint256 _minApprovalPct,
Expand Down
Loading

0 comments on commit 7284881

Please sign in to comment.