Skip to content

Commit

Permalink
feat: update naming
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Oct 23, 2024
1 parent f4a17ab commit 2b0a333
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 38 deletions.
54 changes: 27 additions & 27 deletions contracts/DistributionCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ import { Distributor } from "./Distributor.sol";
/// @author Angle Labs, Inc.
/// @notice Manages the distribution of rewards through the Merkl system
/// @dev This contract is mostly a helper for APIs built on top of Merkl
/// @dev This contract is an upgraded version and distinguishes two types of different rewards:
/// @dev This contract is distinguishes two types of different rewards:
/// - distributions: type of campaign for concentrated liquidity pools created before Feb 15 2024,
/// now deprecated
/// - campaigns: the new more global name to describe any reward program on top of Merkl
/// - campaigns: the more global name to describe any reward program on top of Merkl
//solhint-disable
contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
using SafeERC20 for IERC20;
Expand Down Expand Up @@ -421,6 +421,31 @@ contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
emit FeesSet(_defaultFees);
}

/// @notice Recovers fees accrued on the contract for a list of `tokens`
function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernor {
uint256 tokensLength = tokens.length;
for (uint256 i; i < tokensLength; ) {
tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));
unchecked {
++i;
}
}
}

/// @notice Sets a new address to receive fees
function setFeeRecipient(address _feeRecipient) external onlyGovernor {
feeRecipient = _feeRecipient;
emit FeeRecipientUpdated(_feeRecipient);
}

/// @notice Sets the message that needs to be signed by users before posting rewards
function setMessage(string memory _message) external onlyGovernor {
message = _message;
bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));
messageHash = _messageHash;
emit MessageUpdated(_messageHash);
}

/// @notice Sets the fees specific for a campaign
/// @dev To waive the fees for a campaign, set its fees to 1
function setCampaignFees(uint32 campaignType, uint256 _fees) external onlyGovernorOrGuardian {
Expand All @@ -436,17 +461,6 @@ contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
emit TokenWhitelistToggled(token, toggleStatus);
}

/// @notice Recovers fees accrued on the contract for a list of `tokens`
function recoverFees(IERC20[] calldata tokens, address to) external onlyGovernor {
uint256 tokensLength = tokens.length;
for (uint256 i; i < tokensLength; ) {
tokens[i].safeTransfer(to, tokens[i].balanceOf(address(this)));
unchecked {
++i;
}
}
}

/// @notice Sets fee rebates for a given user
function setUserFeeRebate(address user, uint256 userFeeRebate) external onlyGovernorOrGuardian {
feeRebate[user] = userFeeRebate;
Expand All @@ -470,20 +484,6 @@ contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
}
}

/// @notice Sets a new address to receive fees
function setFeeRecipient(address _feeRecipient) external onlyGovernor {
feeRecipient = _feeRecipient;
emit FeeRecipientUpdated(_feeRecipient);
}

/// @notice Sets the message that needs to be signed by users before posting rewards
function setMessage(string memory _message) external onlyGovernor {
message = _message;
bytes32 _messageHash = ECDSA.toEthSignedMessageHash(bytes(_message));
messageHash = _messageHash;
emit MessageUpdated(_messageHash);
}

/// @notice Toggles the whitelist status for `user` when it comes to signing messages before depositing rewards.
function toggleSigningWhitelist(address user) external onlyGovernorOrGuardian {
uint256 whitelistStatus = 1 - userSignatureWhitelist[user];
Expand Down
4 changes: 2 additions & 2 deletions contracts/deprecated/OldDistributionCreator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { CampaignParameters } from "../struct/CampaignParameters.sol";
import { DistributionParameters } from "../struct/DistributionParameters.sol";
import { RewardTokenAmounts } from "../struct/RewardTokenAmounts.sol";

/// @title DistributionCreator
/// @title OldDistributionCreator
/// @author Angle Labs, Inc.
/// @notice Manages the distribution of rewards through the Merkl system
/// @dev This contract is mostly a helper for APIs built on top of Merkl
Expand All @@ -55,7 +55,7 @@ import { RewardTokenAmounts } from "../struct/RewardTokenAmounts.sol";
/// now deprecated
/// - campaigns: the new more global name to describe any reward program on top of Merkl
//solhint-disable
contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
contract OldDistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable {
using SafeERC20 for IERC20;

/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions contracts/deprecated/OldDistributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ struct Claim {
bytes32 merkleRoot;
}

/// @title Distributor
/// @title OldDistributor
/// @notice Allows to claim rewards distributed to them through Merkl
/// @author Angle Labs. Inc
contract Distributor is UUPSHelper {
contract OldDistributor is UUPSHelper {
using SafeERC20 for IERC20;

/// @notice Epoch duration
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/MockMerklFraxIncentivizationHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.17;

import "../middleman/MerklFraxIncentivizationHandler.sol";
import "../partners/middleman/MerklFraxIncentivizationHandler.sol";

contract MockMerklFraxIncentivizationHandler is MerklFraxIncentivizationHandler {
DistributionCreator public manager;
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/MockMerklGaugeMiddleman.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.17;

import "../middleman/MerklGaugeMiddleman.sol";
import "../partners/middleman/MerklGaugeMiddleman.sol";

contract MockMerklGaugeMiddleman is MerklGaugeMiddleman {
address public angleDistributorAddress;
Expand Down
5 changes: 0 additions & 5 deletions contracts/partners/tokenWrappers/RadiantTokenWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,4 @@ contract RadiantMerklTokenWrapper is BaseMerklTokenWrapper {
VESTING.vestTokens(to, amount, true);
}
}

function overrideNameAndSymbol() public onlyGovernor {
_name = string.concat("Merkl Token Wrapper - ", IERC20Metadata(token()).name());
_symbol = string.concat("mtw", IERC20Metadata(token()).symbol());
}
}

0 comments on commit 2b0a333

Please sign in to comment.