Skip to content

Commit

Permalink
Change uint96 to uint128 so that most memecoins can be used
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Mar 20, 2024
1 parent 7d8b7ac commit d3d1a62
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 74 deletions.
26 changes: 13 additions & 13 deletions contracts/modules/SuperMinterE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
struct MintData {
// The platform address.
address platform;
// The price per token.
uint96 price;
// The start time of the mint.
uint32 startTime;
// The end time of the mint.
uint32 endTime;
// The maximum number of tokens an account can mint in this mint.
uint32 maxMintablePerAccount;
// The price per token.
uint128 price;
// The maximum tokens mintable.
uint32 maxMintable;
// The total number of tokens minted.
Expand Down Expand Up @@ -94,7 +94,7 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
"address to,"
"uint32 signedQuantity,"
"uint32 signedClaimTicket,"
"uint96 signedPrice,"
"uint128 signedPrice,"
"uint32 signedDeadline,"
"address affiliate"
")"
Expand Down Expand Up @@ -160,12 +160,12 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
/**
* @dev The maximum per-mint reward. Applies to artists, affiliates, platform.
*/
uint96 public constant MAX_PER_MINT_REWARD = 0.1 ether;
uint128 public constant MAX_PER_MINT_REWARD = 0.1 ether;

/**
* @dev The maximum platform per-transaction flat fee.
*/
uint96 public constant MAX_PLATFORM_PER_TX_FLAT_FEE = 0.1 ether;
uint128 public constant MAX_PLATFORM_PER_TX_FLAT_FEE = 0.1 ether;

/**
* @dev The boolean flag on whether the mint has been created.
Expand Down Expand Up @@ -220,7 +220,7 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
/**
* @dev A mapping of `platform` => `price`.
*/
mapping(address => uint96) public gaPrice;
mapping(address => uint128) public gaPrice;

/**
* @dev A mapping of `platform` => `platformSigner`.
Expand Down Expand Up @@ -371,7 +371,7 @@ contract SuperMinterE is ISuperMinterE, EIP712 {

// Platform and affilaite fees are accrued mappings.
// Artist earnings are directly forwarded to the nft contract in mint call below.
// Overflow not possible since all fees are uint96s.
// Overflow not possible since all fees are uint128s.
unchecked {
if (l.finalAffiliateFee != 0) {
if (l.erc20 == address(0)) {
Expand Down Expand Up @@ -448,7 +448,7 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
address edition,
uint8 tier,
uint8 scheduleNum,
uint96 price
uint128 price
) public onlyEditionOwnerOrAdmin(edition) {
uint256 mintId = LibOps.packId(edition, tier, scheduleNum);
MintData storage d = _getMintData(mintId);
Expand Down Expand Up @@ -689,7 +689,7 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
/**
* @inheritdoc ISuperMinterE
*/
function setGAPrice(uint96 price) public {
function setGAPrice(uint128 price) public {
address sender = LibMulticaller.senderOrSigner();
gaPrice[sender] = price;
emit GAPriceSet(sender, price);
Expand Down Expand Up @@ -784,7 +784,7 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
uint8 tier,
uint8 scheduleNum,
uint32 quantity,
uint96 signedPrice,
uint128 signedPrice,
bool hasValidAffiliate
) public view returns (TotalPriceAndFees memory) {
uint256 mintId = LibOps.packId(edition, tier, scheduleNum);
Expand Down Expand Up @@ -1214,11 +1214,11 @@ contract SuperMinterE is ISuperMinterE, EIP712 {
uint8 tier,
MintData storage d,
uint32 quantity,
uint96 signedPrice,
uint128 signedPrice,
bool hasValidAffiliate
) internal view returns (TotalPriceAndFees memory f) {
// All flat prices are stored as uint96s in storage.
// The quantity is a uint32. Multiplications between a uint96 and uint32 won't overflow.
// All flat prices are stored as uint128s in storage.
// The quantity is a uint32. Multiplications between a uint128 and uint32 won't overflow.
unchecked {
PlatformFeeConfig memory c = effectivePlatformFeeConfig(d.platform, tier);

Expand Down
38 changes: 19 additions & 19 deletions contracts/modules/interfaces/ISuperMinterE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ISuperMinterE is IERC165 {
// The base price per token.
// For `VERIFY_SIGNATURE`, this will be the minimum limit of the signed price.
// Will be 0 if the `tier` is `GA_TIER`.
uint96 price;
uint128 price;
// The start time of the mint.
uint32 startTime;
// The end time of the mint.
Expand Down Expand Up @@ -68,7 +68,7 @@ interface ISuperMinterE is IERC165 {
// The allowlist Merkle proof.
bytes32[] allowlistProof;
// The signed price. Used if `mode` is `VERIFY_SIGNATURE`.
uint96 signedPrice;
uint128 signedPrice;
// The signed quantity. Used if `mode` is `VERIFY_SIGNATURE`.
uint32 signedQuantity;
// The signed claimed ticket. Used if `mode` is `VERIFY_SIGNATURE`.
Expand Down Expand Up @@ -167,21 +167,21 @@ interface ISuperMinterE is IERC165 {
*/
struct PlatformFeeConfig {
// The amount of reward to give to the artist per mint.
uint96 artistMintReward;
uint128 artistMintReward;
// The amount of reward to give to the affiliate per mint.
uint96 affiliateMintReward;
uint128 affiliateMintReward;
// The amount of reward to give to the platform per mint.
uint96 platformMintReward;
uint128 platformMintReward;
// If the price is greater than this, the rewards will become the threshold variants.
uint96 thresholdPrice;
uint128 thresholdPrice;
// The amount of reward to give to the artist (`unitPrice >= thresholdPrice`).
uint96 thresholdArtistMintReward;
uint128 thresholdArtistMintReward;
// The amount of reward to give to the affiliate (`unitPrice >= thresholdPrice`).
uint96 thresholdAffiliateMintReward;
uint128 thresholdAffiliateMintReward;
// The amount of reward to give to the platform (`unitPrice >= thresholdPrice`).
uint96 thresholdPlatformMintReward;
uint128 thresholdPlatformMintReward;
// The per-transaction flat fee.
uint96 platformTxFlatFee;
uint128 platformTxFlatFee;
// The per-token fee BPS.
uint16 platformMintFeeBPS;
// Whether the fees are active.
Expand All @@ -204,7 +204,7 @@ interface ISuperMinterE is IERC165 {
// For `VERIFY_SIGNATURE` this will be the minimum limit of the signed price.
// If the `tier` is `GA_TIER`, and the `mode` is NOT `VERIFY_SIGNATURE`,
// this value will be the GA price instead.
uint96 price;
uint128 price;
// The start time of the mint.
uint32 startTime;
// The end time of the mint.
Expand Down Expand Up @@ -270,7 +270,7 @@ interface ISuperMinterE is IERC165 {
* @param scheduleNum The edition-tier schedule number.
* @param price The base per-token price.
*/
event PriceSet(address indexed edition, uint8 tier, uint8 scheduleNum, uint96 price);
event PriceSet(address indexed edition, uint8 tier, uint8 scheduleNum, uint128 price);

/**
* @dev Emitted when the max mintable per account for a mint is updated.
Expand Down Expand Up @@ -410,7 +410,7 @@ interface ISuperMinterE is IERC165 {
* @param platform The platform address.
* @param price The price per token for the GA tier.
*/
event GAPriceSet(address indexed platform, uint96 price);
event GAPriceSet(address indexed platform, uint128 price);

/**
* @dev Emitted when the signer for a platform is set.
Expand Down Expand Up @@ -604,7 +604,7 @@ interface ISuperMinterE is IERC165 {
address edition,
uint8 tier,
uint8 scheduleNum,
uint96 price
uint128 price
) external;

/**
Expand Down Expand Up @@ -770,7 +770,7 @@ interface ISuperMinterE is IERC165 {
* @dev Allows the platform to set the price for the GA tier.
* @param price The price per token for the GA tier.
*/
function setGAPrice(uint96 price) external;
function setGAPrice(uint128 price) external;

/**
* @dev Allows the platform to set their signer.
Expand Down Expand Up @@ -846,13 +846,13 @@ interface ISuperMinterE is IERC165 {
* @dev The maximum per-mint reward. Applies to artists, affiliates, platform.
* @return The constant value.
*/
function MAX_PER_MINT_REWARD() external pure returns (uint96);
function MAX_PER_MINT_REWARD() external pure returns (uint128);

/**
* @dev The maximum platform per-transaction flat fee.
* @return The constant value.
*/
function MAX_PLATFORM_PER_TX_FLAT_FEE() external pure returns (uint96);
function MAX_PLATFORM_PER_TX_FLAT_FEE() external pure returns (uint128);

/**
* @dev Returns the amount of fees accrued by the platform.
Expand Down Expand Up @@ -921,7 +921,7 @@ interface ISuperMinterE is IERC165 {
uint8 tier,
uint8 scheduleNum,
uint32 quantity,
uint96 signedPrice,
uint128 signedPrice,
bool hasValidAffiliate
) external view returns (TotalPriceAndFees memory);

Expand All @@ -930,7 +930,7 @@ interface ISuperMinterE is IERC165 {
* @param platform The platform address.
* @return The configured value.
*/
function gaPrice(address platform) external view returns (uint96);
function gaPrice(address platform) external view returns (uint128);

/**
* @dev Returns the signer for the platform.
Expand Down
Loading

0 comments on commit d3d1a62

Please sign in to comment.