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

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinGreen committed Dec 5, 2023
1 parent 502b9b1 commit fd3eded
Show file tree
Hide file tree
Showing 20 changed files with 683 additions and 706 deletions.
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at 2f1126
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 932fdd
24 changes: 12 additions & 12 deletions src/interfaces/ILlamaAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ pragma solidity ^0.8.23;
/// @author Llama ([email protected])
/// @notice This is the interface for Llama accounts which can be used to hold assets for a Llama instance.
interface ILlamaAccount {
// -------- For Inspection --------
// -------- For Inspection --------

/// @notice Returns the address of the Llama instance's executor.
function llamaExecutor() external view returns (address);
/// @notice Returns the address of the Llama instance's executor.
function llamaExecutor() external view returns (address);

// -------- At Account Creation --------
// -------- At Account Creation --------

/// @notice Initializes a new clone of the account.
/// @dev This function is called by the `_deployAccounts` function in the `LlamaCore` contract. The `initializer`
/// modifier ensures that this function can be invoked at most once.
/// @param config The account configuration, encoded as bytes to support differing constructor arguments in
/// different account logic contracts.
/// @return This return statement must be hardcoded to `true` to ensure that initializing an EOA
/// (like the zero address) will revert.
function initialize(bytes memory config) external returns (bool);
/// @notice Initializes a new clone of the account.
/// @dev This function is called by the `_deployAccounts` function in the `LlamaCore` contract. The `initializer`
/// modifier ensures that this function can be invoked at most once.
/// @param config The account configuration, encoded as bytes to support differing constructor arguments in
/// different account logic contracts.
/// @return This return statement must be hardcoded to `true` to ensure that initializing an EOA
/// (like the zero address) will revert.
function initialize(bytes memory config) external returns (bool);
}
22 changes: 11 additions & 11 deletions src/interfaces/ILlamaActionGuard.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import {ActionInfo} from "src/lib/Structs.sol";
/// - Verify the USD value of an account has not decreased by more than a certain amount during
/// execution, i.e. between `validatePreActionExecution` and `validatePostActionExecution`.
interface ILlamaActionGuard {
/// @notice Reverts if action creation is not allowed.
/// @param actionInfo Data required to create an action.
function validateActionCreation(ActionInfo calldata actionInfo) external;
/// @notice Reverts if action creation is not allowed.
/// @param actionInfo Data required to create an action.
function validateActionCreation(ActionInfo calldata actionInfo) external;

/// @notice Called immediately before action execution, and reverts if the action is not allowed
/// to be executed.
/// @param actionInfo Data required to create an action.
function validatePreActionExecution(ActionInfo calldata actionInfo) external;
/// @notice Called immediately before action execution, and reverts if the action is not allowed
/// to be executed.
/// @param actionInfo Data required to create an action.
function validatePreActionExecution(ActionInfo calldata actionInfo) external;

/// @notice Called immediately after action execution, and reverts if the just-executed
/// action should not have been allowed to execute.
/// @param actionInfo Data required to create an action.
function validatePostActionExecution(ActionInfo calldata actionInfo) external;
/// @notice Called immediately after action execution, and reverts if the just-executed
/// action should not have been allowed to execute.
/// @param actionInfo Data required to create an action.
function validatePostActionExecution(ActionInfo calldata actionInfo) external;
}
152 changes: 75 additions & 77 deletions src/interfaces/ILlamaCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,87 +7,85 @@ pragma solidity ^0.8.23;
import {ILlamaPolicy} from "src/interfaces/ILlamaPolicy.sol";
import {ILlamaStrategy} from "src/interfaces/ILlamaStrategy.sol";
import {
Action,
ActionInfo,
LlamaInstanceConfig,
LlamaPolicyConfig,
PermissionData,
RoleHolderData,
RolePermissionData
Action,
ActionInfo,
LlamaInstanceConfig,
LlamaPolicyConfig,
PermissionData,
RoleHolderData,
RolePermissionData
} from "src/lib/Structs.sol";

