Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Nov 6, 2023
1 parent 95cfcf6 commit a1ba7e7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions contracts/modules/SuperMinterV1_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -330,37 +330,40 @@ contract SuperMinterV1_1 is ISuperMinterV1_1, EIP712 {

_incrementMinted(mode, d, p);

/* ----------- AFFILIATE AND PLATFORM FEES LOGIC ------------ */
/* ----------------- COMPUTE AND ACCRUE FEES ---------------- */

TotalPriceAndFees memory f = _totalPriceAndFees(p.tier, d, p.quantity, p.signedPrice);
MintedLogData memory l;
l.affiliate = p.to == p.affiliate ? address(0) : p.affiliate; // Yeah, we know it's left curved.

unchecked {
if (msg.value != f.total) revert WrongPayment(msg.value, f.total); // Require exact payment.

l.finalArtistFee = f.total - f.platformFee; // `platformFee <= total`;
l.finalPlatformFee = f.platformFee; // Initialize to the platform fee.
l.affiliate = p.to == p.affiliate ? address(0) : p.affiliate; // Yeah, we know it's left curved.

/* --------------------- AFFILIATE FEES --------------------- */

// Affiliate fee workflow.
if (l.affiliated = _isAffiliatedWithProof(d, l.affiliate, p.affiliateProof)) {
l.finalArtistFee -= f.affiliateFee;
l.finalPlatformFee -= f.affiliateIncentive;
l.finalAffiliateFee = f.affiliateFee + f.affiliateIncentive;
affiliateFeesAccrued[p.affiliate] += l.finalAffiliateFee; // Accrue the affiliate fee.
affiliateFeesAccrued[p.affiliate] += l.finalAffiliateFee;
} else {
// Proof may be invalid, revert to prevent unintended skipping of affiliate fee.
if (p.affiliate != address(0)) revert InvalidAffiliate();
}

// Free mint fee workflow.
/* --------------------- FREE MINT FEES --------------------- */

if (f.freeMintIncentive != 0 && f.unitPrice == 0) {
l.finalPlatformFee -= f.freeMintIncentive;
l.finalFreeMintFee = f.freeMintIncentive;
l.finalArtistFee += l.finalFreeMintFee;
}

// First collector fee workflow.
/* ------------------ FIRST COLLECTOR FEES ------------------ */

if (firstCollector[p.edition] == address(0)) firstCollector[p.edition] = p.to;
if (f.firstCollectorIncentive != 0) {
l.finalPlatformFee -= f.firstCollectorIncentive;
Expand Down

0 comments on commit a1ba7e7

Please sign in to comment.