-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SuperMinterV1_1 et al. #296
SuperMinterV1_1 et al. #296
Conversation
🦋 Changeset detectedLatest commit: 30e8987 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
0e713fb
to
c4cfd2b
Compare
6af726d
to
3e3985b
Compare
ac89c60
to
d0e97dc
Compare
platformFeesAccrued[d.platform] += f.platformFee; // Accrue the platform fee. | ||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
} | ||
|
||
/* --------------------- FREE MINT FEES --------------------- */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be changed to artist price incentives
Comment:
The platform can elect to split some of it's fees with the artist as an incentive for low mint prices.
The finalPlatformFee is reduced and the finalArtistFee is increased by this incentive amount.
|
||
/* ------------------ FIRST COLLECTOR FEES ------------------ */ | ||
|
||
if (firstCollector[p.edition] == address(0)) firstCollector[p.edition] = p.to; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this as most valuable for rewarding the first collector (in deployAndMint) bringing the contract on chain since they pay extra fees.
If the first minter isn't bringing the contract on chain and not paying any extra fees for that, it's a random reward for being first on superminter and a target for frontrunning. Lmk if you have other thoughts here
// The total affiliate fee. | ||
uint256 finalAffiliateFee; | ||
// The final cheap mint fee. | ||
uint256 finalCheapMintFee; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why this is included in the minted struct when other things like affiliateIncentive is not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call out. I added finalAffiliateIncentive
to the minted struct and renamed finalCheapMintFee
-> finalCheapMintIncentive
in the minted struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The underflow/overflow tracking is getting more and more complex and difficult to easily track, I think we need to either put comments near the calculation on why it can't underflow/overflow or put checks back in.
Additionally, I had questions on how thoroughly we need to be looking at MulticallerWithSigner. I think it has been reviewed during the audit (just checked to be sure), so it seems like we just want to know the integrations are done correctly rather than that the library itself doesn't have issues. Is this correct?
// Deduct the BPS based affiliate fee from the artist's fee. | ||
l.finalArtistFee -= f.affiliateFee; | ||
// Deduct the affiliate incentive from the platform's fee. | ||
l.finalPlatformFee -= f.affiliateIncentive; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracking through all the calculations and configuration checks to try to resolve if this is underflowable gets too complex to be realiably accurate. Can we remove unchecked
or do explicit checks for values that are especially prone to error (values that can't be easily commented on why it isn't underflow/overflowable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also worth considering that any underflow condition breaks balance tracking and will inevitably cause issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left it as checked math.
I think a few hundred gas more is worth the better assurance.
Most of our mints are on L2 anyways.
/* -------------------- CHEAP MINT FEES --------------------- */ | ||
|
||
if (f.cheapMintIncentive != 0 && f.unitPrice <= f.cheapMintIncentiveThreshold) { | ||
l.finalPlatformFee -= f.cheapMintIncentive; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment here. This feels really prone to possible underflow.
@@ -778,7 +780,7 @@ contract SoundEditionV2_1 is ISoundEditionV2_1, ERC721AQueryableUpgradeable, ERC | |||
* @param roles A roles bitmap. | |||
*/ | |||
function _requireOnlyRolesOrOwner(uint256 roles) internal view { | |||
address sender = LibMulticaller.sender(); | |||
address sender = LibMulticaller.senderOrSigner(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerning the MulticallerWithSigner
, how thorough does the review need to be? The library seems covered by the audit, so we're really just considering if we think the function usage here is appropriate. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The priority will be to check if the usage of senderOrSigner()
here is safe, assuming that the MulticallerWithSigner is implemented perfectly.
I am 96% confident of MulticallerWithSigner.
…> finalCheapMintIncentive
* Add presave functionality to SuperMinterV1_1 * Rename PRESAVE -> PLATFORM_AIRDROP * Force PLATFORM_AIRDROP to only use platform signer * Remove artist-customizable signer, everyone must use platform signer * Make mintTo and platformAirdrop return fromTokenId, use airdrop in platformAirdrop * Remove signer from MintData * Update create2 deployment script
…ized/affiliate-flat-fee
…ized/affiliate-flat-fee
…ized/affiliate-flat-fee
* Implement fee changes * T * Fix prices and add tests * Add tests * Simplified fees and rewards (#300) * nit suggestion * changes * Fix code and fuzz test * Tidy * Nit comment --------- Co-authored-by: Vignesh Hirudayakanth <[email protected]> --------- Co-authored-by: Vignesh Hirudayakanth <[email protected]>
e11e105
into
vectorized/affiliate-flat-fee-base
* Clone files and bump versions * SuperMinterV1_1 et al. (#296) * Prep files * Reinstall multicaller * forge install: multicaller v1.3.1 * Add LibMulticaller.senderOrSigner support * Tidy * freeMintIncentive -> cheapMintIncentive * Add comment on the two types of affiliate fees * Remove first collector incentives * Add more comments and use checked math in mintTo * Add finalAffiliateIncentive to Minted log. Change finalCheapMintFee -> finalCheapMintIncentive * Add platform airdrop functionality to SuperMinterV1_1 (#298) * Add presave functionality to SuperMinterV1_1 * Rename PRESAVE -> PLATFORM_AIRDROP * Force PLATFORM_AIRDROP to only use platform signer * Remove artist-customizable signer, everyone must use platform signer * Make mintTo and platformAirdrop return fromTokenId, use airdrop in platformAirdrop * Remove signer from MintData * Update create2 deployment script * Create modern-shirts-try.md * pin version for typechain * tweak ci * more ci tweaks * add back foundry * bump * bump typechain * Implement fee changes (#299) * Implement fee changes * T * Fix prices and add tests * Add tests * Simplified fees and rewards (#300) * nit suggestion * changes * Fix code and fuzz test * Tidy * Nit comment --------- Co-authored-by: Vignesh Hirudayakanth <[email protected]> --------- Co-authored-by: Vignesh Hirudayakanth <[email protected]> * Update modern-shirts-try.md --------- Co-authored-by: Vignesh Hirudayakanth <[email protected]> * Update .github/workflows/canary.yml --------- Co-authored-by: Vectorized <[email protected]>
SuperMinterV1_1
unitPrice <= cheapMintIncentiveThreshold
.This goes to the artist (i.e. SoundEdition).
This will be added to the affiliate fee accrued mapping.
SoundEditionV2_1
fromTierTokenIdIndex
.tierTokensIdsIn
function won't revert if there are no tokens minted.Both SuperMinterV1_1 and SoundEditionV2_1
LibMulticaller.sender()
->LibMulticaller.senderOrSigner()
.The multicaller codebase can be found at: https://github.com/Vectorized/multicaller
It has been reviewed by Kurt (0xPhaze).
MerkleProofLib
andSignatureCheckerLib
, which both have been reviewed and re-reviewed by Spearbit Cantina.Suggested review priority: