Skip to content

Commit

Permalink
held fees unlocked by timestamp. feeless moved.
Browse files Browse the repository at this point in the history
  • Loading branch information
mejango committed Dec 10, 2023
1 parent ac1f6c1 commit 8ba4ea0
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 83 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ evm_version = 'paris' # Required for L2s (Optimism, Arbitrum,
match_contract = "_Local" # Do not run fork tests
sizes = true
verbosity = 3 # display errors
optimizer_runs = 300
optimizer_runs = 200
block_number = 14126430
block_timestamp = 1643802347

Expand Down
5 changes: 4 additions & 1 deletion script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "../src/JBRulesets.sol";
import "../src/JBDirectory.sol";
import "../src/JBTokens.sol";
import "../src/JBSplits.sol";
import "../src/JBFeelessAddresses.sol";
import "../src/JBFundAccessLimits.sol";
import "../src/JBController.sol";
import "../src/JBTerminalStore.sol";
Expand All @@ -26,6 +27,7 @@ contract Deploy is Script {
JBRulesets _rulesets;
JBTokens _tokens;
JBSplits _splits;
JBFeelessAddresses _feelessAddresses;
JBFundAccessLimits _fundAccessLimits;
JBController _controller;
JBTerminalStore _terminalStore;
Expand All @@ -41,6 +43,7 @@ contract Deploy is Script {
_permissions = new JBPermissions();
_projects = new JBProjects(_manager);
_prices = new JBPrices(_permissions, _projects, _manager);
_feelessAddresses = new JBFeelessAddresses(_manager);
_directory = new JBDirectory(_permissions, _projects, msg.sender);
_splits = new JBSplits(_directory);
_fundAccessLimits = new JBFundAccessLimits(_directory);
Expand All @@ -53,7 +56,7 @@ contract Deploy is Script {
_directory.setIsAllowedToSetFirstController(address(_controller), true);
_directory.transferOwnership(_manager);
_multiTerminal = new JBMultiTerminal(
_permissions, _projects, _directory, _splits, _terminalStore, _PERMIT2, _trustedForwarder, _manager
_permissions, _projects, _directory, _splits, _terminalStore, _feelessAddresses, _PERMIT2, _trustedForwarder
);
}

Expand Down
54 changes: 54 additions & 0 deletions src/JBFeelessAddresses.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IJBFeelessAddresses} from "./interfaces/IJBFeelessAddresses.sol";

/// @notice Stores and manages addresses that shouldn't incur fees when being paid towards or from.
contract JBFeelessAddresses is Ownable, ERC165, IJBFeelessAddresses {
//*********************************************************************//
// --------------------- public stored properties -------------------- //
//*********************************************************************//

/// @notice Feeless addresses for this terminal.
/// @dev Feeless addresses can receive payouts without incurring a fee.
/// @dev Feeless addresses can use the surplus allowance without incurring a fee.
/// @dev Feeless addresses can be the beneficary of redemptions without incurring a fee.
/// @custom:param addr The address that may or may not be feeless.
mapping(address addr => bool) public override isFeelessAddress;

//*********************************************************************//
// -------------------------- public views --------------------------- //
//*********************************************************************//

/// @notice Indicates if this contract adheres to the specified interface.
/// @dev See {IERC165-supportsInterface}.
/// @param interfaceId The ID of the interface to check for adherance to.
/// @return A flag indicating if the provided interface ID is supported.
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IJBFeelessAddresses).interfaceId || interfaceId == type(IERC165).interfaceId;
}

/// @param owner The address that will own this contract.
constructor(address owner) Ownable(owner) {}

//*********************************************************************//
// ---------------------- external transactions ---------------------- //
//*********************************************************************//

/// @notice Sets an address as feeless or not feeless for this terminal.
/// @dev Only the owner of this contract can set addresses as feeless or not feeless.
/// @dev Feeless addresses can receive payouts without incurring a fee.
/// @dev Feeless addresses can use the surplus allowance without incurring a fee.
/// @dev Feeless addresses can be the beneficary of redemptions without incurring a fee.
/// @param addr The address to make feeless or not feeless.
/// @param flag A flag indicating whether the `address` should be made feeless or not feeless.
function setFeelessAddress(address addr, bool flag) external virtual override onlyOwner {
// Set the flag value.
isFeelessAddress[addr] = flag;

emit SetFeelessAddress(addr, flag, _msgSender());
}
}
Loading

0 comments on commit 8ba4ea0

Please sign in to comment.