From 129028160e427e18b70f937fd3e978c55caa9e9d Mon Sep 17 00:00:00 2001 From: Kevin Siegler <17910833+topocount@users.noreply.github.com> Date: Thu, 5 Sep 2024 12:17:06 -0500 Subject: [PATCH] chore(evm): prepend abstracts with A --- packages/evm/contracts/BoostCore.sol | 58 +++--- packages/evm/contracts/BoostRegistry.sol | 32 ++-- .../actions/{Action.sol => AAction.sol} | 16 +- .../evm/contracts/actions/AContractAction.sol | 12 +- .../contracts/actions/AERC721MintAction.sol | 8 +- .../evm/contracts/actions/AEventAction.sol | 14 +- .../evm/contracts/actions/ContractAction.sol | 4 +- .../contracts/actions/ERC721MintAction.sol | 8 +- .../evm/contracts/actions/EventAction.sol | 4 +- .../{AllowList.sol => AAllowList.sol} | 10 +- .../contracts/allowlists/ASimpleAllowList.sol | 14 +- .../contracts/allowlists/ASimpleDenyList.sol | 14 +- .../contracts/allowlists/SimpleAllowList.sol | 2 +- .../budgets/{Budget.sol => ABudget.sol} | 16 +- .../evm/contracts/budgets/AManagedBudget.sol | 36 ++-- .../evm/contracts/budgets/ASimpleBudget.sol | 36 ++-- .../evm/contracts/budgets/AVestingBudget.sol | 34 ++-- .../evm/contracts/budgets/ManagedBudget.sol | 6 +- .../evm/contracts/budgets/SimpleBudget.sol | 6 +- .../evm/contracts/budgets/VestingBudget.sol | 7 +- .../incentives/AAllowListIncentive.sol | 24 +-- .../contracts/incentives/ACGDAIncentive.sol | 24 +-- .../incentives/AERC1155Incentive.sol | 18 +- .../contracts/incentives/AERC20Incentive.sol | 20 +- .../incentives/AERC20VariableIncentive.sol | 14 +- .../{Incentive.sol => AIncentive.sol} | 20 +- .../contracts/incentives/APointsIncentive.sol | 22 +-- .../incentives/AllowListIncentive.sol | 6 +- .../contracts/incentives/CGDAIncentive.sol | 18 +- .../contracts/incentives/ERC1155Incentive.sol | 14 +- .../contracts/incentives/ERC20Incentive.sol | 16 +- .../incentives/ERC20VariableIncentive.sol | 16 +- .../contracts/incentives/PointsIncentive.sol | 4 +- .../shared/{Cloneable.sol => ACloneable.sol} | 6 +- packages/evm/contracts/shared/BoostLib.sol | 20 +- .../contracts/validators/ASignerValidator.sol | 6 +- .../evm/contracts/validators/AValidator.sol | 12 +- .../contracts/validators/SignerValidator.sol | 2 +- packages/evm/test/BoostCore.t.sol | 50 ++--- packages/evm/test/BoostRegistry.t.sol | 48 ++--- .../evm/test/actions/ContractAction.t.sol | 6 +- .../evm/test/actions/ERC721MintAction.t.sol | 4 +- packages/evm/test/actions/EventAction.t.sol | 4 +- .../evm/test/allowlists/SimpleAllowList.t.sol | 8 +- .../evm/test/allowlists/SimpleDenyList.t.sol | 8 +- packages/evm/test/budgets/ManagedBudget.t.sol | 180 +++++++++--------- packages/evm/test/budgets/SimpleBudget.t.sol | 168 ++++++++-------- packages/evm/test/budgets/VestingBudget.t.sol | 92 ++++----- packages/evm/test/e2e/EndToEndBasic.t.sol | 40 ++-- .../test/e2e/EndToEndSignerValidator.t.sol | 43 ++--- .../test/incentives/AllowListIncentive.t.sol | 6 +- .../evm/test/incentives/CGDAIncentive.t.sol | 24 +-- .../test/incentives/ERC1155Incentive.t.sol | 31 +-- .../evm/test/incentives/ERC20Incentive.t.sol | 52 ++--- .../incentives/ERC20VariableIncentive.t.sol | 32 ++-- .../evm/test/incentives/PointsIncentive.t.sol | 8 +- packages/evm/test/shared/Cloneable.t.sol | 38 ++-- .../evm/test/validators/SignerValidator.t.sol | 6 +- packages/sdk/src/Actions/Action.ts | 4 +- packages/sdk/src/AllowLists/AllowList.ts | 4 +- packages/sdk/src/Budgets/Budget.ts | 4 +- .../sdk/src/Deployable/DeployableTarget.ts | 14 +- packages/sdk/src/Incentives/Incentive.ts | 4 +- 63 files changed, 740 insertions(+), 737 deletions(-) rename packages/evm/contracts/actions/{Action.sol => AAction.sol} (71%) rename packages/evm/contracts/allowlists/{AllowList.sol => AAllowList.sol} (76%) rename packages/evm/contracts/budgets/{Budget.sol => ABudget.sol} (91%) rename packages/evm/contracts/incentives/{Incentive.sol => AIncentive.sol} (79%) rename packages/evm/contracts/shared/{Cloneable.sol => ACloneable.sol} (90%) diff --git a/packages/evm/contracts/BoostCore.sol b/packages/evm/contracts/BoostCore.sol index a05a9713..d2509fce 100644 --- a/packages/evm/contracts/BoostCore.sol +++ b/packages/evm/contracts/BoostCore.sol @@ -10,12 +10,12 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {BoostLib} from "contracts/shared/BoostLib.sol"; import {BoostRegistry} from "contracts/BoostRegistry.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {Action} from "contracts/actions/Action.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AAction} from "contracts/actions/AAction.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {IAuth} from "contracts/auth/IAuth.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; @@ -28,7 +28,7 @@ contract BoostCore is Ownable, ReentrancyGuard { using SafeTransferLib for address; struct InitPayload { - Budget budget; + ABudget budget; BoostLib.Target action; BoostLib.Target validator; BoostLib.Target allowList; @@ -86,11 +86,11 @@ contract BoostCore is Ownable, ReentrancyGuard { } /// @notice Create a new Boost - /// @param data_ The compressed data for the Boost `(Budget, Target, Target, Target, Target[], protocolFee, referralFee, maxParticipants, owner)` + /// @param data_ The compressed data for the Boost `(ABudget, Target, Target, Target, Target[], protocolFee, referralFee, maxParticipants, owner)` /// @dev The data is expected to: /// - be packed using `abi.encode()` and compressed using [Solady's LibZip calldata compression](https://github.com/Vectorized/solady/blob/main/src/utils/LibZip.sol) /// - properly decode to the following types (in order): - /// - `Budget` to be used for the Boost + /// - `ABudget` to be used for the Boost /// - `Target` for the action /// - `Target` for the validator which is expected to be one of the following: /// - The address of a base implementation to be cloned (e.g. the result of `BoostRegistry.getBaseImplementation("SignerValidator")`), along with the parameters for its initializer; @@ -122,8 +122,8 @@ contract BoostCore is Ownable, ReentrancyGuard { boost.maxParticipants = payload_.maxParticipants; // Setup the Boost components - boost.action = Action(_makeTarget(type(Action).interfaceId, payload_.action, true)); - boost.allowList = AllowList(_makeTarget(type(AllowList).interfaceId, payload_.allowList, true)); + boost.action = AAction(_makeTarget(type(AAction).interfaceId, payload_.action, true)); + boost.allowList = AAllowList(_makeTarget(type(AAllowList).interfaceId, payload_.allowList, true)); boost.incentives = _makeIncentives(payload_.incentives, payload_.budget); boost.validator = AValidator( payload_.validator.instance == address(0) @@ -143,7 +143,7 @@ contract BoostCore is Ownable, ReentrancyGuard { /// @notice Claim an incentive for a Boost /// @param boostId_ The ID of the Boost - /// @param incentiveId_ The ID of the Incentive + /// @param incentiveId_ The ID of the AIncentive /// @param referrer_ The address of the referrer (if any) /// @param data_ The data for the claim function claimIncentive(uint256 boostId_, uint256 incentiveId_, address referrer_, bytes calldata data_) @@ -155,7 +155,7 @@ contract BoostCore is Ownable, ReentrancyGuard { /// @notice Claim an incentive for a Boost on behalf of another user /// @param boostId_ The ID of the Boost - /// @param incentiveId_ The ID of the Incentive + /// @param incentiveId_ The ID of the AIncentive /// @param referrer_ The address of the referrer (if any) /// @param data_ The data for the claim /// @param claimant the address of the user eligible for the incentive payout @@ -210,11 +210,11 @@ contract BoostCore is Ownable, ReentrancyGuard { claimFee = claimFee_; } - /// @notice Check that the provided Budget is valid and that the caller is authorized to use it - /// @param budget_ The Budget to check - /// @dev This function will revert if the Budget is invalid or the caller is unauthorized - function _checkBudget(Budget budget_) internal view { - _checkTarget(type(Budget).interfaceId, address(budget_)); + /// @notice Check that the provided ABudget is valid and that the caller is authorized to use it + /// @param budget_ The ABudget to check + /// @dev This function will revert if the ABudget is invalid or the caller is unauthorized + function _checkBudget(ABudget budget_) internal view { + _checkTarget(type(ABudget).interfaceId, address(budget_)); if (!budget_.isAuthorized(msg.sender)) revert BoostError.Unauthorized(); } @@ -224,7 +224,7 @@ contract BoostCore is Ownable, ReentrancyGuard { /// @dev This function will revert if the Target does not implement the expected interface /// @dev This check costs ~376 gas, which is worth it to validate the target function _checkTarget(bytes4 interfaceId, address instance) internal view { - if (instance == address(0) || !Cloneable(instance).supportsInterface(interfaceId)) { + if (instance == address(0) || !ACloneable(instance).supportsInterface(interfaceId)) { revert BoostError.InvalidInstance(interfaceId, instance); } } @@ -243,25 +243,25 @@ contract BoostCore is Ownable, ReentrancyGuard { instance = _maybeClone(target, shouldInitialize); } - /// @notice Configure a set of incentives for a Boost using the given Budget - /// @param targets_ The set of incentives {Target[]} - /// @param budget_ The Budget from which to allocate the incentives - /// @return incentives The set of initialized incentives {Incentive[]} - function _makeIncentives(BoostLib.Target[] memory targets_, Budget budget_) + /// @notice Configure a set of incentives for a Boost using the given ABudget + /// @param targets_ The set of incentives {Target[]} + /// @param budget_ The ABudget from which to allocate the incentives + /// @return incentives The set of initialized incentives {AIncentive[]} + function _makeIncentives(BoostLib.Target[] memory targets_, ABudget budget_) internal - returns (Incentive[] memory incentives) + returns (AIncentive[] memory incentives) { - incentives = new Incentive[](targets_.length); + incentives = new AIncentive[](targets_.length); for (uint256 i = 0; i < targets_.length; i++) { // Deploy the clone, but don't initialize until it we've preflighted - _checkTarget(type(Incentive).interfaceId, targets_[i].instance); + _checkTarget(type(AIncentive).interfaceId, targets_[i].instance); // Ensure the target is a base implementation (incentive clones are not reusable) if (!targets_[i].isBase) { - revert BoostError.InvalidInstance(type(Incentive).interfaceId, targets_[i].instance); + revert BoostError.InvalidInstance(type(AIncentive).interfaceId, targets_[i].instance); } - incentives[i] = Incentive(_makeTarget(type(Incentive).interfaceId, targets_[i], false)); + incentives[i] = AIncentive(_makeTarget(type(AIncentive).interfaceId, targets_[i], false)); bytes memory preflight = incentives[i].preflight(targets_[i].parameters); if (preflight.length != 0) { @@ -279,7 +279,7 @@ contract BoostCore is Ownable, ReentrancyGuard { instance = target_.isBase ? target_.instance.clone() : target_.instance; if (target_.isBase && shouldInitialize_) { // wake-disable-next-line reentrancy (false positive, entrypoint is nonReentrant) - Cloneable(instance).initialize(target_.parameters); + ACloneable(instance).initialize(target_.parameters); } } diff --git a/packages/evm/contracts/BoostRegistry.sol b/packages/evm/contracts/BoostRegistry.sol index 5400c0be..cdef1adb 100644 --- a/packages/evm/contracts/BoostRegistry.sol +++ b/packages/evm/contracts/BoostRegistry.sol @@ -6,8 +6,8 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {ReentrancyGuard} from "@solady/utils/ReentrancyGuard.sol"; import {BoostLib} from "contracts/shared/BoostLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; /// @title Boost Registry /// @notice A registry for base implementations and cloned instances @@ -31,7 +31,7 @@ contract BoostRegistry is ERC165, ReentrancyGuard { /// @param deployer The address of the deployer struct Clone { RegistryType baseType; - Cloneable instance; + ACloneable instance; address deployer; string name; } @@ -44,7 +44,7 @@ contract BoostRegistry is ERC165, ReentrancyGuard { RegistryType indexed registryType, bytes32 indexed identifier, address baseImplementation, - Cloneable deployedInstance + ACloneable deployedInstance ); /// @notice Thrown when a base implementation is already registered @@ -53,11 +53,11 @@ contract BoostRegistry is ERC165, ReentrancyGuard { /// @notice Thrown when no match is found for the given identifier error NotRegistered(bytes32 identifier); - /// @notice Thrown when the implementation is not a valid {Cloneable} base - error NotCloneable(address implementation); + /// @notice Thrown when the implementation is not a valid {ACloneable} base + error NotACloneable(address implementation); /// @notice The registry of base implementations - mapping(bytes32 => Cloneable) private _bases; + mapping(bytes32 => ACloneable) private _bases; /// @notice The registry of deployed clones mapping(bytes32 => Clone) private _clones; @@ -65,11 +65,11 @@ contract BoostRegistry is ERC165, ReentrancyGuard { /// @notice The registry of clones created by a given deployer mapping(address => bytes32[]) private _deployedClones; - /// @notice A modifier to ensure the given address holds a valid {Cloneable} base + /// @notice A modifier to ensure the given address holds a valid {ACloneable} base /// @param implementation_ The address of the implementation to check - modifier onlyCloneables(address implementation_) { - if (!Cloneable(implementation_).supportsInterface(type(Cloneable).interfaceId)) { - revert NotCloneable(implementation_); + modifier onlyACloneables(address implementation_) { + if (!ACloneable(implementation_).supportsInterface(type(ACloneable).interfaceId)) { + revert NotACloneable(implementation_); } _; } @@ -82,12 +82,12 @@ contract BoostRegistry is ERC165, ReentrancyGuard { /// @dev The given address must implement the given type interface (See {ERC165-supportsInterface}) function register(RegistryType type_, string calldata name_, address implementation_) external - onlyCloneables(implementation_) + onlyACloneables(implementation_) { bytes32 identifier = getIdentifier(type_, name_); if (address(_bases[identifier]) != address(0)) revert AlreadyRegistered(type_, identifier); - _bases[identifier] = Cloneable(implementation_); + _bases[identifier] = ACloneable(implementation_); emit Registered(type_, identifier, implementation_); } @@ -102,11 +102,11 @@ contract BoostRegistry is ERC165, ReentrancyGuard { function deployClone(RegistryType type_, address base_, string calldata name_, bytes calldata data_) external nonReentrant - returns (Cloneable instance) + returns (ACloneable instance) { // Deploy and initialize the clone instance = - Cloneable(base_.cloneAndInitialize(keccak256(abi.encodePacked(type_, base_, name_, msg.sender)), data_)); + ACloneable(base_.cloneAndInitialize(keccak256(abi.encodePacked(type_, base_, name_, msg.sender)), data_)); // Ensure the clone's identifier is unique bytes32 identifier = getCloneIdentifier(type_, base_, msg.sender, name_); @@ -123,7 +123,7 @@ contract BoostRegistry is ERC165, ReentrancyGuard { /// @param identifier_ The unique identifier for the implementation (see {getIdentifier}) /// @return implementation The address of the implementation /// @dev This function will revert if the implementation is not registered - function getBaseImplementation(bytes32 identifier_) public view returns (Cloneable implementation) { + function getBaseImplementation(bytes32 identifier_) public view returns (ACloneable implementation) { implementation = _bases[identifier_]; if (address(implementation) == address(0)) revert NotRegistered(identifier_); } diff --git a/packages/evm/contracts/actions/Action.sol b/packages/evm/contracts/actions/AAction.sol similarity index 71% rename from packages/evm/contracts/actions/Action.sol rename to packages/evm/contracts/actions/AAction.sol index bcaccd59..d398b069 100644 --- a/packages/evm/contracts/actions/Action.sol +++ b/packages/evm/contracts/actions/AAction.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.24; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; -/// @title Boost Action -/// @notice Abstract contract for a generic Action within the Boost protocol -/// @dev Action classes are expected to decode the calldata for implementation-specific handling. If no data is required, calldata should be empty. -abstract contract Action is Cloneable { +/// @title Boost AAction +/// @notice Abstract contract for a generic AAction within the Boost protocol +/// @dev AAction classes are expected to decode the calldata for implementation-specific handling. If no data is required, calldata should be empty. +abstract contract AAction is ACloneable { /// @notice Emitted when the action is executed by a proxy. /// @dev The `data` field should contain the return data from the action, if any. event ActionExecuted(address indexed executor, address caller, bool success, bytes data); @@ -29,8 +29,8 @@ abstract contract Action is Cloneable { /// @return The prepared payload function prepare(bytes calldata data_) external virtual returns (bytes memory); - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Cloneable) returns (bool) { - return interfaceId == type(Action).interfaceId || super.supportsInterface(interfaceId); + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ACloneable) returns (bool) { + return interfaceId == type(AAction).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/actions/AContractAction.sol b/packages/evm/contracts/actions/AContractAction.sol index 09a0555d..0e0cee22 100644 --- a/packages/evm/contracts/actions/AContractAction.sol +++ b/packages/evm/contracts/actions/AContractAction.sol @@ -3,11 +3,11 @@ pragma solidity ^0.8.24; import {ERC721} from "@solady/tokens/ERC721.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; -abstract contract AContractAction is Action { +abstract contract AContractAction is AAction { /// @notice Thrown when execution on a given chain is not supported error TargetChainUnsupported(uint256 targetChainId); @@ -47,13 +47,13 @@ abstract contract AContractAction is Action { } } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(AContractAction).interfaceId; } - /// @inheritdoc Action - function supportsInterface(bytes4 interfaceId) public view virtual override(Action) returns (bool) { + /// @inheritdoc AAction + function supportsInterface(bytes4 interfaceId) public view virtual override(AAction) returns (bool) { return interfaceId == type(AContractAction).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/actions/AERC721MintAction.sol b/packages/evm/contracts/actions/AERC721MintAction.sol index a3cd5fbb..07a3c894 100644 --- a/packages/evm/contracts/actions/AERC721MintAction.sol +++ b/packages/evm/contracts/actions/AERC721MintAction.sol @@ -5,14 +5,14 @@ import {Ownable as AOwnable} from "@solady/auth/Ownable.sol"; import {ERC721} from "@solady/tokens/ERC721.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; import {ContractAction} from "contracts/actions/ContractAction.sol"; import {AContractAction} from "contracts/actions/AContractAction.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; -/// @title ERC721 Mint Action +/// @title ERC721 Mint AAction /// @notice A primitive action to mint and/or validate that an ERC721 token has been minted /// @dev The action is expected to be prepared with the data payload for the minting of the token /// @dev This a minimal generic implementation that should be extended if additional functionality or customizations are required @@ -24,7 +24,7 @@ abstract contract AERC721MintAction is ContractAction, AValidator, AOwnable { /// @inheritdoc ContractAction /// @notice Initialize the contract with the owner and the required data - function initialize(bytes calldata data_) public virtual override(ContractAction, Cloneable) initializer { + function initialize(bytes calldata data_) public virtual override(ContractAction, ACloneable) initializer { ContractAction.initialize(data_); } diff --git a/packages/evm/contracts/actions/AEventAction.sol b/packages/evm/contracts/actions/AEventAction.sol index 701e1caf..77914237 100644 --- a/packages/evm/contracts/actions/AEventAction.sol +++ b/packages/evm/contracts/actions/AEventAction.sol @@ -4,16 +4,16 @@ pragma solidity ^0.8.24; import {ERC721} from "@solady/tokens/ERC721.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; -/// @title Event Action +/// @title Event AAction /// @notice A primitive action to mint and/or validate that an ERC721 token has been minted /// @dev The action is expected to be prepared with the data payload for the minting of the token /// @dev This a minimal generic implementation that should be extended if additional functionality or customizations are required /// @dev It is expected that the target contract has an externally accessible mint function whose selector -abstract contract AEventAction is Action { +abstract contract AEventAction is AAction { ActionEvent[] internal actionEvents; // Define Enums @@ -63,7 +63,7 @@ abstract contract AEventAction is Action { //return (true, data_); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(AEventAction).interfaceId; } @@ -80,8 +80,8 @@ abstract contract AEventAction is Action { return actionEvents; } - /// @inheritdoc Action - function supportsInterface(bytes4 interfaceId) public view virtual override(Action) returns (bool) { + /// @inheritdoc AAction + function supportsInterface(bytes4 interfaceId) public view virtual override(AAction) returns (bool) { return interfaceId == type(AEventAction).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/actions/ContractAction.sol b/packages/evm/contracts/actions/ContractAction.sol index 2530acf7..688fc442 100644 --- a/packages/evm/contracts/actions/ContractAction.sol +++ b/packages/evm/contracts/actions/ContractAction.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.24; import {ERC721} from "@solady/tokens/ERC721.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {AContractAction} from "contracts/actions/AContractAction.sol"; @@ -23,7 +23,7 @@ contract ContractAction is AContractAction { _disableInitializers(); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable /// @notice Initialize the contract with the owner and the required data function initialize(bytes calldata data_) public virtual override initializer { _initialize(abi.decode(data_, (InitPayload))); diff --git a/packages/evm/contracts/actions/ERC721MintAction.sol b/packages/evm/contracts/actions/ERC721MintAction.sol index 186a4a15..4d98bb18 100644 --- a/packages/evm/contracts/actions/ERC721MintAction.sol +++ b/packages/evm/contracts/actions/ERC721MintAction.sol @@ -3,23 +3,23 @@ pragma solidity ^0.8.24; import {ERC721} from "@solady/tokens/ERC721.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {AERC721MintAction} from "contracts/actions/AERC721MintAction.sol"; import {ContractAction} from "contracts/actions/ContractAction.sol"; -/// @title ERC721 Mint Action +/// @title ERC721 Mint AAction /// @notice A primitive action to mint and/or validate that an ERC721 token has been minted /// @dev The action is expected to be prepared with the data payload for the minting of the token /// @dev This a minimal generic implementation that should be extended if additional functionality or customizations are required /// @dev It is expected that the target contract has an externally accessible mint function whose selector contract ERC721MintAction is AERC721MintAction { - /// @notice Construct the ERC721 Mint Action + /// @notice Construct the ERC721 Mint AAction /// @dev Because this contract is a base implementation, it should not be initialized through the constructor. Instead, it should be cloned and initialized using the {initialize} function. constructor() { _disableInitializers(); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable /// @notice Initialize the contract with the owner and the required mint data /// @param data_ The data payload for the mint action `(address target, bytes4 selector, uint256 value)` diff --git a/packages/evm/contracts/actions/EventAction.sol b/packages/evm/contracts/actions/EventAction.sol index 1085bfef..735ed713 100644 --- a/packages/evm/contracts/actions/EventAction.sol +++ b/packages/evm/contracts/actions/EventAction.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.24; import {ERC721} from "@solady/tokens/ERC721.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {AEventAction} from "contracts/actions/AEventAction.sol"; @@ -23,7 +23,7 @@ contract EventAction is AEventAction { _disableInitializers(); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable /// @notice Initialize the contract with the owner and the required data function initialize(bytes calldata data_) public virtual override initializer { _initialize(abi.decode(data_, (InitPayload))); diff --git a/packages/evm/contracts/allowlists/AllowList.sol b/packages/evm/contracts/allowlists/AAllowList.sol similarity index 76% rename from packages/evm/contracts/allowlists/AllowList.sol rename to packages/evm/contracts/allowlists/AAllowList.sol index 2e0aed5d..365e627e 100644 --- a/packages/evm/contracts/allowlists/AllowList.sol +++ b/packages/evm/contracts/allowlists/AAllowList.sol @@ -3,12 +3,12 @@ pragma solidity ^0.8.24; import {Ownable} from "@solady/auth/Ownable.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; /// @title Boost AllowList /// @notice Abstract contract for a generic Allow List within the Boost protocol /// @dev Allow List classes are expected to implement the authorization of users based on implementation-specific criteria, which may involve validation of a data payload. If no data is required, calldata should be empty. -abstract contract AllowList is Ownable, Cloneable { +abstract contract AAllowList is Ownable, ACloneable { /// @notice Constructor to initialize the owner constructor() { _initializeOwner(msg.sender); @@ -20,8 +20,8 @@ abstract contract AllowList is Ownable, Cloneable { /// @return True if the user is authorized function isAllowed(address user_, bytes calldata data_) external view virtual returns (bool); - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Cloneable) returns (bool) { - return interfaceId == type(AllowList).interfaceId || super.supportsInterface(interfaceId); + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ACloneable) returns (bool) { + return interfaceId == type(AAllowList).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/allowlists/ASimpleAllowList.sol b/packages/evm/contracts/allowlists/ASimpleAllowList.sol index e76ab3aa..1bfffc6a 100644 --- a/packages/evm/contracts/allowlists/ASimpleAllowList.sol +++ b/packages/evm/contracts/allowlists/ASimpleAllowList.sol @@ -3,14 +3,14 @@ pragma solidity ^0.8.24; import {OwnableRoles} from "@solady/auth/OwnableRoles.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; /// @title Simple AllowList /// @notice A simple implementation of an AllowList that checks if a user is authorized based on a list of allowed addresses -abstract contract ASimpleAllowList is AllowList, OwnableRoles { +abstract contract ASimpleAllowList is AAllowList, OwnableRoles { /// @notice The role for managing the allow list uint256 public constant LIST_MANAGER_ROLE = 1 << 1; @@ -38,13 +38,13 @@ abstract contract ASimpleAllowList is AllowList, OwnableRoles { } } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(ASimpleAllowList).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(AllowList) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AAllowList) returns (bool) { return interfaceId == type(ASimpleAllowList).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/allowlists/ASimpleDenyList.sol b/packages/evm/contracts/allowlists/ASimpleDenyList.sol index c012685b..6fa89bb5 100644 --- a/packages/evm/contracts/allowlists/ASimpleDenyList.sol +++ b/packages/evm/contracts/allowlists/ASimpleDenyList.sol @@ -2,13 +2,13 @@ pragma solidity ^0.8.24; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; /// @title SimpleDenyList /// @notice A simple implementation of an AllowList that implicitly allows all addresses except those explicitly added to the deny list -abstract contract ASimpleDenyList is AllowList { +abstract contract ASimpleDenyList is AAllowList { /// @dev An internal mapping of denied statuses mapping(address => bool) internal _denied; @@ -33,13 +33,13 @@ abstract contract ASimpleDenyList is AllowList { } } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(ASimpleDenyList).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(AllowList) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AAllowList) returns (bool) { return interfaceId == type(ASimpleDenyList).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/allowlists/SimpleAllowList.sol b/packages/evm/contracts/allowlists/SimpleAllowList.sol index 70255c3b..22b1b0dd 100644 --- a/packages/evm/contracts/allowlists/SimpleAllowList.sol +++ b/packages/evm/contracts/allowlists/SimpleAllowList.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.24; import {OwnableRoles} from "@solady/auth/OwnableRoles.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {ASimpleAllowList} from "contracts/allowlists/ASimpleAllowList.sol"; diff --git a/packages/evm/contracts/budgets/Budget.sol b/packages/evm/contracts/budgets/ABudget.sol similarity index 91% rename from packages/evm/contracts/budgets/Budget.sol rename to packages/evm/contracts/budgets/ABudget.sol index 5368fdbb..fa5027d7 100644 --- a/packages/evm/contracts/budgets/Budget.sol +++ b/packages/evm/contracts/budgets/ABudget.sol @@ -6,13 +6,13 @@ import {Receiver} from "@solady/accounts/Receiver.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -/// @title Boost Budget -/// @notice Abstract contract for a generic Budget within the Boost protocol -/// @dev Budget classes are expected to implement the allocation, reclamation, and disbursement of assets. +/// @title Boost ABudget +/// @notice Abstract contract for a generic ABudget within the Boost protocol +/// @dev ABudget classes are expected to implement the allocation, reclamation, and disbursement of assets. /// @dev WARNING: Budgets currently support only ETH, ERC20, and ERC1155 assets. Other asset types may be added in the future. -abstract contract Budget is Ownable, Cloneable, Receiver { +abstract contract ABudget is Ownable, ACloneable, Receiver { using SafeTransferLib for address; enum AssetType { @@ -122,9 +122,9 @@ abstract contract Budget is Ownable, Cloneable, Receiver { /// @dev The mechanism for checking authorization is left to the implementing contract function isAuthorized(address account_) external view virtual returns (bool); - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Cloneable) returns (bool) { - return interfaceId == type(Budget).interfaceId || super.supportsInterface(interfaceId); + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ACloneable) returns (bool) { + return interfaceId == type(ABudget).interfaceId || super.supportsInterface(interfaceId); } /// @inheritdoc Receiver diff --git a/packages/evm/contracts/budgets/AManagedBudget.sol b/packages/evm/contracts/budgets/AManagedBudget.sol index 4ce4efe9..d425de7f 100644 --- a/packages/evm/contracts/budgets/AManagedBudget.sol +++ b/packages/evm/contracts/budgets/AManagedBudget.sol @@ -10,13 +10,13 @@ import {ReentrancyGuard} from "@solady/utils/ReentrancyGuard.sol"; import {OwnableRoles} from "@solady/auth/OwnableRoles.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -/// @title Abstract Managed Budget +/// @title Abstract Managed ABudget /// @notice A minimal budget implementation that simply holds and distributes tokens (ERC20-like and native) /// @dev This type of budget supports ETH, ERC20, and ERC1155 assets only -abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, ReentrancyGuard { +abstract contract AManagedBudget is ABudget, OwnableRoles, IERC1155Receiver, ReentrancyGuard { using SafeTransferLib for address; /// @notice The role for depositing funds. @@ -30,7 +30,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen /// @dev The total amount of each ERC1155 asset and token ID distributed from the budget mapping(address => mapping(uint256 => uint256)) private _distributedERC1155; - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Allocates assets to the budget /// @param data_ The packed data for the {Transfer} request /// @return True if the allocation was successful @@ -71,7 +71,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Reclaims assets from the budget if sender is owner or admin /// @param data_ The packed {Transfer} request /// @return True if the request was successful @@ -101,7 +101,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Disburses assets from the budget to a single recipient if sender is owner, admin, or manager /// @param data_ The packed {Transfer} request /// @return True if the disbursement was successful @@ -139,7 +139,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Disburses assets from the budget to multiple recipients /// @param data_ The packed array of {Transfer} requests /// @return True if all disbursements were successful @@ -151,13 +151,13 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @dev Checks if account has any level of authorization function isAuthorized(address account_) public view virtual override returns (bool) { return owner() == account_ || hasAnyRole(account_, MANAGER_ROLE | ADMIN_ROLE); } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @dev If authorization is true, grant manager role, otherwise revoke manager role. function setAuthorized(address[] calldata accounts_, bool[] calldata authorized_) external @@ -210,7 +210,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen } } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the total amount of assets allocated to the budget, including any that have been distributed /// @param asset_ The address of the asset /// @return The total amount of assets @@ -227,7 +227,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return IERC1155(asset_).balanceOf(address(this), tokenId_) + _distributedERC1155[asset_][tokenId_]; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the amount of assets available for distribution from the budget /// @param asset_ The address of the asset (or the zero address for native assets) /// @return The amount of assets available @@ -245,7 +245,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return IERC1155(asset_).balanceOf(address(this), tokenId_); } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the amount of assets that have been distributed from the budget /// @param asset_ The address of the asset /// @return The amount of assets distributed @@ -261,7 +261,7 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return _distributedERC1155[asset_][tokenId_]; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @dev This is a no-op as there is no local balance to reconcile function reconcile(bytes calldata) external virtual override returns (uint256) { return 0; @@ -336,13 +336,13 @@ abstract contract AManagedBudget is Budget, OwnableRoles, IERC1155Receiver, Reen return IERC1155Receiver.onERC1155BatchReceived.selector; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Budget, IERC165) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ABudget, IERC165) returns (bool) { return interfaceId == type(AManagedBudget).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId - || interfaceId == type(IERC165).interfaceId || Budget.supportsInterface(interfaceId); + || interfaceId == type(IERC165).interfaceId || ABudget.supportsInterface(interfaceId); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(AManagedBudget).interfaceId; } diff --git a/packages/evm/contracts/budgets/ASimpleBudget.sol b/packages/evm/contracts/budgets/ASimpleBudget.sol index 04b07a62..45c870cb 100644 --- a/packages/evm/contracts/budgets/ASimpleBudget.sol +++ b/packages/evm/contracts/budgets/ASimpleBudget.sol @@ -9,13 +9,13 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {ReentrancyGuard} from "@solady/utils/ReentrancyGuard.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -/// @title Abstract Simple Budget +/// @title Abstract Simple ABudget /// @notice A minimal budget implementation that simply holds and distributes tokens (ERC20-like and native) /// @dev This type of budget supports ETH, ERC20, and ERC1155 assets only -abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { +abstract contract ASimpleBudget is ABudget, IERC1155Receiver, ReentrancyGuard { using SafeTransferLib for address; /// @dev The total amount of each fungible asset distributed from the budget @@ -33,7 +33,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { _; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Allocates assets to the budget /// @param data_ The packed data for the {Transfer} request /// @return True if the allocation was successful @@ -74,7 +74,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Reclaims assets from the budget /// @param data_ The packed {Transfer} request /// @return True if the request was successful @@ -104,7 +104,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Disburses assets from the budget to a single recipient /// @param data_ The packed {Transfer} request /// @return True if the disbursement was successful @@ -136,7 +136,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Disburses assets from the budget to multiple recipients /// @param data_ The packed array of {Transfer} requests /// @return True if all disbursements were successful @@ -148,7 +148,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget function setAuthorized(address[] calldata account_, bool[] calldata authorized_) external virtual @@ -161,12 +161,12 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { } } - /// @inheritdoc Budget + /// @inheritdoc ABudget function isAuthorized(address account_) public view virtual override returns (bool) { return _isAuthorized[account_] || account_ == owner(); } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the total amount of assets allocated to the budget, including any that have been distributed /// @param asset_ The address of the asset /// @return The total amount of assets @@ -183,7 +183,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return IERC1155(asset_).balanceOf(address(this), tokenId_) + _distributedERC1155[asset_][tokenId_]; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the amount of assets available for distribution from the budget /// @param asset_ The address of the asset (or the zero address for native assets) /// @return The amount of assets available @@ -201,7 +201,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return IERC1155(asset_).balanceOf(address(this), tokenId_); } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the amount of assets that have been distributed from the budget /// @param asset_ The address of the asset /// @return The amount of assets distributed @@ -217,7 +217,7 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return _distributedERC1155[asset_][tokenId_]; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @dev This is a no-op as there is no local balance to reconcile function reconcile(bytes calldata) external virtual override returns (uint256) { return 0; @@ -292,13 +292,13 @@ abstract contract ASimpleBudget is Budget, IERC1155Receiver, ReentrancyGuard { return IERC1155Receiver.onERC1155BatchReceived.selector; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Budget, IERC165) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ABudget, IERC165) returns (bool) { return interfaceId == type(ASimpleBudget).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId - || interfaceId == type(IERC165).interfaceId || Budget.supportsInterface(interfaceId); + || interfaceId == type(IERC165).interfaceId || ABudget.supportsInterface(interfaceId); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(ASimpleBudget).interfaceId; } diff --git a/packages/evm/contracts/budgets/AVestingBudget.sol b/packages/evm/contracts/budgets/AVestingBudget.sol index 83b2e7d8..77ea0fa5 100644 --- a/packages/evm/contracts/budgets/AVestingBudget.sol +++ b/packages/evm/contracts/budgets/AVestingBudget.sol @@ -9,17 +9,17 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {ReentrancyGuard} from "@solady/utils/ReentrancyGuard.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -/// @title Vesting Budget +/// @title Vesting ABudget /// @notice A vesting-based budget implementation that allows for the distribution of assets over time /// @dev Take note of the following when making use of this budget type: /// - The budget is designed to manage native and ERC20 token balances only. Using rebasing tokens or other non-standard token types may result in unexpected behavior. /// - Any assets allocated to this type of budget will follow the vesting schedule as if they were locked from the beginning, which is to say that, if the vesting has already started, some portion of the assets will be immediately available for distribution. /// - A vesting budget can also act as a time-lock, unlocking all assets at a specified point in time. To release assets at a specific time rather than vesting them over time, set the `start` to the desired time and the `duration` to zero. /// - This contract is {Ownable} to enable the owner to allocate to the budget, reclaim and disburse assets from the budget, and to set authorized addresses. Additionally, the owner can transfer ownership of the budget to another address. Doing so has no effect on the vesting schedule. -abstract contract AVestingBudget is Budget, ReentrancyGuard { +abstract contract AVestingBudget is ABudget, ReentrancyGuard { using SafeTransferLib for address; /// @dev The total amount of each fungible asset distributed from the budget @@ -43,7 +43,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { _; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Allocates assets to the budget /// @param data_ The packed data for the {Transfer} request /// @return True if the allocation was successful @@ -74,7 +74,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Reclaims assets from the budget /// @param data_ The packed {Transfer} request /// @return True if the request was successful @@ -95,7 +95,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Disburses assets from the budget to a single recipient /// @param data_ The packed {Transfer} request /// @return True if the disbursement was successful @@ -112,7 +112,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Disburses assets from the budget to multiple recipients /// @param data_ The packed array of {Transfer} requests /// @return True if all disbursements were successful @@ -124,7 +124,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return true; } - /// @inheritdoc Budget + /// @inheritdoc ABudget function setAuthorized(address[] calldata account_, bool[] calldata authorized_) external virtual @@ -137,7 +137,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { } } - /// @inheritdoc Budget + /// @inheritdoc ABudget function isAuthorized(address account_) public view virtual override returns (bool) { return _isAuthorized[account_] || account_ == owner(); } @@ -148,7 +148,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return start + duration; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the total amount of assets allocated to the budget, including any that have been distributed /// @param asset_ The address of the asset /// @return The total amount of assets @@ -158,7 +158,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return _distributedFungible[asset_] + balance; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the amount of assets available for distribution from the budget as of the current block timestamp /// @param asset_ The address of the asset (or the zero address for native assets) /// @return The amount of assets currently available for distribution @@ -167,7 +167,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return _vestedAllocation(asset_, uint64(block.timestamp)) - _distributedFungible[asset_]; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @notice Get the amount of assets that have been distributed from the budget /// @param asset_ The address of the asset /// @return The amount of assets distributed @@ -175,7 +175,7 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { return _distributedFungible[asset_]; } - /// @inheritdoc Budget + /// @inheritdoc ABudget /// @dev This is a no-op as there is no local balance to reconcile function reconcile(bytes calldata) external virtual override returns (uint256) { return 0; @@ -229,12 +229,12 @@ abstract contract AVestingBudget is Budget, ReentrancyGuard { } } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { - return interfaceId == type(AVestingBudget).interfaceId || Budget.supportsInterface(interfaceId); + return interfaceId == type(AVestingBudget).interfaceId || ABudget.supportsInterface(interfaceId); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(AVestingBudget).interfaceId; } diff --git a/packages/evm/contracts/budgets/ManagedBudget.sol b/packages/evm/contracts/budgets/ManagedBudget.sol index 1f3a4db4..92178559 100644 --- a/packages/evm/contracts/budgets/ManagedBudget.sol +++ b/packages/evm/contracts/budgets/ManagedBudget.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.24; import {AManagedBudget} from "contracts/budgets/AManagedBudget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -/// @title Managed Budget +/// @title Managed ABudget /// @notice A minimal budget implementation with RBAC that simply holds and distributes tokens (ERC20-like and native) /// @dev This type of budget supports ETH, ERC20, and ERC1155 assets only contract ManagedBudget is AManagedBudget { @@ -21,7 +21,7 @@ contract ManagedBudget is AManagedBudget { _disableInitializers(); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable /// @param data_ The packed init data for the budget `(address owner, address[] authorized, uint256[] roles)` function initialize(bytes calldata data_) public virtual override initializer { InitPayload memory init_ = abi.decode(data_, (InitPayload)); diff --git a/packages/evm/contracts/budgets/SimpleBudget.sol b/packages/evm/contracts/budgets/SimpleBudget.sol index 3a1e4c26..371eb968 100644 --- a/packages/evm/contracts/budgets/SimpleBudget.sol +++ b/packages/evm/contracts/budgets/SimpleBudget.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.24; import {ASimpleBudget} from "contracts/budgets/ASimpleBudget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -/// @title Simple Budget +/// @title Simple ABudget /// @notice A minimal budget implementation that simply holds and distributes tokens (ERC20-like and native) /// @dev This type of budget supports ETH, ERC20, and ERC1155 assets only contract SimpleBudget is ASimpleBudget { @@ -20,7 +20,7 @@ contract SimpleBudget is ASimpleBudget { _disableInitializers(); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable /// @param data_ The packed init data for the budget `(address owner, address[] authorized)` function initialize(bytes calldata data_) public virtual override initializer { InitPayload memory init_ = abi.decode(data_, (InitPayload)); diff --git a/packages/evm/contracts/budgets/VestingBudget.sol b/packages/evm/contracts/budgets/VestingBudget.sol index f0eef323..86d3d25b 100644 --- a/packages/evm/contracts/budgets/VestingBudget.sol +++ b/packages/evm/contracts/budgets/VestingBudget.sol @@ -9,8 +9,8 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {ReentrancyGuard} from "@solady/utils/ReentrancyGuard.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {AVestingBudget} from "contracts/budgets/AVestingBudget.sol"; /// @title Vesting Budget @@ -36,7 +36,7 @@ contract VestingBudget is AVestingBudget { _disableInitializers(); } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable /// @param data_ The packed init data for the budget (see {InitPayload}) function initialize(bytes calldata data_) public virtual override initializer { InitPayload memory init_ = abi.decode(data_, (InitPayload)); @@ -50,4 +50,5 @@ contract VestingBudget is AVestingBudget { _isAuthorized[init_.authorized[i]] = true; } } + } diff --git a/packages/evm/contracts/incentives/AAllowListIncentive.sol b/packages/evm/contracts/incentives/AAllowListIncentive.sol index 6288a596..50a2bc5d 100644 --- a/packages/evm/contracts/incentives/AAllowListIncentive.sol +++ b/packages/evm/contracts/incentives/AAllowListIncentive.sol @@ -2,25 +2,25 @@ pragma solidity ^0.8.24; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; -/// @title SimpleAllowList Incentive +/// @title SimpleAllowList AIncentive /// @notice An incentive implementation that grants the claimer a slot on an {SimpleAllowList} /// @dev In order for any claim to be successful: /// - The claimer must not already be on the allow list; and /// - The maximum number of claims must not have been reached; and /// - This contract must be authorized to modify the allow list -abstract contract AAllowListIncentive is Incentive { +abstract contract AAllowListIncentive is AIncentive { /// @notice The SimpleAllowList contract SimpleAllowList public allowList; /// @notice The maximum number of claims that can be made (one per address) uint256 public limit; - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice Claim a slot on the {SimpleAllowList} /// @param claimTarget the entity receiving the payout function claim(address claimTarget, bytes calldata) external virtual override onlyOwner returns (bool) { @@ -33,18 +33,18 @@ abstract contract AAllowListIncentive is Incentive { return true; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @dev Not a valid operation for this type of incentive function clawback(bytes calldata) external pure override returns (bool) { revert BoostError.NotImplemented(); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function isClaimable(address claimTarget, bytes calldata) external view virtual override returns (bool) { return claims < limit && !claimed[claimTarget] && !allowList.isAllowed(claimTarget, ""); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @dev No preflight approval is required for this incentive (no tokens are handled) function preflight(bytes calldata) external pure override returns (bytes memory) { return new bytes(0); @@ -61,13 +61,13 @@ abstract contract AAllowListIncentive is Incentive { return (users, allowed); } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(AAllowListIncentive).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Incentive) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AIncentive) returns (bool) { return interfaceId == type(AAllowListIncentive).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/incentives/ACGDAIncentive.sol b/packages/evm/contracts/incentives/ACGDAIncentive.sol index 9922d6c1..e73b62d4 100644 --- a/packages/evm/contracts/incentives/ACGDAIncentive.sol +++ b/packages/evm/contracts/incentives/ACGDAIncentive.sol @@ -3,16 +3,16 @@ pragma solidity ^0.8.24; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; -import {Incentive} from "./Incentive.sol"; +import {AIncentive} from "./AIncentive.sol"; -/// @title Continuous Gradual Dutch Auction Incentive +/// @title Continuous Gradual Dutch Auction AIncentive /// @notice An ERC20 incentive implementation with reward amounts adjusting dynamically based on claim volume. -abstract contract ACGDAIncentive is Incentive { +abstract contract ACGDAIncentive is AIncentive { using SafeTransferLib for address; /// @notice The ERC20-like token used for the incentive @@ -33,7 +33,7 @@ abstract contract ACGDAIncentive is Incentive { CGDAParameters public cgdaParams; uint256 public totalBudget; - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice Claim the incentive function claim(address claimTarget, bytes calldata) external virtual override onlyOwner returns (bool) { if (!_isClaimable(claimTarget)) revert NotClaimable(); @@ -52,7 +52,7 @@ abstract contract ACGDAIncentive is Incentive { return true; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function clawback(bytes calldata data_) external virtual override onlyOwner returns (bool) { ClawbackPayload memory claim_ = abi.decode(data_, (ClawbackPayload)); (uint256 amount) = abi.decode(claim_.data, (uint256)); @@ -64,7 +64,7 @@ abstract contract ACGDAIncentive is Incentive { return true; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function isClaimable(address claimTarget, bytes calldata) external view virtual override returns (bool) { return _isClaimable(claimTarget); } @@ -88,13 +88,13 @@ abstract contract ACGDAIncentive is Incentive { return reward > 0 && asset.balanceOf(address(this)) >= reward && !claimed[recipient_]; } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(ACGDAIncentive).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Incentive) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AIncentive) returns (bool) { return interfaceId == type(ACGDAIncentive).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/incentives/AERC1155Incentive.sol b/packages/evm/contracts/incentives/AERC1155Incentive.sol index f20de70c..3f43a2a2 100644 --- a/packages/evm/contracts/incentives/AERC1155Incentive.sol +++ b/packages/evm/contracts/incentives/AERC1155Incentive.sol @@ -5,15 +5,15 @@ import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Re import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; /// @title ERC1155Incentive /// @notice A simple ERC1155 incentive implementation that allows claiming of tokens -abstract contract AERC1155Incentive is Incentive, IERC1155Receiver { +abstract contract AERC1155Incentive is AIncentive, IERC1155Receiver { /// @notice The strategy for the incentive /// @dev The strategy determines how the incentive is disbursed: /// - POOL: Transfer tokens from the pool to the recipient @@ -60,7 +60,7 @@ abstract contract AERC1155Incentive is Incentive, IERC1155Receiver { return false; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function clawback(bytes calldata data_) external override onlyOwner returns (bool) { ClawbackPayload memory claim_ = abi.decode(data_, (ClawbackPayload)); (uint256 amount) = abi.decode(claim_.data, (uint256)); @@ -115,13 +115,13 @@ abstract contract AERC1155Incentive is Incentive, IERC1155Receiver { return this.onERC1155BatchReceived.selector; } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(AERC1155Incentive).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Incentive, IERC165) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AIncentive, IERC165) returns (bool) { return interfaceId == type(AERC1155Incentive).interfaceId || interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId); } diff --git a/packages/evm/contracts/incentives/AERC20Incentive.sol b/packages/evm/contracts/incentives/AERC20Incentive.sol index f739307a..ff12a382 100644 --- a/packages/evm/contracts/incentives/AERC20Incentive.sol +++ b/packages/evm/contracts/incentives/AERC20Incentive.sol @@ -4,15 +4,15 @@ pragma solidity ^0.8.24; import {LibPRNG} from "@solady/utils/LibPRNG.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Incentive} from "./Incentive.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {AIncentive} from "./AIncentive.sol"; -/// @title ERC20 Incentive +/// @title ERC20 AIncentive /// @notice A simple ERC20 incentive implementation that allows claiming of tokens -abstract contract AERC20Incentive is Incentive { +abstract contract AERC20Incentive is AIncentive { using LibPRNG for LibPRNG.PRNG; using SafeTransferLib for address; @@ -64,7 +64,7 @@ abstract contract AERC20Incentive is Incentive { } } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function clawback(bytes calldata data_) external override onlyOwner returns (bool) { ClawbackPayload memory claim_ = abi.decode(data_, (ClawbackPayload)); (uint256 amount) = abi.decode(claim_.data, (uint256)); @@ -115,13 +115,13 @@ abstract contract AERC20Incentive is Incentive { emit Claimed(winnerAddress, abi.encodePacked(asset, winnerAddress, reward)); } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(AERC20Incentive).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Incentive) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AIncentive) returns (bool) { return interfaceId == type(AERC20Incentive).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/incentives/AERC20VariableIncentive.sol b/packages/evm/contracts/incentives/AERC20VariableIncentive.sol index 843d0547..204b6f95 100644 --- a/packages/evm/contracts/incentives/AERC20VariableIncentive.sol +++ b/packages/evm/contracts/incentives/AERC20VariableIncentive.sol @@ -4,15 +4,15 @@ pragma solidity ^0.8.24; import {LibPRNG} from "@solady/utils/LibPRNG.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title ERC20 Incentive with Variable Rewards /// @notice A modified ERC20 incentive implementation that allows claiming of variable token amounts with a spending limit -abstract contract AERC20VariableIncentive is Incentive { +abstract contract AERC20VariableIncentive is AIncentive { using SafeTransferLib for address; /// @notice The address of the ERC20-like token @@ -62,7 +62,7 @@ abstract contract AERC20VariableIncentive is Incentive { return totalClaimed < limit; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function clawback(bytes calldata data_) external override onlyOwner returns (bool) { ClawbackPayload memory claim_ = abi.decode(data_, (ClawbackPayload)); (uint256 amount) = abi.decode(claim_.data, (uint256)); @@ -76,12 +76,12 @@ abstract contract AERC20VariableIncentive is Incentive { return true; } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(AERC20VariableIncentive).interfaceId; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(AERC20VariableIncentive).interfaceId || super.supportsInterface(interfaceId); } diff --git a/packages/evm/contracts/incentives/Incentive.sol b/packages/evm/contracts/incentives/AIncentive.sol similarity index 79% rename from packages/evm/contracts/incentives/Incentive.sol rename to packages/evm/contracts/incentives/AIncentive.sol index 0148f5c9..19fc1ed4 100644 --- a/packages/evm/contracts/incentives/Incentive.sol +++ b/packages/evm/contracts/incentives/AIncentive.sol @@ -4,13 +4,13 @@ pragma solidity ^0.8.24; import {Ownable} from "@solady/auth/Ownable.sol"; import {ReentrancyGuard} from "@solady/utils/ReentrancyGuard.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {IBoostClaim} from "contracts/shared/IBoostClaim.sol"; -/// @title Boost Incentive -/// @notice Abstract contract for a generic Incentive within the Boost protocol -/// @dev Incentive classes are expected to decode the calldata for implementation-specific handling. If no data is required, calldata should be empty. -abstract contract Incentive is IBoostClaim, Ownable, Cloneable, ReentrancyGuard { +/// @title Boost AIncentive +/// @notice Abstract contract for a generic AIncentive within the Boost protocol +/// @dev AIncentive classes are expected to decode the calldata for implementation-specific handling. If no data is required, calldata should be empty. +abstract contract AIncentive is IBoostClaim, Ownable, ACloneable, ReentrancyGuard { /// @notice Emitted when an incentive is claimed /// @dev The `data` field contains implementation-specific context. See the implementation's `claim` function for details. event Claimed(address indexed recipient, bytes data); @@ -61,8 +61,8 @@ abstract contract Incentive is IBoostClaim, Ownable, Cloneable, ReentrancyGuard /// @notice Get the required allowance for the incentive /// @param data_ The initialization payload for the incentive - /// @return The data payload to be passed to the {Budget} for interpretation - /// @dev This function is to be called by {BoostCore} before the incentive is initialized to determine the required budget allowance. It returns an ABI-encoded payload that can be passed directly to the {Budget} contract for interpretation. + /// @return The data payload to be passed to the {ABudget} for interpretation + /// @dev This function is to be called by {BoostCore} before the incentive is initialized to determine the required budget allowance. It returns an ABI-encoded payload that can be passed directly to the {ABudget} contract for interpretation. function preflight(bytes calldata data_) external view virtual returns (bytes memory); /// @return The current reward @@ -70,8 +70,8 @@ abstract contract Incentive is IBoostClaim, Ownable, Cloneable, ReentrancyGuard return reward; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Cloneable) returns (bool) { - return interfaceId == type(Incentive).interfaceId || super.supportsInterface(interfaceId); + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ACloneable) returns (bool) { + return interfaceId == type(AIncentive).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/incentives/APointsIncentive.sol b/packages/evm/contracts/incentives/APointsIncentive.sol index f32205c4..38071f28 100644 --- a/packages/evm/contracts/incentives/APointsIncentive.sol +++ b/packages/evm/contracts/incentives/APointsIncentive.sol @@ -2,19 +2,19 @@ pragma solidity ^0.8.24; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Incentive} from "./Incentive.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {AIncentive} from "./AIncentive.sol"; import {OwnableRoles} from "@solady/auth/OwnableRoles.sol"; -/// @title Points Incentive +/// @title Points AIncentive /// @notice A simple on-chain points incentive implementation that allows claiming of soulbound tokens /// @dev In order for any claim to be successful: /// - The claimer must not have already claimed the incentive; and /// - The maximum number of claims must not have been reached; and /// - This contract must be authorized to operate the points contract's issuance function -abstract contract APointsIncentive is Incentive { +abstract contract APointsIncentive is AIncentive { /// @notice The address of the points contract address public venue; @@ -46,13 +46,13 @@ abstract contract APointsIncentive is Incentive { return true; } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @dev Not a valid operation for this type of incentive function clawback(bytes calldata) external pure override returns (bool) { revert BoostError.NotImplemented(); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice No token approvals are required for this incentive function preflight(bytes calldata) external pure override returns (bytes memory budgetData) { return new bytes(0); @@ -74,13 +74,13 @@ abstract contract APointsIncentive is Incentive { return !claimed[recipient_] && claims < limit; } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(APointsIncentive).interfaceId; } - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Incentive) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(AIncentive) returns (bool) { return interfaceId == type(APointsIncentive).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/incentives/AllowListIncentive.sol b/packages/evm/contracts/incentives/AllowListIncentive.sol index d2af8613..8b3a751b 100644 --- a/packages/evm/contracts/incentives/AllowListIncentive.sol +++ b/packages/evm/contracts/incentives/AllowListIncentive.sol @@ -2,13 +2,13 @@ pragma solidity ^0.8.24; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; import {AAllowListIncentive} from "contracts/incentives/AAllowListIncentive.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; -/// @title SimpleAllowList Incentive +/// @title SimpleAllowList AIncentive /// @notice An incentive implementation that grants the claimer a slot on an {SimpleAllowList} /// @dev In order for any claim to be successful: /// - The claimer must not already be on the allow list; and diff --git a/packages/evm/contracts/incentives/CGDAIncentive.sol b/packages/evm/contracts/incentives/CGDAIncentive.sol index 99b53ae8..6eb2a432 100644 --- a/packages/evm/contracts/incentives/CGDAIncentive.sol +++ b/packages/evm/contracts/incentives/CGDAIncentive.sol @@ -3,14 +3,14 @@ pragma solidity ^0.8.24; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {ACGDAIncentive} from "contracts/incentives/ACGDAIncentive.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; -/// @title Continuous Gradual Dutch Auction Incentive +/// @title Continuous Gradual Dutch Auction AIncentive /// @notice An ERC20 incentive implementation with reward amounts adjusting dynamically based on claim volume. contract CGDAIncentive is ACGDAIncentive { using SafeTransferLib for address; @@ -35,7 +35,7 @@ contract CGDAIncentive is ACGDAIncentive { _disableInitializers(); } - /// @notice Initialize the CGDA Incentive + /// @notice Initialize the CGDA AIncentive /// @param data_ Initialization parameters. function initialize(bytes calldata data_) public override initializer { InitPayload memory init_ = abi.decode(data_, (InitPayload)); @@ -62,7 +62,7 @@ contract CGDAIncentive is ACGDAIncentive { _initializeOwner(msg.sender); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice Preflight the incentive to determine the budget required for all potential claims, which in this case is the `totalBudget` /// @param data_ The compressed incentive parameters `(address asset, uint256 initialReward, uint256 rewardDecay, uint256 rewardBoost, uint256 totalBudget)` /// @return The amount of tokens required @@ -70,11 +70,11 @@ contract CGDAIncentive is ACGDAIncentive { InitPayload memory init_ = abi.decode(data_, (InitPayload)); return abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC20, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC20, asset: init_.asset, target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: init_.totalBudget})) + data: abi.encode(ABudget.FungiblePayload({amount: init_.totalBudget})) }) ); } diff --git a/packages/evm/contracts/incentives/ERC1155Incentive.sol b/packages/evm/contracts/incentives/ERC1155Incentive.sol index 25e6a31c..00091a0e 100644 --- a/packages/evm/contracts/incentives/ERC1155Incentive.sol +++ b/packages/evm/contracts/incentives/ERC1155Incentive.sol @@ -5,9 +5,9 @@ import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {AERC1155Incentive} from "contracts/incentives/AERC1155Incentive.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; /// @title ERC1155Incentive /// @notice A simple ERC1155 incentive implementation that allows claiming of tokens @@ -52,19 +52,19 @@ contract ERC1155Incentive is AERC1155Incentive { _initializeOwner(msg.sender); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice Get the required allowance for the incentive /// @param data_ The initialization payload for the incentive - /// @return budgetData The data payload to be passed to the Budget for interpretation + /// @return budgetData The data payload to be passed to the ABudget for interpretation function preflight(bytes calldata data_) external view override returns (bytes memory budgetData) { InitPayload memory init_ = abi.decode(data_, (InitPayload)); return abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(init_.asset), target: address(this), data: abi.encode( - Budget.ERC1155Payload({tokenId: init_.tokenId, amount: init_.limit, data: init_.extraData}) + ABudget.ERC1155Payload({tokenId: init_.tokenId, amount: init_.limit, data: init_.extraData}) ) }) ); diff --git a/packages/evm/contracts/incentives/ERC20Incentive.sol b/packages/evm/contracts/incentives/ERC20Incentive.sol index 157a7881..a4fb3d77 100644 --- a/packages/evm/contracts/incentives/ERC20Incentive.sol +++ b/packages/evm/contracts/incentives/ERC20Incentive.sol @@ -7,10 +7,10 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {AERC20Incentive} from "contracts/incentives/AERC20Incentive.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; -/// @title ERC20 Incentive +/// @title ERC20 AIncentive /// @notice A simple ERC20 incentive implementation that allows claiming of tokens contract ERC20Incentive is AERC20Incentive { using LibPRNG for LibPRNG.PRNG; @@ -51,20 +51,20 @@ contract ERC20Incentive is AERC20Incentive { _initializeOwner(msg.sender); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice Preflight the incentive to determine the required budget action /// @param data_ The {InitPayload} for the incentive - /// @return budgetData The {Transfer} payload to be passed to the {Budget} for interpretation + /// @return budgetData The {Transfer} payload to be passed to the {ABudget} for interpretation function preflight(bytes calldata data_) external view override returns (bytes memory budgetData) { InitPayload memory init_ = abi.decode(data_, (InitPayload)); uint256 amount = init_.strategy != Strategy.RAFFLE ? init_.reward * init_.limit : init_.reward; return abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC20, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC20, asset: init_.asset, target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: amount})) + data: abi.encode(ABudget.FungiblePayload({amount: amount})) }) ); } diff --git a/packages/evm/contracts/incentives/ERC20VariableIncentive.sol b/packages/evm/contracts/incentives/ERC20VariableIncentive.sol index 041b6570..4317b13f 100644 --- a/packages/evm/contracts/incentives/ERC20VariableIncentive.sol +++ b/packages/evm/contracts/incentives/ERC20VariableIncentive.sol @@ -3,13 +3,13 @@ pragma solidity ^0.8.24; import {LibPRNG} from "@solady/utils/LibPRNG.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {AERC20VariableIncentive} from "contracts/incentives/AERC20VariableIncentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; /// @title ERC20 Incentive with Variable Rewards /// @notice A modified ERC20 incentive implementation that allows claiming of variable token amounts with a spending limit @@ -54,20 +54,20 @@ contract ERC20VariableIncentive is AERC20VariableIncentive { _initializeOwner(msg.sender); } - /// @inheritdoc Incentive + /// @inheritdoc AIncentive /// @notice Preflight the incentive to determine the required budget action /// @param data_ The data payload for the incentive `(address asset, uint256 reward, uint256 limit)` - /// @return budgetData The {Transfer} payload to be passed to the {Budget} for interpretation + /// @return budgetData The {Transfer} payload to be passed to the {ABudget} for interpretation function preflight(bytes calldata data_) external view override returns (bytes memory budgetData) { // TODO: remove unused reward param (address asset_, uint256 reward_, uint256 limit_) = abi.decode(data_, (address, uint256, uint256)); return abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC20, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC20, asset: asset_, target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: limit_})) + data: abi.encode(ABudget.FungiblePayload({amount: limit_})) }) ); } diff --git a/packages/evm/contracts/incentives/PointsIncentive.sol b/packages/evm/contracts/incentives/PointsIncentive.sol index 6f6aaf2f..8ba0fcfb 100644 --- a/packages/evm/contracts/incentives/PointsIncentive.sol +++ b/packages/evm/contracts/incentives/PointsIncentive.sol @@ -2,11 +2,11 @@ pragma solidity ^0.8.24; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {APointsIncentive} from "contracts/incentives/APointsIncentive.sol"; -/// @title Points Incentive +/// @title Points AIncentive /// @notice A simple on-chain points incentive implementation that allows claiming of soulbound tokens /// @dev In order for any claim to be successful: /// - The claimer must not have already claimed the incentive; and diff --git a/packages/evm/contracts/shared/Cloneable.sol b/packages/evm/contracts/shared/ACloneable.sol similarity index 90% rename from packages/evm/contracts/shared/Cloneable.sol rename to packages/evm/contracts/shared/ACloneable.sol index d8faffb4..56b39cc9 100644 --- a/packages/evm/contracts/shared/Cloneable.sol +++ b/packages/evm/contracts/shared/ACloneable.sol @@ -4,9 +4,9 @@ pragma solidity ^0.8.24; import {Initializable} from "@solady/utils/Initializable.sol"; import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; -/// @title Cloneable +/// @title ACloneable /// @notice A contract that can be cloned and initialized only once -abstract contract Cloneable is Initializable, ERC165 { +abstract contract ACloneable is Initializable, ERC165 { /// @notice Thrown when an inheriting contract does not implement the initializer function error InitializerNotImplemented(); @@ -35,6 +35,6 @@ abstract contract Cloneable is Initializable, ERC165 { /// @param interfaceId The interface identifier /// @return True if the contract supports the interface function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { - return interfaceId == type(Cloneable).interfaceId || super.supportsInterface(interfaceId); + return interfaceId == type(ACloneable).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/packages/evm/contracts/shared/BoostLib.sol b/packages/evm/contracts/shared/BoostLib.sol index 3d790bf5..95cc3038 100644 --- a/packages/evm/contracts/shared/BoostLib.sol +++ b/packages/evm/contracts/shared/BoostLib.sol @@ -4,11 +4,11 @@ pragma solidity ^0.8.24; import {LibClone} from "@solady/utils/LibClone.sol"; import {LibZip} from "@solady/utils/LibZip.sol"; -import {Action} from "contracts/actions/Action.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AAction} from "contracts/actions/AAction.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; library BoostLib { @@ -17,11 +17,11 @@ library BoostLib { /// @notice A struct representing a single Boost struct Boost { - Action action; + AAction action; AValidator validator; - AllowList allowList; - Budget budget; - Incentive[] incentives; + AAllowList allowList; + ABudget budget; + AIncentive[] incentives; uint64 protocolFee; uint64 referralFee; uint256 maxParticipants; @@ -44,6 +44,6 @@ library BoostLib { function cloneAndInitialize(address $, bytes32 salt_, bytes memory initData_) internal returns (address _clone) { _clone = $.cloneDeterministic(salt_); // wake-disable-next-line reentrancy (false positive) - Cloneable(_clone).initialize(initData_); + ACloneable(_clone).initialize(initData_); } } diff --git a/packages/evm/contracts/validators/ASignerValidator.sol b/packages/evm/contracts/validators/ASignerValidator.sol index 29d7bcf8..342ff6c5 100644 --- a/packages/evm/contracts/validators/ASignerValidator.sol +++ b/packages/evm/contracts/validators/ASignerValidator.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.24; import {SignatureCheckerLib} from "@solady/utils/SignatureCheckerLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {IBoostClaim} from "contracts/shared/IBoostClaim.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; @@ -39,12 +39,12 @@ abstract contract ASignerValidator is IBoostClaim, AValidator { /// @param newCaller the new authorized caller of the validator function function setValidatorCaller(address newCaller) external virtual; - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function getComponentInterface() public pure virtual override returns (bytes4) { return type(ASignerValidator).interfaceId; } - /// @inheritdoc Cloneable + /// @inheritdoc ACloneable function supportsInterface(bytes4 interfaceId) public view virtual override(AValidator) returns (bool) { return interfaceId == type(ASignerValidator).interfaceId || super.supportsInterface(interfaceId); } diff --git a/packages/evm/contracts/validators/AValidator.sol b/packages/evm/contracts/validators/AValidator.sol index 64b47d1c..c006429c 100644 --- a/packages/evm/contracts/validators/AValidator.sol +++ b/packages/evm/contracts/validators/AValidator.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.24; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; /// @title Boost Validator /// @notice Abstract contract for a generic Validator within the Boost protocol /// @dev Validator classes are expected to decode the calldata for implementation-specific handling. If no data is required, calldata should be empty. -abstract contract AValidator is Cloneable { +abstract contract AValidator is ACloneable { /// @notice Validate that a given user has completed an acction successfully /// @param boostId The Id from the available boosts /// @param incentiveId The Id from the available boost incentives to be claimed @@ -19,13 +19,13 @@ abstract contract AValidator is Cloneable { virtual returns (bool); - /// @inheritdoc Cloneable - function supportsInterface(bytes4 interfaceId) public view virtual override(Cloneable) returns (bool) { + /// @inheritdoc ACloneable + function supportsInterface(bytes4 interfaceId) public view virtual override(ACloneable) returns (bool) { return interfaceId == type(AValidator).interfaceId || super.supportsInterface(interfaceId); } - /// @inheritdoc Cloneable - function getComponentInterface() public pure virtual override(Cloneable) returns (bytes4) { + /// @inheritdoc ACloneable + function getComponentInterface() public pure virtual override(ACloneable) returns (bytes4) { return type(AValidator).interfaceId; } } diff --git a/packages/evm/contracts/validators/SignerValidator.sol b/packages/evm/contracts/validators/SignerValidator.sol index 5c0bc353..ae0b8784 100644 --- a/packages/evm/contracts/validators/SignerValidator.sol +++ b/packages/evm/contracts/validators/SignerValidator.sol @@ -6,7 +6,7 @@ import {Ownable} from "@solady/auth/Ownable.sol"; import {SignatureCheckerLib} from "@solady/utils/SignatureCheckerLib.sol"; import {EIP712} from "@solady/utils/EIP712.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; diff --git a/packages/evm/test/BoostCore.t.sol b/packages/evm/test/BoostCore.t.sol index 6b36e1a5..7d170094 100644 --- a/packages/evm/test/BoostCore.t.sol +++ b/packages/evm/test/BoostCore.t.sol @@ -8,20 +8,20 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {LibZip} from "@solady/utils/LibZip.sol"; // Actions -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; import {ContractAction} from "contracts/actions/ContractAction.sol"; import {ERC721MintAction} from "contracts/actions/ERC721MintAction.sol"; // Allowlists -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; // Budgets -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; // Incentives -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {ERC20Incentive} from "contracts/incentives/ERC20Incentive.sol"; import {AERC20Incentive} from "contracts/incentives/AERC20Incentive.sol"; @@ -34,7 +34,7 @@ import {BoostCore} from "contracts/BoostCore.sol"; import {BoostRegistry} from "contracts/BoostRegistry.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {BoostLib} from "contracts/shared/BoostLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; contract BoostCoreTest is Test { using LibClone for address; @@ -49,7 +49,7 @@ contract BoostCoreTest is Test { BoostLib.Target allowList = _makeAllowList(address(this)); address[] authorized = [address(boostCore)]; - Budget budget = _makeBudget(address(this), authorized); + ABudget budget = _makeBudget(address(this), authorized); bytes validCreateCalldata = LibZip.cdCompress( abi.encode( @@ -72,11 +72,11 @@ contract BoostCoreTest is Test { mockERC20.approve(address(budget), 100 ether); budget.allocate( abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC20, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC20, asset: address(mockERC20), target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: 100 ether})) + data: abi.encode(ABudget.FungiblePayload({amount: 100 ether})) }) ) ); @@ -115,20 +115,20 @@ contract BoostCoreTest is Test { assertEq(boost.referralFee, boostCore.referralFee() + 1000); assertEq(boost.maxParticipants, 10_000); - // Check the Budget + // Check the ABudget assertEq(address(boost.budget), address(budget)); assertTrue(boost.budget.isAuthorized(address(this))); - // Check the Action + // Check the AAction ERC721MintAction _action = ERC721MintAction(address(boost.action)); - assertTrue(_action.supportsInterface(type(Action).interfaceId)); + assertTrue(_action.supportsInterface(type(AAction).interfaceId)); assertEq(_action.target(), address(mockERC721)); assertEq(_action.selector(), MockERC721.mint.selector); assertEq(_action.value(), mockERC721.mintPrice()); // Check the AllowList SimpleAllowList _allowList = SimpleAllowList(address(boost.allowList)); - assertTrue(_allowList.supportsInterface(type(AllowList).interfaceId)); + assertTrue(_allowList.supportsInterface(type(AAllowList).interfaceId)); assertEq(_allowList.owner(), address(this)); assertTrue(_allowList.isAllowed(address(this), bytes(""))); assertFalse(_allowList.isAllowed(address(1), bytes(""))); @@ -136,20 +136,20 @@ contract BoostCoreTest is Test { // Check the Incentives assertEq(1, boost.incentives.length); ERC20Incentive _incentive = ERC20Incentive(address(boost.incentives[0])); - assertTrue(_incentive.supportsInterface(type(Incentive).interfaceId)); + assertTrue(_incentive.supportsInterface(type(AIncentive).interfaceId)); assertTrue(_incentive.strategy() == AERC20Incentive.Strategy.POOL); assertEq(_incentive.asset(), address(mockERC20)); assertEq(_incentive.currentReward(), 1 ether); assertEq(_incentive.limit(), 100); assertEq(_incentive.claims(), 0); - // Check the Validator (which should be the Action) + // Check the Validator (which should be the AAction) assertTrue(boost.validator.supportsInterface(type(AValidator).interfaceId)); assertEq(address(boost.validator), address(boost.action)); } function testCreateBoost_NoBudget() public { - // Try to create a Boost without a Budget (should fail) + // Try to create a Boost without a ABudget (should fail) bytes memory invalidBudgetCalldata = LibZip.cdCompress( abi.encode( address(0), @@ -165,7 +165,7 @@ contract BoostCoreTest is Test { ); vm.expectRevert( - abi.encodeWithSelector(BoostError.InvalidInstance.selector, type(Budget).interfaceId, address(0)) + abi.encodeWithSelector(BoostError.InvalidInstance.selector, type(ABudget).interfaceId, address(0)) ); boostCore.createBoost(invalidBudgetCalldata); } @@ -195,11 +195,11 @@ contract BoostCoreTest is Test { } function testCreateBoost_InvalidBudgetNoSupport() public { - // Try to create a Boost with an address that doesn't support the Budget interface (should fail) + // Try to create a Boost with an address that doesn't support the ABudget interface (should fail) bytes memory calldata_ = LibZip.cdCompress( abi.encode( BoostCore.InitPayload( - Budget(payable(action.instance)), + ABudget(payable(action.instance)), action, BoostLib.Target({isBase: true, instance: address(0), parameters: ""}), allowList, @@ -212,9 +212,9 @@ contract BoostCoreTest is Test { ) ); - // Supports ERC165, but is not a Budget => InvalidBudget + // Supports ERC165, but is not a ABudget => InvalidBudget vm.expectRevert( - abi.encodeWithSelector(BoostError.InvalidInstance.selector, type(Budget).interfaceId, action.instance) + abi.encodeWithSelector(BoostError.InvalidInstance.selector, type(ABudget).interfaceId, action.instance) ); boostCore.createBoost(calldata_); @@ -223,7 +223,7 @@ contract BoostCoreTest is Test { } function testCreateBoost_InvalidAction() public { - // Try to create a Boost with an invalid Action (should fail) + // Try to create a Boost with an invalid AAction (should fail) bytes memory invalidActionCalldata = LibZip.cdCompress( abi.encode( BoostCore.InitPayload( @@ -241,7 +241,7 @@ contract BoostCoreTest is Test { ); vm.expectRevert( - abi.encodeWithSelector(BoostError.InvalidInstance.selector, type(Action).interfaceId, address(0)) + abi.encodeWithSelector(BoostError.InvalidInstance.selector, type(AAction).interfaceId, address(0)) ); boostCore.createBoost(invalidActionCalldata); } @@ -306,8 +306,8 @@ contract BoostCoreTest is Test { }); } - function _makeBudget(address owner_, address[] memory authorized_) internal returns (Budget _budget) { - _budget = Budget(payable(address(new SimpleBudget()).clone())); + function _makeBudget(address owner_, address[] memory authorized_) internal returns (ABudget _budget) { + _budget = ABudget(payable(address(new SimpleBudget()).clone())); _budget.initialize(abi.encode(SimpleBudget.InitPayload({owner: owner_, authorized: authorized_}))); } diff --git a/packages/evm/test/BoostRegistry.t.sol b/packages/evm/test/BoostRegistry.t.sol index a162bf35..d4041748 100644 --- a/packages/evm/test/BoostRegistry.t.sol +++ b/packages/evm/test/BoostRegistry.t.sol @@ -6,19 +6,19 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {BoostRegistry} from "contracts/BoostRegistry.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -contract NotCloneable is ERC165 { +contract NotACloneable is ERC165 { function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return super.supportsInterface(interfaceId); } @@ -73,13 +73,13 @@ contract BoostRegistryTest is Test { registry.register(BoostRegistry.RegistryType.ALLOW_LIST, "SimpleAllowList", address(baseAllowListImpl)); } - function testRegister_NotCloneable() public { - NotCloneable notCloneable = new NotCloneable(); + function testRegister_NotACloneable() public { + NotACloneable notACloneable = new NotACloneable(); - // Attempting to register a non-Cloneable implementation should revert - vm.expectRevert(abi.encodeWithSelector(BoostRegistry.NotCloneable.selector, address(notCloneable))); + // Attempting to register a non-ACloneable implementation should revert + vm.expectRevert(abi.encodeWithSelector(BoostRegistry.NotACloneable.selector, address(notACloneable))); - registry.register(BoostRegistry.RegistryType.ACTION, "NotClonable", address(notCloneable)); + registry.register(BoostRegistry.RegistryType.ACTION, "NotClonable", address(notACloneable)); } ///////////////////////////////////////// @@ -153,7 +153,7 @@ contract BoostRegistryTest is Test { BoostRegistry.RegistryType.ALLOW_LIST, address(baseAllowListImpl), address(this), "Test AllowList" ), address(baseAllowListImpl), - Cloneable(predictedAddress) + ACloneable(predictedAddress) ); registry.deployClone( @@ -171,7 +171,7 @@ contract BoostRegistryTest is Test { authorized[0] = address(this); bytes32 salt = keccak256( - abi.encodePacked(BoostRegistry.RegistryType.BUDGET, baseBudgetImpl, "Testing Budget", address(this)) + abi.encodePacked(BoostRegistry.RegistryType.BUDGET, baseBudgetImpl, "Testing ABudget", address(this)) ); address predictedAddress = LibClone.predictDeterministicAddress(address(baseBudgetImpl), salt, address(registry)); @@ -180,20 +180,20 @@ contract BoostRegistryTest is Test { emit BoostRegistry.Deployed( BoostRegistry.RegistryType.BUDGET, registry.getCloneIdentifier( - BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), address(this), "Testing Budget" + BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), address(this), "Testing ABudget" ), address(baseBudgetImpl), - Cloneable(predictedAddress) + ACloneable(predictedAddress) ); - Cloneable instance = registry.deployClone( + ACloneable instance = registry.deployClone( BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), - "Testing Budget", + "Testing ABudget", abi.encode(SimpleBudget.InitPayload({owner: address(this), authorized: authorized})) ); - assertTrue(instance.supportsInterface(type(Budget).interfaceId)); + assertTrue(instance.supportsInterface(type(ABudget).interfaceId)); assertEq(SimpleBudget(payable(address(instance))).owner(), address(this)); } @@ -204,7 +204,7 @@ contract BoostRegistryTest is Test { registry.deployClone( BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), - "Testing Budget", + "Testing ABudget", abi.encode( unicode"🦄 unicorns (and 🌈 rainbows!) are *so cool* but not valid here... panic at the EVM disco!" ) @@ -219,12 +219,12 @@ contract BoostRegistryTest is Test { registry.register(BoostRegistry.RegistryType.BUDGET, "SimpleBudget", address(baseBudgetImpl)); bytes32 cloneId = registry.getCloneIdentifier( - BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), address(this), "Testing Budget" + BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), address(this), "Testing ABudget" ); registry.deployClone( BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), - "Testing Budget", + "Testing ABudget", abi.encode(SimpleBudget.InitPayload({owner: address(this), authorized: new address[](0)})) ); @@ -232,12 +232,12 @@ contract BoostRegistryTest is Test { assertTrue(clone.baseType == BoostRegistry.RegistryType.BUDGET); assertEq(address(clone.deployer), address(this)); - assertEq(clone.name, "Testing Budget"); + assertEq(clone.name, "Testing ABudget"); } function testGetClone_NotRegistered() public { bytes32 cloneId = registry.getCloneIdentifier( - BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), address(this), "Testing Budget" + BoostRegistry.RegistryType.BUDGET, address(baseBudgetImpl), address(this), "Testing ABudget" ); vm.expectRevert(abi.encodeWithSelector(BoostRegistry.NotRegistered.selector, cloneId)); @@ -252,7 +252,7 @@ contract BoostRegistryTest is Test { _deployAllowListClone("Uno", new address[](0)); assertEq(registry.getClones(address(this)).length, 1); - (bytes32 id, Cloneable clone) = _deployAllowListClone("Dos", new address[](0)); + (bytes32 id, ACloneable clone) = _deployAllowListClone("Dos", new address[](0)); assertEq(registry.getClones(address(this)).length, 2); assertEq(registry.getClones(address(this))[1], id); @@ -266,7 +266,7 @@ contract BoostRegistryTest is Test { function _deployAllowListClone(string memory name, address[] memory signers) internal - returns (bytes32 cloneId, Cloneable clone) + returns (bytes32 cloneId, ACloneable clone) { bool[] memory authorized = new bool[](signers.length); for (uint256 i = 0; i < signers.length; i++) { diff --git a/packages/evm/test/actions/ContractAction.t.sol b/packages/evm/test/actions/ContractAction.t.sol index 95cea785..c0f197d5 100644 --- a/packages/evm/test/actions/ContractAction.t.sol +++ b/packages/evm/test/actions/ContractAction.t.sol @@ -7,7 +7,7 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {Initializable} from "@solady/utils/Initializable.sol"; import {MockERC20} from "contracts/shared/Mocks.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; import {ContractAction} from "contracts/actions/ContractAction.sol"; import {AContractAction} from "contracts/actions/AContractAction.sol"; @@ -121,7 +121,7 @@ contract ContractActionTest is Test { //////////////////////////////////// function testSupportsActionInterface() public { - // Ensure the contract supports the Budget interface - assertTrue(action.supportsInterface(type(Action).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(action.supportsInterface(type(AAction).interfaceId)); } } diff --git a/packages/evm/test/actions/ERC721MintAction.t.sol b/packages/evm/test/actions/ERC721MintAction.t.sol index fe203f99..fefca8e0 100644 --- a/packages/evm/test/actions/ERC721MintAction.t.sol +++ b/packages/evm/test/actions/ERC721MintAction.t.sol @@ -7,7 +7,7 @@ import {ERC721} from "@solady/tokens/ERC721.sol"; import {LibClone} from "@solady/utils/LibClone.sol"; import {Initializable} from "@solady/utils/Initializable.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {ERC721MintAction} from "contracts/actions/ERC721MintAction.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; @@ -179,7 +179,7 @@ contract ERC721MintActionTest is Test { _initialize(address(mockAsset), MockERC721.mint.selector, mockAsset.mintPrice()); // Check the interface support - assertTrue(action.supportsInterface(type(Action).interfaceId)); + assertTrue(action.supportsInterface(type(AAction).interfaceId)); assertTrue(action.supportsInterface(type(AValidator).interfaceId)); } diff --git a/packages/evm/test/actions/EventAction.t.sol b/packages/evm/test/actions/EventAction.t.sol index 5b7a62e1..fce9e0c6 100644 --- a/packages/evm/test/actions/EventAction.t.sol +++ b/packages/evm/test/actions/EventAction.t.sol @@ -8,7 +8,7 @@ import {Initializable} from "@solady/utils/Initializable.sol"; import {MockERC721} from "contracts/shared/Mocks.sol"; import {EventAction} from "contracts/actions/EventAction.sol"; import {AEventAction} from "contracts/actions/AEventAction.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; contract EventActionTest is Test { @@ -123,7 +123,7 @@ contract EventActionTest is Test { function testSupportsInterface() public { // Check the interface support assertTrue(action.supportsInterface(type(AEventAction).interfaceId)); - assertTrue(action.supportsInterface(type(Cloneable).interfaceId)); + assertTrue(action.supportsInterface(type(ACloneable).interfaceId)); } /////////////////////////// diff --git a/packages/evm/test/allowlists/SimpleAllowList.t.sol b/packages/evm/test/allowlists/SimpleAllowList.t.sol index 2a167f96..42bc1aee 100644 --- a/packages/evm/test/allowlists/SimpleAllowList.t.sol +++ b/packages/evm/test/allowlists/SimpleAllowList.t.sol @@ -6,8 +6,8 @@ import {Test, console} from "lib/forge-std/src/Test.sol"; import {LibClone} from "@solady/utils/LibClone.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; contract SimpleAllowListTest is Test { @@ -129,8 +129,8 @@ contract SimpleAllowListTest is Test { /////////////////////////////////////// function testSupportsInterface() public { - assertTrue(allowList.supportsInterface(type(Cloneable).interfaceId)); - assertTrue(allowList.supportsInterface(type(AllowList).interfaceId)); + assertTrue(allowList.supportsInterface(type(ACloneable).interfaceId)); + assertTrue(allowList.supportsInterface(type(AAllowList).interfaceId)); } function testSupportsInterface_Unsupported() public { diff --git a/packages/evm/test/allowlists/SimpleDenyList.t.sol b/packages/evm/test/allowlists/SimpleDenyList.t.sol index 36ac693c..27dedad0 100644 --- a/packages/evm/test/allowlists/SimpleDenyList.t.sol +++ b/packages/evm/test/allowlists/SimpleDenyList.t.sol @@ -6,8 +6,8 @@ import {Test, console} from "lib/forge-std/src/Test.sol"; import {LibClone} from "@solady/utils/LibClone.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; import {SimpleDenyList} from "contracts/allowlists/SimpleDenyList.sol"; contract SimpleDenyListTest is Test { @@ -136,8 +136,8 @@ contract SimpleDenyListTest is Test { /////////////////////////////////////// function testSupportsInterface() public { - assertTrue(denyList.supportsInterface(type(Cloneable).interfaceId)); - assertTrue(denyList.supportsInterface(type(AllowList).interfaceId)); + assertTrue(denyList.supportsInterface(type(ACloneable).interfaceId)); + assertTrue(denyList.supportsInterface(type(AAllowList).interfaceId)); } function testSupportsInterface_Unsupported() public { diff --git a/packages/evm/test/budgets/ManagedBudget.t.sol b/packages/evm/test/budgets/ManagedBudget.t.sol index 736fc825..fafbf233 100644 --- a/packages/evm/test/budgets/ManagedBudget.t.sol +++ b/packages/evm/test/budgets/ManagedBudget.t.sol @@ -11,8 +11,8 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {MockERC20, MockERC1155} from "contracts/shared/Mocks.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {ManagedBudget} from "contracts/budgets/ManagedBudget.sol"; import {AManagedBudget} from "contracts/budgets/AManagedBudget.sol"; @@ -127,7 +127,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); assertTrue(managedBudget.allocate(data)); // Ensure the budget has 100 tokens @@ -136,7 +136,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { function testAllocate_NativeBalance() public { // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); managedBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens @@ -149,11 +149,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 of token ID 42 to the budget bytes memory data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); assertTrue(managedBudget.allocate(data)); @@ -164,20 +164,20 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { function testAllocate_NativeBalanceValueMismatch() public { // Encode an allocation of 100 ETH - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); // Expect a revert due to a value mismatch (too much ETH) - vm.expectRevert(abi.encodeWithSelector(Budget.InvalidAllocation.selector, address(0), uint256(100 ether))); + vm.expectRevert(abi.encodeWithSelector(ABudget.InvalidAllocation.selector, address(0), uint256(100 ether))); managedBudget.allocate{value: 101 ether}(data); // Expect a revert due to a value mismatch (too little ETH) - vm.expectRevert(abi.encodeWithSelector(Budget.InvalidAllocation.selector, address(0), uint256(100 ether))); + vm.expectRevert(abi.encodeWithSelector(ABudget.InvalidAllocation.selector, address(0), uint256(100 ether))); managedBudget.allocate{value: 99 ether}(data); } function testAllocate_NoApproval() public { // Allocate 100 tokens to the budget without approval - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); vm.expectRevert(SafeTransferLib.TransferFromFailed.selector); managedBudget.allocate(data); } @@ -187,7 +187,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 101 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); vm.expectRevert(SafeTransferLib.TransferFromFailed.selector); managedBudget.allocate(data); } @@ -213,12 +213,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.available(address(mockERC20)), 100 ether); // Reclaim 99 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 99 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 99 ether); assertTrue(managedBudget.clawback(data)); // Ensure the budget has 1 token left @@ -227,12 +227,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { function testReclaim_NativeBalance() public { // Allocate 100 ETH to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); managedBudget.allocate{value: 100 ether}(data); assertEq(managedBudget.available(address(0)), 100 ether); // Reclaim 99 ETH from the budget - data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 99 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 99 ether); assertTrue(managedBudget.clawback(data)); // Ensure the budget has 1 ETH left @@ -245,11 +245,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 of token ID 42 to the budget bytes memory data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); managedBudget.allocate(data); @@ -257,11 +257,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Reclaim 99 of token ID 42 from the budget data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 99, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 99, data: ""})) }) ); assertTrue(managedBudget.clawback(data)); @@ -275,12 +275,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.available(address(mockERC20)), 100 ether); // Reclaim all tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 0); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 0); assertTrue(managedBudget.clawback(data)); // Ensure the budget has no tokens left @@ -292,14 +292,14 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.available(address(mockERC20)), 100 ether); // Reclaim 100 tokens from the budget to address(0) - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0), 100 ether); vm.expectRevert( - abi.encodeWithSelector(Budget.TransferFailed.selector, address(mockERC20), address(0), uint256(100 ether)) + abi.encodeWithSelector(ABudget.TransferFailed.selector, address(mockERC20), address(0), uint256(100 ether)) ); managedBudget.clawback(data); @@ -312,15 +312,15 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Reclaim 101 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) ) ); managedBudget.clawback(data); @@ -333,7 +333,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); @@ -348,7 +348,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); @@ -370,7 +370,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); @@ -392,7 +392,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); @@ -411,12 +411,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Disburse 100 tokens from the budget to the recipient - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); assertTrue(managedBudget.disburse(data)); assertEq(mockERC20.balanceOf(address(1)), 100 ether); @@ -427,11 +427,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { function testDisburse_NativeBalance() public { // Allocate 100 ETH to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); managedBudget.allocate{value: 100 ether}(data); // Disburse 100 ETH from the budget to the recipient - data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 100 ether); assertTrue(managedBudget.disburse(data)); assertEq(address(1).balance, 100 ether); @@ -446,11 +446,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 of token ID 42 to the budget bytes memory data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); managedBudget.allocate(data); @@ -458,11 +458,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Disburse 100 of token ID 42 from the budget to the recipient data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(1), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); assertTrue(managedBudget.disburse(data)); @@ -480,10 +480,10 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate the assets to the budget managedBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); managedBudget.allocate{value: 25 ether}( - _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 25 ether) ); managedBudget.allocate(_makeERC1155Transfer(address(mockERC1155), address(this), 42, 50, bytes(""))); assertEq(managedBudget.total(address(mockERC20)), 50 ether); @@ -492,8 +492,8 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Prepare the disbursement requests bytes[] memory requests = new bytes[](3); - requests[0] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); - requests[1] = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(2), 25 ether); + requests[0] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); + requests[1] = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(2), 25 ether); requests[2] = _makeERC1155Transfer(address(mockERC1155), address(3), 42, 10, bytes("")); // Disburse: @@ -520,15 +520,15 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Disburse 101 tokens from the budget to the recipient - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 101 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 101 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) ) ); managedBudget.disburse(data); @@ -541,7 +541,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); @@ -556,12 +556,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Try to disburse 100 tokens from the budget as a non-owner - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); vm.prank(address(0xc0ffee)); vm.expectRevert(); managedBudget.disburse(data); @@ -578,12 +578,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Try to disburse 100 tokens from the budget as a non-owner - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); vm.prank(address(0xdeadbeef)); managedBudget.disburse(data); } @@ -599,12 +599,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Try to disburse 100 tokens from the budget as a non-owner - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); vm.prank(address(0xdeadbeef)); managedBudget.disburse(data); } @@ -614,7 +614,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); @@ -626,7 +626,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { ); // Try to disburse 100 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); vm.expectRevert(SafeTransferLib.TransferFailed.selector); managedBudget.disburse(data); } @@ -636,15 +636,15 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(managedBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); managedBudget.allocate(data); assertEq(managedBudget.total(address(mockERC20)), 100 ether); // Prepare the disbursement data bytes[] memory requests = new bytes[](3); - requests[0] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); - requests[1] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(2), 50 ether); - requests[2] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(3), 10 ether); + requests[0] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); + requests[1] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(2), 50 ether); + requests[2] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(3), 10 ether); // Mock the second ERC20 transfer to fail in an unexpected way vm.mockCallRevert( @@ -669,7 +669,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget mockERC20.approve(address(managedBudget), 100 ether); managedBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); // Ensure the budget has 100 tokens @@ -681,7 +681,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { assertEq(managedBudget.total(address(0)), 0); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); managedBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens @@ -694,15 +694,15 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 50 tokens to the budget managedBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); // Disburse 25 tokens from the budget to the recipient - managedBudget.disburse(_makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether)); + managedBudget.disburse(_makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether)); // Allocate another 50 tokens to the budget managedBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); // Ensure the budget has 50 - 25 + 50 = 75 tokens @@ -726,7 +726,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget mockERC20.approve(address(managedBudget), 100 ether); managedBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); // Ensure the budget has 100 tokens available @@ -738,7 +738,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { assertEq(managedBudget.available(address(0)), 0); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); managedBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens available @@ -761,12 +761,12 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget mockERC20.approve(address(managedBudget), 100 ether); managedBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); // Disburse 50 tokens from the budget to the recipient managedBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); // Ensure the budget has 50 tokens distributed @@ -774,7 +774,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Disburse 25 more tokens from the budget to the recipient managedBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) ); // Ensure the budget has 75 tokens distributed @@ -1037,7 +1037,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { //////////////////////////////////// function testGetComponentInterface() public view { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface console.logBytes4(managedBudget.getComponentInterface()); } @@ -1046,17 +1046,17 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { //////////////////////////////////// function testSupportsBudgetInterface() public view { - // Ensure the contract supports the Budget interface - assertTrue(managedBudget.supportsInterface(type(Budget).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(managedBudget.supportsInterface(type(ABudget).interfaceId)); } function testSupportsERC1155Receiver() public view { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface assertTrue(managedBudget.supportsInterface(type(IERC1155Receiver).interfaceId)); } function testSupportsERC165() public view { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface assertTrue(managedBudget.supportsInterface(type(IERC165).interfaceId)); } @@ -1082,7 +1082,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget bytes memory data = abi.encodeWithSelector( AManagedBudget.allocate.selector, - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); (bool success,) = payable(managedBudget).call(data); @@ -1105,7 +1105,7 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { (bool success,) = payable(managedBudget).call{value: 1 ether}( abi.encodeWithSelector( bytes4(0xdeadbeef), - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ) ); assertFalse(success); @@ -1136,20 +1136,20 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { // Test Helper Functions // /////////////////////////// - function _makeFungibleTransfer(Budget.AssetType assetType, address asset, address target, uint256 value) + function _makeFungibleTransfer(ABudget.AssetType assetType, address asset, address target, uint256 value) internal pure returns (bytes memory) { - Budget.Transfer memory transfer; + ABudget.Transfer memory transfer; transfer.assetType = assetType; transfer.asset = asset; transfer.target = target; - if (assetType == Budget.AssetType.ETH || assetType == Budget.AssetType.ERC20) { - transfer.data = abi.encode(Budget.FungiblePayload({amount: value})); - } else if (assetType == Budget.AssetType.ERC1155) { + if (assetType == ABudget.AssetType.ETH || assetType == ABudget.AssetType.ERC20) { + transfer.data = abi.encode(ABudget.FungiblePayload({amount: value})); + } else if (assetType == ABudget.AssetType.ERC1155) { // we're not actually handling this case yet, so hardcoded token ID of 1 is fine - transfer.data = abi.encode(Budget.ERC1155Payload({tokenId: 1, amount: value, data: ""})); + transfer.data = abi.encode(ABudget.ERC1155Payload({tokenId: 1, amount: value, data: ""})); } return abi.encode(transfer); @@ -1160,11 +1160,11 @@ contract ManagedBudgetTest is Test, IERC1155Receiver { pure returns (bytes memory) { - Budget.Transfer memory transfer; - transfer.assetType = Budget.AssetType.ERC1155; + ABudget.Transfer memory transfer; + transfer.assetType = ABudget.AssetType.ERC1155; transfer.asset = asset; transfer.target = target; - transfer.data = abi.encode(Budget.ERC1155Payload({tokenId: tokenId, amount: value, data: data})); + transfer.data = abi.encode(ABudget.ERC1155Payload({tokenId: tokenId, amount: value, data: data})); return abi.encode(transfer); } diff --git a/packages/evm/test/budgets/SimpleBudget.t.sol b/packages/evm/test/budgets/SimpleBudget.t.sol index ce528424..1770652e 100644 --- a/packages/evm/test/budgets/SimpleBudget.t.sol +++ b/packages/evm/test/budgets/SimpleBudget.t.sol @@ -11,8 +11,8 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {MockERC20, MockERC1155} from "contracts/shared/Mocks.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; import {ASimpleBudget} from "contracts/budgets/ASimpleBudget.sol"; @@ -123,7 +123,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); assertTrue(simpleBudget.allocate(data)); // Ensure the budget has 100 tokens @@ -132,7 +132,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { function testAllocate_NativeBalance() public { // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); simpleBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens @@ -145,11 +145,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 of token ID 42 to the budget bytes memory data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); assertTrue(simpleBudget.allocate(data)); @@ -160,20 +160,20 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { function testAllocate_NativeBalanceValueMismatch() public { // Encode an allocation of 100 ETH - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); // Expect a revert due to a value mismatch (too much ETH) - vm.expectRevert(abi.encodeWithSelector(Budget.InvalidAllocation.selector, address(0), uint256(100 ether))); + vm.expectRevert(abi.encodeWithSelector(ABudget.InvalidAllocation.selector, address(0), uint256(100 ether))); simpleBudget.allocate{value: 101 ether}(data); // Expect a revert due to a value mismatch (too little ETH) - vm.expectRevert(abi.encodeWithSelector(Budget.InvalidAllocation.selector, address(0), uint256(100 ether))); + vm.expectRevert(abi.encodeWithSelector(ABudget.InvalidAllocation.selector, address(0), uint256(100 ether))); simpleBudget.allocate{value: 99 ether}(data); } function testAllocate_NoApproval() public { // Allocate 100 tokens to the budget without approval - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); vm.expectRevert(SafeTransferLib.TransferFromFailed.selector); simpleBudget.allocate(data); } @@ -183,7 +183,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 101 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); vm.expectRevert(SafeTransferLib.TransferFromFailed.selector); simpleBudget.allocate(data); } @@ -209,12 +209,12 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.available(address(mockERC20)), 100 ether); // Reclaim 99 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 99 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 99 ether); assertTrue(simpleBudget.clawback(data)); // Ensure the budget has 1 token left @@ -223,12 +223,12 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { function testReclaim_NativeBalance() public { // Allocate 100 ETH to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); simpleBudget.allocate{value: 100 ether}(data); assertEq(simpleBudget.available(address(0)), 100 ether); // Reclaim 99 ETH from the budget - data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 99 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 99 ether); assertTrue(simpleBudget.clawback(data)); // Ensure the budget has 1 ETH left @@ -241,11 +241,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 of token ID 42 to the budget bytes memory data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); simpleBudget.allocate(data); @@ -253,11 +253,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Reclaim 99 of token ID 42 from the budget data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 99, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 99, data: ""})) }) ); assertTrue(simpleBudget.clawback(data)); @@ -271,12 +271,12 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.available(address(mockERC20)), 100 ether); // Reclaim all tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 0); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 0); assertTrue(simpleBudget.clawback(data)); // Ensure the budget has no tokens left @@ -288,14 +288,14 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.available(address(mockERC20)), 100 ether); // Reclaim 100 tokens from the budget to address(0) - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0), 100 ether); vm.expectRevert( - abi.encodeWithSelector(Budget.TransferFailed.selector, address(mockERC20), address(0), uint256(100 ether)) + abi.encodeWithSelector(ABudget.TransferFailed.selector, address(mockERC20), address(0), uint256(100 ether)) ); simpleBudget.clawback(data); @@ -308,15 +308,15 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); // Reclaim 101 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) ) ); simpleBudget.clawback(data); @@ -329,7 +329,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); @@ -344,7 +344,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); @@ -364,12 +364,12 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); // Disburse 100 tokens from the budget to the recipient - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); assertTrue(simpleBudget.disburse(data)); assertEq(mockERC20.balanceOf(address(1)), 100 ether); @@ -380,11 +380,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { function testDisburse_NativeBalance() public { // Allocate 100 ETH to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); simpleBudget.allocate{value: 100 ether}(data); // Disburse 100 ETH from the budget to the recipient - data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 100 ether); assertTrue(simpleBudget.disburse(data)); assertEq(address(1).balance, 100 ether); @@ -399,11 +399,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 of token ID 42 to the budget bytes memory data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(this), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); simpleBudget.allocate(data); @@ -411,11 +411,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Disburse 100 of token ID 42 from the budget to the recipient data = abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC1155, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC1155, asset: address(mockERC1155), target: address(1), - data: abi.encode(Budget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) + data: abi.encode(ABudget.ERC1155Payload({tokenId: 42, amount: 100, data: ""})) }) ); assertTrue(simpleBudget.disburse(data)); @@ -433,10 +433,10 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate the assets to the budget simpleBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); simpleBudget.allocate{value: 25 ether}( - _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 25 ether) ); simpleBudget.allocate(_makeERC1155Transfer(address(mockERC1155), address(this), 42, 50, bytes(""))); assertEq(simpleBudget.total(address(mockERC20)), 50 ether); @@ -445,8 +445,8 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Prepare the disbursement requests bytes[] memory requests = new bytes[](3); - requests[0] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); - requests[1] = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(2), 25 ether); + requests[0] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); + requests[1] = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(2), 25 ether); requests[2] = _makeERC1155Transfer(address(mockERC1155), address(3), 42, 10, bytes("")); // Disburse: @@ -473,15 +473,15 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); // Disburse 101 tokens from the budget to the recipient - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 101 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 101 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) ) ); simpleBudget.disburse(data); @@ -494,7 +494,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); @@ -509,12 +509,12 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); // Try to disburse 100 tokens from the budget as a non-owner - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); vm.prank(address(0xc0ffee)); vm.expectRevert(); simpleBudget.disburse(data); @@ -525,7 +525,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); @@ -537,7 +537,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { ); // Try to disburse 100 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); vm.expectRevert(SafeTransferLib.TransferFailed.selector); simpleBudget.disburse(data); } @@ -547,15 +547,15 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { mockERC20.approve(address(simpleBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); simpleBudget.allocate(data); assertEq(simpleBudget.total(address(mockERC20)), 100 ether); // Prepare the disbursement data bytes[] memory requests = new bytes[](3); - requests[0] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); - requests[1] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(2), 50 ether); - requests[2] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(3), 10 ether); + requests[0] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); + requests[1] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(2), 50 ether); + requests[2] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(3), 10 ether); // Mock the second ERC20 transfer to fail in an unexpected way vm.mockCallRevert( @@ -580,7 +580,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget mockERC20.approve(address(simpleBudget), 100 ether); simpleBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); // Ensure the budget has 100 tokens @@ -592,7 +592,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { assertEq(simpleBudget.total(address(0)), 0); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); simpleBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens @@ -605,15 +605,15 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 50 tokens to the budget simpleBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); // Disburse 25 tokens from the budget to the recipient - simpleBudget.disburse(_makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether)); + simpleBudget.disburse(_makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether)); // Allocate another 50 tokens to the budget simpleBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); // Ensure the budget has 50 - 25 + 50 = 75 tokens @@ -637,7 +637,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget mockERC20.approve(address(simpleBudget), 100 ether); simpleBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); // Ensure the budget has 100 tokens available @@ -649,7 +649,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { assertEq(simpleBudget.available(address(0)), 0); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); simpleBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens available @@ -672,12 +672,12 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget mockERC20.approve(address(simpleBudget), 100 ether); simpleBudget.allocate( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); // Disburse 50 tokens from the budget to the recipient simpleBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 50 ether) ); // Ensure the budget has 50 tokens distributed @@ -685,7 +685,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Disburse 25 more tokens from the budget to the recipient simpleBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) ); // Ensure the budget has 75 tokens distributed @@ -761,7 +761,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { //////////////////////////////////// function testGetComponentInterface() public { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface console.logBytes4(simpleBudget.getComponentInterface()); } @@ -770,17 +770,17 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { //////////////////////////////////// function testSupportsBudgetInterface() public { - // Ensure the contract supports the Budget interface - assertTrue(simpleBudget.supportsInterface(type(Budget).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(simpleBudget.supportsInterface(type(ABudget).interfaceId)); } function testSupportsERC1155Receiver() public { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface assertTrue(simpleBudget.supportsInterface(type(IERC1155Receiver).interfaceId)); } function testSupportsERC165() public { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface assertTrue(simpleBudget.supportsInterface(type(IERC165).interfaceId)); } @@ -806,7 +806,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Allocate 100 tokens to the budget bytes memory data = abi.encodeWithSelector( ASimpleBudget.allocate.selector, - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); (bool success,) = payable(simpleBudget).call(data); @@ -829,7 +829,7 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { (bool success,) = payable(simpleBudget).call{value: 1 ether}( abi.encodeWithSelector( bytes4(0xdeadbeef), - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ) ); assertFalse(success); @@ -850,20 +850,20 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { // Test Helper Functions // /////////////////////////// - function _makeFungibleTransfer(Budget.AssetType assetType, address asset, address target, uint256 value) + function _makeFungibleTransfer(ABudget.AssetType assetType, address asset, address target, uint256 value) internal pure returns (bytes memory) { - Budget.Transfer memory transfer; + ABudget.Transfer memory transfer; transfer.assetType = assetType; transfer.asset = asset; transfer.target = target; - if (assetType == Budget.AssetType.ETH || assetType == Budget.AssetType.ERC20) { - transfer.data = abi.encode(Budget.FungiblePayload({amount: value})); - } else if (assetType == Budget.AssetType.ERC1155) { + if (assetType == ABudget.AssetType.ETH || assetType == ABudget.AssetType.ERC20) { + transfer.data = abi.encode(ABudget.FungiblePayload({amount: value})); + } else if (assetType == ABudget.AssetType.ERC1155) { // we're not actually handling this case yet, so hardcoded token ID of 1 is fine - transfer.data = abi.encode(Budget.ERC1155Payload({tokenId: 1, amount: value, data: ""})); + transfer.data = abi.encode(ABudget.ERC1155Payload({tokenId: 1, amount: value, data: ""})); } return abi.encode(transfer); @@ -874,11 +874,11 @@ contract SimpleBudgetTest is Test, IERC1155Receiver { pure returns (bytes memory) { - Budget.Transfer memory transfer; - transfer.assetType = Budget.AssetType.ERC1155; + ABudget.Transfer memory transfer; + transfer.assetType = ABudget.AssetType.ERC1155; transfer.asset = asset; transfer.target = target; - transfer.data = abi.encode(Budget.ERC1155Payload({tokenId: tokenId, amount: value, data: data})); + transfer.data = abi.encode(ABudget.ERC1155Payload({tokenId: tokenId, amount: value, data: data})); return abi.encode(transfer); } diff --git a/packages/evm/test/budgets/VestingBudget.t.sol b/packages/evm/test/budgets/VestingBudget.t.sol index 2867eb26..2d505f6d 100644 --- a/packages/evm/test/budgets/VestingBudget.t.sol +++ b/packages/evm/test/budgets/VestingBudget.t.sol @@ -9,8 +9,8 @@ import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {MockERC20} from "contracts/shared/Mocks.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {VestingBudget} from "contracts/budgets/VestingBudget.sol"; contract VestingBudgetTest is Test { @@ -120,7 +120,7 @@ contract VestingBudgetTest is Test { mockERC20.approve(address(vestingBudget), 100 ether); // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); assertTrue(vestingBudget.allocate(data)); // Ensure the budget has 100 tokens @@ -129,7 +129,7 @@ contract VestingBudgetTest is Test { function testAllocate_NativeBalance() public { // Allocate 100 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); vestingBudget.allocate{value: 100 ether}(data); // Ensure the budget has 100 tokens @@ -138,20 +138,20 @@ contract VestingBudgetTest is Test { function testAllocate_NativeBalanceValueMismatch() public { // Encode an allocation of 100 ETH - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(this), 100 ether); // Expect a revert due to a value mismatch (too much ETH) - vm.expectRevert(abi.encodeWithSelector(Budget.InvalidAllocation.selector, address(0), uint256(100 ether))); + vm.expectRevert(abi.encodeWithSelector(ABudget.InvalidAllocation.selector, address(0), uint256(100 ether))); vestingBudget.allocate{value: 101 ether}(data); // Expect a revert due to a value mismatch (too little ETH) - vm.expectRevert(abi.encodeWithSelector(Budget.InvalidAllocation.selector, address(0), uint256(100 ether))); + vm.expectRevert(abi.encodeWithSelector(ABudget.InvalidAllocation.selector, address(0), uint256(100 ether))); vestingBudget.allocate{value: 99 ether}(data); } function testAllocate_NoApproval() public { // Allocate 100 tokens to the budget without approval - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); vm.expectRevert(SafeTransferLib.TransferFromFailed.selector); vestingBudget.allocate(data); } @@ -161,7 +161,7 @@ contract VestingBudgetTest is Test { mockERC20.approve(address(vestingBudget), 100 ether); // Allocate 101 tokens to the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); vm.expectRevert(SafeTransferLib.TransferFromFailed.selector); vestingBudget.allocate(data); } @@ -189,7 +189,7 @@ contract VestingBudgetTest is Test { // Reclaim 99 tokens from the budget assertTrue( vestingBudget.clawback( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 99 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 99 ether) ) ); @@ -206,7 +206,7 @@ contract VestingBudgetTest is Test { _vestAll(); // Reclaim 99 ETH from the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 99 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 99 ether); assertTrue(vestingBudget.clawback(data)); // Ensure the budget has 1 ETH left @@ -218,7 +218,7 @@ contract VestingBudgetTest is Test { _vestAll(); // Reclaim all tokens from the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 0); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 0); assertTrue(vestingBudget.clawback(data)); // Ensure the budget has no tokens left @@ -230,9 +230,9 @@ contract VestingBudgetTest is Test { _vestAll(); // Reclaim 100 tokens from the budget to address(0) - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0), 100 ether); vm.expectRevert( - abi.encodeWithSelector(Budget.TransferFailed.selector, address(mockERC20), address(0), uint256(100 ether)) + abi.encodeWithSelector(ABudget.TransferFailed.selector, address(mockERC20), address(0), uint256(100 ether)) ); vestingBudget.clawback(data); @@ -245,10 +245,10 @@ contract VestingBudgetTest is Test { _vestAll(); // Reclaim 101 tokens from the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 101 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(100 ether), uint256(101 ether) ) ); vestingBudget.clawback(data); @@ -261,7 +261,7 @@ contract VestingBudgetTest is Test { mockERC20.approve(address(vestingBudget), 100 ether); // Allocate 100 tokens to the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether); vestingBudget.allocate(data); assertEq(vestingBudget.total(address(mockERC20)), 100 ether); @@ -279,7 +279,7 @@ contract VestingBudgetTest is Test { vm.prank(address(1)); vm.expectRevert(); vestingBudget.clawback( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 100 ether) ); } @@ -292,16 +292,16 @@ contract VestingBudgetTest is Test { _vestHalf(); // Try to disburse 100 tokens from the budget (should fail, only 50 tokens vested) - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(50 ether), uint256(100 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(50 ether), uint256(100 ether) ) ); vestingBudget.disburse(data); // Disburse 50 tokens from the budget - data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 50 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 50 ether); assertTrue(vestingBudget.disburse(data)); assertEq(mockERC20.balanceOf(address(1)), 50 ether); @@ -316,10 +316,10 @@ contract VestingBudgetTest is Test { _vestHalf(); // Try to disburse 100 ETH from the budget (should fail, only 50 ETH vested) - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 100 ether); // Disburse 50 ETH from the budget - data = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(1), 50 ether); + data = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(1), 50 ether); assertTrue(vestingBudget.disburse(data)); assertEq(address(1).balance, 50 ether); @@ -338,8 +338,8 @@ contract VestingBudgetTest is Test { // Prepare the disbursement requests bytes[] memory requests = new bytes[](2); - requests[0] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); - requests[1] = _makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(2), 25 ether); + requests[0] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); + requests[1] = _makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(2), 25 ether); // Disburse: // 25 tokens to address(1); and @@ -361,10 +361,10 @@ contract VestingBudgetTest is Test { _vestHalf(); // Disburse 50.1 tokens from the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 50.1 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 50.1 ether); vm.expectRevert( abi.encodeWithSelector( - Budget.InsufficientFunds.selector, address(mockERC20), uint256(50 ether), uint256(50.1 ether) + ABudget.InsufficientFunds.selector, address(mockERC20), uint256(50 ether), uint256(50.1 ether) ) ); vestingBudget.disburse(data); @@ -386,7 +386,7 @@ contract VestingBudgetTest is Test { // Try to disburse 100 tokens from the budget as a non-owner bytes memory data = - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(0xdeadbeef), 100 ether); vm.prank(address(0xc0ffee)); vm.expectRevert(); vestingBudget.disburse(data); @@ -404,7 +404,7 @@ contract VestingBudgetTest is Test { ); // Try to disburse 100 tokens from the budget - bytes memory data = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); + bytes memory data = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 100 ether); vm.expectRevert(SafeTransferLib.TransferFailed.selector); vestingBudget.disburse(data); } @@ -415,9 +415,9 @@ contract VestingBudgetTest is Test { // Prepare the disbursement data bytes[] memory requests = new bytes[](3); - requests[0] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); - requests[1] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(2), 50 ether); - requests[2] = _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(3), 10 ether); + requests[0] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether); + requests[1] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(2), 50 ether); + requests[2] = _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(3), 10 ether); // Mock the second ERC20 transfer to fail in an unexpected way vm.mockCallRevert( @@ -462,7 +462,7 @@ contract VestingBudgetTest is Test { _vestAll(); // Disburse 25 tokens from the budget - vestingBudget.disburse(_makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(1), 25 ether)); + vestingBudget.disburse(_makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(1), 25 ether)); // Allocate another 50 tokens to the budget _allocate(address(mockERC20), 50 ether); @@ -498,7 +498,7 @@ contract VestingBudgetTest is Test { // Disburse 25 tokens from the budget and ensure the budget has 75 tokens available vestingBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) ); assertEq(vestingBudget.available(address(mockERC20)), 75 ether); } @@ -519,7 +519,7 @@ contract VestingBudgetTest is Test { assertEq(vestingBudget.available(address(0)), 100 ether); // Disburse 25 ETH from the budget and ensure the budget has 75 ETH available - vestingBudget.disburse(_makeFungibleTransfer(Budget.AssetType.ETH, address(0), address(0xdeadbeef), 25 ether)); + vestingBudget.disburse(_makeFungibleTransfer(ABudget.AssetType.ETH, address(0), address(0xdeadbeef), 25 ether)); assertEq(vestingBudget.available(address(0)), 75 ether); } @@ -542,7 +542,7 @@ contract VestingBudgetTest is Test { // Disburse 25 tokens from the budget vestingBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) ); // Ensure the budget has 25 tokens distributed @@ -550,7 +550,7 @@ contract VestingBudgetTest is Test { // Disburse another 25 tokens from the budget vestingBudget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockERC20), address(this), 25 ether) ); // Ensure the budget has 50 tokens distributed @@ -626,7 +626,7 @@ contract VestingBudgetTest is Test { //////////////////////////////////// function testGetComponentInterface() public { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface console.logBytes4(vestingBudget.getComponentInterface()); } @@ -635,8 +635,8 @@ contract VestingBudgetTest is Test { ///////////////////////////////////// function testSupportsInterface() public { - // Ensure the contract supports the Budget interface - assertTrue(vestingBudget.supportsInterface(type(Budget).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(vestingBudget.supportsInterface(type(ABudget).interfaceId)); } function testSupportsInterface_NotSupported() public { @@ -662,11 +662,11 @@ contract VestingBudgetTest is Test { function _allocate(address asset, uint256 value) internal returns (bool) { if (asset == address(0)) { return vestingBudget.allocate{value: value}( - _makeFungibleTransfer(Budget.AssetType.ETH, asset, address(this), value) + _makeFungibleTransfer(ABudget.AssetType.ETH, asset, address(this), value) ); } else { mockERC20.approve(address(vestingBudget), value); - return vestingBudget.allocate(_makeFungibleTransfer(Budget.AssetType.ERC20, asset, address(this), value)); + return vestingBudget.allocate(_makeFungibleTransfer(ABudget.AssetType.ERC20, asset, address(this), value)); } } @@ -678,17 +678,17 @@ contract VestingBudgetTest is Test { vm.warp(block.timestamp + vestingBudget.duration() / 2); } - function _makeFungibleTransfer(Budget.AssetType assetType, address asset, address target, uint256 value) + function _makeFungibleTransfer(ABudget.AssetType assetType, address asset, address target, uint256 value) internal pure returns (bytes memory) { - Budget.Transfer memory transfer; + ABudget.Transfer memory transfer; transfer.assetType = assetType; transfer.asset = asset; transfer.target = target; - if (assetType == Budget.AssetType.ETH || assetType == Budget.AssetType.ERC20) { - transfer.data = abi.encode(Budget.FungiblePayload({amount: value})); + if (assetType == ABudget.AssetType.ETH || assetType == ABudget.AssetType.ERC20) { + transfer.data = abi.encode(ABudget.FungiblePayload({amount: value})); } return abi.encode(transfer); diff --git a/packages/evm/test/e2e/EndToEndBasic.t.sol b/packages/evm/test/e2e/EndToEndBasic.t.sol index 8866a27f..7bc526a0 100644 --- a/packages/evm/test/e2e/EndToEndBasic.t.sol +++ b/packages/evm/test/e2e/EndToEndBasic.t.sol @@ -13,19 +13,19 @@ import {BoostRegistry} from "contracts/BoostRegistry.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {BoostLib} from "contracts/shared/BoostLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; +import {AAllowList} from "contracts/allowlists/AAllowList.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; import {ContractAction} from "contracts/actions/ContractAction.sol"; import {ERC721MintAction} from "contracts/actions/ERC721MintAction.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {ERC20Incentive} from "contracts/incentives/ERC20Incentive.sol"; import {AERC20Incentive} from "contracts/incentives/AERC20Incentive.sol"; @@ -108,18 +108,18 @@ contract EndToEndBasic is Test { assertEq(boost.owner, address(1)); // Let's spot check the Boost we just created - // - Budget == SimpleBudget + // - ABudget == SimpleBudget assertEq(address(boost.budget), address(budget)); assertEq(boost.budget.owner(), address(this)); assertTrue(budget.isAuthorized(address(this))); assertFalse(budget.isAuthorized(address(0xdeadbeef))); - // - Action == Validator - assertEq(boost.action.supportsInterface(type(Action).interfaceId), true); + // - AAction == Validator + assertEq(boost.action.supportsInterface(type(AAction).interfaceId), true); assertEq(boost.action.supportsInterface(type(AValidator).interfaceId), true); assertEq(address(boost.validator), address(boost.action)); - // - Action == ERC721MintAction + // - AAction == ERC721MintAction assertEq(ERC721MintAction(address(boost.action)).target(), address(erc721)); assertEq(ERC721MintAction(address(boost.action)).selector(), erc721.mint.selector); assertEq(ERC721MintAction(address(boost.action)).value(), erc721.mintPrice()); @@ -129,7 +129,7 @@ contract EndToEndBasic is Test { assertTrue(boost.allowList.isAllowed(address(0xc0ffee), bytes(""))); assertFalse(boost.allowList.isAllowed(address(this), bytes(""))); - // - Incentive[0] == ERC20Incentive + // - AIncentive[0] == ERC20Incentive assertEq(ERC20Incentive(address(boost.incentives[0])).asset(), address(erc20)); assertEq(ERC20Incentive(address(boost.incentives[0])).currentReward(), 100 ether); assertEq(ERC20Incentive(address(boost.incentives[0])).limit(), 5); @@ -159,7 +159,7 @@ contract EndToEndBasic is Test { // "Then I can claim the rewards to my wallet" uint256 boostId = 0; // This is the only Boost we've created = 0 - uint256 incentiveId = 0; // This is the only Incentive in that Boost = 0 + uint256 incentiveId = 0; // This is the only AIncentive in that Boost = 0 uint256 tokenId = 1; // This is the tokenId we just minted = 1 core.claimIncentive{value: core.claimFee()}( boostId, incentiveId, address(0), abi.encode(address(this), abi.encode(tokenId)) @@ -187,7 +187,7 @@ contract EndToEndBasic is Test { registry.getIdentifier(BoostRegistry.RegistryType.BUDGET, "SimpleBudget") ) ), - "My Simple Budget", + "My Simple ABudget", abi.encode(SimpleBudget.InitPayload({owner: address(this), authorized: authorized})) ) ) @@ -197,18 +197,18 @@ contract EndToEndBasic is Test { assertTrue(budget.isAuthorized(address(this))); } - function _when_I_allocate_assets_to_my_budget(Budget budget) internal { + function _when_I_allocate_assets_to_my_budget(ABudget budget) internal { // "When I allocate assets to my budget" // "And the asset is an ERC20 token" erc20.approve(address(budget), 500 ether); assertTrue( budget.allocate( abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC20, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC20, asset: address(erc20), target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: 500 ether})) + data: abi.encode(ABudget.FungiblePayload({amount: 500 ether})) }) ) ) @@ -223,11 +223,11 @@ contract EndToEndBasic is Test { assertTrue( budget.allocate{value: 10.5 ether}( abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ETH, + ABudget.Transfer({ + assetType: ABudget.AssetType.ETH, asset: address(0), target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: 10.5 ether})) + data: abi.encode(ABudget.FungiblePayload({amount: 10.5 ether})) }) ) ) @@ -246,7 +246,7 @@ contract EndToEndBasic is Test { /// @notice When I create a new Boost with my budget /// @param budget The budget to use for the Boost /// @return The Boost that was created - function _when_I_create_a_new_boost_with_my_budget(Budget budget) internal returns (BoostLib.Boost memory) { + function _when_I_create_a_new_boost_with_my_budget(ABudget budget) internal returns (BoostLib.Boost memory) { // NOTES: // - this looks super complicated, but the UI would handling all the encoding, registry lookups, etc. // - solidity stumbles on encoding array literals, so we pre-build those in memory diff --git a/packages/evm/test/e2e/EndToEndSignerValidator.t.sol b/packages/evm/test/e2e/EndToEndSignerValidator.t.sol index fe8845b1..8a86a093 100644 --- a/packages/evm/test/e2e/EndToEndSignerValidator.t.sol +++ b/packages/evm/test/e2e/EndToEndSignerValidator.t.sol @@ -14,22 +14,21 @@ import {BoostRegistry} from "contracts/BoostRegistry.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; import {BoostLib} from "contracts/shared/BoostLib.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -import {AllowList} from "contracts/allowlists/AllowList.sol"; import {SimpleDenyList} from "contracts/allowlists/SimpleDenyList.sol"; import {ASignerValidator, IBoostClaim} from "contracts/validators/ASignerValidator.sol"; import {SignerValidator} from "contracts/validators/SignerValidator.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {ManagedBudget} from "contracts/budgets/ManagedBudget.sol"; -import {Action} from "contracts/actions/Action.sol"; +import {AAction} from "contracts/actions/AAction.sol"; import {ContractAction} from "contracts/actions/ContractAction.sol"; import {ERC721MintAction} from "contracts/actions/ERC721MintAction.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {ERC20VariableIncentive} from "contracts/incentives/ERC20VariableIncentive.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; @@ -39,8 +38,8 @@ contract EndToEndSigner is Test, OwnableRoles { address fee_recipient = address(1); BoostCore public core = new BoostCore(registry, fee_recipient); - address budgetManager = makeAddr("Budget Manager"); - address budgetAdmin = makeAddr("Budget Admin"); + address budgetManager = makeAddr("ABudget Manager"); + address budgetAdmin = makeAddr("ABudget Admin"); address validatorSigner; uint256 validatorSignerKey; @@ -91,14 +90,14 @@ contract EndToEndSigner is Test, OwnableRoles { assertEq(boost.owner, address(1)); // Let's spot check the Boost we just created - // - Budget == ManagedBudget + // - ABudget == ManagedBudget assertEq(address(boost.budget), address(budget)); assertEq(boost.budget.owner(), address(this)); assertTrue(budget.isAuthorized(address(this))); assertTrue(budget.isAuthorized(address(core))); assertFalse(budget.isAuthorized(address(0xdeadbeef))); - // - Action == ERC721MintAction + // - AAction == ERC721MintAction assertEq(ERC721MintAction(address(boost.action)).target(), address(erc721)); assertEq(ERC721MintAction(address(boost.action)).selector(), erc721.mint.selector); assertEq(ERC721MintAction(address(boost.action)).value(), erc721.mintPrice()); @@ -109,11 +108,11 @@ contract EndToEndSigner is Test, OwnableRoles { assertTrue(boost.allowList.isAllowed(address(this), bytes(""))); // - Validator == SignerValidator - assertEq(boost.action.supportsInterface(type(Action).interfaceId), true); + assertEq(boost.action.supportsInterface(type(AAction).interfaceId), true); assertEq(boost.action.supportsInterface(type(AValidator).interfaceId), true); assertEq(SignerValidator(address(boost.validator)).getComponentInterface(), type(ASignerValidator).interfaceId); - // - Incentive[0] == ERC20VariableIncentive + // - AIncentive[0] == ERC20VariableIncentive assertEq(ERC20VariableIncentive(address(boost.incentives[0])).asset(), address(erc20)); assertEq(ERC20VariableIncentive(address(boost.incentives[0])).currentReward(), rewardAmount); assertEq(ERC20VariableIncentive(address(boost.incentives[0])).limit(), incentiveLimitAmount); @@ -136,7 +135,7 @@ contract EndToEndSigner is Test, OwnableRoles { _i_can_complete_an_action(boost, claimer); - // create Incentive Payload + // create AIncentive Payload uint256 boostId = 0; uint256 incentiveId = 0; uint8 incentiveQuantity = 1; @@ -144,7 +143,7 @@ contract EndToEndSigner is Test, OwnableRoles { // claim an amount of 100 tokens bytes memory claimBytes = abi.encode(claimAmount); - // create Validator Payload containing Incentive Payload + // create Validator Payload containing AIncentive Payload bytes32 msgHash = SignerValidator(address(boost.validator)).hashSignerData(boostId, incentiveQuantity, claimer, claimBytes); @@ -185,7 +184,7 @@ contract EndToEndSigner is Test, OwnableRoles { registry.getIdentifier(BoostRegistry.RegistryType.BUDGET, "ManagedBudget") ) ), - "My Managed Budget", + "My Managed ABudget", abi.encode( ManagedBudget.InitPayload({owner: address(this), authorized: authorized, roles: roles}) ) @@ -197,18 +196,18 @@ contract EndToEndSigner is Test, OwnableRoles { assertTrue(budget.isAuthorized(address(this))); } - function _when_I_allocate_assets_to_my_budget(Budget budget) internal { + function _when_I_allocate_assets_to_my_budget(ABudget budget) internal { // "When I allocate assets to my budget" // "And the asset is an ERC20 token" erc20.approve(address(budget), 500 ether); assertTrue( budget.allocate( abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ERC20, + ABudget.Transfer({ + assetType: ABudget.AssetType.ERC20, asset: address(erc20), target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: 500 ether})) + data: abi.encode(ABudget.FungiblePayload({amount: 500 ether})) }) ) ) @@ -223,11 +222,11 @@ contract EndToEndSigner is Test, OwnableRoles { assertTrue( budget.allocate{value: 10.5 ether}( abi.encode( - Budget.Transfer({ - assetType: Budget.AssetType.ETH, + ABudget.Transfer({ + assetType: ABudget.AssetType.ETH, asset: address(0), target: address(this), - data: abi.encode(Budget.FungiblePayload({amount: 10.5 ether})) + data: abi.encode(ABudget.FungiblePayload({amount: 10.5 ether})) }) ) ) @@ -238,7 +237,7 @@ contract EndToEndSigner is Test, OwnableRoles { assertEq(budget.available(address(0)), 10.5 ether); } - function _when_I_create_a_new_boost_with_my_budget(Budget budget) internal returns (BoostLib.Boost memory) { + function _when_I_create_a_new_boost_with_my_budget(ABudget budget) internal returns (BoostLib.Boost memory) { // NOTES: // - this looks super complicated, but the UI would handling all the encoding, registry lookups, etc. // - solidity stumbles on encoding array literals, so we pre-build those in memory diff --git a/packages/evm/test/incentives/AllowListIncentive.t.sol b/packages/evm/test/incentives/AllowListIncentive.t.sol index 8c8dc398..cad3d1c6 100644 --- a/packages/evm/test/incentives/AllowListIncentive.t.sol +++ b/packages/evm/test/incentives/AllowListIncentive.t.sol @@ -7,7 +7,7 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {SimpleAllowList} from "contracts/allowlists/SimpleAllowList.sol"; import {AllowListIncentive} from "contracts/incentives/AllowListIncentive.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; contract AllowListIncentiveTest is Test { SimpleAllowList public allowList; @@ -115,8 +115,8 @@ contract AllowListIncentiveTest is Test { ///////////////////////////////////// function testSupportsInterface() public view { - // Ensure the contract supports the Budget interface - assertTrue(incentive.supportsInterface(type(Incentive).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(incentive.supportsInterface(type(AIncentive).interfaceId)); } function testSupportsInterface_NotSupported() public view { diff --git a/packages/evm/test/incentives/CGDAIncentive.t.sol b/packages/evm/test/incentives/CGDAIncentive.t.sol index 366c4653..a929ff46 100644 --- a/packages/evm/test/incentives/CGDAIncentive.t.sol +++ b/packages/evm/test/incentives/CGDAIncentive.t.sol @@ -8,10 +8,10 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {CGDAIncentive} from "contracts/incentives/CGDAIncentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; contract CGDAIncentiveTest is Test { @@ -148,7 +148,7 @@ contract CGDAIncentiveTest is Test { function test_claim_OutOfBudget() public { incentive.clawback( abi.encode( - Incentive.ClawbackPayload({ + AIncentive.ClawbackPayload({ target: makeAddr("weird al's wonky waffle house"), data: abi.encode(10 ether) }) @@ -158,7 +158,7 @@ contract CGDAIncentiveTest is Test { assertEq(incentive.currentReward(), 0 ether); assertEq(asset.balanceOf(address(incentive)), 0 ether); - vm.expectRevert(Incentive.NotClaimable.selector); + vm.expectRevert(AIncentive.NotClaimable.selector); incentive.claim(makeAddr("sam's soggy sandwich & soup shack"), hex""); assertEq(incentive.currentReward(), 0 ether); @@ -243,7 +243,7 @@ contract CGDAIncentiveTest is Test { assertEq(asset.balanceOf(address(incentive)), 2.25 ether); bytes memory reclaimPayload = - abi.encode(Incentive.ClawbackPayload({target: address(0xdeadbeef), data: abi.encode(2 ether)})); + abi.encode(AIncentive.ClawbackPayload({target: address(0xdeadbeef), data: abi.encode(2 ether)})); incentive.clawback(reclaimPayload); assertEq(incentive.currentReward(), 0.25 ether); @@ -283,9 +283,9 @@ contract CGDAIncentiveTest is Test { }) ) ); - Budget.Transfer memory transfer = abi.decode(preflightPayload, (Budget.Transfer)); + ABudget.Transfer memory transfer = abi.decode(preflightPayload, (ABudget.Transfer)); - assertTrue(transfer.assetType == Budget.AssetType.ERC20); + assertTrue(transfer.assetType == ABudget.AssetType.ERC20); assertEq(transfer.asset, address(asset)); assertEq(transfer.target, address(incentive)); assertEq(abi.decode(transfer.data, (uint256)), 10 ether); @@ -305,8 +305,8 @@ contract CGDAIncentiveTest is Test { ///////////////////////////////////// function testSupportsInterface() public view { - // Ensure the contract supports the Budget interface - assertTrue(incentive.supportsInterface(type(Incentive).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(incentive.supportsInterface(type(AIncentive).interfaceId)); } function testSupportsInterface_NotSupported() public view { @@ -322,16 +322,16 @@ contract CGDAIncentiveTest is Test { incentive.claim(target_, hex""); } - function _makeFungibleTransfer(Budget.AssetType assetType_, address asset_, address target_, uint256 value_) + function _makeFungibleTransfer(ABudget.AssetType assetType_, address asset_, address target_, uint256 value_) internal pure returns (bytes memory) { - Budget.Transfer memory transfer = Budget.Transfer({ + ABudget.Transfer memory transfer = ABudget.Transfer({ assetType: assetType_, asset: asset_, target: target_, - data: abi.encode(Budget.FungiblePayload({amount: value_})) + data: abi.encode(ABudget.FungiblePayload({amount: value_})) }); return abi.encode(transfer); diff --git a/packages/evm/test/incentives/ERC1155Incentive.t.sol b/packages/evm/test/incentives/ERC1155Incentive.t.sol index a9c4eca8..aa1847db 100644 --- a/packages/evm/test/incentives/ERC1155Incentive.t.sol +++ b/packages/evm/test/incentives/ERC1155Incentive.t.sol @@ -10,11 +10,11 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {ERC1155Incentive} from "contracts/incentives/ERC1155Incentive.sol"; import {AERC1155Incentive} from "contracts/incentives/AERC1155Incentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; contract ERC1155IncentiveTest is Test, IERC1155Receiver { @@ -84,7 +84,7 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { _initialize(mockAsset, AERC1155Incentive.Strategy.POOL, 42, 5); vm.expectEmit(true, false, false, true); - emit Incentive.Claimed( + emit AIncentive.Claimed( address(1), abi.encodePacked(address(mockAsset), address(1), uint256(42), uint256(1), bytes("")) ); @@ -103,7 +103,7 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { incentive.claim(address(1), hex""); // Attempt to claim for address(1) again => revert - vm.expectRevert(Incentive.NotClaimable.selector); + vm.expectRevert(AIncentive.NotClaimable.selector); incentive.claim(address(1), hex""); } @@ -117,7 +117,7 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { assertEq(incentive.limit(), 100); // Reclaim 50x the reward amount - bytes memory reclaimPayload = abi.encode(Incentive.ClawbackPayload({target: address(1), data: abi.encode(50)})); + bytes memory reclaimPayload = abi.encode(AIncentive.ClawbackPayload({target: address(1), data: abi.encode(50)})); incentive.clawback(reclaimPayload); assertEq(mockAsset.balanceOf(address(1), 42), 50); @@ -131,7 +131,8 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { _initialize(mockAsset, AERC1155Incentive.Strategy.POOL, 42, 100); // Reclaim 101 tokens => exceeds balance => revert - bytes memory reclaimPayload = abi.encode(Incentive.ClawbackPayload({target: address(1), data: abi.encode(101)})); + bytes memory reclaimPayload = + abi.encode(AIncentive.ClawbackPayload({target: address(1), data: abi.encode(101)})); vm.expectRevert(abi.encodeWithSelector(BoostError.ClaimFailed.selector, address(this), reclaimPayload)); incentive.clawback(reclaimPayload); } @@ -183,11 +184,11 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { function testPreflight() public view { // Check the preflight data bytes memory data = incentive.preflight(_initPayload(mockAsset, AERC1155Incentive.Strategy.POOL, 42, 5)); - Budget.Transfer memory budgetRequest = abi.decode(data, (Budget.Transfer)); + ABudget.Transfer memory budgetRequest = abi.decode(data, (ABudget.Transfer)); assertEq(budgetRequest.asset, address(mockAsset)); - Budget.ERC1155Payload memory payload = abi.decode(budgetRequest.data, (Budget.ERC1155Payload)); + ABudget.ERC1155Payload memory payload = abi.decode(budgetRequest.data, (ABudget.ERC1155Payload)); assertEq(payload.tokenId, 42); assertEq(payload.amount, 5); assertEq(payload.data, ""); @@ -196,8 +197,8 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { function testPreflight_WeirdRewards() public view { // Preflight with zero max claims bytes memory noClaims = incentive.preflight(_initPayload(mockAsset, AERC1155Incentive.Strategy.POOL, 42, 0)); - Budget.Transfer memory request = abi.decode(noClaims, (Budget.Transfer)); - Budget.ERC1155Payload memory payload = abi.decode(request.data, (Budget.ERC1155Payload)); + ABudget.Transfer memory request = abi.decode(noClaims, (ABudget.Transfer)); + ABudget.ERC1155Payload memory payload = abi.decode(request.data, (ABudget.ERC1155Payload)); assertEq(payload.amount, 0); } @@ -215,8 +216,8 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { ///////////////////////////////////// function testSupportsInterface() public view { - // Ensure the contract supports the Budget interface - assertTrue(incentive.supportsInterface(type(Incentive).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(incentive.supportsInterface(type(AIncentive).interfaceId)); } function testSupportsInterface_NotSupported() public view { @@ -259,11 +260,11 @@ contract ERC1155IncentiveTest is Test, IERC1155Receiver { pure returns (bytes memory) { - Budget.Transfer memory transfer; - transfer.assetType = Budget.AssetType.ERC1155; + ABudget.Transfer memory transfer; + transfer.assetType = ABudget.AssetType.ERC1155; transfer.asset = asset; transfer.target = target; - transfer.data = abi.encode(Budget.ERC1155Payload({tokenId: tokenId, amount: value, data: data})); + transfer.data = abi.encode(ABudget.ERC1155Payload({tokenId: tokenId, amount: value, data: data})); return abi.encode(transfer); } diff --git a/packages/evm/test/incentives/ERC20Incentive.t.sol b/packages/evm/test/incentives/ERC20Incentive.t.sol index 2e3d2d21..4477a165 100644 --- a/packages/evm/test/incentives/ERC20Incentive.t.sol +++ b/packages/evm/test/incentives/ERC20Incentive.t.sol @@ -8,11 +8,11 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {ERC20Incentive} from "contracts/incentives/ERC20Incentive.sol"; import {AERC20Incentive} from "contracts/incentives/ERC20Incentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; contract ERC20IncentiveTest is Test { @@ -28,13 +28,13 @@ contract ERC20IncentiveTest is Test { // Preload the budget with some mock tokens mockAsset.mint(address(this), 100 ether); mockAsset.approve(address(budget), 100 ether); - budget.allocate(_makeFungibleTransfer(Budget.AssetType.ERC20, address(mockAsset), address(this), 100 ether)); + budget.allocate(_makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockAsset), address(this), 100 ether)); // NOTE: This would normally be handled by BoostCore during the setup // process, but we do it manually here to test without spinning up // the entire protocol stack. This is a _unit_ test, after all. budget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockAsset), address(incentive), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockAsset), address(incentive), 100 ether) ); } @@ -78,7 +78,7 @@ contract ERC20IncentiveTest is Test { _initialize(address(mockAsset), AERC20Incentive.Strategy.POOL, 1 ether, 5); vm.expectEmit(true, false, false, true); - emit Incentive.Claimed(address(1), abi.encodePacked(address(mockAsset), address(1), uint256(1 ether))); + emit AIncentive.Claimed(address(1), abi.encodePacked(address(mockAsset), address(1), uint256(1 ether))); // Claim the incentive incentive.claim(address(1), hex""); @@ -95,7 +95,7 @@ contract ERC20IncentiveTest is Test { incentive.claim(address(1), hex""); // Attempt to claim for address(1) again => revert - vm.expectRevert(Incentive.NotClaimable.selector); + vm.expectRevert(AIncentive.NotClaimable.selector); incentive.claim(address(1), hex""); } @@ -123,7 +123,7 @@ contract ERC20IncentiveTest is Test { // Reclaim 50x the reward amount bytes memory reclaimPayload = - abi.encode(Incentive.ClawbackPayload({target: address(1), data: abi.encode(50 ether)})); + abi.encode(AIncentive.ClawbackPayload({target: address(1), data: abi.encode(50 ether)})); incentive.clawback(reclaimPayload); assertEq(mockAsset.balanceOf(address(1)), 50 ether); @@ -138,7 +138,7 @@ contract ERC20IncentiveTest is Test { // Reclaim 50.1x => not an integer multiple of the reward amount => revert bytes memory reclaimPayload = - abi.encode(Incentive.ClawbackPayload({target: address(1), data: abi.encode(50.1 ether)})); + abi.encode(AIncentive.ClawbackPayload({target: address(1), data: abi.encode(50.1 ether)})); vm.expectRevert(abi.encodeWithSelector(BoostError.ClaimFailed.selector, address(this), reclaimPayload)); incentive.clawback(reclaimPayload); } @@ -155,7 +155,7 @@ contract ERC20IncentiveTest is Test { // Attempt to reclaim the reward => revert (because the reward is now locked) bytes memory reclaimPayload = - abi.encode(Incentive.ClawbackPayload({target: address(1), data: abi.encode(100 ether)})); + abi.encode(AIncentive.ClawbackPayload({target: address(1), data: abi.encode(100 ether)})); vm.expectRevert(abi.encodeWithSelector(BoostError.ClaimFailed.selector, address(this), reclaimPayload)); incentive.clawback(reclaimPayload); @@ -168,7 +168,7 @@ contract ERC20IncentiveTest is Test { // Reclaim the full reward amount bytes memory reclaimPayload = - abi.encode(Incentive.ClawbackPayload({target: address(this), data: abi.encode(100 ether)})); + abi.encode(AIncentive.ClawbackPayload({target: address(this), data: abi.encode(100 ether)})); incentive.clawback(reclaimPayload); // Check that the limit is set to 0 @@ -223,11 +223,11 @@ contract ERC20IncentiveTest is Test { // Check the preflight data bytes memory data = incentive.preflight(_initPayload(address(mockAsset), AERC20Incentive.Strategy.POOL, 1 ether, 5)); - Budget.Transfer memory budgetRequest = abi.decode(data, (Budget.Transfer)); + ABudget.Transfer memory budgetRequest = abi.decode(data, (ABudget.Transfer)); assertEq(budgetRequest.asset, address(mockAsset)); - Budget.FungiblePayload memory payload = abi.decode(budgetRequest.data, (Budget.FungiblePayload)); + ABudget.FungiblePayload memory payload = abi.decode(budgetRequest.data, (ABudget.FungiblePayload)); assertEq(payload.amount, 5 ether); } @@ -235,15 +235,15 @@ contract ERC20IncentiveTest is Test { // Preflight with no reward amount bytes memory noRewards = incentive.preflight(_initPayload(address(mockAsset), AERC20Incentive.Strategy.POOL, 0 ether, 5)); - Budget.Transfer memory request = abi.decode(noRewards, (Budget.Transfer)); - Budget.FungiblePayload memory payload = abi.decode(request.data, (Budget.FungiblePayload)); + ABudget.Transfer memory request = abi.decode(noRewards, (ABudget.Transfer)); + ABudget.FungiblePayload memory payload = abi.decode(request.data, (ABudget.FungiblePayload)); assertEq(payload.amount, 0); // Preflight with zero max claims bytes memory noClaims = incentive.preflight(_initPayload(address(mockAsset), AERC20Incentive.Strategy.POOL, 1 ether, 0)); - Budget.Transfer memory request2 = abi.decode(noClaims, (Budget.Transfer)); - Budget.FungiblePayload memory payload2 = abi.decode(request2.data, (Budget.FungiblePayload)); + ABudget.Transfer memory request2 = abi.decode(noClaims, (ABudget.Transfer)); + ABudget.FungiblePayload memory payload2 = abi.decode(request2.data, (ABudget.FungiblePayload)); assertEq(payload2.amount, 0); } @@ -251,11 +251,11 @@ contract ERC20IncentiveTest is Test { // Check the preflight data for a raffle bytes memory data = incentive.preflight(_initPayload(address(mockAsset), AERC20Incentive.Strategy.RAFFLE, 1 ether, 5)); - Budget.Transfer memory budgetRequest = abi.decode(data, (Budget.Transfer)); + ABudget.Transfer memory budgetRequest = abi.decode(data, (ABudget.Transfer)); assertEq(budgetRequest.asset, address(mockAsset)); - Budget.FungiblePayload memory payload = abi.decode(budgetRequest.data, (Budget.FungiblePayload)); + ABudget.FungiblePayload memory payload = abi.decode(budgetRequest.data, (ABudget.FungiblePayload)); assertEq(payload.amount, 1 ether); } @@ -310,8 +310,8 @@ contract ERC20IncentiveTest is Test { ///////////////////////////////////// function testSupportsInterface() public view { - // Ensure the contract supports the Budget interface - assertTrue(incentive.supportsInterface(type(Incentive).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(incentive.supportsInterface(type(AIncentive).interfaceId)); } function testSupportsInterface_NotSupported() public view { @@ -339,20 +339,20 @@ contract ERC20IncentiveTest is Test { return abi.encode(ERC20Incentive.InitPayload({asset: asset, strategy: strategy, reward: reward, limit: limit})); } - function _makeFungibleTransfer(Budget.AssetType assetType, address asset, address target, uint256 value) + function _makeFungibleTransfer(ABudget.AssetType assetType, address asset, address target, uint256 value) internal pure returns (bytes memory) { - Budget.Transfer memory transfer; + ABudget.Transfer memory transfer; transfer.assetType = assetType; transfer.asset = asset; transfer.target = target; - if (assetType == Budget.AssetType.ETH || assetType == Budget.AssetType.ERC20) { - transfer.data = abi.encode(Budget.FungiblePayload({amount: value})); - } else if (assetType == Budget.AssetType.ERC1155) { + if (assetType == ABudget.AssetType.ETH || assetType == ABudget.AssetType.ERC20) { + transfer.data = abi.encode(ABudget.FungiblePayload({amount: value})); + } else if (assetType == ABudget.AssetType.ERC1155) { // we're not actually handling this case yet, so hardcoded token ID of 1 is fine - transfer.data = abi.encode(Budget.ERC1155Payload({tokenId: 1, amount: value, data: ""})); + transfer.data = abi.encode(ABudget.ERC1155Payload({tokenId: 1, amount: value, data: ""})); } return abi.encode(transfer); diff --git a/packages/evm/test/incentives/ERC20VariableIncentive.t.sol b/packages/evm/test/incentives/ERC20VariableIncentive.t.sol index d9a49dac..5cbd2f70 100644 --- a/packages/evm/test/incentives/ERC20VariableIncentive.t.sol +++ b/packages/evm/test/incentives/ERC20VariableIncentive.t.sol @@ -7,12 +7,12 @@ import {LibClone} from "@solady/utils/LibClone.sol"; import {SafeTransferLib} from "@solady/utils/SafeTransferLib.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Incentive, IBoostClaim} from "contracts/incentives/Incentive.sol"; +import {AIncentive, IBoostClaim} from "contracts/incentives/AIncentive.sol"; import {ERC20VariableIncentive} from "contracts/incentives/ERC20VariableIncentive.sol"; import {AERC20VariableIncentive} from "contracts/incentives/AERC20VariableIncentive.sol"; -import {Budget} from "contracts/budgets/Budget.sol"; +import {ABudget} from "contracts/budgets/ABudget.sol"; import {SimpleBudget} from "contracts/budgets/SimpleBudget.sol"; contract ERC20VariableIncentiveTest is Test { @@ -33,11 +33,11 @@ contract ERC20VariableIncentiveTest is Test { // Preload the budget with some mock tokens mockAsset.mint(address(this), 100 ether); mockAsset.approve(address(budget), 100 ether); - budget.allocate(_makeFungibleTransfer(Budget.AssetType.ERC20, address(mockAsset), address(this), 100 ether)); + budget.allocate(_makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockAsset), address(this), 100 ether)); // Manually handle the budget disbursement budget.disburse( - _makeFungibleTransfer(Budget.AssetType.ERC20, address(mockAsset), address(incentive), 100 ether) + _makeFungibleTransfer(ABudget.AssetType.ERC20, address(mockAsset), address(incentive), 100 ether) ); } @@ -78,7 +78,9 @@ contract ERC20VariableIncentiveTest is Test { _initialize(address(mockAsset), 1 ether, 5 ether); vm.expectEmit(true, false, false, true); - emit Incentive.Claimed(CLAIM_RECIPIENT, abi.encodePacked(address(mockAsset), CLAIM_RECIPIENT, uint256(1 ether))); + emit AIncentive.Claimed( + CLAIM_RECIPIENT, abi.encodePacked(address(mockAsset), CLAIM_RECIPIENT, uint256(1 ether)) + ); // Claim the incentive incentive.claim(CLAIM_RECIPIENT, _encodeBoostClaim(1 ether)); @@ -93,7 +95,7 @@ contract ERC20VariableIncentiveTest is Test { _initialize(address(mockAsset), 1 ether, 2 ether); // Attempt to claim more than the limit => revert - vm.expectRevert(Incentive.ClaimFailed.selector); + vm.expectRevert(AIncentive.ClaimFailed.selector); incentive.claim(CLAIM_RECIPIENT, abi.encode(IBoostClaim.BoostClaimData(hex"", abi.encode(2 ether + 1)))); } @@ -117,7 +119,7 @@ contract ERC20VariableIncentiveTest is Test { incentive.claim(CLAIM_RECIPIENT, _encodeBoostClaim(1 ether)); // Attempt to claim again => revert - vm.expectRevert(Incentive.NotClaimable.selector); + vm.expectRevert(AIncentive.NotClaimable.selector); incentive.claim(CLAIM_RECIPIENT, _encodeBoostClaim(1 ether)); } @@ -130,10 +132,10 @@ contract ERC20VariableIncentiveTest is Test { abi.encode(ERC20VariableIncentive.InitPayload({asset: address(mockAsset), reward: 1 ether, limit: 5 ether})) ); - Budget.Transfer memory transfer = abi.decode(preflightPayload, (Budget.Transfer)); + ABudget.Transfer memory transfer = abi.decode(preflightPayload, (ABudget.Transfer)); assertEq(transfer.asset, address(mockAsset)); assertEq(transfer.target, address(incentive)); - assertEq(abi.decode(transfer.data, (Budget.FungiblePayload)).amount, 5 ether); + assertEq(abi.decode(transfer.data, (ABudget.FungiblePayload)).amount, 5 ether); } //////////////////////////////////// @@ -146,7 +148,7 @@ contract ERC20VariableIncentiveTest is Test { // Reclaim some tokens bytes memory reclaimPayload = - abi.encode(Incentive.ClawbackPayload({target: address(this), data: abi.encode(2 ether)})); + abi.encode(AIncentive.ClawbackPayload({target: address(this), data: abi.encode(2 ether)})); incentive.clawback(reclaimPayload); // Check the balance and limit @@ -168,8 +170,8 @@ contract ERC20VariableIncentiveTest is Test { ////////////////////////////////////////////// function testSupportsInterface() public view { - // Ensure the contract supports the Incentive interface - assertTrue(incentive.supportsInterface(type(Incentive).interfaceId)); + // Ensure the contract supports the AIncentive interface + assertTrue(incentive.supportsInterface(type(AIncentive).interfaceId)); } function testSupportsInterface_NotSupported() public view { @@ -197,16 +199,16 @@ contract ERC20VariableIncentiveTest is Test { return abi.encode(ERC20VariableIncentive.InitPayload({asset: asset, reward: reward, limit: limit})); } - function _makeFungibleTransfer(Budget.AssetType assetType, address asset, address target, uint256 value) + function _makeFungibleTransfer(ABudget.AssetType assetType, address asset, address target, uint256 value) internal pure returns (bytes memory) { - Budget.Transfer memory transfer; + ABudget.Transfer memory transfer; transfer.assetType = assetType; transfer.asset = asset; transfer.target = target; - transfer.data = abi.encode(Budget.FungiblePayload({amount: value})); + transfer.data = abi.encode(ABudget.FungiblePayload({amount: value})); return abi.encode(transfer); } diff --git a/packages/evm/test/incentives/PointsIncentive.t.sol b/packages/evm/test/incentives/PointsIncentive.t.sol index c0428fe0..9a6bb9b0 100644 --- a/packages/evm/test/incentives/PointsIncentive.t.sol +++ b/packages/evm/test/incentives/PointsIncentive.t.sol @@ -6,7 +6,7 @@ import {Test, console} from "lib/forge-std/src/Test.sol"; import {LibClone} from "@solady/utils/LibClone.sol"; import {Initializable} from "@solady/utils/Initializable.sol"; -import {Incentive} from "contracts/incentives/Incentive.sol"; +import {AIncentive} from "contracts/incentives/AIncentive.sol"; import {PointsIncentive} from "contracts/incentives/PointsIncentive.sol"; import {Points} from "contracts/tokens/Points.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; @@ -138,7 +138,7 @@ contract PointsIncentiveTest is Test { ) ); points.grantRoles(address(failingIncentive), points.ISSUER_ROLE()); - vm.expectRevert(Incentive.ClaimFailed.selector); + vm.expectRevert(AIncentive.ClaimFailed.selector); failingIncentive.claim(address(1), hex""); } @@ -189,8 +189,8 @@ contract PointsIncentiveTest is Test { ///////////////////////////////////// function testSupportsInterface() public view { - // Ensure the contract supports the Budget interface - assertTrue(incentive.supportsInterface(type(Incentive).interfaceId)); + // Ensure the contract supports the ABudget interface + assertTrue(incentive.supportsInterface(type(AIncentive).interfaceId)); } function testSupportsInterface_NotSupported() public view { diff --git a/packages/evm/test/shared/Cloneable.t.sol b/packages/evm/test/shared/Cloneable.t.sol index e7e5e956..17bd7c30 100644 --- a/packages/evm/test/shared/Cloneable.t.sol +++ b/packages/evm/test/shared/Cloneable.t.sol @@ -2,15 +2,15 @@ pragma solidity ^0.8.24; import {Test, console} from "lib/forge-std/src/Test.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; -contract CloneableImpl is Cloneable { +contract ACloneableImpl is ACloneable { function getComponentInterface() public pure virtual override returns (bytes4) { - return type(Cloneable).interfaceId; + return type(ACloneable).interfaceId; } } -contract CloneableImpl2 is Cloneable { +contract ACloneableImpl2 is ACloneable { uint256 private something; function initialize(bytes calldata data_) public override initializer { @@ -18,7 +18,7 @@ contract CloneableImpl2 is Cloneable { } function getComponentInterface() public pure virtual override returns (bytes4) { - return type(Cloneable).interfaceId; + return type(ACloneable).interfaceId; } function getSomething() external view returns (uint256) { @@ -26,21 +26,21 @@ contract CloneableImpl2 is Cloneable { } } -contract CloneableTest is Test { - CloneableImpl cloneable; - CloneableImpl2 cloneable2; +contract ACloneableTest is Test { + ACloneableImpl cloneable; + ACloneableImpl2 cloneable2; function setUp() public { - cloneable = new CloneableImpl(); - cloneable2 = new CloneableImpl2(); + cloneable = new ACloneableImpl(); + cloneable2 = new ACloneableImpl2(); } ///////////////////////////////// - // Cloneable.supportsInterface // + // ACloneable.supportsInterface // ///////////////////////////////// function testSupportsInterface() public { - assertTrue(cloneable.supportsInterface(type(Cloneable).interfaceId)); + assertTrue(cloneable.supportsInterface(type(ACloneable).interfaceId)); } function testSupportsInterface_NotSupported() public { @@ -48,7 +48,7 @@ contract CloneableTest is Test { } ////////////////////////// - // Cloneable.initialize // + // ACloneable.initialize // ////////////////////////// function testInitialize() public { @@ -57,21 +57,21 @@ contract CloneableTest is Test { } function testInitialize_NotImplemented() public { - vm.expectRevert(Cloneable.InitializerNotImplemented.selector); + vm.expectRevert(ACloneable.InitializerNotImplemented.selector); cloneable.initialize(unicode"🦄 unicorns (and 🌈 rainbows!) are *so cool*"); } ////////////////////////////////////// - // Cloneable.getComponentInterface // + // ACloneable.getComponentInterface // ////////////////////////////////////// - function testGetComponentInterface_CloneableImpl() public { - bytes4 expectedInterfaceId = type(Cloneable).interfaceId; + function testGetComponentInterface_ACloneableImpl() public { + bytes4 expectedInterfaceId = type(ACloneable).interfaceId; assertEq(cloneable.getComponentInterface(), expectedInterfaceId); } - function testGetComponentInterface_CloneableImpl2() public { - bytes4 expectedInterfaceId = type(Cloneable).interfaceId; + function testGetComponentInterface_ACloneableImpl2() public { + bytes4 expectedInterfaceId = type(ACloneable).interfaceId; assertEq(cloneable2.getComponentInterface(), expectedInterfaceId); } } diff --git a/packages/evm/test/validators/SignerValidator.t.sol b/packages/evm/test/validators/SignerValidator.t.sol index 059e9309..e290f761 100644 --- a/packages/evm/test/validators/SignerValidator.t.sol +++ b/packages/evm/test/validators/SignerValidator.t.sol @@ -13,7 +13,7 @@ import {MockERC1271Malicious} from "lib/solady/test/utils/mocks/MockERC1271Malic import {IBoostClaim} from "contracts/shared/IBoostClaim.sol"; import {BoostError} from "contracts/shared/BoostError.sol"; -import {Cloneable} from "contracts/shared/Cloneable.sol"; +import {ACloneable} from "contracts/shared/ACloneable.sol"; import {AValidator} from "contracts/validators/AValidator.sol"; import {SignerValidator, ASignerValidator, IncentiveBits} from "contracts/validators/SignerValidator.sol"; @@ -300,7 +300,7 @@ contract SignerValidatorTest is Test { ///////////////////////////////////////// function testGetComponentInterface() public view { - // Ensure the contract supports the Budget interface + // Ensure the contract supports the ABudget interface console.logBytes4(validator.getComponentInterface()); } @@ -309,7 +309,7 @@ contract SignerValidatorTest is Test { /////////////////////////////////////// function testSupportsInterface() public view { - assertTrue(validator.supportsInterface(type(Cloneable).interfaceId)); + assertTrue(validator.supportsInterface(type(ACloneable).interfaceId)); assertTrue(validator.supportsInterface(type(AValidator).interfaceId)); } diff --git a/packages/sdk/src/Actions/Action.ts b/packages/sdk/src/Actions/Action.ts index 69258579..b50f766e 100644 --- a/packages/sdk/src/Actions/Action.ts +++ b/packages/sdk/src/Actions/Action.ts @@ -1,4 +1,4 @@ -import { actionAbi } from '@boostxyz/evm'; +import { aActionAbi } from '@boostxyz/evm'; import { readContract } from '@wagmi/core'; import type { Address, Hex } from 'viem'; import type { DeployableOptions } from '../Deployable/Deployable'; @@ -43,7 +43,7 @@ export async function actionFromAddress( address: Address, ) { const interfaceId = (await readContract(options.config, { - abi: actionAbi, + abi: aActionAbi, functionName: 'getComponentInterface', address, })) as keyof typeof ActionByComponentInterface; diff --git a/packages/sdk/src/AllowLists/AllowList.ts b/packages/sdk/src/AllowLists/AllowList.ts index 0a765315..e5872edb 100644 --- a/packages/sdk/src/AllowLists/AllowList.ts +++ b/packages/sdk/src/AllowLists/AllowList.ts @@ -1,4 +1,4 @@ -import { allowListAbi } from '@boostxyz/evm'; +import { aAllowListAbi } from '@boostxyz/evm'; import { readContract } from '@wagmi/core'; import type { Address, Hex } from 'viem'; import type { DeployableOptions } from '../Deployable/Deployable'; @@ -41,7 +41,7 @@ export async function allowListFromAddress( address: Address, ) { const interfaceId = (await readContract(options.config, { - abi: allowListAbi, + abi: aAllowListAbi, functionName: 'getComponentInterface', address, })) as keyof typeof AllowListByComponentInterface; diff --git a/packages/sdk/src/Budgets/Budget.ts b/packages/sdk/src/Budgets/Budget.ts index cec3a725..3c8b407a 100644 --- a/packages/sdk/src/Budgets/Budget.ts +++ b/packages/sdk/src/Budgets/Budget.ts @@ -1,4 +1,4 @@ -import { budgetAbi } from '@boostxyz/evm'; +import { aBudgetAbi } from '@boostxyz/evm'; import { readContract } from '@wagmi/core'; import type { Address, Hex } from 'viem'; import type { DeployableOptions } from '../Deployable/Deployable'; @@ -43,7 +43,7 @@ export async function budgetFromAddress( address: Address, ) { const interfaceId = (await readContract(options.config, { - abi: budgetAbi, + abi: aBudgetAbi, functionName: 'getComponentInterface', address, })) as keyof typeof BudgetByComponentInterface; diff --git a/packages/sdk/src/Deployable/DeployableTarget.ts b/packages/sdk/src/Deployable/DeployableTarget.ts index 11e5fbe6..10dd4bfd 100644 --- a/packages/sdk/src/Deployable/DeployableTarget.ts +++ b/packages/sdk/src/Deployable/DeployableTarget.ts @@ -1,7 +1,7 @@ import { - type cloneableAbi, - readCloneableGetComponentInterface, - readCloneableSupportsInterface, + type aCloneableAbi, + readACloneableGetComponentInterface as readACloneableGetComponentInterface, + readACloneableSupportsInterface, } from '@boostxyz/evm'; import { deployContract } from '@wagmi/core'; import { @@ -155,9 +155,9 @@ export class DeployableTarget< */ public async supportsInterface( interfaceId: Hex, - params?: ReadParams, + params?: ReadParams, ) { - return readCloneableSupportsInterface(this._config, { + return readACloneableSupportsInterface(this._config, { address: this.assertValidAddress(), ...this.optionallyAttachAccount(), // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally @@ -176,9 +176,9 @@ export class DeployableTarget< * @returns {unknown} */ public async getComponentInterface( - params?: ReadParams, + params?: ReadParams, ) { - return readCloneableGetComponentInterface(this._config, { + return readACloneableGetComponentInterface(this._config, { address: this.assertValidAddress(), ...this.optionallyAttachAccount(), // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally diff --git a/packages/sdk/src/Incentives/Incentive.ts b/packages/sdk/src/Incentives/Incentive.ts index 52dc9bb0..bd5979c2 100644 --- a/packages/sdk/src/Incentives/Incentive.ts +++ b/packages/sdk/src/Incentives/Incentive.ts @@ -1,4 +1,4 @@ -import { incentiveAbi } from '@boostxyz/evm'; +import { aIncentiveAbi } from '@boostxyz/evm'; import { readContract } from '@wagmi/core'; import type { Address, Hex } from 'viem'; import type { DeployableOptions } from '../Deployable/Deployable'; @@ -62,7 +62,7 @@ export async function incentiveFromAddress( address: Address, ) { const interfaceId = (await readContract(options.config, { - abi: incentiveAbi, + abi: aIncentiveAbi, functionName: 'getComponentInterface', address, })) as keyof typeof IncentiveByComponentInterface;