Skip to content

Commit

Permalink
Merge branch 'v2-protocol-rewards' into v2-audit
Browse files Browse the repository at this point in the history
  • Loading branch information
neokry committed Sep 12, 2023
2 parents f660035 + ff84134 commit 540ae61
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/rewards/ProtocolRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ contract ProtocolRewards is IProtocolRewards, EIP712 {
/// @notice An account's balance
mapping(address => uint256) public balanceOf;

/// @notice Manager contract
address immutable manager;

/// @notice Configuration for the protocol rewards
RewardConfig public config;

constructor(address _manager, address _builderRewardRecipient) payable initializer {
Expand Down
30 changes: 21 additions & 9 deletions src/rewards/interfaces/IProtocolRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,33 @@ interface IProtocolRewards {
/// @notice Low-level ETH transfer has failed
error TRANSFER_FAILED();

/// @notice Caller is not managers owner
error ONLY_MANAGER_OWNER();

/// @notice Config for protocol rewards
struct RewardConfig {
//// @notice Address to send Builder DAO rewards to
address builderRewardRecipient;
//// @notice Percentage of final bid amount in BPS claimable by the bid referral
uint256 referralRewardBPS;
//// @notice Percentage of final bid amount in BPS claimable by BuilderDAO
uint256 builderRewardBPS;
}

struct RewardSplits {
//// @notice Total rewards amount
uint256 totalRewards;
//// @notice Founder rewards amount
uint256 founderReward;
//// @notice Bid referral rewards amount
uint256 refferalReward;
//// @notice BuilderDAO rewards amount
uint256 builderReward;
}

/// @notice Generic function to deposit ETH for a recipient, with an optional comment
/// @param to Address to deposit to
/// @param to Reason system reason for deposit (used for indexing)
/// @param why Reason system reason for deposit (used for indexing)
/// @param comment Optional comment as reason for deposit
function deposit(
address to,
Expand All @@ -90,14 +99,17 @@ interface IProtocolRewards {
string calldata comment
) external payable;

function computeTotalRewards(uint256 finalBidAmount, uint256 founderRewardPercent) external returns (RewardSplits memory split);

/// @notice Used by Zora ERC-721 & ERC-1155 contracts to deposit protocol rewards
/// @param founder Creator for NFT rewards
/// @param founderReward Creator for NFT rewards
/// @param referral Creator reward amount
/// @param referralReward Mint referral user
/// @param builderReward Mint referral user
/// @notice Computes the total rewards given a bid amount and founders reward percentage
/// @param finalBidAmount Final bid amount
/// @param founderRewardBPS Percentage of final bid amount in BPS claimable by the founder
function computeTotalRewards(uint256 finalBidAmount, uint256 founderRewardBPS) external returns (RewardSplits memory split);

/// @notice Used by Auction contracts to deposit protocol rewards
/// @param founder Deployer for founder rewards
/// @param founderReward Founder reward amount
/// @param referral Bid referral user
/// @param referralReward Bid referral reward amount
/// @param builderReward BuilderDAO reward amount
function depositRewards(
address founder,
uint256 founderReward,
Expand Down

0 comments on commit 540ae61

Please sign in to comment.