From 2328635dee39c466ee81b4470566016fabc26b00 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Mon, 4 Dec 2023 12:48:34 -0500 Subject: [PATCH 1/2] refactor: remove outdated logic related to refunds --- .../authorities/SellPartyCardsAuthority.sol | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/contracts/authorities/SellPartyCardsAuthority.sol b/contracts/authorities/SellPartyCardsAuthority.sol index 48d3f212..50cfcf53 100644 --- a/contracts/authorities/SellPartyCardsAuthority.sol +++ b/contracts/authorities/SellPartyCardsAuthority.sol @@ -462,7 +462,7 @@ contract SellPartyCardsAuthority { SaleState memory state = _validateContribution(party, saleId, gateData); uint96 contributionToTransfer; - (votingPower, contribution, contributionToTransfer, ) = _processContribution( + (votingPower, contributionToTransfer, ) = _processContribution( party, saleId, state, @@ -494,7 +494,6 @@ contract SellPartyCardsAuthority { uint96 contributionToTransfer; ( votingPowers[i], - contributions[i], contributionToTransfer, state.totalContributions ) = _processContribution(party, saleId, state, contributions[i]); @@ -523,12 +522,7 @@ contract SellPartyCardsAuthority { uint96 contribution ) private - returns ( - uint96 votingPower, - uint96 contributionUsed, - uint96 contributionToTransfer, - uint96 totalContributions - ) + returns (uint96 votingPower, uint96 contributionToTransfer, uint96 totalContributions) { totalContributions = state.totalContributions; uint96 maxTotalContributions = state.maxTotalContributions; @@ -569,17 +563,11 @@ contract SellPartyCardsAuthority { } } - // Check that the contribution amount is at or above the minimum. This - // is done after `amount` is potentially reduced if refunding excess - // contribution. + // Check that the contribution amount is at or above the minimum. if (contribution < minContribution) { revert OutOfBoundsContributionsError(contribution, minContribution); } - // Return contribution amount used after refund and including amount - // used for funding split. Will be emitted in `MintedFromSale` event. - contributionUsed = contribution; - // Subtract split from contribution amount if applicable. address payable fundingSplitRecipient = state.fundingSplitRecipient; uint16 fundingSplitBps = state.fundingSplitBps; From 4e7257d2e6dbe6f2395039a7b2301c2c8d3036c6 Mon Sep 17 00:00:00 2001 From: Brian Le Date: Mon, 4 Dec 2023 13:30:16 -0500 Subject: [PATCH 2/2] move up `minContribution` earlier since no refunds anymore --- contracts/authorities/SellPartyCardsAuthority.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/authorities/SellPartyCardsAuthority.sol b/contracts/authorities/SellPartyCardsAuthority.sol index 50cfcf53..842eb4d9 100644 --- a/contracts/authorities/SellPartyCardsAuthority.sol +++ b/contracts/authorities/SellPartyCardsAuthority.sol @@ -539,6 +539,11 @@ contract SellPartyCardsAuthority { revert SaleInactiveError(); } + // Check that the contribution amount is at or above the minimum. + if (contribution < minContribution) { + revert OutOfBoundsContributionsError(contribution, minContribution); + } + // Check that the contribution amount is at or below the maximum. uint96 maxContribution = state.maxContribution; if (contribution > maxContribution) { @@ -563,11 +568,6 @@ contract SellPartyCardsAuthority { } } - // Check that the contribution amount is at or above the minimum. - if (contribution < minContribution) { - revert OutOfBoundsContributionsError(contribution, minContribution); - } - // Subtract split from contribution amount if applicable. address payable fundingSplitRecipient = state.fundingSplitRecipient; uint16 fundingSplitBps = state.fundingSplitBps;