-
Notifications
You must be signed in to change notification settings - Fork 547
deploy config poc #684
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
base: main
Are you sure you want to change the base?
deploy config poc #684
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.20; | ||
|
||
interface IMintFeeManager { | ||
function calculatePlatformFeeAndRecipient( | ||
uint256 _price | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here i think it makes sense to send some sort of 'source' or 'id' that the calling contract would pass. For example for drop721 it could pass "dropERC721". that way the fee manager can decide to change the fees for different contracts based on that passed 'id'. ie. maybe marketplace has a diff fee than a drop erc721 |
||
) external view returns (uint256 platformFee, address feeRecipient); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,8 @@ import "../../extension/LazyMint.sol"; | |
import "../../extension/PermissionsEnumerable.sol"; | ||
import "../../extension/Drop.sol"; | ||
|
||
import "../../extension/interface/IMintFeeManager.sol"; | ||
|
||
contract DropERC721 is | ||
Initializable, | ||
ContractMetadata, | ||
|
@@ -68,20 +70,21 @@ contract DropERC721 is | |
/// @dev Max bps in the thirdweb system. | ||
uint256 private constant MAX_BPS = 10_000; | ||
|
||
address public constant DEFAULT_FEE_RECIPIENT = 0x1Af20C6B23373350aD464700B5965CE4B0D2aD94; | ||
uint16 private constant DEFAULT_FEE_BPS = 100; | ||
|
||
/// @dev Global max total supply of NFTs. | ||
uint256 public maxTotalSupply; | ||
|
||
address public immutable mintFeeManager; | ||
|
||
/// @dev Emitted when the global max supply of tokens is updated. | ||
event MaxTotalSupplyUpdated(uint256 maxTotalSupply); | ||
|
||
/*/////////////////////////////////////////////////////////////// | ||
Constructor + initializer logic | ||
//////////////////////////////////////////////////////////////*/ | ||
|
||
constructor() initializer {} | ||
constructor(address _mintFeeManager) initializer { | ||
mintFeeManager = _mintFeeManager; | ||
} | ||
|
||
/// @dev Initializes the contract, like a constructor. | ||
function initialize( | ||
|
@@ -264,8 +267,16 @@ contract DropERC721 is | |
address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient; | ||
|
||
uint256 totalPrice = _quantityToClaim * _pricePerToken; | ||
uint256 platformFeesTw = (totalPrice * DEFAULT_FEE_BPS) / MAX_BPS; | ||
|
||
uint256 platformFees = (totalPrice * platformFeeBps) / MAX_BPS; | ||
address _mintFeeManager = mintFeeManager; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dont really need this var |
||
uint256 platformFeesTw = 0; | ||
address feeRecipientTw; | ||
if (_mintFeeManager != address(0)) { | ||
(platformFeesTw, feeRecipientTw) = IMintFeeManager(_mintFeeManager).calculatePlatformFeeAndRecipient( | ||
totalPrice | ||
); | ||
} | ||
|
||
bool validMsgValue; | ||
if (_currency == CurrencyTransferLib.NATIVE_TOKEN) { | ||
|
@@ -275,7 +286,7 @@ contract DropERC721 is | |
} | ||
require(validMsgValue, "!V"); | ||
|
||
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), DEFAULT_FEE_RECIPIENT, platformFeesTw); | ||
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), feeRecipientTw, platformFeesTw); | ||
CurrencyTransferLib.transferCurrency(_currency, _msgSender(), platformFeeRecipient, platformFees); | ||
CurrencyTransferLib.transferCurrency( | ||
_currency, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.11; | ||
|
||
contract MockMintFeeManager { | ||
address public feeRecipient; | ||
uint256 public feeBps; | ||
|
||
constructor(address _feeRecipient, uint256 _feeBps) { | ||
feeRecipient = _feeRecipient; | ||
feeBps = _feeBps; | ||
} | ||
|
||
function calculatePlatformFeeAndRecipient( | ||
uint256 _price | ||
) external view returns (uint256 _platformFee, address _feeRecipient) { | ||
_platformFee = (_price * feeBps) / 10_000; | ||
_feeRecipient = feeRecipient; | ||
} | ||
} |
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.
where is the actual implementation of this?
also was thinking of keeping the naming a bit generic, drop the 'mint' from it since it can be for all sorts of fees