/// @title LlamaCore Interface
/// @author Llama ([email protected])
/// @notice This is the interface for LlamaCore.
interface ILlamaCore {
function actionGuard(address target, bytes4 selector) external view returns (address guard);
function actionsCount() external view returns (uint256);
function approvals(uint256 actionId, address policyholder) external view returns (bool hasApproved);
function authorizedAccountLogics(address accountLogic) external view returns (bool isAuthorized);
function authorizedScripts(address script) external view returns (bool isAuthorized);
function authorizedStrategyLogics(ILlamaStrategy strategyLogic) external view returns (bool isAuthorized);
function cancelAction(ActionInfo memory actionInfo) external;
function cancelActionBySig(address policyholder, ActionInfo memory actionInfo, uint8 v, bytes32 r, bytes32 s)
external;
function castApproval(uint8 role, ActionInfo memory actionInfo, string memory reason) external returns (uint96);
function castApprovalBySig(
address policyholder,
uint8 role,
ActionInfo memory actionInfo,
string memory reason,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint96);
function castDisapproval(uint8 role, ActionInfo memory actionInfo, string memory reason)
external
returns (uint96);
function castDisapprovalBySig(
address policyholder,
uint8 role,
ActionInfo memory actionInfo,
string memory reason,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint96);
function createAccounts(address llamaAccountLogic, bytes[] memory accountConfigs) external;
function createAction(
uint8 role,
ILlamaStrategy strategy,
address target,
uint256 value,
bytes memory data,
string memory description
) external returns (uint256 actionId);
function createActionBySig(
address policyholder,
uint8 role,
ILlamaStrategy strategy,
address target,
uint256 value,
bytes memory data,
string memory description,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 actionId);
function createStrategies(address llamaStrategyLogic, bytes[] memory strategyConfigs) external;
function disapprovals(uint256 actionId, address policyholder) external view returns (bool hasDisapproved);
function executeAction(ActionInfo memory actionInfo) external payable;
function executor() external view returns (address);
function getAction(uint256 actionId) external view returns (Action memory);
function getActionState(ActionInfo memory actionInfo) external view returns (uint8);
function incrementNonce(bytes4 selector) external;
function initialize(LlamaInstanceConfig memory config, address policyLogic, address policyMetadataLogic) external;
function name() external view returns (string memory);
function nonces(address policyholder, bytes4 selector) external view returns (uint256 currentNonce);
function policy() external view returns (ILlamaPolicy);
function queueAction(ActionInfo memory actionInfo) external;
function setAccountLogicAuthorization(address accountLogic, bool authorized) external;
function setGuard(address target, bytes4 selector, address guard) external;
function setScriptAuthorization(address script, bool authorized) external;
function setStrategyAuthorization(ILlamaStrategy strategy, bool authorized) external;
function setStrategyLogicAuthorization(ILlamaStrategy strategyLogic, bool authorized) external;
function strategies(ILlamaStrategy strategy) external view returns (bool deployed, bool authorized);
function actionGuard(address target, bytes4 selector) external view returns (address guard);
function actionsCount() external view returns (uint256);
function approvals(uint256 actionId, address policyholder) external view returns (bool hasApproved);
function authorizedAccountLogics(address accountLogic) external view returns (bool isAuthorized);
function authorizedScripts(address script) external view returns (bool isAuthorized);
function authorizedStrategyLogics(ILlamaStrategy strategyLogic) external view returns (bool isAuthorized);
function cancelAction(ActionInfo memory actionInfo) external;
function cancelActionBySig(address policyholder, ActionInfo memory actionInfo, uint8 v, bytes32 r, bytes32 s)
external;
function castApproval(uint8 role, ActionInfo memory actionInfo, string memory reason) external returns (uint96);
function castApprovalBySig(
address policyholder,
uint8 role,
ActionInfo memory actionInfo,
string memory reason,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint96);
function castDisapproval(uint8 role, ActionInfo memory actionInfo, string memory reason) external returns (uint96);
function castDisapprovalBySig(
address policyholder,
uint8 role,
ActionInfo memory actionInfo,
string memory reason,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint96);
function createAccounts(address llamaAccountLogic, bytes[] memory accountConfigs) external;
function createAction(
uint8 role,
ILlamaStrategy strategy,
address target,
uint256 value,
bytes memory data,
string memory description
) external returns (uint256 actionId);
function createActionBySig(
address policyholder,
uint8 role,
ILlamaStrategy strategy,
address target,
uint256 value,
bytes memory data,
string memory description,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 actionId);
function createStrategies(address llamaStrategyLogic, bytes[] memory strategyConfigs) external;
function disapprovals(uint256 actionId, address policyholder) external view returns (bool hasDisapproved);
function executeAction(ActionInfo memory actionInfo) external payable;
function executor() external view returns (address);
function getAction(uint256 actionId) external view returns (Action memory);
function getActionState(ActionInfo memory actionInfo) external view returns (uint8);
function incrementNonce(bytes4 selector) external;
function initialize(LlamaInstanceConfig memory config, address policyLogic, address policyMetadataLogic) external;
function name() external view returns (string memory);
function nonces(address policyholder, bytes4 selector) external view returns (uint256 currentNonce);
function policy() external view returns (ILlamaPolicy);
function queueAction(ActionInfo memory actionInfo) external;
function setAccountLogicAuthorization(address accountLogic, bool authorized) external;
function setGuard(address target, bytes4 selector, address guard) external;
function setScriptAuthorization(address script, bool authorized) external;
function setStrategyAuthorization(ILlamaStrategy strategy, bool authorized) external;
function setStrategyLogicAuthorization(ILlamaStrategy strategyLogic, bool authorized) external;
function strategies(ILlamaStrategy strategy) external view returns (bool deployed, bool authorized);
}
10 changes: 5 additions & 5 deletions src/interfaces/ILlamaExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pragma solidity ^0.8.23;
/// @author Llama ([email protected])
/// @notice This is the interface for LlamaExecutor.
interface ILlamaExecutor {
function LLAMA_CORE() external view returns (address);
function execute(address target, bool isScript, bytes calldata data)
external
payable
returns (bool success, bytes memory result);
function LLAMA_CORE() external view returns (address);
function execute(address target, bool isScript, bytes calldata data)
external
payable
returns (bool success, bytes memory result);
}
Loading

0 comments on commit fd3eded

Please sign in to comment.