Skip to content

Commit

Permalink
Add finalAffiliateIncentive to Minted log. Change finalCheapMintFee -…
Browse files Browse the repository at this point in the history
…> finalCheapMintIncentive
  • Loading branch information
Vectorized committed Dec 1, 2023
1 parent e993498 commit 9df9a7a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
5 changes: 3 additions & 2 deletions contracts/modules/SuperMinterV1_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ contract SuperMinterV1_1 is ISuperMinterV1_1, EIP712 {
l.finalPlatformFee -= f.affiliateIncentive;
// Sum up the BPS based affiliate fee and the affiliate incentive.
l.finalAffiliateFee = f.affiliateFee + f.affiliateIncentive;
l.finalAffiliateIncentive = f.affiliateIncentive;
affiliateFeesAccrued[p.affiliate] += l.finalAffiliateFee;
} else {
// Proof may be invalid, revert to prevent unintended skipping of affiliate fee.
Expand All @@ -373,8 +374,8 @@ contract SuperMinterV1_1 is ISuperMinterV1_1, EIP712 {
if (f.cheapMintIncentive != 0 && f.unitPrice <= f.cheapMintIncentiveThreshold) {
// Divert the cheap mint incentive from the platform to the artist.
l.finalPlatformFee -= f.cheapMintIncentive;
l.finalCheapMintFee = f.cheapMintIncentive;
l.finalArtistFee += l.finalCheapMintFee;
l.finalCheapMintIncentive = f.cheapMintIncentive;
l.finalArtistFee += l.finalCheapMintIncentive;
}

platformFeesAccrued[d.platform] += l.finalPlatformFee; // Accrue the platform fee.
Expand Down
6 changes: 4 additions & 2 deletions contracts/modules/interfaces/ISuperMinterV1_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ interface ISuperMinterV1_1 is IERC165 {
uint256 finalPlatformFee;
// The total affiliate fee.
uint256 finalAffiliateFee;
// The final cheap mint fee.
uint256 finalCheapMintFee;
// The final affiliate incentive.
uint256 finalAffiliateIncentive;
// The final cheap mint incentive.
uint256 finalCheapMintIncentive;
}

/**
Expand Down
23 changes: 13 additions & 10 deletions tests/modules/SuperMinterV1_1.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -820,12 +820,14 @@ contract SuperMinterV1_1Tests is TestConfigV2_1 {
l.affiliated = true;
l.requiredEtherValue = tpaf.total;
l.unitPrice = tpaf.unitPrice;
uint256 finalCheapMintFee;
if (tpaf.unitPrice <= tpaf.cheapMintIncentiveThreshold) finalCheapMintFee = tpaf.cheapMintIncentive;
l.finalArtistFee = tpaf.total - tpaf.platformFee - tpaf.affiliateFee + finalCheapMintFee;
l.finalPlatformFee = tpaf.platformFee - tpaf.affiliateIncentive - finalCheapMintFee;
uint256 finalCheapMintIncentive;
if (tpaf.unitPrice <= tpaf.cheapMintIncentiveThreshold)
finalCheapMintIncentive = tpaf.cheapMintIncentive;
l.finalArtistFee = tpaf.total - tpaf.platformFee - tpaf.affiliateFee + finalCheapMintIncentive;
l.finalPlatformFee = tpaf.platformFee - tpaf.affiliateIncentive - finalCheapMintIncentive;
l.finalAffiliateIncentive = tpaf.affiliateIncentive;
l.finalAffiliateFee = tpaf.affiliateFee + tpaf.affiliateIncentive;
l.finalCheapMintFee = finalCheapMintFee;
l.finalCheapMintIncentive = finalCheapMintIncentive;
}
emit Minted(address(edition), 1, 0, address(this), l, 0);

Expand Down Expand Up @@ -861,12 +863,13 @@ contract SuperMinterV1_1Tests is TestConfigV2_1 {
l.affiliated = false;
l.requiredEtherValue = tpaf.total;
l.unitPrice = tpaf.unitPrice;
uint256 finalCheapMintFee;
if (tpaf.unitPrice <= tpaf.cheapMintIncentiveThreshold) finalCheapMintFee = tpaf.cheapMintIncentive;
l.finalArtistFee = tpaf.total - tpaf.platformFee + finalCheapMintFee;
l.finalPlatformFee = tpaf.platformFee - finalCheapMintFee;
uint256 finalCheapMintIncentive;
if (tpaf.unitPrice <= tpaf.cheapMintIncentiveThreshold)
finalCheapMintIncentive = tpaf.cheapMintIncentive;
l.finalArtistFee = tpaf.total - tpaf.platformFee + finalCheapMintIncentive;
l.finalPlatformFee = tpaf.platformFee - finalCheapMintIncentive;
l.finalAffiliateFee = 0;
l.finalCheapMintFee = finalCheapMintFee;
l.finalCheapMintIncentive = finalCheapMintIncentive;
}
emit Minted(address(edition), 1, 0, address(this), l, 0);

Expand Down

0 comments on commit 9df9a7a

Please sign in to comment.