Skip to content

Commit acf2ef1

Browse files
committedAug 28, 2024
feat(evm): change createBoost auth to be optional
1 parent 599adde commit acf2ef1

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed
 

‎packages/evm/contracts/BoostCore.sol

+22-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {AllowList} from "contracts/allowlists/AllowList.sol";
1717
import {Budget} from "contracts/budgets/Budget.sol";
1818
import {Incentive} from "contracts/incentives/Incentive.sol";
1919
import {Validator} from "contracts/validators/Validator.sol";
20+
import {IAuth} from "contracts/auth/IAuth.sol";
2021

2122
/// @title Boost Core
2223
/// @notice The core contract for the Boost protocol
@@ -53,6 +54,8 @@ contract BoostCore is Ownable, ReentrancyGuard {
5354
/// @notice The BoostRegistry contract
5455
BoostRegistry public registry;
5556

57+
IAuth public createBoostAuth;
58+
5659
/// @notice The protocol fee receiver
5760
address public protocolFeeReceiver;
5861

@@ -68,6 +71,13 @@ contract BoostCore is Ownable, ReentrancyGuard {
6871
/// @notice The fee denominator (basis points, i.e. 10000 == 100%)
6972
uint64 public constant FEE_DENOMINATOR = 10_000;
7073

74+
modifier canCreateBoost(address sender) {
75+
if (address(createBoostAuth) != address(0) && !createBoostAuth.isAuthorized(sender)) {
76+
revert BoostError.Unauthorized();
77+
}
78+
_;
79+
}
80+
7181
/// @notice Constructor to initialize the owner
7282
constructor(BoostRegistry registry_, address protocolFeeReceiver_) {
7383
_initializeOwner(msg.sender);
@@ -92,7 +102,12 @@ contract BoostCore is Ownable, ReentrancyGuard {
92102
/// - `uint256` for the referralFee (added to the base referral fee)
93103
/// - `uint256` for the maxParticipants
94104
/// - `address` for the owner of the Boost
95-
function createBoost(bytes calldata data_) external onlyOwner nonReentrant returns (BoostLib.Boost memory) {
105+
function createBoost(bytes calldata data_)
106+
external
107+
canCreateBoost(msg.sender)
108+
nonReentrant
109+
returns (BoostLib.Boost memory)
110+
{
96111
InitPayload memory payload_ = abi.decode(data_.cdDecompress(), (InitPayload));
97112

98113
// Validate the Budget
@@ -160,6 +175,12 @@ contract BoostCore is Ownable, ReentrancyGuard {
160175
return _boosts.length;
161176
}
162177

178+
/// @notice Set the createBoostAuth address
179+
/// @param auth_ The new createBoostAuth address
180+
function setCreateBoostAuth(address auth_) external onlyOwner {
181+
createBoostAuth = IAuth(auth_);
182+
}
183+
163184
/// @notice Set the protocol fee receiver address
164185
/// @param protocolFeeReceiver_ The new protocol fee receiver address
165186
/// @dev This function is only callable by the owner

0 commit comments

Comments
 (0)
Please sign in to comment.